/* MacroChip — painel de aquecimento (ecossistema Macro).
   Um céu só, em duas horas: à noite (escuro) e ao amanhecer (claro). O laranja do logo é a luz do
   horizonte; ela esquenta quando o motor liga. Painéis de vidro flutuam por cima.

   A paleta tem duas camadas:
   1. Escalas (primitivos): laranja Macro, noite (azul do site), crepúsculo, mar, grafite.
   2. Tokens por função (fundo, vidro, texto, destaque, estados, séries), com um valor por tema.
   Componentes usam só a camada 2. Tema novo = redefinir a camada 2. */

/* ============ 1. Escalas ============ */
:root {
  --orange-50: #fff4ea;
  --orange-100: #ffe4cc;
  --orange-200: #ffc999;
  --orange-300: #ffa964;
  --orange-400: #ff9a4f;
  --orange-500: #f58634;   /* cor do logo */
  --orange-600: #e2621b;
  --orange-700: #b94d12;
  --orange-800: #8a3a10;

  --night-950: #0b111e;
  --night-900: #111a2c;
  --night-800: #1a2438;
  --night-700: #243349;    /* azul-noite do site */
  --night-600: #3a4a68;
  --night-500: #5b6a88;
  --night-400: #8792ab;
  --night-300: #b4bccd;
  --night-200: #d9deea;
  --night-100: #edf0f6;
  --night-50: #f7f8fb;

  --dusk-400: #b892f0;     /* crepúsculo: violeta entre o azul e o laranja */
  --dusk-500: #a06ee0;
  --dusk-600: #8a5cd6;
  --dusk-700: #7445c4;
  --sea-400: #4cc3d4;      /* mar: os empreendimentos da Macro são no litoral */
  --sea-500: #2a9fb0;
  --sea-600: #008da3;
  --sea-700: #007a8e;
  --graphite: #373435;     /* cinza do logo */
  --rose-500: #c95a8a;

  --sunset: linear-gradient(135deg, var(--orange-300) 0%, var(--orange-500) 48%, var(--orange-600) 100%);

  --r-xl: 24px;
  --r: 20px;
  --r-md: 14px;
  --r-sm: 11px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --blur: blur(20px) saturate(150%);
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: var(--sans);
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

/* ============ 2. Tokens por função ============ */

/* Escuro: céu noturno */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--night-950);
  --sky: linear-gradient(180deg, #0a0f1b 0%, #0f1729 52%, #1a1b28 100%);
  --sky-glow-1: rgba(52, 86, 150, 0.42);
  --sky-glow-2: rgba(60, 50, 110, 0.28);
  --horizon-1: rgba(226, 98, 27, 0.55);
  --horizon-2: rgba(245, 134, 52, 0.5);
  --horizon-3: rgba(201, 90, 138, 0.22);
  --horizon-rest: 0.38;
  --horizon-warm: 0.85;

  --surface: rgba(20, 27, 44, 0.58);
  --surface-hi: linear-gradient(180deg, rgba(255, 255, 255, 0.075) 0%, rgba(255, 255, 255, 0.025) 100%);
  --surface-strong: rgba(18, 24, 40, 0.86);
  --surface-head: rgba(18, 24, 40, 0.82);
  --surface-solid: #141a2a;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-hover: rgba(255, 255, 255, 0.26);
  --line: rgba(255, 255, 255, 0.07);
  --tile: rgba(255, 255, 255, 0.04);
  --tile-hover: rgba(255, 255, 255, 0.07);
  --fill: rgba(255, 255, 255, 0.06);
  --fill-hover: rgba(255, 255, 255, 0.1);
  --hover: rgba(255, 255, 255, 0.05);
  --row-hover: rgba(255, 255, 255, 0.035);
  --track: rgba(255, 255, 255, 0.09);
  --field: rgba(255, 255, 255, 0.05);
  --field-hover: rgba(255, 255, 255, 0.075);
  --switch-off: rgba(255, 255, 255, 0.14);
  --bubble: rgba(255, 255, 255, 0.075);
  --bubble-line: rgba(255, 255, 255, 0.06);
  --preview: rgba(0, 0, 0, 0.18);

  --text: #f3efe9;
  --text-strong: #ffffff;
  --text-2: #c9ccd6;
  --muted: #959cae;
  --muted-2: #6f778a;
  --on-accent: #1b0f05;

  --accent: var(--orange-500);
  --accent-strong: var(--orange-300);
  --accent-text: #ffab6b;
  --accent-soft: rgba(245, 134, 52, 0.14);
  --accent-line: rgba(245, 134, 52, 0.42);
  --accent-wash: linear-gradient(90deg, rgba(245, 134, 52, 0.24), rgba(245, 134, 52, 0.05));
  --accent-focus: rgba(245, 134, 52, 0.2);
  --sunset-text: linear-gradient(100deg, #ffd3a8 0%, var(--orange-300) 35%, var(--orange-500) 65%, var(--rose-500) 100%);

  --success: #3ccf91;
  --success-soft: rgba(60, 207, 145, 0.14);
  --warning: #f2b84b;
  --warning-soft: rgba(242, 184, 75, 0.14);
  --danger: #ff7a6b;
  --danger-soft: rgba(255, 122, 107, 0.14);
  --info: #7fb0ff;
  --info-soft: rgba(127, 176, 255, 0.14);
  --info-ink: #d8e6ff;
  --warning-ink: #fbe7bf;
  --danger-ink: #ffd6d0;

  --s-dm: #dd6d24;
  --s-group: var(--dusk-500);
  --s-received: var(--sea-500);
  --s-group-text: var(--dusk-400);
  --s-received-text: var(--sea-400);

  --shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-pop: 0 30px 70px -20px rgba(0, 0, 0, 0.75);
  --glow: 0 10px 34px -8px rgba(245, 134, 52, 0.55);
  --glow-strong: 0 14px 40px -8px rgba(245, 134, 52, 0.7);
  --logo-glow: rgba(245, 134, 52, 0.45);
  --overlay: rgba(5, 8, 15, 0.6);
  --scroll: rgba(255, 255, 255, 0.12);
  --selection: rgba(245, 134, 52, 0.38);
}

/* Claro: o mesmo céu ao amanhecer */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fa;
  --sky: linear-gradient(180deg, #e4ecf9 0%, #f2f4f9 46%, #fbefe5 100%);
  --sky-glow-1: rgba(122, 162, 232, 0.4);
  --sky-glow-2: rgba(178, 156, 236, 0.26);
  --horizon-1: rgba(255, 168, 104, 0.6);
  --horizon-2: rgba(245, 134, 52, 0.36);
  --horizon-3: rgba(236, 128, 170, 0.26);
  --horizon-rest: 0.5;
  --horizon-warm: 0.92;

  --surface: rgba(255, 255, 255, 0.6);
  --surface-hi: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.42) 100%);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --surface-head: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --border: rgba(22, 32, 58, 0.08);
  --border-strong: rgba(22, 32, 58, 0.14);
  --border-hover: rgba(22, 32, 58, 0.26);
  --line: rgba(22, 32, 58, 0.08);
  --tile: rgba(22, 32, 58, 0.035);
  --tile-hover: rgba(22, 32, 58, 0.06);
  --fill: rgba(255, 255, 255, 0.78);
  --fill-hover: #ffffff;
  --hover: rgba(22, 32, 58, 0.05);
  --row-hover: rgba(22, 32, 58, 0.03);
  --track: rgba(22, 32, 58, 0.09);
  --field: rgba(255, 255, 255, 0.78);
  --field-hover: #ffffff;
  --switch-off: rgba(22, 32, 58, 0.16);
  --bubble: rgba(255, 255, 255, 0.92);
  --bubble-line: rgba(22, 32, 58, 0.07);
  --preview: rgba(22, 32, 58, 0.035);

  --text: #16203a;
  --text-strong: #0d1529;
  --text-2: #3c4763;
  --muted: #5f6984;
  --muted-2: #98a1b6;

  --accent-strong: var(--orange-600);
  --accent-text: var(--orange-700);
  --accent-soft: rgba(245, 134, 52, 0.13);
  --accent-line: rgba(226, 98, 27, 0.38);
  --accent-wash: linear-gradient(90deg, rgba(245, 134, 52, 0.2), rgba(245, 134, 52, 0.03));
  --accent-focus: rgba(245, 134, 52, 0.22);
  --sunset-text: linear-gradient(100deg, var(--orange-700) 0%, var(--orange-600) 38%, var(--orange-500) 66%, #c2477a 100%);

  --success: #13895a;
  --success-soft: rgba(19, 137, 90, 0.12);
  --warning: #9a6200;
  --warning-soft: rgba(214, 150, 20, 0.16);
  --danger: #c8392b;
  --danger-soft: rgba(200, 57, 43, 0.1);
  --info: #2f5fae;
  --info-soft: rgba(47, 95, 174, 0.1);
  --info-ink: #1f3f73;
  --warning-ink: #5c3d00;
  --danger-ink: #7d1d12;

  --s-dm: #dd6d24;
  --s-group: var(--dusk-600);
  --s-received: var(--sea-600);
  --s-group-text: var(--dusk-700);
  --s-received-text: var(--sea-700);

  --shadow: 0 1px 2px rgba(22, 32, 58, 0.05), 0 18px 40px -24px rgba(22, 32, 58, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-pop: 0 30px 70px -24px rgba(22, 32, 58, 0.38);
  --glow: 0 10px 28px -10px rgba(226, 98, 27, 0.55);
  --glow-strong: 0 14px 34px -10px rgba(226, 98, 27, 0.7);
  --logo-glow: rgba(226, 98, 27, 0.32);
  --overlay: rgba(22, 32, 58, 0.26);
  --scroll: rgba(22, 32, 58, 0.18);
  --selection: rgba(245, 134, 52, 0.28);
}

/* Nomes que o JS usa */
:root, [data-theme] {
  --green: var(--success);
  --green-soft: var(--success-soft);
  --yellow: var(--warning);
  --yellow-soft: var(--warning-soft);
  --red: var(--danger);
  --red-soft: var(--danger-soft);
  --blue: var(--info);
  --blue-soft: var(--info-soft);
  --teal: var(--s-received-text);
  --teal-soft: color-mix(in srgb, var(--s-received) 16%, transparent);
  --violet: var(--s-group-text);
  --violet-soft: color-mix(in srgb, var(--s-group) 16%, transparent);
  --orange: var(--orange-500);
  --orange-text: var(--accent-text);
  --orange-soft: var(--accent-soft);
  --orange-line: var(--accent-line);
  --ember: var(--accent);
  --ember-2: var(--accent-text);
  --ember-3: var(--accent-text);
  --ember-soft: var(--accent-soft);
  --grad: var(--sunset);
  --ink: var(--on-accent);
  --bg-2: var(--tile);
  --panel: var(--surface);
  --line-2: var(--border-strong);
}

/* ============ 3. Base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Céu e horizonte */
body::before, body::after { content: ""; position: fixed; pointer-events: none; z-index: -1; }
body::before {
  inset: 0;
  background:
    radial-gradient(900px 520px at 78% -12%, var(--sky-glow-1), transparent 62%),
    radial-gradient(700px 420px at 8% 8%, var(--sky-glow-2), transparent 60%),
    var(--sky);
}
body::after {
  left: -10%; right: -10%; bottom: -38vh; height: 70vh;
  background:
    radial-gradient(50% 60% at 30% 50%, var(--horizon-1), transparent 70%),
    radial-gradient(45% 55% at 72% 55%, var(--horizon-2), transparent 70%),
    radial-gradient(60% 50% at 50% 40%, var(--horizon-3), transparent 72%);
  filter: blur(40px);
  opacity: var(--horizon-rest);
  transition: opacity 1.6s var(--ease), transform 1.6s var(--ease);
  animation: drift 26s ease-in-out infinite alternate;
}
body.warm::after { opacity: var(--horizon-warm); transform: translateY(-6vh); animation: drift 26s ease-in-out infinite alternate, breathe 6s ease-in-out infinite; }
@keyframes drift { from { translate: -3% 0; } to { translate: 3% -2vh; } }
@keyframes breathe { 0%, 100% { filter: blur(40px) brightness(1); } 50% { filter: blur(46px) brightness(1.15); } }

/* Troca de tema: o tema novo abre num círculo a partir do botão */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; font-weight: 600; transition: opacity .2s; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 12.5px; padding: 2px 6px; border-radius: 6px; background: var(--tile-hover); color: var(--text); }
::selection { background: var(--selection); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input { caret-color: var(--accent); }

.num { font-variant-numeric: tabular-nums lining-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.sp-between { justify-content: space-between; }
.hidden { display: none !important; }
.t-ok { color: var(--success); }
.t-err { color: var(--danger); }
.t-warn { color: var(--warning); }
.t-accent { color: var(--accent-text); }
.svg-ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.svg-ic.sm { width: 15px; height: 15px; }
.svg-ic.lg { width: 22px; height: 22px; }

/* Vidro */
.card, .sidebar, .kpi-strip, .hero, .totals, .modal, .drawer, .menu, .toast, .chart-tip, .login .box {
  background: var(--surface-hi), var(--surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ============ 4. Estrutura ============ */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 14px; height: calc(100vh - 28px); margin: 14px 0 14px 14px; padding: 18px 12px 14px;
  display: flex; flex-direction: column; gap: 3px; overflow-y: auto; border-radius: var(--r-xl);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 4px 22px 8px; }
.brand img { width: 46px; height: 46px; margin: -3px -3px -3px -6px; flex: none; filter: drop-shadow(0 8px 16px var(--logo-glow)); }
.brand b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; color: var(--text-strong); }
.brand span { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; }
.brand .theme-btn { margin-left: auto; }

.theme-btn {
  position: relative; width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--fill); color: var(--text-2);
  transition: background-color .25s var(--ease), color .25s, border-color .25s, transform .25s var(--ease);
}
.theme-btn:hover { background: var(--fill-hover); color: var(--accent-strong); border-color: var(--accent-line); }
.theme-btn:active { transform: scale(.94); }
.theme-btn .svg-ic { transition: transform .5s var(--ease); }
.theme-btn:hover .svg-ic { transform: rotate(-18deg); }

.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 9px 12px; border-radius: 13px;
  color: var(--text-2); cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font-weight: 600;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.nav-item:hover { background: var(--hover); color: var(--text-strong); }
.nav-item.active { color: var(--text-strong); background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.nav-item.active .svg-ic { color: var(--accent-strong); }
.nav-item .badge { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 14px; }

.engine-card { position: relative; overflow: hidden; padding: 14px; border-radius: 18px; background: var(--tile);
  border: 1px solid var(--border); transition: border-color .6s var(--ease), box-shadow .6s var(--ease); }
.engine-card::before { content: ""; position: absolute; inset: auto -30% -70% -30%; height: 140%; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 50%, rgba(245, 134, 52, 0.55), transparent 70%); opacity: 0; transition: opacity .8s var(--ease); }
.engine-card > * { position: relative; }
.engine-card.on { border-color: var(--accent-line); box-shadow: var(--glow); }
.engine-card.on::before { opacity: .5; animation: pulseGlow 4.5s ease-in-out infinite; }
@keyframes pulseGlow { 0%, 100% { transform: scale(1); opacity: .4; } 50% { transform: scale(1.08); opacity: .65; } }
.engine-card .title { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.engine-card .state { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; margin: 2px 0 8px; color: var(--text-strong); }
.engine-card .state.on { color: var(--accent-text); }
.side-meta { display: flex; flex-direction: column; gap: 6px; padding: 0 6px; }
.side-meta .row { font-size: 12.5px; color: var(--muted); gap: 7px; }

.main { min-width: 0; padding: 30px clamp(18px, 3vw, 40px) 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 30px; line-height: 1.12; font-weight: 800; letter-spacing: -0.03em; color: var(--text-strong); }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* Entrada orquestrada (só ao abrir a tela) */
.main.enter > * { animation: rise .7s var(--ease) both; }
.main.enter > *:nth-child(2) { animation-delay: .05s; }
.main.enter > *:nth-child(3) { animation-delay: .1s; }
.main.enter > *:nth-child(4) { animation-delay: .15s; }
.main.enter > *:nth-child(5) { animation-delay: .2s; }
.main.enter > *:nth-child(6) { animation-delay: .25s; }
.main.enter > *:nth-child(n+7) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

/* ============ 5. Componentes ============ */
.card { border-radius: var(--r); padding: 18px; }
.card.flush { padding: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-strong); }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.g-chart { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 6px 16px;
  border-radius: 12px; border: 1px solid var(--border-strong); background: var(--fill); color: var(--text);
  font-weight: 650; cursor: pointer; white-space: nowrap;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background-color .25s var(--ease), border-color .25s var(--ease), filter .25s;
}
.btn:hover { background: var(--fill-hover); border-color: var(--border-hover); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--sunset); border-color: transparent; color: var(--on-accent); box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn.primary:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: var(--glow-strong), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: var(--hover); color: var(--text-strong); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.modal-foot .btn.danger { background: linear-gradient(135deg, #ff8b7c, #e5503f); border-color: transparent; color: #200603; box-shadow: 0 10px 30px -10px rgba(229, 80, 63, 0.7); }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 34px; }
.btn.block { width: 100%; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650; background: var(--tile-hover); color: var(--text-2); white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.green { background: var(--success-soft); color: var(--success); }
.pill.yellow { background: var(--warning-soft); color: var(--warning); }
.pill.red { background: var(--danger-soft); color: var(--danger); }
.pill.blue { background: var(--info-soft); color: var(--info); }
.pill.ember { background: var(--accent-soft); color: var(--accent-text); }
.pill.teal { background: var(--teal-soft); color: var(--teal); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--sunset);
  color: var(--on-accent); font-size: 11.5px; font-weight: 800; display: inline-grid; place-items: center; }
.pulse .dot { animation: ping 1.8s var(--ease) infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.switch { position: relative; width: 46px; height: 26px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--switch-off);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2); transition: background .35s var(--ease), box-shadow .35s var(--ease); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: transform .35s var(--ease); }
.switch input:checked + span { background: var(--sunset); box-shadow: 0 4px 16px -4px rgba(245, 134, 52, 0.75); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + span { opacity: .45; }
.switch.lg { width: 56px; height: 32px; }
.switch.lg span::after { width: 26px; height: 26px; }
.switch.lg input:checked + span::after { transform: translateX(24px); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  height: 42px; padding: 0 13px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--field);
  outline: none; width: 100%; transition: border-color .2s, box-shadow .25s var(--ease), background-color .2s;
}
.input::placeholder { color: var(--muted-2); }
textarea.input { height: auto; padding: 10px 13px; resize: vertical; }
.input:hover { background: var(--field-hover); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-focus); background: var(--field-hover); }
.input:disabled { opacity: .55; }
.input.sm { height: 36px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
select.input.sm { background-position: calc(100% - 17px) 15px, calc(100% - 12px) 15px; }
select.input option { background: var(--surface-solid); color: var(--text); }
[data-theme="dark"] input[type="time"].input::-webkit-calendar-picker-indicator { filter: invert(.8); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--tile); cursor: pointer; transition: border-color .2s, background-color .2s, box-shadow .3s var(--ease); }
.check:hover { border-color: var(--border-strong); background: var(--tile-hover); }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.check.on { border-color: var(--accent-line); background: var(--accent-wash); box-shadow: 0 8px 26px -16px rgba(245, 134, 52, 0.7); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--fill); cursor: pointer;
  font-size: 13px; font-weight: 550; color: var(--text-2); transition: all .2s var(--ease); }
