/* ============================================================
   CRM Jurídico — Design System (Advocacia Letícia Barros)
   Paleta clara e profissional · Spectral (títulos) + Inter (UI)
   ============================================================ */
:root {
  --navy: #2a3f5f;          /* navy refinado, mais claro */
  --navy-deep: #1f3047;
  --navy-light: #3a517a;
  --gold: #b8924c;          /* champagne/ouro suave */
  --gold-soft: #ceae72;
  --bg: #f4f6fa;            /* fundo claro e arejado */
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --text: #1f2a3a;
  --text-soft: #51607a;
  --text-muted: #93a0b5;
  --border: #e7ecf3;
  --border-soft: #eff2f7;
  --green: #2f8f63;
  --green-bg: #e7f4ec;
  --red: #c4453b;
  --red-bg: #fbe9e7;
  --amber: #c08a2e;
  --amber-bg: #fbf1dc;
  --shadow-sm: 0 1px 2px rgba(31, 48, 71, .05);
  --shadow: 0 4px 16px rgba(31, 48, 71, .06);
  --shadow-lg: 0 12px 40px rgba(31, 48, 71, .12);
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
.hidden { display: none !important; }
h1, h2, h3, h4 { font-family: 'Spectral', Georgia, serif; font-weight: 600; letter-spacing: -.01em; color: var(--navy-deep); }

/* ── Buttons ── */
.btn-primary {
  background: var(--navy); color: #fff; border: none; padding: 12px 20px;
  border-radius: 10px; font-weight: 600; cursor: pointer; font-size: 14px;
  transition: all .18s; width: 100%; font-family: inherit;
}
.btn-primary:hover { background: var(--navy-light); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-gold { background: var(--gold); color: #fff; border: none; padding: 10px 18px; border-radius: 10px; font-weight: 600; cursor: pointer; font-size: 13px; transition: all .18s; font-family: inherit; }
.btn-gold:hover { background: var(--gold-soft); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: #c7d0df; border: 1px solid rgba(255,255,255,.22); padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit; }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn-icon { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }
.btn-icon:hover { color: var(--navy); }
.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--text-soft); font-weight: 500; font-family: inherit; transition: all .15s; }
.btn-sm:hover { border-color: var(--gold); color: var(--gold); background: #fff; }

/* ── Login (painel dividido) ── */
.login-view { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand-panel {
  background: linear-gradient(150deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff; display: flex; align-items: center; justify-content: center; padding: 40px;
  position: relative; overflow: hidden;
}
.login-brand-panel::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(184,146,76,.18), transparent 45%);
}
.brand-inner { position: relative; max-width: 380px; }
.login-emblem {
  width: 76px; height: 76px; border: 2px solid var(--gold-soft); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Spectral', serif; font-size: 30px; font-weight: 700; color: var(--gold-soft);
  letter-spacing: 1px; margin-bottom: 28px;
}
.login-brand-panel h1 { color: #fff; font-size: 40px; line-height: 1.1; }
.brand-sub { color: var(--gold-soft); font-size: 15px; letter-spacing: 2px; text-transform: uppercase; margin-top: 6px; }
.brand-divider { width: 54px; height: 2px; background: var(--gold); margin: 26px 0; }
.brand-tagline { color: #c4cedd; font-size: 16px; line-height: 1.6; font-family: 'Spectral', serif; font-style: italic; }

.login-form-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 30px; }
.login-hint { color: var(--text-muted); font-size: 14px; margin: 6px 0 28px; }
#login-form { display: flex; flex-direction: column; gap: 18px; }
#login-form label, .form-grid label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 500; color: var(--text-soft); }
input, select, textarea {
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px;
  font-family: inherit; background: var(--surface); color: var(--text); transition: all .16s; width: 100%;
}
input::placeholder { color: #b7c0d0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,146,76,.12); }
.error-msg { color: var(--red); font-size: 13px; text-align: center; min-height: 18px; }

/* ── App layout ── */
.app-view { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--navy-deep); color: #fff; display: flex; flex-direction: column; position: fixed; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 13px; padding: 24px 22px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .emblem {
  width: 42px; height: 42px; flex-shrink: 0; border: 1.5px solid var(--gold-soft); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Spectral', serif; font-weight: 700; font-size: 16px; color: var(--gold-soft); letter-spacing: .5px;
}
.sidebar-brand strong { display: block; font-size: 15px; font-family: 'Spectral', serif; }
.sidebar-brand small { color: var(--gold-soft); font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; }
.nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-item { color: #b6c1d4; text-decoration: none; padding: 10px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 500; transition: all .15s; display: flex; align-items: center; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(184,146,76,.16); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-highlight { background: var(--gold); color: #fff; font-weight: 600; margin-bottom: 8px; box-shadow: 0 4px 14px rgba(184,146,76,.35); }
.nav-highlight:hover { background: var(--gold-soft); color: #fff; }
.nav-highlight.active { background: var(--gold-soft); box-shadow: 0 4px 14px rgba(184,146,76,.45); }
.sidebar-footer { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
#user-name { color: #c7d0df; font-size: 12.5px; }
.bell { background: rgba(255,255,255,.06); color: #fff; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; padding: 10px 12px; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 7px; transition: all .15s; }
.bell:hover { background: rgba(255,255,255,.13); }
.bell-count { background: var(--red); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.content { margin-left: 260px; flex: 1; padding: 34px 42px; max-width: 1180px; }

/* ── Page header ── */
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; gap: 16px; flex-wrap: wrap; }
.page-header h2 { font-size: 30px; }
.page-header .sub { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

/* ── KPIs ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft); position: relative; overflow: hidden; transition: box-shadow .18s; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); opacity: .85; }
.kpi:hover { box-shadow: var(--shadow); }
.kpi .label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.kpi .value { font-size: 30px; font-weight: 600; color: var(--navy-deep); margin-top: 6px; font-family: 'Spectral', serif; line-height: 1.1; }
.kpi .value.money { font-size: 23px; }

/* ── Cards / Tabelas ── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft); overflow: hidden; }
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select { min-width: 160px; width: auto; }
.toolbar .spacer { flex: 1; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted); font-weight: 600; padding: 15px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
tbody td { padding: 14px 20px; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.empty { padding: 48px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 600; text-transform: capitalize; }
.badge.ativo, .badge.convertido, .badge.aceita, .badge.pago, .badge.fechada, .badge.realizada, .badge.recebido, .badge.assinado, .badge.finalizado { background: var(--green-bg); color: var(--green); }
.badge.inativo, .badge.perdido, .badge.perdida, .badge.recusada, .badge.vencido, .badge.descartado, .badge.cancelado, .badge.cancelada { background: var(--red-bg); color: var(--red); }
.badge.novo, .badge.prospecto, .badge.pendente, .badge.rascunho, .badge.nomeada, .badge.previsto, .badge.triagem, .badge.agendada { background: #eef2f8; color: var(--navy); }
.badge.contatado, .badge.qualificado, .badge.em_negociacao, .badge.em_triagem, .badge.reuniao_marcada, .badge.enviada, .badge.atendimento_inicial, .badge.reuniao, .badge.proposta, .badge.proposta_em_analise, .badge.em_andamento, .badge.em_producao, .badge.adiada { background: var(--amber-bg); color: var(--amber); }
.badge.urgente { background: var(--red-bg); color: var(--red); }
.badge.atencao { background: var(--amber-bg); color: var(--amber); }
.badge.normal { background: var(--green-bg); color: var(--green); }
.badge.admin, .badge.advogado, .badge.parceiro, .badge.estagiario, .badge.cliente, .badge.responsavel, .badge.colaborador, .badge.staff, .badge.concluida { background: #eef2f8; color: var(--navy); }
.badge.dativo { background: var(--navy); color: #fff; letter-spacing: .6px; }
.badge.alta, .badge.critica { background: var(--red-bg); color: var(--red); }
.badge.media { background: var(--amber-bg); color: var(--amber); }
.badge.baixa { background: #eef2f8; color: var(--text-soft); }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; }
.tab { background: none; border: none; padding: 11px 18px; font-size: 14px; font-weight: 500; color: var(--text-soft); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit; }
.tab:hover { color: var(--navy); }
.tab.active { color: var(--navy-deep); border-bottom-color: var(--gold); font-weight: 600; }
.dash-section { margin-bottom: 26px; }
.dash-section h3 { font-size: 18px; margin-bottom: 12px; }
.mini-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft); overflow: hidden; }
.mini-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.mini-row:last-child { border-bottom: none; }
.mini-row small { color: var(--text-muted); }

/* ── Kanban ── */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kanban-col { background: #eaeef4; border-radius: var(--radius); padding: 12px; min-height: 220px; }
.kanban-col h4 { font-family: 'Inter', sans-serif; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.kanban-col h4 .count { background: var(--navy); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 11px; }
.kanban-card { background: #fff; border-radius: 9px; padding: 12px 13px; margin-bottom: 8px; box-shadow: var(--shadow-sm); cursor: pointer; transition: all .15s; border: 1px solid var(--border-soft); }
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card strong { font-size: 13px; display: block; color: var(--navy-deep); }
.kanban-card small { color: var(--text-muted); font-size: 12px; }

/* ── Modal ── */
.modal { position: fixed; inset: 0; background: rgba(31,48,71,.5); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-card { background: #fff; border-radius: 16px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 26px; border-bottom: 1px solid var(--border-soft); }
.modal-header h3 { font-size: 22px; }
#modal-body { padding: 26px; }
.form-grid { display: flex; flex-direction: column; gap: 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Toast ── */
.toast { position: fixed; bottom: 26px; right: 26px; background: var(--navy-deep); color: #fff; padding: 14px 22px; border-radius: 11px; box-shadow: var(--shadow-lg); z-index: 200; font-size: 14px; font-weight: 500; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ── Calendário ── */
.cal-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.cal-header h3 { font-size: 22px; min-width: 200px; text-transform: capitalize; }
.cal-nav { background: #fff; border: 1px solid var(--border); border-radius: 9px; width: 36px; height: 36px; cursor: pointer; font-size: 16px; color: var(--text-soft); }
.cal-nav:hover { border-color: var(--gold); color: var(--gold); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); padding: 6px 0; font-weight: 600; }
.cal-day { background: var(--surface); border-radius: 9px; min-height: 98px; padding: 7px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 3px; }
.cal-day.other { background: #f0f3f8; opacity: .6; }
.cal-day.today { border: 2px solid var(--gold); }
.cal-day .num { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.cal-chip { font-size: 11px; padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.cal-chip.reuniao { background: #e3ebf7; color: var(--navy); }
.cal-chip.audiencia { background: #efe4f4; color: #774299; }
.cal-chip.compromisso { background: #eef2f8; color: var(--text-soft); }
.cal-chip.prazo, .cal-chip.tarefa { background: var(--amber-bg); color: var(--amber); }
.cal-chip.vencido, .cal-chip.urgente { background: var(--red-bg); color: var(--red); }

/* ── Notificações ── */
.notif-item { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); }
.notif-item:last-child { border-bottom: none; }
.notif-item strong { font-size: 14px; }
.notif-item p { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.notif-item small { color: var(--text-muted); font-size: 12px; }

/* ── Responsivo ── */
@media (max-width: 880px) {
  .login-view { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .content { margin-left: 0; padding: 22px; }
  .kanban { grid-template-columns: 1fr; }
  .app-view { flex-direction: column; }
}
