/* ============================================================
   LÍQUIDO — folha de estilo
   Tema: financeiro escuro e refinado, acento lima
   ============================================================ */

:root {
  --bg: #0a0c0b;
  --bg-soft: #0f1211;
  --surface: #141816;
  --surface-2: #1a201d;
  --surface-3: #232b27;
  --line: #283029;
  --line-soft: #1c2320;
  --text: #eef1ed;
  --text-dim: #98a19a;
  --text-faint: #5f6862;
  --accent: #c7f95b;
  --accent-deep: #aee63f;
  --accent-soft: rgba(199, 249, 91, 0.12);
  --pos: #5fd6a0;
  --neg: #ff6f5e;
  --gold: #ecc46a;
  --info: #74b9e6;

  --font-display: 'Bricolage Grotesque', 'Hanken Grotesk', sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --r: 18px;
  --r-sm: 11px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.85);
  --sidebar-w: 236px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* O atributo hidden sempre vence regras de display de classe */
[hidden] { display: none !important; }

/* Barras de rolagem invisíveis — continua rolando normalmente */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(900px 600px at 88% -8%, rgba(199, 249, 91, 0.07), transparent 60%),
    radial-gradient(700px 500px at -5% 105%, rgba(116, 185, 230, 0.05), transparent 55%),
    var(--bg);
  min-height: 100%;
}

button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
input, select, textarea { outline: none; }
a { color: inherit; }
svg { fill: currentColor; }
::selection { background: var(--accent); color: #0a0c0b; }

/* Texturas de fundo */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.04; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.glow {
  position: fixed; top: -180px; right: -120px; width: 520px; height: 520px;
  z-index: 0; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, rgba(199, 249, 91, 0.16), transparent 68%);
  filter: blur(20px);
}

/* Marca / logo */
.logo-coin {
  width: 27px; height: 27px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #0a0c0b;
  border-radius: 50%;
  font-family: var(--font-mono); font-weight: 700; font-size: 15px;
  box-shadow: 0 0 18px rgba(199, 249, 91, 0.5);
}
.logo-word {
  font-family: var(--font-display);
  font-weight: 800; letter-spacing: 0.11em; font-size: 16px;
}
.logo-word em { color: var(--accent); font-style: normal; }

/* ============================================================
   LOGIN
   ============================================================ */
.auth {
  position: relative; z-index: 2;
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 24px; padding: 38px 32px;
  box-shadow: var(--shadow);
  animation: rise 0.6s both;
}
.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo .logo-word { font-size: 21px; }
.auth-logo .logo-coin { width: 34px; height: 34px; font-size: 19px; }
.auth-tag {
  color: var(--text-faint); font-size: 13px; margin: 10px 0 28px;
  letter-spacing: 0.02em;
}
.auth-msg { font-size: 13px; min-height: 18px; margin-top: 12px; color: var(--neg); }
.auth-foot {
  margin-top: 18px; font-size: 12px; color: var(--text-faint);
  line-height: 1.5; text-align: center;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-dim); margin-bottom: 7px; letter-spacing: 0.03em;
}
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 12px 13px; font-size: 15px; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder { color: var(--text-faint); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 18px; border-radius: var(--r-sm);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, opacity 0.15s;
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; }
.btn-accent { background: var(--accent); color: #0a0c0b; }
.btn-accent:hover { background: var(--accent-deep); }
.btn-ghost { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--text-faint); }
.btn-danger { background: rgba(255, 111, 94, 0.13); color: var(--neg); border-color: rgba(255, 111, 94, 0.25); }
.btn-danger:hover { background: rgba(255, 111, 94, 0.2); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 13px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { position: relative; z-index: 2; min-height: 100dvh; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  padding: 22px 16px; gap: 6px;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 8px 22px;
}
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--r-sm);
  color: var(--text-dim); font-weight: 600; font-size: 14.5px;
  transition: background 0.15s, color 0.15s;
  text-align: left; width: 100%;
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft); color: var(--accent);
}
.nav-logout { margin-top: auto; color: var(--text-faint); }
.nav-logout:hover { color: var(--neg); background: rgba(255, 111, 94, 0.08); }

.main {
  margin-left: var(--sidebar-w);
  min-height: 100dvh;
  padding: 0 30px 60px;
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  padding: 24px 0 18px;
  background: linear-gradient(180deg, var(--bg) 72%, transparent);
  backdrop-filter: blur(4px);
}
.topbar-head h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: 28px; letter-spacing: -0.02em;
}
.page-sub { color: var(--text-faint); font-size: 13px; margin-top: 3px; }
.topbar-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Filtro de período */
.period {
  display: flex; gap: 3px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 13px;
}
.chip {
  padding: 7px 13px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); color: #0a0c0b; }
