/* AdvoCRM — Modern SaaS App.
   Direção: dark friendly tipo Cakto/Linear/Vercel.
   Cards generosos arredondados, sans clean (Plus Jakarta + Geist Mono),
   accent emerald vibrante, sombras macias, sensação de produto fintech atual. */

/* ─────────────────────────────────────────────────────────────
   TOKENS
   ───────────────────────────────────────────────────────────── */
:root {
  /* ── Theming ──────────────────────────────────────────────────────
     Tokens default = tema "emerald-dark". Outros temas sobrescrevem
     via [data-theme="..."] no <html>, setado por settings.js.
     localStorage key: 'advocrm:theme'
  */

  /* Surfaces — dark friendly com matiz suave verde-escura (não cinza-chumbo) */
  --bg:           #0a0d0c;
  --surface-1:    #11171a;          /* sidebar, cards */
  --surface-2:    #161d20;          /* hover, elevations */
  --surface-3:    #1d2528;          /* inputs, pills internas */
  --surface-4:    #252e32;          /* hover de pills */
  --overlay:      rgba(10, 13, 12, 0.85);

  /* Aliases legados */
  --bg-primary:   var(--bg);
  --bg-secondary: var(--surface-1);
  --bg-tertiary:  var(--surface-2);
  --bg-elevated:  var(--surface-3);
  --bg-overlay:   var(--overlay);

  /* Bordas — quase invisíveis (Cakto usa muito sombra ao invés de border) */
  --line:         rgba(255, 255, 255, 0.04);
  --line-2:       rgba(255, 255, 255, 0.08);
  --line-3:       rgba(255, 255, 255, 0.14);
  --border:       var(--line);
  --border-strong:var(--line-2);

  /* Texto */
  --fg:           #ffffff;
  --fg-2:         #b1b8c2;
  --fg-3:         #6b7682;
  --fg-4:         #4a525c;
  --text-primary:   var(--fg);
  --text-secondary: var(--fg-2);
  --text-tertiary:  var(--fg-3);
  --text-disabled:  var(--fg-4);

  /* ACCENT — verde esmeralda Cakto (do print real) */
  --brand:         #10b981;          /* primário */
  --brand-hi:      #34d399;
  --brand-lo:      #059669;
  --brand-deep:    #047857;          /* botão escuro */
  --brand-soft:    rgba(16, 185, 129, 0.12);
  --brand-glow:    rgba(16, 185, 129, 0.32);
  --brand-dark:    #022c1f;          /* texto sobre botão verde */

  /* Aliases legados (mantém compat com classes existentes) */
  --primary:        var(--brand);
  --primary-hover:  var(--brand-hi);
  --primary-soft:   var(--brand-soft);
  --primary-glow:   var(--brand-glow);
  --accent:         var(--brand);
  --accent-hover:   var(--brand-hi);
  --accent-soft:    var(--brand-soft);
  --accent-glow:    var(--brand-glow);

  /* Status vibrantes */
  --success:        var(--brand);
  --success-soft:   var(--brand-soft);
  --info:           #4cb3ff;
  --info-soft:      rgba(76, 179, 255, 0.10);
  --warning:        #ffb547;
  --warning-soft:   rgba(255, 181, 71, 0.10);
  --danger:         #ff5a65;
  --danger-soft:    rgba(255, 90, 101, 0.10);
  --violet:         #b48bff;
  --violet-soft:    rgba(180, 139, 255, 0.10);

  --accent-blue:    var(--info);
  --accent-red:     var(--danger);

  /* Tipografia — sans clean SaaS */
  --font:         'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', -apple-system, system-ui, sans-serif;
  --font-mono:    'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;

  /* Escala */
  --text-xs:   11px;
  --text-sm:   12.5px;
  --text-base: 14px;
  --text-md:   15px;
  --text-lg:   17px;
  --text-xl:   20px;
  --text-2xl:  26px;
  --text-3xl:  clamp(28px, 3.5vw, 38px);
  --text-4xl:  clamp(40px, 5vw, 56px);

  /* Espaçamento */
  --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;
  --sp-16: 64px;

  /* Radius generosos (Cakto-style — bem arredondado) */
  --r-sm:   10px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-2xl:  28px;
  --r-full: 999px;

  /* Sombras macias com glow do brand (Cakto-feel) */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md:  0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg:  0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-xl:  0 32px 80px rgba(0, 0, 0, 0.6);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-glow:  0 0 0 4px var(--brand-soft);
  --shadow-glow-strong: 0 8px 32px var(--brand-glow), 0 0 0 1px var(--brand-soft);
  --shadow-btn-brand:  0 4px 14px rgba(0, 255, 136, 0.25), 0 1px 2px rgba(0, 0, 0, 0.3);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --motion-fast: 120ms;
  --motion-base: 180ms;
  --motion-slow: 280ms;
}

/* ─────────────────────────────────────────────────────────────
   RESET + BASE
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  font-size: var(--text-base);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.011em;
  position: relative;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-out);
}
a:hover { color: var(--brand-hi); }
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--brand-soft); color: var(--fg); }

/* Scrollbar moderna */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--r-full);
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.16); }

/* ─────────────────────────────────────────────────────────────
   TIPOGRAFIA — sans clean com hierarquia
   ───────────────────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: var(--fg);
  font-weight: 700;
}
h1 {
  font-size: var(--text-3xl);
  line-height: 1.1;
  margin-bottom: var(--sp-3);
}
h2 {
  font-size: var(--text-xl);
  line-height: 1.2;
  margin-bottom: var(--sp-2);
  font-weight: 600;
}
h3 {
  font-size: var(--text-lg);
  line-height: 1.3;
  font-weight: 600;
}

.font-display { font-family: var(--font-display); }
.font-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'ss01';
}

p {
  color: var(--fg-2);
  font-size: var(--text-base);
  margin-bottom: var(--sp-4);
  line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────────
   AUTH / CARDS centralizados
   ───────────────────────────────────────────────────────────── */
.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(0, 213, 99, 0.06), transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 100%, rgba(76, 179, 255, 0.04), transparent 60%),
    var(--bg);
}

.card {
  max-width: 460px;
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  padding: var(--sp-10) var(--sp-8);
  box-shadow: var(--shadow-lg);
}

.card-fluid { max-width: none; padding: 0; box-shadow: none; background: transparent; border: 0; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-2);
  color: var(--fg);
}
.logo .dot {
  width: 10px;
  height: 10px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--brand-soft), 0 0 18px var(--brand);
  display: inline-block;
}

.tagline {
  color: var(--fg-3);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-8);
  font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────
   FORMS — pills modernas com border ao redor
   ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--sp-4); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-2);
  margin-bottom: var(--sp-2);
  letter-spacing: -0.005em;
}

.form-input,
input:where([type="text"], [type="email"], [type="number"], [type="date"], [type="month"], [type="password"], [type="search"], [type="tel"], [type="url"]),
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--fg);
  font-size: var(--text-base);
  font-family: var(--font);
  line-height: 1.4;
  transition: border-color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out);
}
.form-input::placeholder { color: var(--fg-4); }
.form-input:hover { border-color: var(--line-2); background: var(--surface-3); }
.form-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface-1);
  box-shadow: var(--shadow-glow);
}
.form-input:disabled { opacity: 0.5; cursor: not-allowed; }

/* Ícone do date picker nativo — força branco (default é cinza/preto, some no dark theme).
   Suporta Chrome/Edge/Safari (webkit). Firefox não tem esse pseudo, mostra outro UI.
   color-scheme: dark faz o calendário popup também vir em dark. */
input[type="date"],
input[type="month"],
input[type="datetime-local"],
input[type="time"] {
  color-scheme: dark;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.2);
  opacity: 0.7;
  cursor: pointer;
  transition: opacity var(--motion-fast);
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

select.form-input, select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='%23a1a1aa'><path d='M3 4.5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px;
  padding-right: 36px;
  cursor: pointer;
}

textarea.form-input, textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.55;
}

.form-help { font-size: var(--text-xs); color: var(--fg-3); margin-top: var(--sp-1); }

input[type="checkbox"] {
  accent-color: var(--brand);
  width: 16px; height: 16px;
  cursor: pointer;
  vertical-align: middle;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--brand);
  cursor: pointer;
  border: 0;
  box-shadow: 0 0 0 0 var(--brand-soft);
  transition: box-shadow var(--motion-fast);
}
input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px var(--brand-soft);
}

/* ─────────────────────────────────────────────────────────────
   BUTTONS — sólidos, com lift suave
   ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 12px 24px;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.btn:hover:not(:disabled) {
  background: var(--brand-lo);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow), var(--shadow-btn-brand);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn-block { width: 100%; }

.btn-secondary {
  background: var(--surface-3);
  color: var(--fg);
  border: 0;
  box-shadow: none;
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-4);
  border: 0;
  box-shadow: none;
  color: var(--fg);
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--fg-2);
  border: 0;
  box-shadow: none;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--fg);
  box-shadow: none;
  transform: none;
}

.btn-danger {
  background: var(--danger);
  color: #21080a;
  box-shadow: 0 4px 14px rgba(255, 90, 101, 0.25), 0 1px 2px rgba(0,0,0,0.3);
}
.btn-danger:hover:not(:disabled) {
  background: #ff7780;
  box-shadow: 0 6px 24px rgba(255, 90, 101, 0.4);
}

/* ─────────────────────────────────────────────────────────────
   CLERK widgets
   ───────────────────────────────────────────────────────────── */
.cl-rootBox, .cl-card {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  width: 100% !important;
  max-width: 100% !important;
}
.cl-formButtonPrimary, .cl-internal-1ta0xpz {
  background: var(--brand) !important;
  color: #00210d !important;
  border: 0 !important;
  font-family: var(--font) !important;
  font-weight: 600 !important;
}
.cl-formFieldInput {
  background: var(--surface-2) !important;
  border: 1px solid var(--line-2) !important;
  color: var(--fg) !important;
  font-family: var(--font) !important;
}

