/* ============================================================
   Distribuidor de Leads — visual clean (dourado + modo escuro)
   ============================================================ */
:root {
  color-scheme: light;
  /* superfícies */
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --surface-3: #f2f0eb;
  --hover: #f5f3ee;
  /* texto */
  --text: #17171a;
  --text-2: #3d3d44;
  --muted: #6f6f78;
  --faint: #a3a3ab;
  /* linhas */
  --line: #e8e5de;
  --line-2: #f0eee9;
  --line-hover: #d9d5cb;
  /* marca: dourado */
  --gold: #c39a3c;
  --gold-d: #96731f;
  --gold-t: #8a6a1c;
  --gold-l: #fbf6e9;
  --gold-m: #eddcb0;
  --gold-grad: linear-gradient(145deg, #e3c271 0%, #c39a3c 55%, #a8812a 100%);
  --gold-btn: linear-gradient(180deg, #d6b25a, #c09538);
  --on-gold: #241a05;
  --ring: 0 0 0 4px rgba(195, 154, 60, .16);
  /* semânticas */
  --green: #16a34a; --green-t: #15803d; --green-l: #ecfdf3; --green-m: #bbf7d0;
  --wa: #22c55e;
  --amber: #d97706; --amber-t: #b45309; --amber-l: #fffbeb; --amber-m: #fde68a;
  --blue: #2563eb; --blue-t: #1d4ed8; --blue-l: #eff6ff; --blue-m: #dbeafe;
  --violet: #7c3aed; --violet-t: #6d28d9; --violet-l: #f5f3ff; --violet-m: #ede9fe;
  --red: #dc2626; --red-t: #b91c1c; --red-l: #fef2f2; --red-m: #fecaca;
  --banner-bg: #fffbeb; --banner-line: #fde68a; --banner-text: #78350f;
  /* forma */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(23, 20, 10, .04);
  --shadow: 0 1px 2px rgba(23, 20, 10, .04), 0 4px 14px rgba(23, 20, 10, .04);
  --shadow-lg: 0 10px 40px rgba(23, 20, 10, .14);
  --overlay: rgba(20, 18, 12, .42);
  --toast-bg: #17171a; --toast-text: #fff;
  --wa-bg: #efeae2; --bubble: #ffffff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f12;
  --surface: #16171c;
  --surface-2: #1b1d23;
  --surface-3: #22242b;
  --hover: #1f2127;
  --text: #ededf0;
  --text-2: #c9cad1;
  --muted: #8f919b;
  --faint: #62646d;
  --line: #2a2c34;
  --line-2: #212329;
  --line-hover: #3a3d47;
  --gold: #d4ae55;
  --gold-d: #e2c27a;
  --gold-t: #e6c77f;
  --gold-l: rgba(212, 174, 85, .12);
  --gold-m: rgba(212, 174, 85, .32);
  --gold-grad: linear-gradient(145deg, #e8ca7e 0%, #d0a64a 55%, #a8812a 100%);
  --gold-btn: linear-gradient(180deg, #ddb963, #c79d40);
  --on-gold: #1c1404;
  --ring: 0 0 0 4px rgba(212, 174, 85, .2);
  --green: #22c55e; --green-t: #4ade80; --green-l: rgba(34, 197, 94, .12); --green-m: rgba(34, 197, 94, .3);
  --amber: #f59e0b; --amber-t: #fbbf24; --amber-l: rgba(245, 158, 11, .12); --amber-m: rgba(245, 158, 11, .3);
  --blue: #60a5fa; --blue-t: #93c5fd; --blue-l: rgba(59, 130, 246, .14); --blue-m: rgba(59, 130, 246, .32);
  --violet: #a78bfa; --violet-t: #c4b5fd; --violet-l: rgba(139, 92, 246, .15); --violet-m: rgba(139, 92, 246, .32);
  --red: #f87171; --red-t: #fca5a5; --red-l: rgba(239, 68, 68, .13); --red-m: rgba(239, 68, 68, .32);
  --banner-bg: rgba(245, 158, 11, .1); --banner-line: rgba(245, 158, 11, .28); --banner-text: #fcd34d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .2);
  --shadow-lg: 0 14px 44px rgba(0, 0, 0, .55);
  --overlay: rgba(0, 0, 0, .6);
  --toast-bg: #ededf0; --toast-text: #16171c;
  --wa-bg: #0b141a; --bubble: #202c33;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
  transition: background-color .2s, color .2s;
}
.hidden { display: none !important; }
h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
h3 { margin: 0 0 14px; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
h4 { font-weight: 650; }
.mt { margin-top: 24px; }
.muted { color: var(--muted); }
small { font-size: 12.5px; }
b, strong { color: inherit; }
code { background: var(--surface-3); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-variant-ligatures: none; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
a { color: var(--gold-t); }

/* ---------- Form ---------- */
input, select, textarea {
  font: inherit; color: inherit;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-sm); padding: 9px 12px; width: 100%;
  outline: none; transition: border-color .15s, box-shadow .15s, background-color .2s;
  box-shadow: var(--shadow-sm);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--line-hover); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: var(--ring); }
textarea { resize: vertical; line-height: 1.55; }
select { cursor: pointer; }
option { background: var(--surface); color: var(--text); }
.field { display: grid; gap: 6px; text-align: left; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  border-radius: var(--radius-sm); padding: 9px 15px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s, filter .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--hover); border-color: var(--line-hover); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--gold-btn); border-color: transparent; color: var(--on-gold);
  box-shadow: 0 1px 2px rgba(150, 115, 31, .35), inset 0 1px 0 rgba(255, 255, 255, .28); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-l); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.full { width: 100%; justify-content: center; }
.btn.lg { padding: 11px 16px; font-size: 15px; }
.btn.wa { background: #22c55e; border-color: #22c55e; color: #fff; }
.btn.wa:hover { background: #16a34a; }
.icon-btn { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.theme-ic-dark { display: none; }
:root[data-theme="dark"] .theme-ic-dark { display: block; }
:root[data-theme="dark"] .theme-ic-light { display: none; }

/* ---------- Logo ---------- */
.logo-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: var(--gold-grad); box-shadow: 0 4px 12px rgba(168, 129, 42, .35), inset 0 1px 0 rgba(255,255,255,.35); flex: 0 0 auto; }
.logo-mark svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.logo-mark.lg { width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 6px; }
.logo-mark.lg svg { width: 27px; height: 27px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px 16px 120px; position: relative;
  background:
    radial-gradient(900px 520px at 12% -12%, rgba(212, 174, 85, .16), transparent 60%),
    radial-gradient(700px 500px at 112% 112%, rgba(212, 174, 85, .08), transparent 60%),
    var(--bg); }
.login-card { background: var(--surface); padding: 36px 32px 28px; border-radius: 20px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); width: 100%; max-width: 390px; text-align: center; display: grid; gap: 14px; }
.login-card h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.login-card p { margin: -8px 0 6px; font-size: 14px; }
.login-theme { position: absolute; top: 16px; right: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.error { color: var(--red); margin: 6px 0 0; min-height: 1em; font-size: 13.5px; }
.ok-msg { color: var(--green-t); margin-left: 12px; font-weight: 600; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; transition: background-color .2s; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 15px; line-height: 1.15; padding: 2px 8px 22px; letter-spacing: -.01em; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; letter-spacing: 0; }
nav { display: grid; gap: 2px; }
nav a { display: flex; gap: 11px; align-items: center; padding: 9px 11px; border-radius: 9px; cursor: pointer; color: var(--text-2); font-weight: 500; font-size: 14px; user-select: none; transition: background .12s, color .12s; }
nav a .ic { color: var(--faint); transition: color .12s; }
nav a:hover { background: var(--hover); color: var(--text); }
nav a:hover .ic { color: var(--text-2); }
nav a.active { background: var(--gold-l); color: var(--gold-t); font-weight: 600; }
nav a.active .ic { color: var(--gold); }
.nav-sep { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 16px 11px 6px; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.pill { font-size: 12.5px; font-weight: 600; padding: 7px 11px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; }
.pill.on { background: var(--green-l); color: var(--green-t); }
.pill.on::before { background: var(--wa); box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); animation: pulse 2.4s ease-in-out infinite; }
.pill.sim { background: var(--amber-l); color: var(--amber-t); }
.pill.sim::before { background: #f59e0b; }
.pill.off { background: var(--red-l); color: var(--red-t); }
.pill.off::before { background: #ef4444; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, .08); } }
.me-card { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line); padding: 12px 2px 0; }
.me-box { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.me-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold-l); border: 1px solid var(--gold-m); color: var(--gold-t); font-weight: 700; font-size: 13px; display: grid; place-items: center; flex: 0 0 auto; }
.me-text { min-width: 0; line-height: 1.25; }
.me-text b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--muted); font-size: 12px; }
.foot-btns { display: flex; gap: 0; }
#soundBtn.is-on { color: var(--gold); }

.content { padding: 30px 36px 64px; max-width: 1240px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; font-size: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; transition: background-color .2s, border-color .2s; }
.card.nopad { padding: 0; overflow: hidden; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > input { flex: 1 1 200px; width: auto; }
.small-note { font-size: 13px; margin-top: 10px; }

.banner { background: var(--banner-bg); border: 1px solid var(--banner-line); color: var(--banner-text); padding: 12px 16px; border-radius: 12px; margin-bottom: 22px; font-size: 13.5px; }

/* ---------- Segmented ---------- */
.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.seg button { font: inherit; font-size: 13.5px; font-weight: 600; border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; cursor: pointer; color: var(--muted); transition: background .12s, color .12s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; box-shadow: var(--shadow); }
.kpi-top { display: flex; align-items: center; gap: 9px; }
.kpi-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.kpi-ic .ic { width: 16px; height: 16px; }
.kpi .l { font-size: 13px; color: var(--muted); font-weight: 500; line-height: 1.2; }
.kpi .v { font-size: 30px; font-weight: 700; margin-top: 12px; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi.k-total .kpi-ic { background: var(--gold-l); color: var(--gold); }
.kpi.k-novo .kpi-ic { background: var(--amber-l); color: var(--amber); }
.kpi.k-at .kpi-ic { background: var(--blue-l); color: var(--blue); }
.kpi.k-vend .kpi-ic { background: var(--green-l); color: var(--green); }
.kpi.k-conv .kpi-ic { background: var(--violet-l); color: var(--violet); }

/* ---------- Chart ---------- */
.chart { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 10px; align-items: end; height: 180px; padding-top: 12px;
  background-image: linear-gradient(var(--line-2) 1px, transparent 1px); background-size: 100% 40px; background-position: 0 22px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar { width: 100%; max-width: 30px; background: var(--gold-grad); border-radius: 7px 7px 3px 3px; min-height: 3px; transition: opacity .15s; }
.bar-col:hover .bar { opacity: .8; }
.bar-n { font-size: 12px; font-weight: 600; color: var(--text-2); }
.bar-d { font-size: 11px; color: var(--faint); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.card:not(.nopad) th { background: transparent; padding-left: 10px; padding-right: 10px; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; color: var(--text-2); }
.card:not(.nopad) td { padding-left: 10px; padding-right: 10px; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
table.leads tbody tr { cursor: pointer; }
td select { padding: 6px 30px 6px 10px; font-size: 13px; width: auto; min-width: 140px; border-radius: 8px; }
td b, .lead-name { color: var(--text); }
.lead-name { font-weight: 600; }
.lead-phone { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.lead-msg { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13.5px; }
.lead-interest { font-weight: 600; font-size: 13.5px; color: var(--text); margin-bottom: 2px; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-interest { margin-top: 10px; display: inline-block; background: var(--gold-l); color: var(--gold-t); font-weight: 600; padding: 5px 12px; border-radius: 999px; font-size: 13.5px; border: 1px solid var(--gold-m); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Barras horizontais (mais procurados) */
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 240px) 1fr auto; gap: 14px; align-items: center; font-size: 13.5px; }
.hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--text); }
.hbar-track { background: var(--surface-3); border-radius: 999px; height: 8px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--gold-grad); border-radius: 999px; }
.hbar-n { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.hbar-n small { color: var(--green-t) !important; }
@media (max-width: 760px) { .hbar { grid-template-columns: minmax(0, 1fr) auto; } .hbar-track { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.b-novo { background: var(--amber-l); color: var(--amber-t); border-color: var(--amber-m); }
.b-em_atendimento { background: var(--blue-l); color: var(--blue-t); border-color: var(--blue-m); }
.b-vendido { background: var(--green-l); color: var(--green-t); border-color: var(--green-m); }
.b-perdido { background: var(--red-l); color: var(--red-t); border-color: var(--red-m); }
.b-simulado { background: var(--amber-l); color: var(--amber-t); border-color: var(--amber-m); }
.b-enviado { background: var(--green-l); color: var(--green-t); border-color: var(--green-m); }
.b-erro { background: var(--red-l); color: var(--red-t); border-color: var(--red-m); }
.b-pendente { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
.b-origin { background: var(--violet-l); color: var(--violet-t); border-color: var(--violet-m); font-size: 11px; vertical-align: 1px; }
.b-admin { background: var(--gold-l); color: var(--gold-t); border-color: var(--gold-m); }
.b-gestor { background: var(--blue-l); color: var(--blue-t); border-color: var(--blue-m); }

.st-select { font-weight: 600; }
.st-select.s-novo { background-color: var(--amber-l); border-color: var(--amber-m); color: var(--amber-t); }
.st-select.s-em_atendimento { background-color: var(--blue-l); border-color: var(--blue-m); color: var(--blue-t); }
.st-select.s-vendido { background-color: var(--green-l); border-color: var(--green-m); color: var(--green-t); }
.st-select.s-perdido { background-color: var(--red-l); border-color: var(--red-m); color: var(--red-t); }

/* ---------- Filters ---------- */
.filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }

/* ---------- Sellers ---------- */
.add-seller .row > .btn { flex: 0 0 auto; }
.seller-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.seller { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: grid; gap: 14px; transition: border-color .15s, box-shadow .15s; }
.seller:hover { box-shadow: 0 2px 4px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.07); }
.seller.next { border-color: var(--gold-m); box-shadow: 0 0 0 3px var(--gold-l), var(--shadow); }
.seller.off { opacity: .55; }
.seller-top { display: flex; align-items: center; gap: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 16px; flex: 0 0 auto; }
.seller-name { font-weight: 650; font-size: 15px; color: var(--text); }
.seller-stats { display: flex; gap: 18px; font-size: 13px; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--line-2); }
.seller-stats b { color: var(--text); font-size: 15px; font-weight: 700; }
.seller-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.next-tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--gold-t); background: var(--gold-l); border: 1px solid var(--gold-m); padding: 2px 8px; border-radius: 999px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text-2); user-select: none; }
.switch input { display: none; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--line-hover); position: relative; transition: background .18s; flex: 0 0 auto; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--gold); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ---------- Config ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid3 label, .grid2 label { display: grid; gap: 6px; align-content: start; }
.grid2 label > span, .grid3 label > span { font-weight: 600; font-size: 13.5px; color: var(--text-2); }
.cmd-help { margin-top: 14px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; display: grid; gap: 7px; font-size: 13.5px; color: var(--text-2); }
.sub { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.sub h4 { margin: 0 0 10px; font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag-rec { font-size: 11px; font-weight: 600; color: var(--gold-t); background: var(--gold-l); border: 1px solid var(--gold-m); padding: 1px 8px; border-radius: 999px; }
.howto { margin-bottom: 12px; font-size: 13.5px; }
.howto summary { cursor: pointer; color: var(--gold-t); font-weight: 600; }
.howto ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; color: var(--muted); }
.row.nowrap { flex-wrap: nowrap; }
.row.nowrap > input { min-width: 0; }
.save-bar { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 35%); padding: 20px 0 8px; }
.alert-log { margin-top: 12px; display: grid; gap: 6px; font-size: 13px; }
.alert-log div { display: grid; grid-template-columns: 105px 1fr; gap: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; color: var(--text-2); transition: border-color .12s, color .12s; }
.chip:hover { border-color: var(--gold); color: var(--gold-t); }

/* ---------- Usuários ---------- */
body.role-gestor [data-admin] { display: none !important; }
.grid-user { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr 0.8fr auto; gap: 10px; }
.created-box { margin-top: 14px; background: var(--gold-l); border: 1px solid var(--gold-m); border-radius: 12px; padding: 14px 16px; font-size: 14px; }
.created-box pre { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; font-size: 13.5px; white-space: pre-wrap; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
@media (max-width: 1000px) { .grid-user { grid-template-columns: minmax(0, 1fr); } }

/* ---------- WhatsApp ---------- */
.wa-status { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.wa-big { font-size: 34px; width: 60px; height: 60px; border-radius: 16px; background: var(--surface-3); display: grid; place-items: center; }
.wa-status h3[style*="green"] { color: var(--green-t) !important; }
.qr { margin-top: 18px; text-align: center; }
.qr img { width: 260px; height: 260px; border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: #fff; box-shadow: var(--shadow); }
.steps { margin: 14px 0 0; padding-left: 20px; line-height: 1.75; }

/* ---------- Simulador ---------- */
.sim-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.sim-grid form { display: grid; gap: 10px; }
.sim-result { padding: 12px 16px; border-radius: 12px; background: var(--gold-l); border: 1px solid var(--gold-m); color: var(--gold-t); font-weight: 600; margin-bottom: 18px; }
.phone { background: var(--wa-bg); min-height: 400px; }
.bubbles { display: grid; gap: 10px; max-height: 620px; overflow-y: auto; }
.bubble { background: var(--bubble); border-radius: 4px 12px 12px 12px; padding: 9px 12px 6px; box-shadow: 0 1px 1px rgba(0,0,0,.08); font-size: 14px; white-space: pre-wrap; word-break: break-word; max-width: 92%; }
.bubble .to { font-size: 12px; font-weight: 700; color: var(--green-t); margin-bottom: 4px; }
.bubble .time { font-size: 11px; color: var(--muted); text-align: right; margin-top: 4px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s ease-out; }
.modal-box { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 620px; max-height: 90vh; overflow-y: auto; padding: 28px; position: relative; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-x { position: absolute; top: 16px; right: 16px; border: 0; background: var(--surface-3); color: var(--muted); width: 32px; height: 32px; border-radius: 9px; cursor: pointer; font-size: 13px; transition: background .12s, color .12s; }
.modal-x:hover { background: var(--line); color: var(--text); }
.m-head h3 { font-size: 19px; margin: 0 0 2px; font-weight: 700; letter-spacing: -.02em; }
.m-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.m-grid label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.m-grid select { min-width: 0; width: 100%; padding: 9px 12px; }
.m-msg { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; font-size: 14px; white-space: pre-wrap; margin-top: 6px; color: var(--text-2); }
.timeline { list-style: none; padding: 0 0 0 14px; margin: 10px 0 0; display: grid; gap: 12px; border-left: 2px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 105px 1fr; gap: 10px; font-size: 13.5px; position: relative; color: var(--text-2); }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-hover); }
.timeline li:first-child::before { border-color: var(--gold); background: var(--gold-l); }
.timeline .t { color: var(--muted); font-size: 12.5px; }
.m-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; justify-content: space-between; padding-top: 18px; border-top: 1px solid var(--line); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-text); padding: 11px 18px; border-radius: 12px; font-weight: 500; font-size: 14px; z-index: 60; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }

/* Cores fixas que vieram do JS (texto de sucesso/erro) */
[style*="color:var(--green)"] { color: var(--green-t) !important; }
[style*="color:var(--green-d)"] { color: var(--green-t) !important; }

/* ---------- Crédito do desenvolvedor ---------- */
.credit { font-size: 11.5px; color: var(--faint); display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap; letter-spacing: .01em; }
.credit-brand { font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.credit-logo { height: 12px; width: auto; display: block; }
.credit-logo-full { height: 46px; width: auto; display: block; opacity: .95; }
.credit-login { position: absolute; bottom: 22px; left: 0; right: 0; flex-direction: column; gap: 8px; }
.credit-side { justify-content: flex-start; padding: 0 4px; gap: 3px 5px; }

/* ---------- Brilho dourado (só no modo escuro) ---------- */
:root[data-theme="dark"] {
  --glow: rgba(232, 196, 104, .55);
  --glow-soft: rgba(212, 174, 85, .22);
}
:root[data-theme="dark"] body {
  background:
    radial-gradient(560px 380px at 248px 0%, rgba(212, 174, 85, .16), transparent 64%),
    radial-gradient(820px 560px at 100% 100%, rgba(212, 174, 85, .16), transparent 62%),
    radial-gradient(520px 380px at 100% 0%, rgba(212, 174, 85, .07), transparent 60%),
    radial-gradient(420px 320px at 0% 100%, rgba(212, 174, 85, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
:root[data-theme="dark"] .sidebar {
  background:
    radial-gradient(300px 220px at 0% 0%, rgba(212, 174, 85, .12), transparent 70%),
    radial-gradient(280px 240px at 0% 100%, rgba(212, 174, 85, .08), transparent 70%),
    var(--surface);
  border-right-color: rgba(212, 174, 85, .16);
  box-shadow: 1px 0 0 rgba(212, 174, 85, .06), 10px 0 40px -18px var(--glow-soft);
}
:root[data-theme="dark"] .logo-mark { box-shadow: 0 0 22px -2px var(--glow), inset 0 1px 0 rgba(255,255,255,.35); }
:root[data-theme="dark"] nav a.active {
  box-shadow: inset 0 0 0 1px rgba(212, 174, 85, .22), 0 0 18px -6px var(--glow);
  text-shadow: 0 0 12px rgba(232, 196, 104, .35);
}
:root[data-theme="dark"] nav a.active .ic { filter: drop-shadow(0 0 4px rgba(232, 196, 104, .6)); }
:root[data-theme="dark"] .btn.primary { box-shadow: 0 0 20px -4px var(--glow), inset 0 1px 0 rgba(255,255,255,.3); }
:root[data-theme="dark"] .btn.primary:hover { box-shadow: 0 0 26px -2px var(--glow), inset 0 1px 0 rgba(255,255,255,.3); }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .kpi, :root[data-theme="dark"] .seller {
  transition: border-color .2s, box-shadow .25s;
}
:root[data-theme="dark"] .card:hover, :root[data-theme="dark"] .kpi:hover, :root[data-theme="dark"] .seller:hover {
  border-color: rgba(212, 174, 85, .28);
  box-shadow: 0 0 0 1px rgba(212, 174, 85, .06), 0 0 28px -10px var(--glow-soft), var(--shadow);
}
:root[data-theme="dark"] .kpi.k-total .v { text-shadow: 0 0 18px rgba(232, 196, 104, .25); }
:root[data-theme="dark"] .bar { box-shadow: 0 0 14px -3px var(--glow-soft); }
:root[data-theme="dark"] .seller.next { box-shadow: 0 0 0 3px var(--gold-l), 0 0 26px -8px var(--glow); }
:root[data-theme="dark"] .login {
  background:
    radial-gradient(700px 480px at 0% 0%, rgba(212, 174, 85, .16), transparent 62%),
    radial-gradient(800px 560px at 100% 100%, rgba(212, 174, 85, .12), transparent 62%),
    var(--bg);
}
:root[data-theme="dark"] .login-card {
  border-color: rgba(212, 174, 85, .22);
  box-shadow: 0 0 0 1px rgba(212, 174, 85, .05), 0 0 60px -18px var(--glow-soft), var(--shadow-lg);
}
:root[data-theme="dark"] .credit-logo-full { filter: drop-shadow(0 0 10px rgba(232, 196, 104, .25)); }
:root[data-theme="dark"] input:focus, :root[data-theme="dark"] select:focus, :root[data-theme="dark"] textarea:focus {
  box-shadow: var(--ring), 0 0 18px -6px var(--glow);
}

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .sim-grid, .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .row.nowrap { flex-wrap: wrap; }
  .filters { grid-template-columns: 1fr 1fr; }
  .content { padding: 26px 24px 60px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: 8px 10px; z-index: 20; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm); }
  .brand { padding: 0 4px 0 0; }
  .brand > div:last-child, .nav-sep, .me-box, .credit-side { display: none; }
  .brand .logo-mark { width: 30px; height: 30px; border-radius: 9px; }
  nav { display: flex; gap: 2px; }
  nav a { padding: 8px 9px; }
  nav a span { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; display: flex; align-items: center; gap: 4px; }
  .pill { font-size: 0; padding: 8px; gap: 0; }
  .me-card { border: 0; padding: 0; }
  .content { padding: 20px 16px 50px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .v { font-size: 26px; }
  .filters { grid-template-columns: 1fr; }
  .m-grid { grid-template-columns: 1fr; }
  .chart { gap: 3px; }
  .card { padding: 18px; }
  #ignoredTable thead { display: none; }
  #ignoredTable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-bottom: 1px solid var(--line); padding: 6px 4px; }
  #ignoredTable td { border: 0; padding: 4px 10px; }
  #ignoredTable td:nth-child(1) { grid-column: 1 / -1; font-size: 12px; color: var(--muted); padding-bottom: 0; }
  #ignoredTable td:nth-child(3) { grid-column: 1 / -1; grid-row: 3; }
  #ignoredTable td:nth-child(3) .lead-msg { white-space: normal; max-width: none; }
  #ignoredTable td.empty { grid-column: 1 / -1; }
  .bar-d { font-size: 9px; }
}