.chip:hover { border-color: var(--border-hover); color: var(--text-strong); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }

/* KPIs: uma faixa de vidro dividida */
.kpi-strip { display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr)); border-radius: var(--r); margin-bottom: 16px; overflow: hidden; }
.kpi { position: relative; padding: 16px 18px 15px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi .k-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .k-icon { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; background: var(--tile-hover); color: var(--text-2); }
.kpi .k-value { font-size: 30px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; margin-top: 10px; color: var(--text-strong); font-variant-numeric: tabular-nums lining-nums; }
.kpi .k-value small { font-size: 14px; color: var(--muted); font-weight: 550; margin-left: 4px; letter-spacing: 0; }
.kpi .k-foot { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kpi.accent .k-icon { background: var(--accent-soft); color: var(--accent-text); }
.kpi.teal .k-icon { background: var(--teal-soft); color: var(--teal); }
.kpi.green .k-icon { background: var(--success-soft); color: var(--success); }
.kpi.blue .k-icon { background: var(--info-soft); color: var(--info); }
.kpi.violet .k-icon { background: var(--violet-soft); color: var(--violet); }
.kpi.yellow .k-icon { background: var(--warning-soft); color: var(--warning); }

/* Hero: o horizonte do motor */
.hero { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; gap: 20px;
  padding: 22px 24px; margin-bottom: 16px; border-radius: var(--r-xl); }
.hero::after { content: ""; position: absolute; z-index: -1; left: -5%; right: -5%; bottom: -105%; height: 180%; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 50%, var(--horizon-1), color-mix(in srgb, var(--horizon-2) 45%, transparent) 45%, transparent 72%);
  transition: opacity 1s var(--ease); animation: horizon 7s ease-in-out infinite; }
.hero::before { content: ""; position: absolute; left: 6%; right: 6%; bottom: 0; height: 1px; z-index: -1;
  background: linear-gradient(90deg, transparent, var(--orange-300), transparent); box-shadow: 0 -6px 16px -2px rgba(245, 134, 52, 0.5); }
.hero.off::after { opacity: 0; animation: none; }
.hero.off::before { opacity: .15; box-shadow: none; }
@keyframes horizon { 0%, 100% { transform: translateY(0) scaleX(1); } 50% { transform: translateY(-5%) scaleX(1.06); } }
.hero .flame { position: relative; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none;
  background: var(--sunset); color: var(--on-accent); box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.hero .flame .svg-ic { animation: flicker 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.07, .96) rotate(-2deg); } 60% { transform: scale(.97, 1.05) rotate(2deg); } }