/* ─────────────────────────────────────────────────────────────
   APP SHELL — sidebar dark + main content
   ───────────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(0, 255, 136, 0.04), transparent 70%);
}

.sidebar {
  background: var(--surface-1);
  border-right: 1px solid var(--line);
  padding: var(--sp-6) var(--sp-4);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.main-content {
  padding: var(--sp-8) var(--sp-10);
  overflow-y: auto;
  max-width: 100%;
  min-width: 0;
}

/* Nav items — pílulas Cakto-style: bem arredondados, ícone destacado */
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 11px 14px;
  border-radius: var(--r-md);
  color: var(--fg-2);
  font-size: var(--text-base);
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-out);
  letter-spacing: -0.005em;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--fg);
}
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(0, 255, 136, 0.15);
}
.nav-item.active > span:first-child {
  opacity: 1;
  transform: scale(1.05);
}

/* Item de menu desabilitado/em breve — visual atenuado, badge no canto.
   Continua clicável (mostra tela "Em breve"), só sinaliza visualmente. */
.nav-item-disabled .nav-icon,
.nav-item-disabled > span:not(.nav-soon-badge) {
  opacity: 0.55;
}
.nav-soon-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: rgba(255, 181, 71, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.28);
  line-height: 1;
  white-space: nowrap;
}

/* Tela "Em breve" — usada quando uma rota está temporariamente desabilitada. */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  min-height: 60vh;
}
.coming-soon-icon {
  width: 88px; height: 88px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 20px;
  border: 1px solid rgba(0, 255, 136, 0.18);
}
.coming-soon-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: rgba(245, 158, 11, 0.14);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.32);
  margin-bottom: 14px;
}
.coming-soon h1 {
  font-size: 28px;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.coming-soon p {
  max-width: 520px;
  color: var(--fg-2);
  line-height: 1.55;
  font-size: 15px;
  margin: 0;
}
.nav-item > span:first-child {
  font-size: 17px;
  width: 22px;
  text-align: center;
  opacity: 0.85;
  transition: transform var(--motion-fast);
}

/* Ícones SVG do sidebar — Lucide-style, currentColor, opacidade sutil que vira 100% no active */
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.72;
  transition: opacity var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out);
  stroke: currentColor;
}
.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active .nav-icon {
  opacity: 1;
  transform: scale(1.04);
}

/* Sidebar footer — card flutuante com plano destacado */
.sidebar-footer {
  border-top: 0;
  background: var(--surface-2);
  padding: var(--sp-4);
  margin-top: var(--sp-5);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-org {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--fg);
  font-weight: 600;
  padding: 0;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-org::before {
  content: '';
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-lo) 100%);
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--brand-glow);
}
/* ───────── Badge de plano (sidebar) ─────────
   Renderizado por renderPlanBadge() em tenant.html.
   Variantes por plano via classe modificadora (.plan-active, .plan-admin, etc).
   Cor é controlada por --p-color e --p-soft locais — todo .sidebar-plan-* puxa
   delas, então adicionar variante nova = só setar essas 2 vars.
*/
.sidebar-plan {
  --p-color: var(--brand);
  --p-soft: var(--brand-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--p-color);
  background: var(--p-soft);
  padding: 4px 10px 4px 8px;
  border-radius: var(--r-full);
  letter-spacing: 0.02em;
  font-weight: 700;
  margin: 4px 0 var(--sp-2) 40px;
  align-self: flex-start;
  border: 1px solid color-mix(in srgb, var(--p-color) 30%, transparent);
  transition: transform .15s, box-shadow .15s;
}
.sidebar-plan:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--p-color) 35%, transparent);
}
.sidebar-plan-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--p-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--p-color) 55%, transparent);
  flex-shrink: 0;
}
.sidebar-plan-label { line-height: 1; text-transform: uppercase; letter-spacing: 0.06em; font-size: 10.5px; }

/* ── Variantes por status do plano ── */
.sidebar-plan.plan-active  { --p-color: #10b981; --p-soft: rgba(16,185,129,0.12); }
.sidebar-plan.plan-trial   { --p-color: #38bdf8; --p-soft: rgba(56,189,248,0.12); }
.sidebar-plan.plan-gift    { --p-color: #a78bfa; --p-soft: rgba(167,139,250,0.14); }
.sidebar-plan.plan-admin   { --p-color: #c084fc; --p-soft: rgba(192,132,252,0.14); }
.sidebar-plan.plan-warn    { --p-color: #f59e0b; --p-soft: rgba(245,158,11,0.14); }
.sidebar-plan.plan-danger  { --p-color: #ef4444; --p-soft: rgba(239,68,68,0.14); }
.sidebar-plan.plan-muted   { --p-color: var(--fg-3); --p-soft: var(--bg-3); }
.sidebar-email {
  font-size: var(--text-xs);
  color: var(--fg-3);
  padding: 0 0 0 40px;
  margin-bottom: var(--sp-3);
  word-break: break-all;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--sp-16) var(--sp-6);
  color: var(--fg-3);
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: var(--sp-4);
  opacity: 0.4;
}

/* ─────────────────────────────────────────────────────────────
   UTILS
   ───────────────────────────────────────────────────────────── */
.muted { color: var(--fg-3); }
.text-sm  { font-size: var(--text-sm); }
.text-xs  { font-size: var(--text-xs); }
.text-md  { font-size: var(--text-md); }
.text-lg  { font-size: var(--text-lg); }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }

.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.page { animation: fadeSlideUp 0.4s var(--ease-out) both; }
.dash-cards > * { animation: fadeSlideUp 0.4s var(--ease-out) both; }
.dash-cards > *:nth-child(1) { animation-delay: 0.04s; }
.dash-cards > *:nth-child(2) { animation-delay: 0.08s; }
.dash-cards > *:nth-child(3) { animation-delay: 0.12s; }
.dash-cards > *:nth-child(4) { animation-delay: 0.16s; }
.dash-cards > *:nth-child(5) { animation-delay: 0.20s; }
.dash-cards > *:nth-child(6) { animation-delay: 0.24s; }

/* ─────────────────────────────────────────────────────────────
   LEADS table — bordas internas suaves, rows pill-like
   ───────────────────────────────────────────────────────────── */
.leads-filters {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}
.leads-table thead th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--fg-3);
  border-bottom: 1px solid var(--line);
  background: transparent;
  letter-spacing: -0.005em;
}
.leads-table tbody tr {
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out);
}
.leads-table tbody tr:hover { background: var(--surface-1); }
.leads-table tbody tr:last-child { border-bottom: none; }
.leads-table td {
  padding: var(--sp-4);
  vertical-align: middle;
  font-size: var(--text-base);
}
.leads-table td .name { font-weight: 600; color: var(--fg); }
.leads-table td .contact { color: var(--fg-3); font-size: var(--text-sm); font-family: var(--font-mono); }

/* ─────────────────────────────────────────────────────────────
   BADGES — pills coloridas modernas
   ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.4;
}
.badge-novo        { background: var(--info-soft);    color: var(--info); }
.badge-em_contato  { background: var(--warning-soft); color: var(--warning); }
.badge-qualificado { background: var(--violet-soft);  color: var(--violet); }
.badge-cliente     { background: var(--brand-soft);   color: var(--brand-hi); }
.badge-perdido     { background: var(--danger-soft);  color: var(--danger); }
.badge-manual      { background: var(--surface-3); color: var(--fg-3); }
.badge-facebook    { background: var(--info-soft);  color: var(--info); }
.badge-google      { background: var(--danger-soft); color: var(--danger); }
.badge-whatsapp    { background: var(--brand-soft);  color: var(--brand-hi); }
.badge-indicacao   { background: var(--violet-soft); color: var(--violet); }
.badge-outro       { background: var(--surface-3); color: var(--fg-3); }

/* Tese: pill neutro com tom levemente brand */
.badge-tese {
  background: var(--brand-soft);
  color: var(--brand-hi);
  font-family: var(--font);
  letter-spacing: 0;
}

/* ─── Toggle Tabela/Kanban no header da página /leads ─── */
.leads-view-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
}
.leads-view-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--fg-3);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--motion-fast);
  font-family: var(--font);
}
.leads-view-btn svg { width: 14px; height: 14px; }
.leads-view-btn:hover { color: var(--fg); }
.leads-view-btn.active {
  background: var(--surface-1);
  color: var(--brand);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ─── Kanban de leads ─── */
.leads-kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  min-height: 400px;
}
.kanban-col {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  max-height: calc(100vh - 280px);
}
.kanban-col.is-none {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface-1) 60%);
}
.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.kanban-col-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.kanban-col-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.kanban-col-body {
  display: flex; flex-direction: column;
  gap: 8px;
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}
.kanban-col-more {
  text-align: center;
  font-size: 11.5px;
  color: var(--fg-4);
  padding: 8px;
}
.kanban-card {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-out);
}
.kanban-card:hover {
  border-color: var(--brand);
  background: var(--surface-3);
  transform: translateY(-1px);
}

/* Decisão da IA: borda lateral colorida (verde/vermelho) +
   leve tint no background pra destaque sem poluir. */
.kanban-card.is-qualificado {
  border-left: 3px solid var(--brand, #00d97e);
  background: linear-gradient(90deg, rgba(0,217,126,0.06) 0%, var(--surface-2) 30%);
}
.kanban-card.is-perdido {
  border-left: 3px solid #ef4444;
  background: linear-gradient(90deg, rgba(239,68,68,0.05) 0%, var(--surface-2) 30%);
  opacity: 0.85;
}

/* Etiqueta no topo direito do card */
.kanban-card-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.2;
}
.kanban-card-tag.is-qualificado {
  background: rgba(0,217,126,0.18);
  color: #00d97e;
  border: 1px solid rgba(0,217,126,0.32);
}
.kanban-card-tag.is-perdido {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.30);
}
.kanban-card-head {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 6px;
}
.kanban-card-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-hi);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.kanban-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kanban-card-meta {
  font-size: 11.5px;
  color: var(--fg-3);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.kanban-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ─────────────────────────────────────────────────────────────
   MODAL
   ───────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  animation: fadeIn 180ms var(--ease-out);
}
.modal {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: fadeSlideUp 220ms var(--ease-out);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; }
.modal-close {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--fg-2);
  font-size: 16px;
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--motion-fast);
}
.modal-close:hover { background: var(--surface-3); color: var(--fg); }
.modal-body { padding: var(--sp-6); overflow-y: auto; }