.chip-cal { padding: 7px 9px; display: flex; }
.chip-cal svg { width: 16px; height: 16px; }
.period-custom {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-faint);
}
.period-custom input {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px; font-size: 13px; color: var(--text);
}
.btn-action { padding: 10px 16px; }

/* Views */
.view { display: none; }
.view.active { display: block; animation: rise 0.45s both; }

/* ============================================================
   COMPONENTES DE DADOS
   ============================================================ */

/* Hero — destaque do lucro */
.hero {
  background:
    radial-gradient(420px 200px at 88% 0%, rgba(199, 249, 91, 0.1), transparent 70%),
    linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--r); padding: 24px 26px;
  margin-bottom: 16px; position: relative; overflow: hidden;
}
.hero-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.hero-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hero-value {
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(34px, 6vw, 52px); letter-spacing: -0.02em;
  margin: 8px 0 4px; line-height: 1;
}
.hero-value.neg { color: var(--neg); }
.hero-value.pos { color: var(--accent); }
.hero-meta { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 16px; }
.hero-meta div { display: flex; flex-direction: column; gap: 2px; }
.hero-meta span { font-size: 12px; color: var(--text-faint); }
.hero-meta b { font-family: var(--font-mono); font-size: 15px; font-weight: 700; }

/* Grade de KPIs */
.kpi-grid {
  display: grid; gap: 13px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
}
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 17px;
  animation: rise 0.5s both;
}
.kpi:nth-child(1) { animation-delay: 0.03s; }
.kpi:nth-child(2) { animation-delay: 0.06s; }
.kpi:nth-child(3) { animation-delay: 0.09s; }
.kpi:nth-child(4) { animation-delay: 0.12s; }
.kpi:nth-child(5) { animation-delay: 0.15s; }
.kpi:nth-child(6) { animation-delay: 0.18s; }
.kpi:nth-child(7) { animation-delay: 0.21s; }
.kpi:nth-child(8) { animation-delay: 0.24s; }
.kpi-top {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  letter-spacing: 0.02em;
}
.kpi-ic {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.kpi-ic svg { width: 15px; height: 15px; }
.kpi-ic.gold { background: rgba(236, 196, 106, 0.13); color: var(--gold); }
.kpi-ic.neg { background: rgba(255, 111, 94, 0.13); color: var(--neg); }
.kpi-ic.info { background: rgba(116, 185, 230, 0.13); color: var(--info); }
.kpi-value {
  font-family: var(--font-mono); font-weight: 700;
  font-size: 23px; margin-top: 12px; letter-spacing: -0.02em;
}
.kpi-value.neg { color: var(--neg); }
.kpi-value.pos { color: var(--pos); }
.kpi-foot { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

/* Cartões / painéis */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px;
  margin-bottom: 16px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.panel-head h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 17px; letter-spacing: -0.01em;
}
.panel-head .sub { font-size: 12px; color: var(--text-faint); }

/* Barra de desempenho (proporção) */
.perf-bar {
  display: flex; height: 30px; border-radius: 9px; overflow: hidden;
  background: var(--surface-2); margin-bottom: 14px;
}
.perf-seg {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #0a0c0b;
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  min-width: 0; overflow: hidden; white-space: nowrap;
}
.perf-seg.trafego { background: var(--info); }
.perf-seg.despesas { background: var(--gold); }
.perf-seg.lucro { background: var(--accent); }
.perf-seg.prejuizo { background: var(--neg); }
.perf-legend { display: flex; gap: 18px; flex-wrap: wrap; }
.perf-legend div { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.lg-dot { width: 9px; height: 9px; border-radius: 3px; }

/* Gráfico */
.chart-host { width: 100%; }
.chart { display: block; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .line-r {
  fill: none; stroke: var(--accent); stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
}
.chart .line-c {
  fill: none; stroke: rgba(116, 185, 230, 0.6); stroke-width: 1.8;
  stroke-dasharray: 4 5; stroke-linecap: round; stroke-linejoin: round;
}
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 3; }
.chart .lbl { fill: var(--text-faint); font-size: 10px; font-family: var(--font-mono); }

/* Tira de resumo */
.summary {
  display: grid; gap: 11px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.sum-item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 13px 15px;
}
.sum-item .lbl { font-size: 11.5px; color: var(--text-dim); font-weight: 600; }
.sum-item .val {
  font-family: var(--font-mono); font-weight: 700;
  font-size: 19px; margin-top: 5px;
}
.sum-item .val.pos { color: var(--pos); }
.sum-item .val.neg { color: var(--neg); }
.sum-item .val.accent { color: var(--accent); }

/* Listas de dados */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 13px 15px;
  transition: border-color 0.15s, transform 0.12s;
}
.row:hover { border-color: var(--surface-3); }
.row-link { cursor: pointer; }
.row-link:hover { border-color: var(--accent); }
.row-main { flex: 1; min-width: 0; }
.row-title {
  font-weight: 600; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-sub {
  font-size: 12px; color: var(--text-faint); margin-top: 2px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.row-amount {
  font-family: var(--font-mono); font-weight: 700; font-size: 16px;
  text-align: right; white-space: nowrap;
}
.row-amount.pos { color: var(--pos); }
.row-amount.neg { color: var(--neg); }
.row-amount .tiny { display: block; font-size: 11px; color: var(--text-faint); font-weight: 500; }
.row-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); transition: background 0.15s, color 0.15s;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.del:hover { background: rgba(255, 111, 94, 0.12); color: var(--neg); }

/* Etiquetas */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}
.tag-dot { width: 6px; height: 6px; border-radius: 50%; }
.tag.ok { background: rgba(95, 214, 160, 0.13); color: var(--pos); }
.tag.wait { background: rgba(236, 196, 106, 0.13); color: var(--gold); }
.tag.bad { background: rgba(255, 111, 94, 0.13); color: var(--neg); }
.tag.neutral { background: var(--surface-2); color: var(--text-dim); }
.tag.plat { background: var(--surface-2); color: var(--text-dim); }
.tag.info { background: rgba(116, 185, 230, 0.14); color: var(--info); }
.tag.creative { background: rgba(199, 249, 91, 0.12); color: var(--accent); }

/* Estado vazio */
.empty {
  text-align: center; padding: 50px 20px; color: var(--text-faint);
}
.empty svg { width: 42px; height: 42px; opacity: 0.4; margin-bottom: 12px; }
.empty p { font-size: 14px; }
.empty .hint { font-size: 12.5px; margin-top: 5px; }

/* Banner do webhook */
.banner {
  display: flex; align-items: flex-start; gap: 13px;
  background: linear-gradient(120deg, var(--accent-soft), transparent);
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 17px; margin-bottom: 16px;
}
.banner svg { width: 20px; height: 20px; color: var(--accent); flex: none; margin-top: 1px; }
.banner-body { flex: 1; min-width: 0; }
.banner-body h3 { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.banner-body p { font-size: 12.5px; color: var(--text-dim); }
.code-line {
  display: flex; align-items: center; gap: 8px; margin-top: 9px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 11px;
}
.code-line code {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--accent);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Botão de ajustes na topbar (aparece no mobile) */
.tb-gear {
  display: none; width: 38px; height: 38px; border-radius: 11px;
  align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-dim);
}
.tb-gear svg { width: 19px; height: 19px; }

/* Indicador "ao vivo" + botão de atualizar */
.tb-live {
  display: flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 12px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text-dim); font-size: 12px; font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
}
.tb-live:hover { border-color: var(--text-faint); color: var(--text); }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--pos); animation: livePulse 2.4s infinite;
}
.live-ic { width: 14px; height: 14px; }
.tb-live.spin .live-ic { animation: spin360 0.6s ease; }
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(95, 214, 160, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(95, 214, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(95, 214, 160, 0); }
}
@keyframes spin360 { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Cartões de criativo */
.cre-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px 16px;
}
.cre-card.win { border-color: rgba(95, 214, 160, 0.32); }
.cre-card.lose { border-color: rgba(255, 111, 94, 0.3); }
.cre-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cre-name {
  font-weight: 700; font-size: 14.5px; min-width: 0;
  display: flex; align-items: center; gap: 9px;
}
.cre-name .dotc { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.cre-name b {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700;
}
.cre-roas {
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  padding: 4px 10px; border-radius: 999px; flex: none;
  background: var(--surface-2); color: var(--text-dim);
}
.cre-roas.good { background: var(--accent-soft); color: var(--accent); }
.cre-roas.bad { background: rgba(255, 111, 94, 0.13); color: var(--neg); }
.cre-stats {
  display: grid; gap: 8px; margin-top: 13px;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
}
.cre-stat { background: var(--bg-soft); border-radius: 9px; padding: 8px 10px; }
.cre-stat .l { font-size: 10.5px; color: var(--text-faint); font-weight: 600; }
.cre-stat .v {
  font-family: var(--font-mono); font-weight: 700; font-size: 14px; margin-top: 3px;
}
.cre-stat .v.pos { color: var(--pos); }
.cre-stat .v.neg { color: var(--neg); }
.cre-bar {
  height: 6px; border-radius: 3px; background: var(--surface-2);
  margin-top: 12px; display: flex; overflow: hidden;
}
.cre-bar i { display: block; height: 100%; }

/* Segmented control (entrada/saída, etc.) */
.seg {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.seg button {
  flex: 1; padding: 9px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}
.seg button.active { background: var(--surface-3); color: var(--text); }
.seg button.active[data-kind="entrada"] { background: rgba(95, 214, 160, 0.16); color: var(--pos); }
.seg button.active[data-kind="saida"] { background: rgba(255, 111, 94, 0.16); color: var(--neg); }

/* ============================================================
   DRAWER (formulários)
   ============================================================ */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5, 7, 6, 0.6); backdrop-filter: blur(3px);
  display: flex; justify-content: flex-end;
  animation: fade 0.2s both;
}
.drawer {
  width: 100%; max-width: 420px; height: 100%;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-left: 1px solid var(--line);
  padding: 24px; overflow-y: auto;
  animation: slideR 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.drawer-head h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
}
.drawer-foot { display: flex; gap: 10px; margin-top: 22px; }
.drawer-foot .btn { flex: 1; }
.calc-line {
  display: flex; justify-content: space-between;
  font-size: 13px; padding: 9px 0; color: var(--text-dim);
  border-top: 1px dashed var(--line);
}
.calc-line.total { color: var(--text); font-weight: 700; }
.calc-line b { font-family: var(--font-mono); }

