/* base.css — CRM ALFA */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary:        #C4A46B;
  --primary-hover:  #B8925A;
  --primary-light:  rgba(196,164,107,.12);

  --green:  #059669;
  --green2: #10B981;
  --amber:  #D97706;
  --red:    #DC2626;
  --blue:   #2563EB;
  --purple: #7C3AED;

  --bg:     #F8F9FC;
  --surf:   #FFFFFF;
  --surf2:  #F3F4F8;
  --border: #E4E7ED;
  --skel:   #E4E7ED;

  --t1: #111827;
  --t2: #374151;
  --t3: #9CA3AF;

  --sidebar-bg:         #111827;
  --sidebar-text:       rgba(255,255,255,.55);
  --sidebar-text-act:   #FFFFFF;
  --sidebar-active-bg:  rgba(196,164,107,.22);

  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 1px 4px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.10);

  --font: 'Inter', system-ui, sans-serif;
  --tx: 150ms ease;
  --sidebar-w: 220px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0F1117;
    --surf:          #161B27;
    --surf2:         #1E2537;
    --border:        #2D3349;
    --skel:          #2D3349;
    --t1:            #F1F5F9;
    --t2:            #CBD5E1;
    --t3:            #64748B;
    --primary-light: rgba(196,164,107,.15);
  }
}
:root[data-theme="dark"] {
  --bg: #0F1117; --surf: #161B27; --surf2: #1E2537;
  --border: #2D3349; --skel: #2D3349;
  --t1: #F1F5F9; --t2: #CBD5E1; --t3: #64748B;
  --primary-light: rgba(196,164,107,.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--t1); line-height: 1.5; min-height: 100dvh; }
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Shell ──────────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100dvh; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column; flex-shrink: 0;
  padding: var(--sp-5) 0;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
}
.sidebar__brand {
  padding: 0 var(--sp-4) var(--sp-5);
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: var(--sp-3);
}
.sidebar__brand-name { font-size: 1rem; font-weight: 700; color: #fff; letter-spacing: -.01em; }
.sidebar__brand-sub  { font-size: .7rem; color: rgba(255,255,255,.4); margin-top: 2px; }
.sidebar__nav { list-style: none; flex: 1; padding: 0 var(--sp-2); display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 7px var(--sp-3); color: var(--sidebar-text);
  font-size: .875rem; font-weight: 500; border-radius: var(--radius);
  transition: background var(--tx), color var(--tx); text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-act); font-weight: 600; }
.nav-item__icon { font-size: .9rem; width: 20px; text-align: center; flex-shrink: 0; opacity: .65; }
.nav-item.active .nav-item__icon,
.nav-item:hover  .nav-item__icon { opacity: 1; }
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 18px;
  text-align: center; display: none;
}
.nav-badge.visible { display: block; }
.sidebar__footer {
  padding: var(--sp-3) var(--sp-4); font-size: .75rem;
  color: var(--sidebar-text); border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto; flex-shrink: 0;
}

/* ── Main content ───────────────────────────────────────────────────────── */
.main-content { flex: 1; min-width: 0; padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-6); overflow-y: auto; }

/* ── Page header ────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.page-title  { font-size: 1.25rem; font-weight: 700; color: var(--t1); letter-spacing: -.01em; }
.page-subtitle { font-size: .875rem; color: var(--t3); margin-top: 2px; }

/* ── Card ───────────────────────────────────────────────────────────────── */
.card { background: var(--surf); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); box-shadow: var(--shadow-sm); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius); font-family: var(--font);
  font-size: .875rem; font-weight: 600; line-height: 1; cursor: pointer;
  border: 1px solid transparent; transition: background var(--tx), border-color var(--tx), color var(--tx), opacity var(--tx);
  white-space: nowrap; text-decoration: none;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #1a1006; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); color: #1a1006; text-decoration: none; }
.btn-outline  { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary-light); text-decoration: none; }
.btn-ghost    { background: transparent; color: var(--t2); border-color: transparent; }
.btn-ghost:hover:not(:disabled)   { background: color-mix(in srgb, var(--t3) 15%, transparent); color: var(--t1); text-decoration: none; }
.btn-danger   { background: transparent; color: var(--red); border-color: var(--red); }
.btn-danger:hover:not(:disabled)  { background: color-mix(in srgb, var(--red) 10%, transparent); text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-lg { padding: 10px 22px; font-size: 1rem; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--sp-1); }
.field label { font-size: .8rem; font-weight: 600; color: var(--t2); }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surf); color: var(--t1);
  font-family: var(--font); font-size: .875rem; outline: none; appearance: none; line-height: 1.4;
  transition: border-color var(--tx), box-shadow var(--tx);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(196,164,107,.18);
}
.field textarea { resize: vertical; min-height: 80px; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
}
.modal-backdrop.hidden { display: none; }
.modal-box {
  background: var(--surf); border-radius: var(--radius-lg);
  width: 100%; max-width: 540px; max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1rem; font-weight: 700; color: var(--t1); }
.modal-body   { flex: 1; overflow-y: auto; padding: var(--sp-5) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.modal-footer { padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--sp-3); }

/* ── Grid ───────────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--sp-4); }

/* ── Utils ──────────────────────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.text-sm { font-size: .875rem; } .text-xs { font-size: .75rem; }
.text-t2 { color: var(--t2); } .text-t3 { color: var(--t3); }
.font-semi { font-weight: 600; } .font-bold { font-weight: 700; }
.text-green { color: var(--green); } .text-amber { color: var(--amber); }
.text-red { color: var(--red); } .text-gold { color: var(--primary); }

/* ── Badges de etapa ────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.badge-lead            { background: color-mix(in srgb, #3b82f6 14%, transparent); color: #1d4ed8; }
.badge-qualificando    { background: color-mix(in srgb, #f59e0b 14%, transparent); color: #92400e; }
.badge-sessao_agendada { background: color-mix(in srgb, #8b5cf6 14%, transparent); color: #6d28d9; }
.badge-sessao_realizada{ background: color-mix(in srgb, #06b6d4 14%, transparent); color: #0e7490; }
.badge-proposta        { background: color-mix(in srgb, #f97316 14%, transparent); color: #c2410c; }
.badge-aluno           { background: color-mix(in srgb, #10b981 14%, transparent); color: #065f46; }
.badge-perdido         { background: color-mix(in srgb, var(--t3) 14%, transparent); color: var(--t3); }

/* ── Empty state ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: var(--sp-12) var(--sp-6); color: var(--t3); }
.empty-state p { margin: var(--sp-2) 0 var(--sp-4); }

/* ── Skeleton ───────────────────────────────────────────────────────────── */
.skel { background: var(--skel); border-radius: 6px; animation: skel-pulse 1.4s ease infinite; }
@keyframes skel-pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ── Alert dot ──────────────────────────────────────────────────────────── */
.alert-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; flex-shrink: 0; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid rgba(255,255,255,.1); }
  .sidebar__nav { flex-direction: row; flex: none; flex-wrap: nowrap; overflow-x: auto; gap: 2px; }
  .nav-item { padding: var(--sp-2) var(--sp-3); white-space: nowrap; }
  .sidebar__brand { border-bottom: none; margin: 0; padding-bottom: 0; }
  .sidebar__footer { display: none; }
  .grid-4, .grid-3 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 440px) {
  .main-content { padding: var(--sp-4) var(--sp-3); }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