/* ─── Tabs do modal de Lead (Detalhes / Resumo IA) ─── */
.lead-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  margin-top: -4px;
}
.lead-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-3);
  cursor: pointer;
  transition: color var(--motion-fast), border-color var(--motion-fast);
}
.lead-tab:hover { color: var(--fg); }
.lead-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* ─── Resumo IA — visual estruturado de leitura rápida ─── */
.summary-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 16px;
}
.summary-tldr-wrap { flex: 1; min-width: 0; }
.summary-tldr-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 4px;
}
.summary-tldr {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.summary-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.summary-viability {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.summary-viability.is-high   { background: rgba(0,217,126,0.15); color: #00d97e; border: 1px solid rgba(0,217,126,0.30); }
.summary-viability.is-medium { background: rgba(251,191,36,0.12); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.summary-viability.is-low    { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.summary-viability.is-unknown { background: var(--surface-3); color: var(--fg-3); border: 1px solid var(--line); }

.summary-refresh {
  font-size: 11px;
  padding: 4px 10px;
  height: auto;
}

.summary-section {
  margin-bottom: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
}
.summary-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-3);
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.summary-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-list li {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.5;
}
.summary-foot {
  margin-top: 12px;
  text-align: center;
  padding: 6px;
}

/* ─────────────────────────────────────────────────────────────
   TIMELINE
   ───────────────────────────────────────────────────────────── */
.timeline { margin-top: var(--sp-4); }
.timeline-item {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  flex-shrink: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand);
  margin-top: 8px;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.timeline-content { flex: 1; }
.timeline-when { font-size: var(--text-xs); color: var(--fg-3); font-weight: 500; }
.timeline-text { font-size: var(--text-base); color: var(--fg); margin-top: 2px; }

/* ─────────────────────────────────────────────────────────────
   DASHBOARD — KPI cards modernos
   ───────────────────────────────────────────────────────────── */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
}
.card.kpi {
  padding: var(--sp-5) var(--sp-6);
  max-width: none;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--motion-base) var(--ease-out),
              border-color var(--motion-base) var(--ease-out),
              box-shadow var(--motion-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.card.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}
.card.kpi:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 255, 136, 0.15);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 255, 136, 0.08);
}

.kpi-label {
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--fg-3);
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 30px;
  margin-top: var(--sp-3);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--fg);
  font-weight: 700;
}
.kpi-sub {
  font-family: var(--font);
  font-size: var(--text-xs);
  color: var(--fg-3);
  margin-left: var(--sp-2);
  font-weight: 500;
  padding: 2px 8px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  vertical-align: middle;
}

/* ROI status */
.roi-good      { color: var(--brand); }
.roi-good.kpi  { border-color: rgba(0, 213, 99, 0.25); }
.roi-good.kpi:hover { box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 213, 99, 0.15); }
.roi-ok        { color: var(--warning); }
.roi-ok.kpi    { border-color: rgba(255, 181, 71, 0.25); }
.roi-ok.kpi:hover { box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 181, 71, 0.15); }
.roi-bad       { color: var(--danger); }
.roi-bad.kpi   { border-color: rgba(255, 90, 101, 0.25); }
.roi-bad.kpi:hover { box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 90, 101, 0.15); }
.roi-na        { color: var(--fg-3); }

/* ─────────────────────────────────────────────────────────────
   INTEGRAÇÕES
   ───────────────────────────────────────────────────────────── */
.copy-row {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.copy-row input { flex: 1; }

/* ─────────────────────────────────────────────────────────────
   PROCESS DETAIL
   ───────────────────────────────────────────────────────────── */
.modal.modal-wide { max-width: 920px; }

.pd-header {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-5);
}
.pd-header-main { flex: 1; min-width: 0; }
.pd-cnj {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--fg-3);
  margin-bottom: var(--sp-2);
}
.pd-meta {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
.pd-status {
  padding: 3px var(--sp-3);
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.pd-status-ativo      { background: var(--brand-soft); color: var(--brand-hi); }
.pd-status-suspenso   { background: var(--warning-soft); color: var(--warning); }
.pd-status-arquivado  { background: var(--surface-3); color: var(--fg-3); }
.pd-status-encerrado  { background: var(--danger-soft); color: var(--danger); }
.pd-chip {
  padding: 3px var(--sp-3);
  border-radius: var(--r-full);
  background: var(--surface-2);
  font-size: var(--text-sm);
  color: var(--fg-2);
  border: 1px solid var(--line);
}
.pd-court { font-size: var(--text-base); color: var(--fg-2); margin-top: var(--sp-1); }
.pd-description {
  font-size: var(--text-md);
  color: var(--fg);
  margin-top: var(--sp-3);
  line-height: 1.55;
}
.pd-btn-sm { padding: 8px var(--sp-4); font-size: var(--text-sm); }

.pd-datajud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--info-soft);
  border: 1px solid rgba(76, 179, 255, 0.22);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-5);
}
.pd-datajud-left { display: flex; align-items: center; gap: var(--sp-3); }
.pd-datajud-dot {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}
.pd-datajud-title { font-size: var(--text-base); font-weight: 600; }
.pd-datajud-sub { font-size: var(--text-xs); color: var(--fg-3); margin-top: 2px; }
.pd-datajud-sub.pd-err { color: var(--danger); }
.pd-datajud-actions { display: flex; align-items: center; gap: var(--sp-3); }
.pd-toggle {
  display: flex; align-items: center; gap: var(--sp-2);
  cursor: pointer; font-size: var(--text-sm);
  color: var(--fg-2);
}

.pd-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}
@media (max-width: 720px) { .pd-grid-2 { grid-template-columns: 1fr; } }

.pd-section { display: flex; flex-direction: column; }
.pd-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.pd-section-head h3 {
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-2);
  margin: 0;
  letter-spacing: -0.005em;
}
.pd-count {
  background: var(--surface-3);
  padding: 2px var(--sp-2);
  border-radius: var(--r-full);
  font-size: var(--text-xs);
  color: var(--fg-3);
  font-weight: 600;
}

.pd-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.pd-empty {
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--fg-3);
  font-size: var(--text-sm);
  background: var(--surface-1);
  border-radius: var(--r-md);
  border: 1px dashed var(--line);
}

.pd-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  align-items: center;
  transition: all var(--motion-fast) var(--ease-out);
}
.pd-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.pd-card-urgent  { background: var(--warning-soft); border-color: rgba(255,181,71,0.3); }
.pd-card-overdue { background: var(--danger-soft); border-color: rgba(255,90,101,0.32); }
.pd-card-warn    { background: var(--info-soft); border-color: rgba(76,179,255,0.22); }
.pd-card-past    { opacity: 0.5; }
.pd-card-time {
  text-align: center;
  border-right: 1px solid var(--line);
  padding-right: var(--sp-3);
}
.pd-card-date {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1;
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.pd-card-hour {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--fg-2);
  margin-top: var(--sp-1);
}
.pd-card-when {
  font-size: 10px;
  color: var(--fg-3);
  margin-top: var(--sp-1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.pd-card-body { min-width: 0; }
.pd-card-title {
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--fg);
  margin-bottom: var(--sp-1);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  letter-spacing: -0.01em;
}
.pd-card-sub { font-size: var(--text-sm); color: var(--fg-2); margin-bottom: var(--sp-1); }
.pd-card-notes {
  font-size: var(--text-sm);
  color: var(--fg-2);
  margin-top: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border-left: 2px solid var(--brand);
  line-height: 1.5;
}
.pd-status-pill {
  display: inline-block;
  padding: 2px var(--sp-2);
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: var(--sp-2);
}
.pd-status-agendada  { background: var(--info-soft);  color: var(--info); }
.pd-status-realizada { background: var(--brand-soft); color: var(--brand-hi); }
.pd-status-cancelada { background: var(--danger-soft); color: var(--danger); }
.pd-status-adiada    { background: var(--warning-soft); color: var(--warning); }
.pd-status-pendente  { background: var(--info-soft);  color: var(--info); }
.pd-status-cumprido  { background: var(--brand-soft); color: var(--brand-hi); }
.pd-status-perdido   { background: var(--danger-soft); color: var(--danger); }
.pd-auto-tag {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--info-soft);
  color: var(--info);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.pd-del {
  background: transparent;
  border: 0;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  color: var(--fg-3);
  font-size: 16px;
  cursor: pointer;
  align-self: start;
  transition: all var(--motion-fast) var(--ease-out);
}
.pd-del:hover { background: var(--danger-soft); color: var(--danger); }

.pd-add { margin-top: var(--sp-3); }
.pd-add summary {
  cursor: pointer;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  color: var(--fg-3);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  list-style: none;
  user-select: none;
  transition: all var(--motion-fast) var(--ease-out);
  font-weight: 500;
}
.pd-add summary::-webkit-details-marker { display: none; }
.pd-add summary:hover { color: var(--brand); border-color: var(--brand); }
.pd-add[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; }
.pd-add-form {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px dashed var(--line-2);
  border-top: none;
  border-bottom-left-radius: var(--r-md);
  border-bottom-right-radius: var(--r-md);
}
.pd-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }

.pd-events-list { gap: 0; }
.pd-event {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
}
.pd-event-line {
  display: flex;
  justify-content: center;
  position: relative;
}
.pd-event-line::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--line);
}
.pd-event:first-child .pd-event-line::before { top: 8px; }
.pd-event:last-child .pd-event-line::before { bottom: calc(100% - 8px); }
.pd-event-dot {
  position: relative;
  z-index: 1;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 7px;
  box-shadow: 0 0 0 3px var(--bg);
}
.pd-event-body { padding-bottom: var(--sp-1); }
.pd-event-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: 2px;
  font-size: var(--text-sm);
}
.pd-event-type { font-weight: 600; color: var(--fg); }
.pd-event-when { color: var(--fg-3); font-family: var(--font-mono); font-size: 11px; }
.pd-attach {
  margin-left: auto;
  cursor: pointer;
  padding: 2px var(--sp-2);
  border-radius: var(--r-sm);
  color: var(--fg-3);
  font-size: 14px;
  transition: all var(--motion-fast);
}
.pd-attach:hover { background: var(--surface-3); color: var(--fg); }
.pd-event-text { font-size: var(--text-base); color: var(--fg-2); line-height: 1.55; }
.pd-event-attachments { font-size: var(--text-xs); color: var(--fg-3); margin-top: var(--sp-1); }