.hero.off .flame { background: var(--tile-hover); color: var(--muted); box-shadow: none; }
.hero.off .flame .svg-ic { animation: none; }
.hero h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.025em; color: var(--text-strong); }
.hero p { margin: 3px 0 0; color: var(--text-2); font-size: 13.5px; }
.hero .meter { min-width: 280px; }
.hero .meter b { font-size: 15px; color: var(--text-strong); }

.bar { position: relative; height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bar > i { position: relative; display: block; height: 100%; border-radius: 99px; background: var(--sunset); transition: width .8s var(--ease); overflow: hidden; }
/* Ponta acesa da barra: a luz fica na frente do progresso, sem loop correndo */
.hero:not(.off) .bar > i::after, .engine-card.on .bar > i::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 18px;
  border-radius: 99px; background: linear-gradient(90deg, transparent, rgba(255, 236, 214, 0.9)); }
.bar.teal > i { background: linear-gradient(90deg, var(--sea-600), var(--sea-400)); }
.bar.thin { height: 5px; }

/* Desde o início */
.totals { display: grid; grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.6fr); border-radius: var(--r-xl); margin-bottom: 16px; overflow: hidden; }
.totals .feat { position: relative; padding: 22px 24px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line);
  background: radial-gradient(120% 90% at 0% 0%, var(--accent-soft), transparent 60%); }
