/* Identidade visual: troque as variáveis de marca (--brand*) quando tivermos a paleta oficial */
:root {
  color-scheme: dark;
  --brand: #22c55e;
  --brand-soft: color-mix(in srgb, var(--brand) 16%, transparent);
  --bg: #0b0c0f;
  --surface-1: #14161b;
  --surface-2: #1b1e24;
  --surface-3: #242830;
  --border: #262a32;
  --grid: #23262d;
  --text-primary: #f3f4f6;
  --text-secondary: #b3b7bf;
  --text-muted: #7c818b;
  --good: #34c77b;
  --bad: #f06a6a;
  --warn: #e0a83a;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface-1: #fcfcfb;
  --surface-2: #f3f3f1;
  --surface-3: #e9e9e6;
  --border: #e3e2de;
  --grid: #ecebe7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7d7c77;
  --good: #16803f;
  --bad: #c93434;
  --warn: #a86b00;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text-primary); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface-1); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 650; font-size: 15px; }
.brand img { height: 30px; max-width: 150px; object-fit: contain; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #04110a; display: grid; place-items: center; font-weight: 800; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--text-secondary); }
.nav a:hover { background: var(--surface-2); color: var(--text-primary); }
.nav a.active { background: var(--brand-soft); color: var(--text-primary); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding: 18px 10px 6px; }
.store-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; text-decoration: none; color: var(--text-secondary); }
.store-link:hover { background: var(--surface-2); }
.store-link.active { background: var(--surface-3); color: var(--text-primary); }
.avatar { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.side-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.main { min-width: 0; padding: 22px 26px 60px; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 16px; }
.topbar h1 { font-size: 21px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.subtitle { color: var(--text-muted); font-size: 12.5px; }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-secondary); font-size: 12.5px; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); display: inline-block; }
.dot.ok { background: var(--good); } .dot.run { background: var(--warn); animation: pulse 1s infinite; } .dot.err { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-primary); cursor: pointer; text-decoration: none; font-size: 13px; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #04110a; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--text-secondary); padding: 6px 11px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.seg button:hover { color: var(--text-primary); }
.seg button.on { background: var(--surface-3); color: var(--text-primary); }
.range { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12.5px; }
.input, .range input, select.input { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 6px 9px; color: var(--text-primary); min-width: 0; }
.input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.check { display: inline-flex; gap: 7px; align-items: center; color: var(--text-secondary); font-size: 13px; cursor: pointer; }

.banner { border: 1px solid var(--border); background: var(--surface-1); border-left: 3px solid var(--warn); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; color: var(--text-secondary); }
.banner.err { border-left-color: var(--bad); }
.flash { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.flash li { background: var(--surface-1); border: 1px solid var(--border); padding: 9px 13px; border-radius: 10px; white-space: pre-wrap; }

/* cards */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis-2 { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 14px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card h3 { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.card .hint { color: var(--text-muted); font-size: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.stat .label { color: var(--text-secondary); font-size: 12.5px; display: flex; align-items: center; gap: 5px; }
.stat .value { font-size: 23px; font-weight: 650; letter-spacing: -.015em; margin-top: 6px; }
.stat .sub { color: var(--text-muted); font-size: 12px; margin-top: 3px; }
.stat.hero { background: linear-gradient(150deg, color-mix(in srgb, var(--brand) 22%, var(--surface-1)), var(--surface-1) 70%); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
.stat.hero .value { font-size: 30px; }
.delta { font-size: 12px; font-weight: 600; margin-left: 4px; white-space: nowrap; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); } .delta.flat { color: var(--text-muted); }
.spark { height: 34px; margin-top: 8px; }
.tip { cursor: help; color: var(--text-muted); font-size: 11px; border: 1px solid var(--border); border-radius: 50%; width: 15px; height: 15px; display: inline-grid; place-items: center; }

.row-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; margin-top: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.stack { display: grid; gap: 14px; align-content: start; }
.chart-box { position: relative; height: 320px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; color: var(--text-secondary); font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.list { display: grid; gap: 2px; }
.list .li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--grid); color: var(--text-secondary); }
.list .li:last-child { border-bottom: 0; }
.list .li b { color: var(--text-primary); font-weight: 600; }

.funnel-step { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.funnel-step:last-of-type { border-bottom: 0; }
.funnel-step .v { font-size: 18px; font-weight: 650; }
.funnel-bars { display: grid; gap: 6px; margin-top: 12px; }
.fbar { display: grid; grid-template-columns: 78px 1fr 48px; gap: 8px; align-items: center; font-size: 12px; color: var(--text-secondary); }
.fbar .track { height: 10px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.fbar .fill { height: 100%; background: var(--series-1); border-radius: 4px; }

.meter { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; margin: 10px 0 6px; }
.meter > div { height: 100%; background: var(--brand); border-radius: 5px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface-1); }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t .r { text-align: right; }
.t tbody tr:hover { background: var(--surface-2); }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-secondary); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.paid { color: var(--good); } .badge.pending, .badge.analysis { color: var(--warn); }
.badge.cancelled { color: var(--text-muted); } .badge.refunded, .badge.chargeback, .badge.refused { color: var(--bad); }
.editable { cursor: pointer; border-bottom: 1px dashed var(--text-muted); }
.editable.ov { border-bottom-color: var(--warn); }
.warn-ic { color: var(--warn); }
.pos { color: var(--good); } .neg { color: var(--bad); }

.empty { padding: 40px; text-align: center; color: var(--text-muted); }
.skeleton { color: transparent !important; background: var(--surface-3); border-radius: 6px; animation: pulse 1.2s infinite; }

/* forms */
.form { display: grid; gap: 14px; max-width: 880px; }
.form fieldset { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); padding: 16px 18px; margin: 0; display: grid; gap: 12px; }
.form legend { padding: 0 6px; font-weight: 600; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { display: grid; gap: 5px; }
.field label { color: var(--text-secondary); font-size: 12.5px; }
.field .input { width: 100%; }
.help { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.help code, code { background: var(--surface-3); padding: 1px 5px; border-radius: 5px; font-size: 12px; word-break: break-all; }
.copy { display: flex; gap: 6px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }

.mobile-top { display: none; }

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis-2 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row-main { grid-template-columns: 1fr; }
  .row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); }
  .mobile-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-1); position: sticky; top: 0; z-index: 30; }
  .main { padding: 16px 16px 60px; }
  .kpis, .kpis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat.hero { grid-column: 1 / -1; }
  .row-3 { grid-template-columns: 1fr; }
  .chart-box { height: 260px; }
  .stat .value { font-size: 20px; }
}

/* ajustes */
.list .li > span { min-width: 0; }
.list .li > b { white-space: nowrap; flex: none; }
.chart-card { display: flex; flex-direction: column; }
.chart-card .chart-box { flex: 1; min-height: 320px; }

/* marca G2 */
.brand { text-decoration: none; color: var(--text-primary); letter-spacing: -.01em; }
.logo-mark { height: 22px; width: auto; color: var(--text-primary); flex: none; display: block; }
.login-brand { flex-direction: column; align-items: center; gap: 14px; padding: 4px 0 10px; font-size: 20px; }
.login-brand .logo-mark { height: 46px; }