.proc-sync-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 8px var(--brand-glow);
  margin-left: var(--sp-2);
  vertical-align: middle;
  animation: pulse 2s ease-in-out infinite;
}

.pd-card-clickable { cursor: pointer; }
.pd-card-clickable:hover {
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.pd-actions { margin-top: var(--sp-3); display: flex; gap: var(--sp-2); flex-wrap: wrap; }


/* ─────────────────────────────────────────────────────────────
   WHATSAPP INBOX — Minimalista premium (Linear/Vercel-style)
   Sem doodle pattern, sem verde-musgo WhatsApp, sem cauda.
   Foco: espaço, tipografia, hairlines, brand color do app.
   ───────────────────────────────────────────────────────────── */

/* Estado vazio — antes de conectar */
.wpp-empty {
  text-align: center;
  padding: 120px var(--sp-6);
  color: var(--fg-3);
}
.wpp-empty-icon { font-size: 48px; opacity: 0.3; margin-bottom: var(--sp-5); }
.wpp-empty h1 { margin-bottom: var(--sp-2); color: var(--fg); font-weight: 600; }

.wpp-qr-screen { max-width: 460px; margin: var(--sp-10) auto; text-align: center; }

/* Shell — sem borda, ocupa tudo, vira parte do app */
.wpp-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: calc(100vh - 64px);
  background: var(--bg);
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

/* ── Lista de conversas ────────────────────────────────────── */
.wpp-list {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface-1);
  min-width: 0;
}

.wpp-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
  background: transparent;
  border-bottom: 0;
}
.wpp-head-info { flex: 1; min-width: 0; }
.wpp-head-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.wpp-head-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.wpp-head-sub {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  font-size: 12px;
  color: var(--fg-3);
  font-family: var(--font);
  letter-spacing: 0;
  min-width: 0;
}
.wpp-head-account {
  color: var(--fg-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.wpp-head-phone {
  color: var(--fg-4);
  font-variant-numeric: tabular-nums;
}
.wpp-head-phone::before {
  content: "·";
  margin-right: 6px;
  color: var(--fg-4);
}
.wpp-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand, #00d97e);
  box-shadow: 0 0 0 0 rgba(0, 217, 126, 0.55);
  animation: wpp-pulse-dot 2.2s ease-out infinite;
  flex-shrink: 0;
}
@keyframes wpp-pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(0, 217, 126, 0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(0, 217, 126, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 217, 126, 0); }
}

/* Botão circular do header — desconectar */
.wpp-head-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--fg-3);
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-out);
  flex-shrink: 0;
}
.wpp-head-btn svg { width: 16px; height: 16px; }
.wpp-head-btn:hover {
  background: var(--danger-soft, rgba(239,68,68,0.1));
  border-color: var(--danger, #ef4444);
  color: var(--danger, #ef4444);
  transform: scale(1.04);
}

.wpp-list-items {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--sp-2) var(--sp-3);
}

/* Item de conversa — minimalista, hover sutil, ativo com indicador lateral */
.wpp-conv {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  border: 0;
  border-radius: var(--r-md);
  align-items: center;
  transition: background var(--motion-fast) var(--ease-out);
  position: relative;
  margin: 1px 0;
}
.wpp-conv:hover { background: var(--surface-2); }
.wpp-conv.active {
  background: var(--surface-2);
}
.wpp-conv.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 12px var(--brand-glow);
}

/* Avatar — gradient sutil, sem peso visual exagerado */
.wpp-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  color: var(--fg-2);
  flex-shrink: 0;
  position: relative;
}
.wpp-conv.active .wpp-avatar {
  background: linear-gradient(135deg, var(--brand-soft), var(--surface-3));
  border-color: rgba(0, 213, 99, 0.25);
  color: var(--brand);
}

.wpp-conv-body { min-width: 0; }
.wpp-conv-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-2);
}
.wpp-conv-head strong {
  font-size: 14px;
  color: var(--fg);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.wpp-conv-head .muted, .wpp-conv-head .text-xs {
  font-size: 11px;
  color: var(--fg-3);
  white-space: nowrap;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.wpp-conv-preview {
  font-size: 13px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.4;
}
.wpp-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--r-full);
  font-size: 10px;
  margin-top: 5px;
  font-weight: 600;
  letter-spacing: 0;
  background: var(--brand-soft);
  color: var(--brand);
}
.wpp-badge {
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--r-full);
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* ── Painel da conversa aberta ─────────────────────────────── */
.wpp-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  position: relative;
}

/* Header da conversa — slot pra avatar via data-initial */
.wpp-conv-head-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  background: var(--surface-1);
  border-bottom: 1px solid var(--line);
  min-height: 68px;
}

.wpp-conv-head-main > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.wpp-conv-head-main > div:first-child::before {
  content: attr(data-initial);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-soft), var(--surface-3));
  border: 1px solid rgba(0, 213, 99, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
  flex-shrink: 0;
}
/* Nome + telefone empilhados verticalmente ao lado do avatar.
   Sem isso, o flex-row do pai colocava avatar/nome/telefone tudo inline,
   e o telefone era encoberto pelo lado direito quando o header lotava. */
.wpp-head-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.wpp-head-text > div:first-child {
  color: var(--fg) !important;
  font-weight: 600 !important;
  font-size: 15px !important;
  line-height: 1.3;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wpp-head-text .muted,
.wpp-head-text .text-xs {
  color: var(--fg-3) !important;
  font-size: 12px !important;
  margin-top: 2px;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Lado direito do header — botões + tag de lead/cliente.
   flex-shrink: 0 nos botões pra não esmagarem; gap consistente.
   Sem isso, o select de templates (texto longo) empurrava tudo
   pra cima do nome/telefone. */
.wpp-head-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.wpp-head-actions > * { flex-shrink: 0; }
/* Tag dentro do header é inline-flex centralizado, sem margin-top
   (esse margin era pra contexto de card na sidebar, não de header). */
.wpp-head-actions .wpp-tag {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wpp-head-actions select {
  max-width: 220px;
  text-overflow: ellipsis;
}

/* Select de template de IA no header — antes usava --wa-bg-elev/--wa-text
   (que NÃO existem como CSS vars) então caía pro fundo branco padrão do
   browser e quebrava o tema dark.
   color-scheme: dark faz o dropdown nativo aparecer em dark no Chrome/Edge/Firefox. */
.wpp-ai-template-select {
  padding: 6px 28px 6px 12px !important;
  font-size: 12px !important;
  background: var(--surface-2) !important;
  color: var(--fg) !important;
  border: 1px solid var(--line-2) !important;
  border-radius: var(--r-md) !important;
  cursor: pointer;
  color-scheme: dark;
  height: auto !important;
  width: auto !important;
  min-width: 0;
}
.wpp-ai-template-select:hover {
  background: var(--surface-3) !important;
  border-color: var(--line-3) !important;
}
.wpp-ai-template-select:focus {
  outline: none;
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 2px var(--brand-soft);
}
/* Options dentro do dropdown — bg dark + texto claro.
   Browsers limitam estilização de <option>, mas Chrome/Edge/Firefox respeitam
   background-color e color. Em Safari fica nativo (limitação do WebKit). */
.wpp-ai-template-select option {
  background-color: var(--surface-1);
  color: var(--fg);
  padding: 6px 10px;
}
.wpp-ai-template-select option:checked,
.wpp-ai-template-select option:hover {
  background-color: var(--brand-soft);
  color: var(--brand);
}

.wpp-conv-head-main button {
  background: transparent !important;
  border: 1px solid var(--line-2) !important;
  color: var(--fg-2) !important;
  font-size: 12px !important;
  padding: 6px 12px !important;
  font-weight: 500 !important;
  border-radius: var(--r-md) !important;
  width: auto !important;
  height: auto !important;
  box-shadow: none !important;
}
.wpp-conv-head-main button.btn:not(.btn-secondary) {
  background: var(--brand-soft) !important;
  color: var(--brand) !important;
  border-color: transparent !important;
}
.wpp-conv-head-main button:hover {
  background: var(--surface-2) !important;
  border-color: var(--line-3) !important;
  color: var(--fg) !important;
  transform: none !important;
}

/* ── Área de mensagens ─────────────────────────────────────── */
.wpp-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5) 12% var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wpp-date-sep {
  text-align: center;
  margin: var(--sp-5) 0 var(--sp-3);
}
.wpp-date-sep span {
  font-size: 10px;
  color: var(--fg-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0 14px;
  position: relative;
}
.wpp-date-sep span::before, .wpp-date-sep span::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40px;
  height: 1px;
  background: var(--line);
}
.wpp-date-sep span::before { right: 100%; }
.wpp-date-sep span::after { left: 100%; }

.wpp-msg {
  display: flex;
  margin: 1px 0;
}
.wpp-msg-in { justify-content: flex-start; padding: 0 15% 0 0; }
.wpp-msg-out { justify-content: flex-end; padding: 0 0 0 15%; }

/* Bubble — sem cauda, sem clip-path, cantos arredondados uniformes */
.wpp-msg-bubble {
  max-width: 100%;
  padding: 9px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  color: var(--fg);
  min-width: 56px;
  position: relative;
  letter-spacing: -0.003em;
}

.wpp-msg-in .wpp-msg-bubble {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.wpp-msg-out .wpp-msg-bubble {
  background: var(--brand-soft);
  border: 1px solid rgba(0, 213, 99, 0.18);
  border-bottom-right-radius: 4px;
}

/* Meta — hora + status, discreto e tabular */
.wpp-msg-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  float: right;
  margin: 4px 0 -2px 10px;
  user-select: none;
  letter-spacing: 0.02em;
}
.wpp-msg-out .wpp-msg-meta { color: rgba(255, 255, 255, 0.45); }

/* Check marks SVG — minimalistas, sem cor de WhatsApp */
.wpp-check {
  display: inline-flex;
  align-items: center;
  width: 14px;
  height: 10px;
}
.wpp-check.read { color: var(--brand); }
.wpp-check.unread { color: var(--fg-4); }

/* ── Composer ──────────────────────────────────────────────── */
.wpp-composer {
  display: flex;
  gap: 8px;
  padding: 14px 18px 18px;
  background: var(--surface-1);
  border-top: 1px solid var(--line);
  align-items: flex-end;
}

.wpp-composer textarea {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--fg);
  border-radius: 12px;
  padding: 11px 16px;
  font-family: var(--font);
  font-size: 14px;
  resize: none;
  min-height: 44px;
  max-height: 140px;
  line-height: 1.45;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.wpp-composer textarea::placeholder { color: var(--fg-4); }
.wpp-composer textarea:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Botão enviar — minimalista, ícone setinha simples */
.wpp-composer button.btn {
  align-self: flex-end;
  background: var(--brand) !important;
  color: #fff !important;
  padding: 0 !important;
  width: 44px;
  height: 44px;
  border-radius: 12px !important;
  font-size: 0;
  position: relative;
  flex-shrink: 0;
  box-shadow: var(--shadow-btn-brand) !important;
}
.wpp-composer button.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><line x1='22' y1='2' x2='11' y2='13'/><polygon points='22 2 15 22 11 13 2 9 22 2'/></svg>");
  background-size: 18px;
  background-repeat: no-repeat;
  background-position: center;
}
.wpp-composer button.btn:hover {
  background: var(--brand-hi) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px var(--brand-glow) !important;
}

#page-conversations {
  padding: 0;
  margin: calc(-1 * var(--sp-8)) calc(-1 * var(--sp-10));
  height: calc(100vh - 0px);
}