.totals .feat h2 { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -0.015em; color: var(--text-strong); }
.totals .feat .since { color: var(--muted); font-size: 12.5px; }
.totals .big { margin: 16px 0 2px; font-size: 64px; font-weight: 800; letter-spacing: -0.04em; line-height: 1;
  background: var(--sunset-text); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums lining-nums; }
.totals .big-label { font-weight: 650; color: var(--text-2); }
.compo { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; margin-top: 18px; background: var(--track); }
.compo i { display: block; height: 100%; min-width: 3px; transition: flex-grow .8s var(--ease); }
.compo-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.compo-legend span { display: inline-flex; align-items: center; gap: 6px; }
.compo-legend b { color: var(--text-2); font-weight: 650; font-variant-numeric: tabular-nums; }
.compo-legend .sw { width: 8px; height: 8px; border-radius: 3px; }
.totals .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.totals .stat { padding: 18px 20px; min-width: 0; }
.totals .stat:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
.totals .stat:not(:nth-child(3n+1)) { border-left: 1px solid var(--line); }
.totals .stat dt { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.totals .stat dt .svg-ic { color: var(--text-2); }
.totals .stat dd { margin: 0; }
.totals .stat .v { margin-top: 8px; font-size: 27px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; color: var(--text-strong); font-variant-numeric: tabular-nums lining-nums; }
.totals .stat .ft { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.totals .stat .ft b { color: var(--text-2); font-weight: 650; font-variant-numeric: tabular-nums; }

/* Gráficos */
.chart { width: 100%; height: 210px; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .grid-line { stroke: var(--line); }
.chart .base-line { stroke: var(--border-strong); }
.chart .dot { stroke: var(--surface-solid); }
.chart .hit { cursor: crosshair; }
.chart .hit:hover { fill: var(--row-hover); }
.enter .chart .bar-r { transform-box: fill-box; transform-origin: 50% 100%; animation: grow .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms + .15s); }
.enter .chart .ln { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s var(--ease) .35s forwards; }
.enter .chart .area, .enter .chart .dot { animation: fade .8s var(--ease) .9s both; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.ln { height: 3px; width: 14px; border-radius: 3px; vertical-align: 3px; }
.chart-tip { position: fixed; pointer-events: none; z-index: 60; padding: 9px 12px; font-size: 12.5px; border-radius: 12px; min-width: 150px;
  background: var(--surface-hi), var(--surface-strong); color: var(--text); animation: fade .15s ease-out; }
.chart-tip .sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* Tabelas */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.table td { padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .2s; cursor: pointer; }
.table tbody tr:hover { background: var(--row-hover); }
.table .who b, .table .who span { white-space: nowrap; }

.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800;
  font-size: 13px; color: #10131c; background: var(--sunset); position: relative; box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.5); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 54px; height: 54px; font-size: 18px; }
.avatar .st { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface-solid); }
.avatar.ic { color: #fff; }
.who b { display: block; font-weight: 700; color: var(--text-strong); }
.who span { color: var(--muted); font-size: 12.5px; }

.ring { width: 46px; height: 46px; position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring .track { stroke: var(--track); }
.ring .arc { transition: stroke-dashoffset 1s var(--ease); filter: drop-shadow(0 2px 3px rgba(226, 98, 27, 0.35)); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.ring.lg { width: 76px; height: 76px; }
.ring.lg .lbl { font-size: 13px; line-height: 1.05; text-align: center; }

/* Feed */
.feed { display: flex; flex-direction: column; max-height: 560px; overflow: auto; margin-right: -6px; padding-right: 6px; }
.feed-item { display: flex; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-item.new { animation: slideIn .7s var(--ease) both; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); background: var(--accent-soft); } to { opacity: 1; transform: none; background: transparent; } }
.feed-item .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.feed-item .meta b { color: var(--text-2); }
.feed-item .txt { margin-top: 2px; color: var(--text); word-break: break-word; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.event { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.event:last-child { border-bottom: 0; }
.event .ic { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.event.success .ic { background: var(--success-soft); color: var(--success); }
.event.info .ic { background: var(--info-soft); color: var(--info); }
.event.warn .ic { background: var(--warning-soft); color: var(--warning); }
.event.error .ic { background: var(--danger-soft); color: var(--danger); }

/* Cartões de número */
.n-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.n-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: border-color .3s var(--ease); }
.n-card:hover { border-color: var(--border-strong); }
.n-card .top { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; }
.n-card .top .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.n-card .mid { display: flex; align-items: center; gap: 16px; padding: 4px 16px 14px; }
.n-card .day b { font-size: 21px; font-weight: 800; letter-spacing: -0.025em; color: var(--text-strong); }
.n-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 12px; border-radius: var(--r-md); background: var(--tile); }
.n-card .stats > div { padding: 10px 12px; }
.n-card .stats > div + div { border-left: 1px solid var(--line); }
.n-card .stats .v { font-size: 18px; font-weight: 750; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.n-card .stats .l { font-size: 12px; color: var(--muted); font-weight: 550; }
.n-card .act { display: flex; align-items: center; gap: 8px; padding: 12px 16px 10px; font-size: 13px; color: var(--text-2); }
.n-card .foot { display: flex; gap: 8px; padding: 0 16px 16px; }
.n-card.add { align-items: center; justify-content: center; min-height: 260px; cursor: pointer; color: var(--muted); gap: 10px;
  background: var(--tile); border: 1px dashed var(--border-strong); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.n-card.add:hover { color: var(--text-strong); border-color: var(--accent-line); background: var(--accent-soft); }
.n-card.add .plus { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--sunset); color: var(--on-accent);
  box-shadow: var(--glow); transition: transform .35s var(--ease); }
.n-card.add:hover .plus { transform: rotate(90deg) scale(1.05); }
.act-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.menu { position: fixed; z-index: 80; min-width: 230px; padding: 6px; border-radius: 16px; background: var(--surface-hi), var(--surface-strong);
  box-shadow: var(--shadow-pop); animation: pop .18s var(--ease) both; transform-origin: top right; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 10px;
  cursor: pointer; color: var(--text-2); font-weight: 550; text-align: left; transition: background-color .15s, color .15s; }
.menu button:hover { background: var(--hover); color: var(--text-strong); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }

/* Modal e gaveta */
.backdrop { position: fixed; inset: 0; z-index: 50; background: var(--overlay); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px; animation: fadein .25s ease-out; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: var(--r-xl);
  background: var(--surface-hi), var(--surface-strong); box-shadow: var(--shadow-pop); animation: modalIn .35s var(--ease) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 6px; }
.modal-head h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.025em; color: var(--text-strong); }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }
.modal-body { padding: 16px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--line); }
.steps { display: flex; gap: 8px; padding: 8px 24px 0; }
.steps .s { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--muted); }
.steps .s i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--tile-hover); font-style: normal; font-size: 11.5px; }
.steps .s.on { color: var(--text-strong); }
.steps .s.on i { background: var(--sunset); color: var(--on-accent); box-shadow: var(--glow); }
.steps .s.done i { background: var(--success-soft); color: var(--success); }
.steps .s::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.steps .s:last-child::after { display: none; }

