/* ==================================================================
   JurisCRM v1.8 — Mensagens internas + Perfil
   Tema navy (#0f2744) + gold (#e8c97e)
   ================================================================== */

/* ---------- Caixa de Mensagens ---------- */
.msg-layout {
  display: grid; grid-template-columns: 320px 1fr; gap: 16px;
  height: calc(100vh - 220px); min-height: 420px;
}
.msg-sidebar {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  overflow-y: auto;
}
.msg-conv {
  display: flex; gap: 10px; padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background .15s;
}
.msg-conv:hover { background: var(--bg); }
.msg-conv.active { background: rgba(232,201,126,.14); }
.msg-avatar, .prof-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: 14px; flex-shrink: 0; overflow: hidden;
}
.msg-avatar img, .prof-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-conv-body { flex: 1; min-width: 0; }
.msg-conv-top { display: flex; justify-content: space-between; align-items: center; }
.msg-conv-name { font-weight: 600; color: var(--navy); font-size: 14px; }
.msg-conv-last { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-badge {
  background: var(--red, #dc2626); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 1px 7px; min-width: 18px; text-align: center;
}

.msg-main {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
}
.msg-empty { color: var(--text-muted); text-align: center; margin: auto; padding: 30px; }
.msg-thread-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-weight: 700; color: var(--navy); background: var(--bg);
}
.msg-thread-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.msg-bubble { max-width: 70%; padding: 9px 13px; border-radius: 14px; font-size: 14px; }
.msg-bubble.mine { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.theirs { align-self: flex-start; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-time { font-size: 10px; opacity: .7; margin-top: 3px; text-align: right; }
.msg-compose {
  display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end;
}
.msg-compose textarea { flex: 1; resize: none; }

/* badge no menu lateral */
.nav-badge {
  background: var(--red, #dc2626); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 9px; padding: 1px 6px; margin-left: auto; display: none;
}

/* ---------- Perfil ---------- */
.profile-grid {
  display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start;
}
.profile-grid .card:nth-child(3) { grid-column: 2; }
.prof-avatar { width: 110px; height: 110px; margin: 0 auto; font-size: 36px; }
.prof-name { font-weight: 700; color: var(--navy); margin-top: 12px; font-size: 16px; }
.prof-role { font-size: 13px; color: var(--text-muted); }

@media (max-width: 820px) {
  .msg-layout { grid-template-columns: 1fr; height: auto; }
  .msg-sidebar { max-height: 220px; }
  .msg-main { min-height: 360px; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-grid .card:nth-child(3) { grid-column: 1; }
}