/* Botões de ícone do composer (anexar, microfone) — sem borda */
.wpp-icon-btn {
  background: transparent;
  border: 0;
  border-radius: var(--r-md);
  width: 44px; height: 44px;
  cursor: pointer;
  color: var(--fg-3);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--motion-fast);
}
.wpp-icon-btn:hover {
  background: var(--surface-2);
  color: var(--fg);
}
.wpp-icon-btn.recording {
  background: var(--danger-soft);
  color: var(--danger);
  animation: pulse 1s ease-in-out infinite;
}

/* Botão "Excluir" no header da conversa — visualmente diferenciado do secondary
   normal pra evitar clique acidental (ação destrutiva sem undo). */
.btn.wpp-btn-danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.25);
}
.btn.wpp-btn-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fecaca;
}

/* Search field redesenhado — lupa SVG inline + botão limpar */
.wpp-list-search {
  padding: 4px var(--sp-5) var(--sp-3);
  background: transparent;
}
.wpp-search-field {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 38px;
  transition: border-color var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out);
}
.wpp-search-field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.wpp-search-icon {
  width: 15px;
  height: 15px;
  color: var(--fg-4);
  margin-left: 12px;
  flex-shrink: 0;
  transition: color var(--motion-fast);
}
.wpp-search-field:focus-within .wpp-search-icon { color: var(--brand); }
.wpp-list-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0 10px 0 10px;
  color: var(--fg);
  font-size: 13px;
  font-family: var(--font);
  height: 100%;
  min-width: 0;
}
.wpp-list-search input::placeholder { color: var(--fg-4); }
.wpp-search-clear {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--fg-4);
  width: 30px;
  height: 30px;
  margin-right: 4px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--motion-fast);
}
.wpp-search-clear svg { width: 14px; height: 14px; }
.wpp-search-clear:hover { background: rgba(255,255,255,0.06); color: var(--fg); }

/* Abas Conversas / Arquivadas — segment control sutil */
.wpp-tabs {
  display: flex;
  gap: 2px;
  padding: 0 var(--sp-5) var(--sp-3);
}
.wpp-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--fg-3);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-out);
  position: relative;
}
.wpp-tab svg { width: 14px; height: 14px; opacity: 0.7; transition: opacity var(--motion-fast); }
.wpp-tab:hover { color: var(--fg); background: var(--surface-2); }
.wpp-tab:hover svg { opacity: 1; }
.wpp-tab.active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}
.wpp-tab.active svg { opacity: 1; }

/* ── Mensagens com mídia ───────────────────────────────────── */
.wpp-msg-img, .wpp-msg-video {
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  cursor: pointer;
  display: block;
  margin: -2px -4px 0;
}
.wpp-msg-audio { display: block; width: 260px; margin: 4px 0; }
.wpp-msg-sticker { max-width: 140px; max-height: 140px; }
.wpp-msg-doc {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--fg) !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  word-break: break-all;
  transition: border-color var(--motion-fast);
}
.wpp-msg-doc:hover { border-color: var(--brand); }
.wpp-msg-caption { margin-top: 6px; }

/* Botões de reply/react — aparecem no hover do bubble */
.wpp-msg-reply, .wpp-msg-react {
  background: transparent;
  border: 0;
  color: var(--fg-3);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: all var(--motion-fast);
  margin-right: 4px;
}
.wpp-msg-bubble:hover .wpp-msg-reply,
.wpp-msg-bubble:hover .wpp-msg-react { opacity: 0.7; }
.wpp-msg-reply:hover, .wpp-msg-react:hover {
  background: var(--surface-3);
  color: var(--brand);
  opacity: 1 !important;
}

/* Popover de reações */
.wpp-react-popover {
  position: fixed;
  z-index: 200;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
  padding: 6px;
  display: flex;
  gap: 4px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 150ms var(--ease-out);
}
.wpp-react-emoji {
  background: transparent;
  border: 0;
  font-size: 20px;
  padding: 5px 8px;
  cursor: pointer;
  border-radius: 50%;
  transition: transform var(--motion-fast), background var(--motion-fast);
}
.wpp-react-emoji:hover {
  background: var(--surface-4);
  transform: scale(1.2);
}

/* Reply bar — citando uma mensagem antes de enviar */
.wpp-reply-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: var(--surface-1);
  border-top: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  margin: 0 18px;
  border-radius: 8px 8px 0 0;
}
.wpp-reply-content { flex: 1; min-width: 0; padding: 2px 0; }
.wpp-reply-content .text-xs.muted {
  color: var(--brand);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.wpp-reply-preview {
  font-size: 13px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Recorder bar — gravando áudio */
.wpp-rec-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface-1);
  border-top: 1px solid var(--line);
  min-height: 76px;
}
.wpp-rec-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
}
.wpp-rec-dot.pulse {
  animation: rec-pulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 90, 101, 0.7);
}
@keyframes rec-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 90, 101, 0.7); }
  50%  { box-shadow: 0 0 0 8px rgba(255, 90, 101, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 90, 101, 0); }
}
.wpp-rec-time {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  min-width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.wpp-rec-canvas {
  flex: 1;
  height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
}
.wpp-rec-preview { flex: 1; height: 40px; }
.wpp-rec-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--fg-3);
  font-size: 11px;
}

/* Estado vazio do main (sem conversa selecionada) — minimalista premium */
.wpp-main .wpp-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 60px 24px;
}
.wpp-main .wpp-empty-icon {
  width: 84px;
  height: 84px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--brand, #00d97e);
  opacity: 0.85;
}
.wpp-main .wpp-empty-icon svg {
  width: 38px;
  height: 38px;
}
.wpp-empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.015em;
  margin: 0;
}
.wpp-empty-sub {
  font-size: 13px;
  color: var(--fg-3);
  margin-top: 6px;
  max-width: 280px;
  text-align: center;
}
.wpp-main .wpp-empty h1 {
  color: var(--fg);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.wpp-main .wpp-empty p {
  color: var(--fg-3);
  font-size: 13px;
  font-weight: 400;
  max-width: 320px;
  text-align: center;
  line-height: 1.5;
}


/* ─────────────────────────────────────────────────────────────
   IA TOGGLE
   ───────────────────────────────────────────────────────────── */
.ia-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 8px var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
  transition: all var(--motion-fast);
}
.ia-switch:hover { border-color: var(--brand); color: var(--brand); }
.ia-switch input[type="checkbox"] { accent-color: var(--brand); }

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .main-content { padding: var(--sp-6) var(--sp-5); }
}
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: var(--sp-3);
  }
  .sidebar-footer { display: none; }
  .main-content { padding: var(--sp-5); }
  .modal { max-width: 100%; }
}

/* ─────────────────────────────────────────────────────────────
   AUTH SPLIT PANEL — estilo Cakto
   Painel esquerdo claro com form, painel direito escuro com brand showcase
   ───────────────────────────────────────────────────────────── */
.auth-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
}

/* ── PAINEL ESQUERDO — form em fundo branco ── */
.auth-form-pane {
  display: flex;
  flex-direction: column;
  padding: var(--sp-10) var(--sp-12);
  background: #fff;
  color: #1a1d23;
  overflow-y: auto;
  position: relative;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--brand-deep);
  margin-bottom: var(--sp-12);
}
.auth-brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.auth-form {
  max-width: 420px;
  width: 100%;
  margin: auto 0;
  padding: var(--sp-6) 0;
}

.auth-form h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #1a1d23;
  margin-bottom: var(--sp-3);
}
.auth-form > p {
  color: #6b7280;
  font-size: var(--text-base);
  margin-bottom: var(--sp-8);
}

/* Tabs Login sem senha / Login com senha */
.auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: var(--sp-6);
}
.auth-tab {
  flex: 1;
  background: none;
  border: 0;
  padding: 14px 0;
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: 600;
  color: #9ca3af;
  cursor: pointer;
  position: relative;
  transition: color var(--motion-fast);
  letter-spacing: -0.005em;
}
.auth-tab:hover { color: #4b5563; }
.auth-tab.active { color: var(--brand-deep); }
.auth-tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
}