.drawer-wrap { position: fixed; inset: 0; z-index: 50; background: var(--overlay); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadein .25s ease-out; }
.drawer { position: absolute; right: 12px; top: 12px; bottom: 12px; width: min(720px, calc(100% - 24px)); overflow: auto; border-radius: var(--r-xl);
  background: var(--surface-hi), var(--surface-strong); box-shadow: var(--shadow-pop); animation: slidein .45s var(--ease) both; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 18px 22px;
  background: var(--surface-head); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.drawer-body { padding: 18px 22px 40px; display: flex; flex-direction: column; gap: 16px; }
.drawer .card, .drawer .kpi-strip { background: var(--tile); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.drawer .kpi-strip { margin-bottom: 0; }
.day-title { font-size: 21px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.2; color: var(--text-strong); }

.qr-box { display: grid; grid-template-columns: 260px 1fr; gap: 22px; align-items: center; }
.qr-frame { width: 260px; height: 260px; border-radius: 20px; background: #fff; display: grid; place-items: center; padding: 14px; position: relative;
  box-shadow: 0 0 0 6px var(--tile-hover), var(--glow); }
.qr-frame img { width: 100%; height: 100%; image-rendering: pixelated; }
.qr-frame .loading { color: #555; font-weight: 650; }
.qr-frame.ok { background: var(--success-soft); }
.qr-steps { margin: 0; padding-left: 18px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.pair-code { font-family: var(--mono); font-size: 30px; letter-spacing: .12em; font-weight: 600; padding: 14px 18px; border-radius: 16px;
  background: var(--tile); border: 1px dashed var(--border-strong); text-align: center; }
.tabs { display: inline-flex; padding: 4px; border-radius: 13px; background: var(--tile); border: 1px solid var(--line); gap: 2px; }
.tabs button { border: 0; background: none; padding: 7px 13px; border-radius: 9px; cursor: pointer; font-weight: 650; color: var(--muted); font-size: 13.5px;
  transition: background-color .25s var(--ease), color .25s, box-shadow .25s; }
.tabs button:hover { color: var(--text-strong); }
.tabs button.on { background: var(--fill-hover); color: var(--text-strong); box-shadow: 0 4px 14px -8px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08); }

/* Conversas */
.conv { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 150px); min-height: 520px; overflow: hidden; }
.conv-list { border-right: 1px solid var(--line); overflow: auto; }
.conv-item { position: relative; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: 11px; transition: background-color .2s; }
.conv-item:hover { background: var(--row-hover); }
.conv-item.on { background: var(--accent-wash); }
.conv-item .t { font-weight: 700; font-size: 13.5px; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .l { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread { display: flex; flex-direction: column; min-width: 0; }
.thread-head { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.thread-body { flex: 1; overflow: auto; padding: 20px 26px; display: flex; flex-direction: column; gap: 6px;
  background: radial-gradient(70% 60% at 100% 100%, var(--accent-soft), transparent 60%), radial-gradient(60% 50% at 0% 0%, var(--sky-glow-2), transparent 60%); }
.bubble { max-width: min(520px, 78%); padding: 8px 12px 6px; border-radius: 16px 16px 16px 6px; background: var(--bubble);
  border: 1px solid var(--bubble-line); align-self: flex-start; animation: bubbleIn .35s var(--ease) both; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
.bubble.me { align-self: flex-end; border-radius: 16px 16px 6px 16px; background: linear-gradient(135deg, #ffad6e, var(--orange-500) 60%, #ea6f24); color: var(--on-accent); border-color: transparent;
  box-shadow: 0 10px 24px -14px rgba(245, 134, 52, 0.9); }
.bubble .who { font-size: 12px; font-weight: 750; margin-bottom: 1px; }
.bubble .tm { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.bubble.me .tm { color: rgba(27, 15, 5, 0.65); }
.bubble.react { background: none; border: 0; box-shadow: none; padding: 0 4px; font-size: 20px; }
.bubble.failed { border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.bubble.ghost { opacity: .55; border-style: dashed; border-color: var(--border-strong); background: transparent; animation: none; color: var(--text); }
.day-sep { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--fill); border: 1px solid var(--line); padding: 3px 11px; border-radius: 999px; margin: 8px 0; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty .big { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; display: grid; place-items: center; background: var(--tile-hover); color: var(--text-2); }
.empty h3 { color: var(--text-strong); margin: 6px 0; font-size: 18px; font-weight: 750; }

/* Conteúdo */
.topic { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--tile); transition: opacity .3s; }
.topic.off { opacity: .45; }
.topic b { display: block; color: var(--text-strong); }
.preview { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--r-md); background: var(--preview); border: 1px solid var(--line); min-height: 200px; }

/* Configurações */
.set-section { display: grid; grid-template-columns: 260px 1fr; gap: 24px; padding: 22px 6px; border-bottom: 1px solid var(--line); }
.set-section:first-child { padding-top: 6px; }
.set-section:last-child { border-bottom: 0; }
.set-section h3 { margin: 0 0 4px; font-size: 16px; font-weight: 750; letter-spacing: -0.01em; color: var(--text-strong); }
.set-section .desc { color: var(--muted); font-size: 13px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--tile); transition: border-color .2s, background-color .2s; }
.toggle-row:hover { background: var(--tile-hover); }
.toggle-row b { display: block; font-size: 14px; color: var(--text-strong); }
.toggle-row span { color: var(--muted); font-size: 12.5px; }
.curve-table input { width: 100%; height: 34px; padding: 0 9px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--field); outline: none; transition: border-color .2s, box-shadow .2s; }
.curve-table input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-focus); }
.curve-table input:disabled { opacity: .5; }
.curve-table tbody tr { cursor: default; }
.curve-table tbody tr:hover { background: transparent; }
.curve-table td, .curve-table th { padding: 6px 6px; }
.curve-table td:first-child, .curve-table th:first-child { padding-left: 6px; min-width: 132px; }
.curve-table td { min-width: 64px; }
.shield { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shield .it { display: flex; gap: 10px; padding: 12px; border-radius: var(--r-md); background: var(--tile); border: 1px solid var(--line); font-size: 13px; }
.shield .it .svg-ic { color: var(--success); margin-top: 1px; }
.shield .it b { display: block; font-size: 13.5px; color: var(--text-strong); }
.shield .it span { color: var(--muted); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .box { position: relative; width: min(420px, 100%); padding: 34px 32px 28px; border-radius: 28px; animation: modalIn .7s var(--ease) both; }
.login .box .theme-btn { position: absolute; top: 18px; right: 18px; }
.login .logo { width: 68px; height: 68px; margin-left: -8px; filter: drop-shadow(0 12px 26px var(--logo-glow)); }
.login h1 { margin: 18px 0 2px; font-size: 32px; font-weight: 800; letter-spacing: -0.035em; color: var(--text-strong); }
.login .lead { margin: 0 0 22px; color: var(--text-2); }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* Avisos */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 16px; background: var(--surface-hi), var(--surface-strong); color: var(--text);
  display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; box-shadow: var(--shadow-pop); animation: toastIn .45s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(.98); } to { opacity: 1; transform: none; } }
.toast .svg-ic { flex: none; width: 26px; height: 26px; padding: 5px; border-radius: 9px; }
.toast.ok .svg-ic { color: var(--success); background: var(--success-soft); }
.toast.info .svg-ic { color: var(--info); background: var(--info-soft); }
.toast.err .svg-ic { color: var(--danger); background: var(--danger-soft); }
.toast > div { padding-top: 3px; }

.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; margin-bottom: 16px; font-size: 13.5px; border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--info) 28%, transparent); background: linear-gradient(90deg, var(--info-soft), color-mix(in srgb, var(--info) 4%, transparent)); color: var(--info-ink); }
.banner > .svg-ic { color: var(--info); }
.banner.warn { border-color: color-mix(in srgb, var(--warning) 32%, transparent); background: linear-gradient(90deg, var(--warning-soft), color-mix(in srgb, var(--warning) 4%, transparent)); color: var(--warning-ink); }
.banner.warn > .svg-ic { color: var(--warning); }
.banner.err { border-color: color-mix(in srgb, var(--danger) 32%, transparent); background: linear-gradient(90deg, var(--danger-soft), color-mix(in srgb, var(--danger) 4%, transparent)); color: var(--danger-ink); }
.banner.err > .svg-ic { color: var(--danger); }