/* Configurações */
.config-group { margin-bottom: 14px; }
.config-group .panel-head { margin-bottom: 14px; }
.kv {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px;
}
.kv:first-of-type { border-top: none; }
.kv .k { color: var(--text-dim); }

/* ============================================================
   TOASTS
   ============================================================ */
.toasts {
  position: fixed; z-index: 90; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 9px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-3); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); padding: 12px 16px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow);
  animation: slideU 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  max-width: 320px;
}
.toast.err { border-left-color: var(--neg); }
.toast.err svg { color: var(--neg); }
.toast svg { width: 17px; height: 17px; color: var(--accent); flex: none; }
.toast.out { animation: fadeOut 0.25s both; }

/* ============================================================
   ANIMAÇÕES
   ============================================================ */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(8px); } }
@keyframes slideR { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideU { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
.bottomnav { display: none; }

@media (max-width: 880px) {
  body { font-size: 14.5px; }
  .sidebar { display: none; }
  .tb-gear { display: flex; }
  .live-txt { display: none; }
  .main { margin-left: 0; padding: 0 16px 96px; }
  .topbar {
    padding: 16px 0 12px;
    position: sticky;
  }
  .topbar-head h1 { font-size: 23px; }
  .topbar-tools { width: 100%; }
  .period { flex: 1; justify-content: space-between; }
  .chip { flex: 1; padding: 8px 6px; text-align: center; }
  .btn-action {
    position: fixed; right: 16px; bottom: 80px; z-index: 40;
    width: 54px; height: 54px; border-radius: 50%; padding: 0;
    box-shadow: 0 12px 28px -8px rgba(199, 249, 91, 0.5);
  }
  .btn-action .lbl-txt { display: none; }
  .btn-action svg { width: 22px; height: 22px; }

  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--bg-soft); border-top: 1px solid var(--line);
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
  }
  .bn-item {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 2px; color: var(--text-faint); font-size: 9.5px; font-weight: 600;
    transition: color 0.15s;
  }
  .bn-item svg { width: 20px; height: 20px; }
  .bn-item span { white-space: nowrap; }
  .bn-item.active { color: var(--accent); }

  .drawer {
    max-width: 100%; height: auto; max-height: 92dvh;
    margin-top: auto; border-radius: 22px 22px 0 0;
    border-left: none; border-top: 1px solid var(--line);
    animation: slideU 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .drawer-backdrop { align-items: flex-end; }
  .hero-value { font-size: 38px; }
  .toasts { left: 16px; right: 16px; bottom: 90px; }
  .toast { max-width: none; }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 20px; }
  .summary { grid-template-columns: repeat(2, 1fr); }
}