/* Inputs do form de auth (sobrescreve o dark global) */
.auth-form .form-label {
  color: #374151;
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 6px;
}
.auth-form .form-input,
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px 16px;
  color: #1a1d23;
  font-size: var(--text-base);
  font-family: var(--font);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.auth-form .form-input::placeholder { color: #9ca3af; font-style: normal; }
.auth-form .form-input:hover { border-color: #9ca3af; background: #fff; }
.auth-form .form-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
  background: #fff;
}

/* Checkbox "manter conexão" */
.auth-keep {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: var(--sp-4) 0 var(--sp-6);
  cursor: pointer;
  user-select: none;
}
.auth-keep input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--brand);
  flex-shrink: 0;
}
.auth-keep-text strong {
  font-size: var(--text-sm);
  color: #1f2937;
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.auth-keep-text small {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.45;
}

/* Botão CTA da auth */
.auth-form .btn,
.auth-cta {
  width: 100%;
  background: var(--brand);
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: var(--text-base);
  font-weight: 600;
  border: 0;
  cursor: pointer;
  transition: background var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.auth-form .btn:hover,
.auth-cta:hover {
  background: var(--brand-lo);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.auth-form .btn-secondary {
  background: #fff;
  color: #1f2937;
  border: 1px solid #d1d5db;
  box-shadow: none;
}
.auth-form .btn-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  box-shadow: none;
}

.auth-bottom {
  text-align: center;
  margin-top: var(--sp-6);
  font-size: var(--text-sm);
  color: #6b7280;
}
.auth-bottom a {
  color: var(--brand-deep);
  font-weight: 600;
  text-decoration: none;
}
.auth-bottom a:hover { text-decoration: underline; }

.auth-foot {
  margin-top: auto;
  padding-top: var(--sp-8);
  font-size: 12px;
  color: #9ca3af;
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
}
.auth-foot a { color: #6b7280; }

/* ── PAINEL DIREITO — escuro com brand showcase ── */
.auth-showcase {
  background: linear-gradient(135deg, #0a0d0c 0%, #0f1614 50%, #0a0d0c 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--sp-12);
}

/* Grid pattern sutil verde */
.auth-showcase::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(16,185,129,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,185,129,0.06) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  pointer-events: none;
}

/* Glow verde central */
.auth-showcase::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, transparent 60%);
  pointer-events: none;
}

.auth-showcase-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 480px;
}

.auth-showcase-eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--r-full);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--brand-hi);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--sp-6);
}

.auth-showcase h2 {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  color: #fff;
  margin: 0;
}
.auth-showcase h2 .accent {
  background: linear-gradient(135deg, var(--brand-hi) 0%, var(--brand) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: block;
  font-style: italic;
}

.auth-showcase-sub {
  font-size: var(--text-md);
  color: #9ca3af;
  margin-top: var(--sp-5);
  line-height: 1.6;
}

/* Métricas decorativas */
.auth-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-top: var(--sp-10);
  padding-top: var(--sp-6);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.auth-metric {
  text-align: left;
}
.auth-metric-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--brand-hi);
  letter-spacing: -0.02em;
}
.auth-metric-label {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-top: 4px;
}

/* Bar charts decorativos atrás do título */
.auth-bars {
  position: absolute;
  bottom: var(--sp-12);
  right: var(--sp-12);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 80px;
  z-index: 1;
  opacity: 0.55;
}
.auth-bar {
  width: 14px;
  background: linear-gradient(180deg, var(--brand-hi), var(--brand-deep));
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

/* Responsivo: empilha em mobile */
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-showcase { min-height: 280px; padding: var(--sp-8); }
  .auth-showcase h2 { font-size: 32px; }
  .auth-form-pane { padding: var(--sp-8) var(--sp-6); }
  .auth-bars { display: none; }
}

/* ─────────────────────────────────────────────────────────────
   SKELETONS — feedback visual durante loading (não mais "Carregando…")
   ───────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-1) 0%, var(--surface-3) 50%, var(--surface-1) 100%);
  background-size: 200% 100%;
  animation: skel 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
  display: inline-block;
  vertical-align: middle;
}
@keyframes skel {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Skeleton blocks utilitários — usar inline no HTML pra evitar flash */
.skel-line   { height: 14px; border-radius: 4px; width: 100%; display: block; margin: 6px 0; }
.skel-line-sm { height: 11px; border-radius: 3px; width: 60%; display: block; margin: 4px 0; }
.skel-line-lg { height: 28px; border-radius: 6px; width: 40%; display: block; margin: 8px 0; }
.skel-circle { border-radius: 50%; display: inline-block; }
.skel-box    { height: 100px; border-radius: var(--r-md); display: block; margin: 8px 0; }

/* Apresets prontos pra páginas inteiras */
.skel-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 0;
}
.skel-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.skel-kpi {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.skel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.skel-row > .skeleton:last-child { margin-left: auto; }
.skel-table {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

/* Spinner elegante — alternativa ao skeleton quando o conteúdo é dinâmico demais */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--line-3);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Container centralizado pro spinner em página inteira */
.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 24px;
  color: var(--fg-3);
  font-size: 13px;
}

/* Toast notification — flutua bottom-right, fade in/out */
.wpp-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--surface-1);
  border: 1px solid var(--brand, #10b981);
  color: var(--fg);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 1px var(--brand-soft);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  max-width: 360px;
}
.wpp-toast.is-active {
  opacity: 1;
  transform: translateY(0);
}
.wpp-toast-error {
  border-color: var(--danger, #ef4444);
  color: #fca5a5;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 1px rgba(239,68,68,0.15);
}

/* Transição suave de skeleton → conteúdo real (sem flash) */
.fade-in-fast { animation: fadeInFast 240ms ease-out both; }
@keyframes fadeInFast {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== TEMAS ALTERNATIVOS =====
   Ativados via data-theme no html (ver settings.js)
   Cada tema sobrescreve as CSS vars do default
*/

/* Oceano: azul profundo */
[data-theme="ocean"] {
  --bg: #060d1f;
  --surface-1: #0d1830;
  --surface-2: #142544;
  --surface-3: #1c3258;
  --surface-4: #25406d;
  --overlay: rgba(6, 13, 31, 0.85);
  --brand: #3b82f6;
  --brand-hi: #60a5fa;
  --brand-lo: #2563eb;
  --brand-deep: #1d4ed8;
  --brand-soft: rgba(59, 130, 246, 0.16);
  --brand-glow: rgba(59, 130, 246, 0.40);
  --brand-dark: #0a1530;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --primary-glow: rgba(59, 130, 246, 0.40);
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --accent-glow: rgba(59, 130, 246, 0.40);
  --success: #3b82f6;
  --success-soft: rgba(59, 130, 246, 0.16);
}

/* Roxo: violeta saturado */
[data-theme="violet"] {
  --bg: #0a061a;
  --surface-1: #150f2e;
  --surface-2: #1f1740;
  --surface-3: #2a2055;
  --surface-4: #382b6c;
  --overlay: rgba(10, 6, 26, 0.85);
  --brand: #a855f7;
  --brand-hi: #c084fc;
  --brand-lo: #9333ea;
  --brand-deep: #7e22ce;
  --brand-soft: rgba(168, 85, 247, 0.16);
  --brand-glow: rgba(168, 85, 247, 0.40);
  --brand-dark: #1a0a30;
  --primary: #a855f7;
  --primary-hover: #c084fc;
  --primary-soft: rgba(168, 85, 247, 0.16);
  --primary-glow: rgba(168, 85, 247, 0.40);
  --accent: #a855f7;
  --accent-hover: #c084fc;
  --accent-soft: rgba(168, 85, 247, 0.16);
  --accent-glow: rgba(168, 85, 247, 0.40);
  --success: #a855f7;
  --success-soft: rgba(168, 85, 247, 0.16);
}

/* Coral — quente e enérgico */
[data-theme="coral"] {
  --bg:           #1a0d0a;
  --surface-1:    #261410;
  --surface-2:    #321b16;
  --surface-3:    #40231d;
  --surface-4:    #4f2c24;
  --overlay:      rgba(26, 13, 10, 0.85);

  --brand:        #f97316;
  --brand-hi:     #fb923c;
  --brand-lo:     #ea580c;
  --brand-deep:   #c2410c;
  --brand-soft:   rgba(249, 115, 22, 0.14);
  --brand-glow:   rgba(249, 115, 22, 0.35);
  --brand-dark:   #2a0d04;
}

/* Âmbar — dourado executivo */
[data-theme="amber"] {
  --bg:           #14120a;
  --surface-1:    #1f1b10;
  --surface-2:    #2a2417;
  --surface-3:    #362d1d;
  --surface-4:    #443827;
  --overlay:      rgba(20, 18, 10, 0.85);

  --brand:        #f59e0b;
  --brand-hi:     #fbbf24;
  --brand-lo:     #d97706;
  --brand-deep:   #b45309;
  --brand-soft:   rgba(245, 158, 11, 0.14);
  --brand-glow:   rgba(245, 158, 11, 0.35);
  --brand-dark:   #2a1c04;
}

/* Light — tema claro completo (off-white quente) */
[data-theme="light"] {
  --bg:           #f7f8f9;
  --surface-1:    #ffffff;
  --surface-2:    #f1f3f5;
  --surface-3:    #e9ecef;
  --surface-4:    #dee2e6;
  --overlay:      rgba(247, 248, 249, 0.92);

  --line:         rgba(0, 0, 0, 0.08);
  --line-2:       rgba(0, 0, 0, 0.14);
  --line-3:       rgba(0, 0, 0, 0.22);
  --border:       var(--line);
  --border-strong:var(--line-2);

  --fg:           #0d1117;
  --fg-2:         #444d56;
  --fg-3:         #6a737d;
  --fg-4:         #959da5;
  --text-primary:   var(--fg);
  --text-secondary: var(--fg-2);
  --text-tertiary:  var(--fg-3);
  --text-disabled:  var(--fg-4);

  --brand:        #059669;
  --brand-hi:     #10b981;
  --brand-lo:     #047857;
  --brand-deep:   #065f46;
  --brand-soft:   rgba(5, 150, 105, 0.10);
  --brand-glow:   rgba(5, 150, 105, 0.25);
  --brand-dark:   #ecfdf5;
}
/* Light mode: ícone do calendário deve voltar a escuro (invertemos pra branco no dark) */
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="month"],
[data-theme="light"] input[type="datetime-local"],
[data-theme="light"] input[type="time"] {
  color-scheme: light;
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="month"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: 0.6;
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-theme="light"] input[type="month"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════
   Cálculos — hero + tool cards + visualizações
   ═══════════════════════════════════════════════════════════════════ */

.calc-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 28px 32px;
  background:
    radial-gradient(900px 240px at 100% -10%, rgba(0,217,126,0.18), transparent 60%),
    radial-gradient(700px 200px at -10% 100%, rgba(125,211,252,0.10), transparent 60%),
    linear-gradient(180deg, var(--surface-1, #131720) 0%, var(--surface-2, #0f131a) 100%);
  border: 1px solid var(--line);
  isolation: isolate;
}
.calc-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: rgba(255,255,255,0.04);
  z-index: 0;
}
.calc-hero-bg svg { width: 100%; height: 100%; }
.calc-hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
}
.calc-hero-text { max-width: 560px; }
.calc-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft, rgba(0,217,126,0.12));
  color: var(--brand, #00d97e);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.calc-hero-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 10px 0 6px;
  color: var(--fg);
  line-height: 1.05;
}
.calc-hero-sub {
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  max-width: 520px;
}
.calc-hero-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.calc-hero-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 240px;
  backdrop-filter: blur(8px);
}
.calc-hero-stat-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft, rgba(0,217,126,0.12));
  color: var(--brand, #00d97e);
  flex-shrink: 0;
}
.calc-hero-stat-icon svg { width: 18px; height: 18px; }
.calc-hero-stat-label {
  font-size: 11px;
  color: var(--fg-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.calc-hero-stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.calc-hero-stat-foot {
  font-size: 10.5px;
  color: var(--fg-4);
  margin-top: 1px;
}

@media (max-width: 880px) {
  .calc-hero-content { grid-template-columns: 1fr; }
}

/* ── Picker de ferramentas — escolha qual calcular ── */
.calc-picker {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.calc-picker-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px;
}
.calc-picker-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.018em;
  color: var(--fg);
  margin: 0;
}
.calc-picker-sub {
  font-size: 13px;
  color: var(--fg-3);
  margin: 0;
}
.calc-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.calc-picker-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 22px 24px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: all var(--motion-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.calc-picker-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 200px at 100% 0%, var(--brand-soft), transparent 60%);
  opacity: 0;
  transition: opacity var(--motion-fast);
  pointer-events: none;
}
.calc-picker-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2), 0 0 0 1px var(--brand-soft);
}
.calc-picker-card:hover::before { opacity: 1; }
.calc-picker-icon {
  width: 54px; height: 54px;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform var(--motion-fast);
  position: relative;
  z-index: 1;
}
.calc-picker-icon svg { width: 26px; height: 26px; }
.calc-picker-card:hover .calc-picker-icon { transform: scale(1.05) rotate(-3deg); }
.calc-picker-body { min-width: 0; position: relative; z-index: 1; }
.calc-picker-card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--fg);
}
.calc-picker-card-sub {
  font-size: 12.5px;
  color: var(--fg-3);
  margin: 4px 0 10px;
  line-height: 1.5;
}
.calc-picker-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.calc-picker-arrow {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-3);
  flex-shrink: 0;
  transition: all var(--motion-fast);
  position: relative;
  z-index: 1;
}
.calc-picker-arrow svg { width: 14px; height: 14px; }
.calc-picker-card:hover .calc-picker-arrow {
  background: var(--brand);
  color: var(--brand-dark, #022c1f);
  border-color: var(--brand);
  transform: translateX(2px);
}

/* Botão "voltar" no header das ferramentas abertas */
.calc-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--fg-3);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--motion-fast);
}
.calc-back-btn svg { width: 16px; height: 16px; }
.calc-back-btn:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  transform: translateX(-2px);
}