.skeleton { border-radius: var(--r); background: linear-gradient(90deg, var(--tile) 0%, var(--tile-hover) 50%, var(--tile) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.ob-flame { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; flex: none; background: var(--sunset); color: var(--on-accent); box-shadow: var(--glow); }
.ob-title { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; color: var(--text-strong); }
.ob-step { background: var(--tile) !important; box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============ 6. Responsivo ============ */
@media (min-width: 1700px) {
  .main { width: 100%; max-width: 1560px; margin-inline: auto; }
}
@media (max-width: 1280px) {
  .g-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(3n+1) { border-left: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
  .g-main { grid-template-columns: 1fr; }
  .totals { grid-template-columns: 1fr; }
  .totals .feat { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .hero .meter { min-width: 0; width: 100%; }
  .sidebar { position: static; height: auto; margin: 12px 12px 0; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .brand { padding: 4px 4px 8px 8px; width: 100%; }
  .side-foot { display: none; }
  .nav-item { width: auto; }
  .main { padding: 20px 16px 50px; }
  .page-head h1 { font-size: 26px; }
  .g-4, .g-3, .g-chart, .g-2 { grid-template-columns: 1fr; }
  .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3n+1) { border-left: 1px solid var(--line); }
  .kpi:nth-child(2n+1) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .totals .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .totals .stat { border-left: 0 !important; border-bottom: 1px solid var(--line); }
  .totals .stat:nth-child(2n) { border-left: 1px solid var(--line) !important; }
  .totals .stat:nth-last-child(-n+2) { border-bottom: 0; }
  .totals .big { font-size: 52px; }
  .conv { grid-template-columns: 1fr; height: auto; }
  .set-section { grid-template-columns: 1fr; gap: 12px; }
  .qr-box { grid-template-columns: 1fr; justify-items: center; }
  .form-grid { grid-template-columns: 1fr; }
  .shield { grid-template-columns: 1fr; }
  .hero { flex-wrap: wrap; }
  .drawer { right: 0; top: 0; bottom: 0; width: 100%; border-radius: 0; }
}