/* Animação de entrada quando ferramenta abre */
.calc-tool-view {
  animation: calcToolEnter 0.32s var(--ease-out) both;
}
@keyframes calcToolEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Tool cards — cabeçalho com ícone tintado + chips de presets.
   max-width: none override do .card (que limita a 460px) — ferramenta
   precisa usar TODA a largura disponível pra mostrar 3 colunas no form */
.calc-tool {
  max-width: none;
  width: 100%;
  overflow: hidden;
  transition: border-color var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out);
}
.calc-tool:hover {
  border-color: rgba(255,255,255,0.12);
}
.calc-tool-head {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 22px 28px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
}
.calc-tool-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform var(--motion-fast);
}
.calc-tool-icon svg { width: 22px; height: 22px; }
.calc-tool:hover .calc-tool-icon { transform: scale(1.05) rotate(-2deg); }
.calc-tool-icon-emerald {
  background: rgba(0,217,126,0.12);
  color: #00d97e;
  box-shadow: inset 0 0 0 1px rgba(0,217,126,0.25);
}
.calc-tool-icon-amber {
  background: rgba(251,191,36,0.10);
  color: #fbbf24;
  box-shadow: inset 0 0 0 1px rgba(251,191,36,0.22);
}
.calc-tool-meta { flex: 1; min-width: 0; }
.calc-tool-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.018em;
  margin: 0;
  color: var(--fg);
}
.calc-tool-sub {
  font-size: 12.5px;
  color: var(--fg-3);
  margin: 4px 0 0;
  line-height: 1.5;
  max-width: 640px;
}
.calc-chip-group {
  display: inline-flex;
  gap: 5px;
  flex-shrink: 0;
}
.calc-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .calc-tool-head { flex-wrap: wrap; }
  .calc-chip-group { width: 100%; margin-top: 4px; }
}

/* Form rows da página cálculos — flex wrap pra mobile + gap consistente */
.calc-form-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.calc-form-row > .form-group { min-width: 160px; flex: 1 1 200px; }

/* Input monetário com prefixo R$ — visual claro, padding ajustado */
.calc-input-money {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out);
}
.calc-input-money:hover {
  border-color: var(--line-2);
  background: var(--surface-3);
}
.calc-input-money:focus-within {
  border-color: var(--brand);
  background: var(--surface-1);
  box-shadow: var(--shadow-glow);
}
.calc-input-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  background: rgba(0,217,126,0.07);
  color: var(--brand, #00d97e);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  border-right: 1px solid var(--line);
  flex-shrink: 0;
  user-select: none;
  transition: background var(--motion-fast);
}
.calc-input-money:focus-within .calc-input-prefix {
  background: rgba(0,217,126,0.14);
}
.calc-input-money .form-input {
  flex: 1;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0;
  padding: 12px 16px;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 500;
  min-width: 0;
}
.calc-input-money .form-input:focus { box-shadow: none !important; }

/* ── Resultado da atualização monetária — KPIs + gráfico de linha SVG ── */
.calc-result {
  margin-top: 8px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-1);
  animation: calcFadeUp 0.36s var(--ease-out) both;
}
@keyframes calcFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.calc-result-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(0,217,126,0.04) 0%, transparent 100%);
}
.calc-result-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand, #00d97e);
}
.calc-result-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line);
}
.calc-kpi {
  padding: 18px 20px;
  background: var(--surface-1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.calc-kpi-label {
  font-size: 11px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.calc-kpi-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}
.calc-kpi-foot {
  font-size: 11px;
  color: var(--fg-4);
  margin-top: 2px;
}
.calc-kpi-final .calc-kpi-value { color: var(--brand, #00d97e); font-size: 26px; }
.calc-kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin-top: 4px;
  border-radius: 999px;
  background: rgba(0,217,126,0.12);
  color: var(--brand, #00d97e);
  font-size: 11px;
  font-weight: 600;
  width: max-content;
  font-variant-numeric: tabular-nums;
}

/* Gráfico — área preenchida + linha + dots interativos + tooltip */
.calc-chart {
  padding: 22px 24px 16px;
  background: var(--surface-1);
  border-top: 1px solid var(--line);
}
.calc-chart-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 12px;
}
.calc-chart-title-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.calc-chart-title-foot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.calc-chart-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand, #00d97e);
  box-shadow: 0 0 6px rgba(0,217,126,0.5);
}
.calc-chart-wrap {
  position: relative;
  width: 100%;
}
.calc-chart-svg {
  width: 100%;
  height: 240px;
  display: block;
  overflow: visible;
}
.calc-chart-grid line {
  stroke: rgba(255,255,255,0.05);
  stroke-width: 1;
}
.calc-chart-area { fill: url(#calcAreaGrad); }
.calc-chart-line {
  fill: none;
  stroke: var(--brand, #00d97e);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 10px rgba(0,217,126,0.25));
}
.calc-chart-dot {
  fill: var(--brand, #00d97e);
  stroke: var(--surface-1);
  stroke-width: 2;
  cursor: pointer;
  transition: r var(--motion-fast) var(--ease-out);
}
.calc-chart-dot:hover { r: 6; }
.calc-chart-end {
  fill: var(--surface-1);
  stroke: var(--brand, #00d97e);
  stroke-width: 3;
  filter: drop-shadow(0 0 10px rgba(0,217,126,0.7));
  animation: calcPulseEnd 2s ease-in-out infinite;
}
@keyframes calcPulseEnd {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(0,217,126,0.7)); }
  50%      { filter: drop-shadow(0 0 18px rgba(0,217,126,0.95)); }
}
.calc-chart-axis {
  fill: var(--fg-4);
  font-size: 10.5px;
  font-family: var(--font-mono);
}
.calc-chart-axis-y { text-anchor: end; }
.calc-chart-axis-x { text-anchor: middle; }

/* Crosshair vertical no hover */
.calc-chart-cursor {
  stroke: rgba(0,217,126,0.4);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms;
}
.calc-chart-cursor.is-active { opacity: 1; }

/* Tooltip flutuante absoluto */
.calc-chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-1);
  border: 1px solid rgba(0,217,126,0.35);
  border-radius: 8px;
  padding: 8px 11px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,217,126,0.08);
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-10px);
  transition: opacity 140ms var(--ease-out);
  z-index: 10;
  min-width: 110px;
}
.calc-chart-tooltip.is-active { opacity: 1; }
.calc-chart-tooltip-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.calc-chart-tooltip-value {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--brand, #00d97e);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.calc-chart-tooltip-delta {
  font-size: 10.5px;
  color: var(--fg-3);
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

/* Tabela de detalhes (expansível) */
.calc-details {
  border-top: 1px solid var(--line);
  padding: 0;
}
.calc-details summary {
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-3);
  user-select: none;
  transition: color var(--motion-fast);
}
.calc-details summary::-webkit-details-marker { display: none; }
.calc-details summary::before {
  content: '';
  width: 14px; height: 14px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23838d99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 15 12 9 6'/></svg>") center/contain no-repeat;
  transition: transform var(--motion-fast);
}
.calc-details[open] summary::before { transform: rotate(90deg); }
.calc-details summary:hover { color: var(--fg); }
.calc-details-body { padding: 0 20px 16px; }

/* ── Resultado da rescisão — split com donut + linhas + total destacado ── */
.calc-resc-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.calc-resc-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.calc-resc-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fbbf24;
  display: inline-flex;
  width: max-content;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(251,191,36,0.10);
  border: 1px solid rgba(251,191,36,0.22);
}
.calc-resc-period {
  font-size: 13px;
  color: var(--fg-2);
  margin-top: 6px;
}
.calc-resc-period strong { color: var(--fg); font-family: var(--font-display); font-weight: 600; }

/* Donut SVG: proventos vs descontos */
.calc-donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.calc-donut {
  width: 100px;
  height: 100px;
  transform: rotate(-90deg);
}
.calc-donut-track { stroke: var(--surface-2); stroke-width: 12; fill: none; }
.calc-donut-segment {
  stroke-width: 12; fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s var(--ease-out);
}
.calc-donut-net    { stroke: var(--brand, #00d97e); filter: drop-shadow(0 0 6px rgba(0,217,126,0.4)); }
.calc-donut-desc   { stroke: rgba(239,68,68,0.65); }
.calc-donut-legend {
  display: flex;
  gap: 12px;
  font-size: 10.5px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.calc-donut-legend span::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
.calc-donut-legend .calc-leg-net::before  { background: var(--brand, #00d97e); }
.calc-donut-legend .calc-leg-desc::before { background: rgba(239,68,68,0.65); }

.calc-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.calc-section:last-child { border-bottom: 0; }
.calc-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-3);
  margin: 0 0 12px;
}
.calc-section-title.is-desc { color: rgba(239,68,68,0.85); }

.calc-line-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.calc-line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
}
.calc-line:last-child { border-bottom: 0; }
.calc-line-bar-wrap {
  width: 80px;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.calc-line-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand, #00d97e), rgba(0,217,126,0.5));
  border-radius: 2px;
  transform-origin: left;
  animation: calcBarGrow 0.6s var(--ease-out) both;
}
.calc-line-bar.is-desc {
  background: linear-gradient(90deg, rgba(239,68,68,0.8), rgba(239,68,68,0.4));
}
@keyframes calcBarGrow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
.calc-line-label {
  font-size: 13px;
  color: var(--fg-2);
  min-width: 0;
}
.calc-line-value {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.calc-line.is-total {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  margin-top: 4px;
}
.calc-line.is-total .calc-line-label { font-weight: 600; color: var(--fg); }
.calc-line.is-total .calc-line-value { font-size: 15px; }

/* Bloco total líquido — destaque máximo */
.calc-resc-total {
  margin: 20px;
  padding: 22px 24px;
  border-radius: 14px;
  background:
    radial-gradient(600px 120px at 100% -20%, rgba(0,217,126,0.18), transparent 60%),
    linear-gradient(180deg, rgba(0,217,126,0.08) 0%, rgba(0,217,126,0.03) 100%);
  border: 1px solid rgba(0,217,126,0.30);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.calc-resc-total.is-negative {
  background:
    radial-gradient(600px 120px at 100% -20%, rgba(239,68,68,0.18), transparent 60%),
    linear-gradient(180deg, rgba(239,68,68,0.08) 0%, rgba(239,68,68,0.03) 100%);
  border-color: rgba(239,68,68,0.30);
}
.calc-resc-total-label {
  font-size: 11px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.calc-resc-total-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--brand, #00d97e);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.calc-resc-total.is-negative .calc-resc-total-value { color: #fca5a5; }
.calc-resc-total-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand, #00d97e);
  flex-shrink: 0;
}
.calc-resc-total.is-negative .calc-resc-total-icon { color: #fca5a5; }
.calc-resc-total-icon svg { width: 26px; height: 26px; }

.calc-fgts-note {
  margin: 0 20px 20px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-left: 3px solid #7dd3fc;
  border-radius: 0 8px 8px 0;
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.55;
}
.calc-fgts-note strong { color: var(--fg); }

.calc-notes {
  margin: 0 20px 20px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.025);
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 12px;
  color: var(--fg-3);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════
   Configurações — header, stats, grid de cards
   ═══════════════════════════════════════════════════════════════════ */

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
}
.settings-eyebrow {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft, rgba(0,217,126,0.12));
  color: var(--brand, #00d97e);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.settings-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw, 34px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 10px 0 6px;
  color: var(--fg);
  line-height: 1.05;
}
.settings-sub {
  color: var(--fg-3);
  font-size: 13.5px;
  margin: 0;
}
.settings-header-actions { display: flex; gap: 8px; }
.settings-header-actions .btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  font-size: 12.5px;
}

/* Stats cards — 4 KPIs */
.settings-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.settings-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color var(--motion-fast), transform var(--motion-fast);
}
.settings-stat-card:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}
.settings-stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.settings-stat-icon svg { width: 18px; height: 18px; }
.settings-stat-icon-blue    { background: rgba(125,211,252,0.12); color: #7dd3fc; }
.settings-stat-icon-emerald { background: rgba(0,217,126,0.12);  color: #00d97e; }
.settings-stat-icon-amber   { background: rgba(251,191,36,0.10); color: #fbbf24; }
.settings-stat-icon-rose    { background: rgba(244,114,182,0.10); color: #f472b6; }
.settings-stat-label {
  font-size: 11.5px;
  color: var(--fg-3);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.settings-stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* Grid principal: form (2/3) + side (1/3) */
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 980px) {
  .settings-grid { grid-template-columns: 1fr; }
}
.settings-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.settings-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.015) 0%, transparent 100%);
}
.settings-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft, rgba(0,217,126,0.12));
  color: var(--brand, #00d97e);
  flex-shrink: 0;
}
.settings-card-icon svg { width: 18px; height: 18px; }
.settings-card-icon-amber   { background: rgba(251,191,36,0.10); color: #fbbf24; }
.settings-card-icon-emerald { background: rgba(0,217,126,0.12);  color: #00d97e; }
.settings-card-icon-blue    { background: rgba(125,211,252,0.12); color: #7dd3fc; }

.settings-card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--fg);
}
.settings-card-sub {
  font-size: 12px;
  color: var(--fg-3);
  margin: 2px 0 0;
}
.settings-card-body { padding: 18px 20px; }

/* Linhas key:value nos cards laterais */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
  font-size: 13px;
}
.settings-row:last-of-type { border-bottom: 0; }
.settings-row > span:first-child {
  color: var(--fg-3);
  font-size: 12.5px;
}
.settings-row > span:last-child,
.settings-row > [data-val] {
  color: var(--fg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Pills de status */
.settings-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--fg-3);
}
.settings-pill.is-active  { background: rgba(0,217,126,0.12);  color: #00d97e; border-color: rgba(0,217,126,0.25); }
.settings-pill.is-pending { background: rgba(251,191,36,0.10); color: #fbbf24; border-color: rgba(251,191,36,0.22); }
.settings-pill.is-warn    { background: rgba(249,115,22,0.10); color: #fb923c; border-color: rgba(249,115,22,0.22); }
.settings-pill.is-danger  { background: rgba(239,68,68,0.10);  color: #fca5a5; border-color: rgba(239,68,68,0.22); }
.settings-pill.is-info    { background: rgba(125,211,252,0.12); color: #7dd3fc; border-color: rgba(125,211,252,0.25); }

/* Áreas de atuação — chips removíveis */
.settings-areas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  margin-bottom: 8px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.settings-area-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  background: rgba(0,217,126,0.10);
  border: 1px solid rgba(0,217,126,0.25);
  color: #00d97e;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  animation: fadeInFast 200ms ease-out;
}
.settings-area-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: #00d97e;
  transition: all var(--motion-fast);
}
.settings-area-x svg { width: 10px; height: 10px; }
.settings-area-x:hover {
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
}
.settings-areas-input {
  display: flex;
  gap: 8px;
}
.settings-areas-input .form-input { flex: 1; }
.settings-areas-input .btn-ghost { flex-shrink: 0; padding: 8px 14px; }

/* Rodapé do form — salvar + status */
.settings-form-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.settings-save-status {
  font-size: 12.5px;
  color: var(--fg-3);
  font-weight: 500;
  transition: opacity 200ms;
}
.settings-save-status.is-success { color: #00d97e; }
.settings-save-status.is-error   { color: #fca5a5; }

/* Ícone violeta extra pro card de tema */
.settings-card-icon-violet { background: rgba(168, 85, 247, 0.12); color: #c084fc; }

/* Grid de temas — swatches clicáveis */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--motion-fast) var(--ease-out);
  font-family: var(--font);
}
.theme-option:hover {
  border-color: var(--line-3);
  transform: translateY(-1px);
  background: var(--surface-2);
}
.theme-option.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.theme-swatch {
  position: relative;
  width: 100%;
  aspect-ratio: 1.6;
  border-radius: 8px;
  background: var(--s-bg, #0a0d0c);
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  transition: transform var(--motion-fast);
}
.theme-swatch.is-light { border-color: rgba(0,0,0,0.08); }
.theme-swatch::before {
  /* "card" interno mostrando o surface-1 */
  content: '';
  position: absolute;
  left: 22%; top: 22%; right: 18%; bottom: 22%;
  border-radius: 5px;
  background: var(--s-card, #11171a);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.theme-swatch::after {
  /* "botão" da marca no canto */
  content: '';
  position: absolute;
  right: 12%; top: 12%;
  width: 22%; aspect-ratio: 1;
  border-radius: 50%;
  background: var(--s-brand, #10b981);
  box-shadow: 0 0 10px var(--s-brand, #10b981);
}
.theme-option:hover .theme-swatch { transform: scale(1.03); }
.theme-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-2);
  letter-spacing: -0.005em;
}
.theme-option.is-active .theme-name { color: var(--brand); }

/* Debug expansível */
.settings-debug {
  margin-top: 24px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
}
.settings-debug summary {
  padding: 12px 18px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-debug summary::-webkit-details-marker { display: none; }
.settings-debug summary::before {
  content: '';
  width: 12px; height: 12px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23838d99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 15 12 9 6'/></svg>") center/contain no-repeat;
  transition: transform var(--motion-fast);
}
.settings-debug[open] summary::before { transform: rotate(90deg); }
.settings-debug summary:hover { color: var(--fg); }
.settings-debug > #settings-org-info { margin: 0 18px 16px; }
