/* ============================================================ tokens */
:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --surface-3: #f0efec;
  --border: #e6e5df;
  --border-strong: #d6d5ce;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6a64;
  --grid: #ecebe6;
  --baseline: #c3c2b7;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-soft: #e9f1fc;
  --s1: #2a78d6;  /* Loja */
  --s2: #eb6834;  /* Distribuidora */
  --s0: #4b5563;  /* série única, sem canal */
  --deemph: #cfcec6;
  --good: #006300;  --good-bg: #e7f4e7;
  --bad: #b42318;   --bad-bg: #fdecea;
  --st-good: #0a7d0a; --st-warn: #fab219; --st-serious: #ec835a; --st-crit: #d03b3b;
  --st-parado: #c8402f; --st-antigo: #b9b8b0;
  --warn-ink: #8a5a00;
  --ano-1: #c4c3bb; --ano-2: #8f8e87;
  --heat-0: #a9cbf5; --heat-1: #86b6ef; --heat-2: #5d9be8; --heat-3: #3987e5; --heat-4: #256abf; --heat-5: #184f95; --heat-6: #0d366b;
  --heat-label: #ffffff;
  --side-bg: #0f1b2d;
  --side-ink: #e8ecf2;
  --side-muted: #93a0b4;
  --side-hover: rgba(255,255,255,.06);
  --side-active: rgba(57,135,229,.18);
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.12), 0 2px 6px rgba(16,24,40,.06);
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #1f1f1e;
  --surface-3: #262624;
  --border: #2c2c2a;
  --border-strong: #3a3a37;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #9a9993;
  --grid: #2c2c2a;
  --baseline: #383835;
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-soft: rgba(57,135,229,.15);
  --s1: #3987e5;
  --s2: #d95926;
  --s0: #dfe3e8;
  --deemph: #4a4a46;
  --good: #4cc94c;  --good-bg: rgba(76,201,76,.14);
  --bad: #ff8a80;   --bad-bg: rgba(255,138,128,.14);
  --st-good: #2f9e2f; --st-parado: #e0624f; --st-antigo: #6b6b66;
  --warn-ink: #f5c46b;
  --ano-1: #5c5c57; --ano-2: #8f8e87;
  --heat-0: #1d2a3d; --heat-1: #1f3b63; --heat-2: #245089; --heat-3: #2f6bb5; --heat-4: #4f8fdb; --heat-5: #86b6ef; --heat-6: #cde2fb;
  --heat-label: #0b0b0b;
  --side-bg: #111110;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.45;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.mobile-only, .brand-row.mobile-only { display: none; }

/* ============================================================ login */
.brand-row { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.pw { position: relative; }
.pw input { padding-right: 84px; }
.pw-toggle {
  position: absolute; right: 6px; top: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--accent-ink); font-weight: 600; cursor: pointer; font-size: 13px;
}
.pw-toggle:hover { background: var(--accent-soft); }
.btn-primary {
  margin-top: 24px; height: 46px; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; transition: background .15s;
}
.btn-primary:hover { background: var(--accent-ink); }
.btn-primary:disabled { opacity: .7; cursor: wait; }
.alert {
  background: var(--bad-bg); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 4px;
}

/* ============================================================ shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--side-bg); color: var(--side-ink); padding: 22px 14px 16px;
  display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh;
}
.side .brand-row { padding: 0 8px; font-size: 16px; }
.store-chip {
  display: flex; align-items: center; gap: 8px; margin: 0 4px; padding: 9px 12px;
  border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: rgba(255,255,255,.03);
  font-weight: 600; font-size: 13.5px;
}
.store-chip[hidden] { display: none; }
.store-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-good); box-shadow: 0 0 0 3px rgba(12,163,12,.2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px;
  color: var(--side-muted); text-decoration: none; font-weight: 500; transition: background .12s, color .12s;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--side-hover); color: var(--side-ink); }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; }
.nav a[aria-current="page"] svg { color: #86b6ef; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.fresh { font-size: 12px; color: var(--side-muted); padding: 0 8px; }
.user { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid rgba(255,255,255,.08); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #1c5cab; color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none;
}
.user-txt { display: flex; flex-direction: column; min-width: 0; }
.user-txt strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-txt span { font-size: 12px; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-actions { display: flex; gap: 6px; }
.side-actions form { flex: 1; display: flex; }
.ghost {
  flex: 1; height: 32px; border: 1px solid rgba(255,255,255,.1); background: transparent; color: var(--side-muted);
  border-radius: 8px; cursor: pointer; font-size: 12.5px;
}
.ghost:hover { color: var(--side-ink); background: var(--side-hover); }

.main { min-width: 0; padding: 26px 32px 40px; max-width: 1480px; width: 100%; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.title-wrap h1 { font-size: 26px; font-weight: 700; }
.title-wrap p { margin: 4px 0 0; }
.foot { margin-top: 28px; font-size: 12.5px; }

/* ============================================================ filtros */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ctl {
  height: 38px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm);
  padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; box-shadow: var(--shadow);
  font-weight: 500; white-space: nowrap;
}
.ctl:hover { border-color: var(--baseline); }
.ctl svg { width: 16px; height: 16px; color: var(--muted); }
.ctl .chev { margin-left: 2px; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 7px; cursor: pointer;
  color: var(--ink-2); font-weight: 500;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dd { position: relative; }
.pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; display: none;
}
.dd.open .pop { display: block; }
.pop .opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.pop .opt:hover { background: var(--surface-3); }
.pop .opt .check { font-weight: 800; color: var(--accent); visibility: hidden; }
.pop .opt[aria-checked="true"] .check { visibility: visible; }
.pop .opt[aria-checked="true"] { font-weight: 600; }
.pop .sep { height: 1px; background: var(--border); margin: 6px 4px; }
.pop .range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 6px 6px 4px; }
.pop .range label { font-size: 12px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }
.pop .range input { height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 8px; background: var(--surface); }
.pop .apply { margin: 6px; height: 34px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; width: calc(100% - 12px); }
.pop .cb { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.pop .cb:hover { background: var(--surface-3); }
.pop .cb input { accent-color: var(--accent); width: 16px; height: 16px; }
.pop .pop-head { display: flex; justify-content: space-between; padding: 6px 10px; font-size: 12px; color: var(--muted); }
.pop .link { border: 0; background: none; color: var(--accent-ink); cursor: pointer; font-size: 12px; padding: 0; }
.badge-count { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 600; }

/* ============================================================ grid e cards */
/* minmax(0, …) em tudo: gráficos SVG não podem forçar a largura do grid */
.view { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.row { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.r-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.r-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.r-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.r-21 { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.r-32 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; min-width: 0;
}
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-h h2 { font-size: 15.5px; font-weight: 600; }
.card-h p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); }
.card-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.chart { width: 100%; height: 320px; overflow: hidden; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 14px; position: relative; overflow: hidden; }
.kpi .lbl { color: var(--ink-2); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.kpi .sub { font-size: 12.5px; color: var(--muted); }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.kpi-top > div { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.kpi .val { white-space: nowrap; }
.kpi .spark { width: 80px; }
.spark-wrap { margin: 4px 0 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.spark-wrap figcaption { font-size: 10.5px; color: var(--muted); }
.cmp { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.cmp-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmp-txt { font-size: 12.5px; color: var(--ink-2); }
.cmp-prev { font-size: 12px; color: var(--muted); padding-top: 6px; border-top: 1px dashed var(--border); margin-top: 4px; }
.delta {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--ink-2); background: var(--surface-3); }
.delta-ctx { font-size: 11.5px; color: var(--muted); margin-left: 6px; }
.spark { width: 96px; height: 30px; flex: none; }
.spark path.l { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark path.a { fill: var(--accent-soft); }
.spark circle { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.tip {
  color: var(--muted); cursor: pointer; border: 1px solid var(--border-strong); border-radius: 50%; background: transparent;
  width: 17px; height: 17px; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; padding: 0; line-height: 1;
}
.tip:hover, .help.open .tip { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.help { position: relative; display: inline-flex; vertical-align: middle; }
.help-pop {
  display: none; position: absolute; z-index: 40; top: calc(100% + 8px); left: -12px; width: min(340px, 80vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 14px 16px; color: var(--ink); font-size: 13px; font-weight: 400; line-height: 1.5; text-transform: none; letter-spacing: 0;
}
.help.open .help-pop { display: block; }
.help-pop strong { display: block; font-size: 13.5px; margin-bottom: 6px; }
.help-pop p { margin: 0 0 8px; color: var(--ink-2); }
.help-pop p:last-child { margin-bottom: 0; }
.help-pop .ex { background: var(--surface-3); border-radius: 8px; padding: 8px 10px; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi:last-child .help-pop, .card-h .help-pop.right { left: auto; right: -12px; }
.help-ok { display: none; }
.kpi { overflow: visible; }

/* curva ABC */
.abc-bars { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 14px; align-items: center; margin: 4px 0 18px; }
.abc-bars .lbl { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.abc-bars .segbar { height: 30px; border-radius: 8px; }
.abc-bars .segbar div { font-size: 12px; }
.abc-A { background: #184f95; } .abc-B { background: #3987e5; } .abc-C { background: #86b6ef; color: #0b0b0b !important; }
.abc-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.abc-col { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); }
.abc-col .hd { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.abc-col .hd .curva { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
.abc-col .hd .curva.A { background: #184f95; } .abc-col .hd .curva.B { background: #3987e5; color: #fff; }
.abc-col .hd .curva.C { background: #86b6ef; color: #0b0b0b; }
.abc-col .big { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.abc-col .meta { font-size: 12.5px; color: var(--ink-2); }
.abc-col p { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.abc-col p b { color: var(--ink); font-weight: 600; }
.curva.A { background: #184f95; color: #fff; } .curva.B { background: #3987e5; color: #fff; } .curva.C { background: #86b6ef; color: #0b0b0b; }

/* variação por canal e variação real, sob os KPIs */
.canais { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.canal-var { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.canal-var i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.pos { color: var(--good); font-weight: 600; }
.neg { color: var(--bad); font-weight: 600; }
.real { font-size: 12px; color: var(--ink-2); margin-top: 6px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* destaques */
.insights li.destaque-feature { background: var(--accent-soft); border-radius: 10px; padding: 11px 12px; margin: 4px -12px; border-bottom: 0; }
.insight-link { color: inherit; text-decoration: none; }
.insight-link .go { color: var(--accent-ink); font-weight: 600; white-space: nowrap; }
.insight-link:hover .go { text-decoration: underline; }
.insights .ic.feat { background: var(--accent); color: #fff; }
.nav-novo {
  margin-left: auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--st-warn); color: #0b0b0b; border-radius: 999px; padding: 1px 7px;
}

/* pedido de compra */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; align-items: center;
  background: radial-gradient(900px 300px at 100% 0%, rgba(57,135,229,.16), transparent 60%), var(--surface);
}
.hero h2 { font-size: 22px; font-weight: 700; margin: 8px 0 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero p { margin: 0; color: var(--ink-2); max-width: 56ch; }
.tag-novo { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 9px; }
.hero-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hero-kpis > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; }
.hero-kpis span { font-size: 12px; color: var(--ink-2); }
.hero-kpis b { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.hero-kpis .alerta b { color: var(--bad); }
.forn-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }
.forn-list { display: grid; gap: 12px; }
details.forn { padding: 0; overflow: hidden; }
details.forn summary { list-style: none; cursor: pointer; padding: 16px 20px; }
details.forn summary::-webkit-details-marker { display: none; }
details.forn[open] summary { border-bottom: 1px solid var(--border); }
details.forn .tbl-wrap { margin: 0; }
details.forn .tbl th:first-child, details.forn .tbl td:first-child { padding-left: 20px; }
.forn-h { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; }
.forn-h h2 { font-size: 15.5px; font-weight: 600; }
.forn-h h2::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--muted); transition: transform .15s; }
details.forn[open] .forn-h h2::before { transform: rotate(90deg); }
.forn-h p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); }
.forn-tot { text-align: right; display: flex; flex-direction: column; }
.forn-tot span { font-size: 18px; font-weight: 700; }
.forn-tot small { font-size: 11px; color: var(--muted); }
.forn-acoes { display: flex; gap: 6px; }
.forn-mais { padding: 12px 20px; border-top: 1px solid var(--border); }
.btn-sm.wa { background: #148443; border-color: #148443; color: #fff; text-decoration: none; }
.btn-sm.wa:hover { background: #0f6b36; }
.insights { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.insights li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.insights li:last-child { border-bottom: 0; }
.insights .ic {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
}
.insights .ic.warn { background: color-mix(in srgb, var(--st-serious) 16%, transparent); color: var(--warn-ink); }
.insights .ic svg { width: 16px; height: 16px; }
.insights b { font-weight: 600; }

/* legenda */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* barra segmentada */
.segbar { display: flex; height: 44px; border-radius: 10px; overflow: hidden; gap: 2px; background: var(--surface); }
.segbar div { display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; }
.segbar .dark-txt { color: #0b0b0b; }

/* info */
.banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.banner svg { width: 20px; height: 20px; color: var(--accent-ink); flex: none; margin-top: 1px; }

/* tabela */
.tbl-tools { display: flex; gap: 8px; align-items: center; }
.search {
  height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 10px 0 32px; width: 220px;
  background: var(--surface) no-repeat 10px center / 14px; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23898781' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-sm {
  height: 34px; padding: 0 12px; border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 8px; cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn-sm:hover { background: var(--surface-3); }
.btn-sm:disabled { opacity: .45; cursor: default; }
.btn-sm svg { width: 15px; height: 15px; }
.tbl-wrap { overflow-x: auto; margin: 0 -20px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
  padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; user-select: none; position: sticky; top: 0; vertical-align: bottom; line-height: 1.3;
}
.tbl th.r { min-width: 84px; }
.tbl td { white-space: nowrap; }
.tbl td.wrap { white-space: nowrap; max-width: 340px; }
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl th .arr { opacity: .35; margin-left: 4px; }
.tbl th[aria-sort] .arr { opacity: 1; color: var(--accent); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl td.wrap { max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.tbl-foot .pg { display: flex; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.curva { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-weight: 700; font-size: 12px; }
.curva.A { background: var(--accent); color: #fff; }
.curva.B { background: var(--accent-soft); color: var(--accent-ink); }
.curva.C { background: var(--surface-3); color: var(--ink-2); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* esqueleto de carregamento */
.sk { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* tooltip ECharts */
.tt { font-family: var(--font); font-size: 12.5px; min-width: 140px; }
.tt .tt-h { color: var(--ink-2); margin-bottom: 4px; }
.tt .tt-r { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.tt .tt-r b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tt .k { display: inline-block; width: 10px; height: 2px; margin-right: 6px; vertical-align: middle; }

/* ============================================================ responsivo */
@media (max-width: 1180px) {
  .r-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r-21, .r-32 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .mobile-only { display: block; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side, .nav { min-width: 0; }
  .main { padding: 18px 16px 104px; }
  .r-2, .r-3, .abc-cols { grid-template-columns: minmax(0, 1fr); }
  .abc-bars { grid-template-columns: 76px minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .forn-h { grid-template-columns: minmax(0, 1fr) auto; }
  .forn-acoes { grid-column: 1 / -1; }
  /* no celular a explicação abre como painel fixo embaixo, sem vazar da tela */
  .help-pop, .kpi:last-child .help-pop, .card-h .help-pop.right {
    position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; width: auto; max-height: 70vh; overflow-y: auto;
  }
  .topbar { align-items: stretch; }
  .filters { width: 100%; }
  .search { width: 100%; }
  .card-h { flex-wrap: wrap; }
  .tbl-tools { width: 100%; }
}
@media (max-width: 520px) {
  /* no celular, um card por linha: a frase de comparação precisa de espaço */
  .r-4 { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 24px; }
  .title-wrap h1 { font-size: 22px; }
}

/* ---------- Produtos: ranking, aviso, histórico (modal) ---------- */
.card-h.wrap { flex-wrap: wrap; }
.card-h.wrap > div:first-child { flex: 1 1 320px; min-width: 0; }
.tt .tt-foot { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11.5px; }
button.link { border: 0; background: none; padding: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
button.link:hover, button.link:focus-visible { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.card.aviso { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; font-size: 13.5px;
  background: color-mix(in srgb, var(--st-warn) 12%, var(--surface)); border-color: color-mix(in srgb, var(--st-warn) 45%, var(--border)); }
.card.aviso .ic { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--st-warn) 30%, transparent); color: var(--warn-ink); }
.card.aviso .ic svg { width: 16px; height: 16px; }

body.modal-on { overflow: hidden; }
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 25, .55); display: block;
  padding: 4vh 16px; overflow-y: auto; }
.modal { width: min(1040px, 100%); margin: 0 auto; min-width: 0; background: var(--bg); border-radius: 16px; box-shadow: 0 24px 64px rgba(0,0,0,.3); }
.modal-h { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 20px 24px 14px;
  position: sticky; top: -4vh; background: var(--bg); border-radius: 16px 16px 0 0; z-index: 2; border-bottom: 1px solid var(--border); }
.modal-h h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.modal-h p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-h .x { border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); width: 34px; height: 34px; flex: none;
  border-radius: 10px; font-size: 22px; line-height: 1; cursor: pointer; }
.modal-h .x:hover { color: var(--ink); border-color: var(--ink-2); }
.modal-body { padding: 18px 24px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.modal-sec h3 { margin: 0; font-size: 15px; }
.modal-sec .card-h p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.pv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.pv-c { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.pv-l { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.pv-l i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pv-l i.dash { height: 0; border-radius: 0; border-top: 2px dashed var(--muted); width: 14px; background: none !important; }
.pv-val { font-size: 20px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; }
.pv-mes { font-size: 12px; font-weight: 500; color: var(--muted); }
.pv-de { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pv-d { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.pv-d.bom { color: var(--good); background: var(--good-bg); }
.pv-d.ruim { color: var(--bad); background: var(--bad-bg); }
.pv-d.neutro, .pv-d.flat { color: var(--ink-2); background: var(--surface-3); }
.insights.compact li { padding: 8px 0; font-size: 13.5px; }
.nota.warn { margin: 0 0 10px; font-size: 13px; padding: 10px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--st-warn) 12%, transparent); color: var(--ink); }
.tbl-scroll { overflow-x: auto; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.mini th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.mini td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.mini tr:last-child td { border-bottom: 0; }
table.mini .r { text-align: right; }
@media (max-width: 520px) {
  .modal-bg { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; }
  .modal-h { top: 0; border-radius: 0; padding: 14px 16px 12px; }
  .modal-body { padding: 14px 16px 20px; }
  .modal-sec { padding: 14px; }
  .pv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .pv-val { font-size: 17px; }
  .card-h.wrap .seg { width: 100%; overflow-x: auto; }
  .card-h.wrap .seg button { flex: 1 0 auto; }
}

/* ---------- Visão geral: alternar faturamento/lucro ---------- */
.card-h-r { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
/* ---------- Quando vende: leitura e resumo ---------- */
.card.leitura { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; font-size: 13.5px; line-height: 1.5;
  background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }
.card.leitura .ic { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--surface); color: var(--accent-ink); }
.card.leitura .ic svg { width: 16px; height: 16px; }
.leitura-acao { margin-top: 10px; }
.card.resumo .lbl { font-size: 12.5px; color: var(--ink-2); }
.card.resumo .rv { font-size: 20px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; }
.card.resumo .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
/* ---------- seletor de período com datas ---------- */
.pop .pop-h { font-size: 11.5px; color: var(--muted); padding: 4px 10px 6px; }
.pop .opt .opt-t { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.pop .opt .opt-t small { font-size: 11.5px; color: var(--muted); font-weight: 400; }
@media (max-width: 860px) { .card-h-r { align-items: flex-start; } }


/* ============================================================ revisão UI/UX (nov/2026) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* foco visível para quem usa teclado (T24) */
:where(a, button, input, select, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.side :where(a, button):focus-visible { outline-color: #86b6ef; }
.search:focus-visible { outline: 2px solid var(--accent); }
h1:focus { outline: none; }

/* KPI: rótulo · valor · minigráfico em linha própria · comparação (T6) */
.kpi { gap: 4px; }
.kpi .lbl { margin-bottom: 2px; }
.kpi .spark-row { margin: 4px 0 6px; height: 28px; }
.kpi .spark-row .spark { width: 100%; height: 28px; }
.kpi .spark-row path { vector-effect: non-scaling-stroke; }
.kpi .spark-row circle { display: none; }
.kpi .cmp-line { margin-top: 2px; }
.kpi .cmp-txt { font-size: 12px; }
.kpi .real { margin-top: 4px; }

/* gráfico que preenche a altura do card ao lado (T12) */
.card-fill { display: flex; flex-direction: column; }
.card-fill .chart { flex: 1; min-height: 320px; }

/* destaques em dois grupos, com ação (T13) */
.dest-grupos { display: flex; flex-direction: column; gap: 14px; }
.dest-h { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 2px; }
.insights a.go { color: var(--accent-ink); font-weight: 600; white-space: nowrap; text-decoration: none; }
.insights a.go:hover { text-decoration: underline; }

/* filtros: avisos fixos e explicação do canal (T8, T21) */
.canal-f { display: inline-flex; align-items: center; gap: 6px; }
.chip-fixo { height: 38px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); color: var(--ink-2); font-size: 13px; cursor: help; white-space: nowrap; }
.pop .pop-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pop .pop-h strong { font-size: 13px; color: var(--ink); }
.pop .pop-sub { font-size: 12px; color: var(--ink-2); padding: 2px 10px 0; }
.pop .range-msg { color: var(--bad); font-size: 12.5px; padding: 0 10px; min-height: 0; }
.pop .range-msg:empty { display: none; }
.pop .apply:disabled { opacity: .45; cursor: not-allowed; }
.pop .range input { width: 100%; }

/* tabelas: cabeçalho como botão; rolagem com sombra; menos aperto (T23, T24) */
.th-btn { all: unset; cursor: pointer; display: inline-flex; align-items: flex-end; gap: 2px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.th-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.tbl th, .tbl td { padding-left: 10px; padding-right: 10px; }
.tbl td.wrap { max-width: 300px; }
button.link { max-width: 300px; }
.tbl-wrap {
  background:
    linear-gradient(to right, var(--surface), var(--surface)) left center / 24px 100% no-repeat local,
    linear-gradient(to left, var(--surface), var(--surface)) right center / 24px 100% no-repeat local,
    linear-gradient(to right, rgba(0,0,0,.09), transparent) left center / 14px 100% no-repeat scroll,
    linear-gradient(to left, rgba(0,0,0,.09), transparent) right center / 14px 100% no-repeat scroll;
}
.ord-sel { display: none; }
.dica { font-size: 12px !important; color: var(--muted) !important; }

/* estoque: legenda com valores (T15) */
.seg-lista { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); }
.seg-lista li { display: inline-flex; align-items: center; gap: 6px; }
.seg-lista i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.seg-lista b { color: var(--ink); font-weight: 600; }
.seg-lista small { color: var(--muted); font-size: 12px; }

/* pedido de compra (T5) */
.passos { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 8px; counter-reset: p; font-size: 13px; }
.passos li { counter-increment: p; display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px 3px 4px; color: var(--ink-2); }
.passos li::before { content: counter(p); width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700; }
details.forn summary { padding: 12px 20px; min-height: 56px; display: flex; align-items: center; }
details.forn summary .forn-h { width: 100%; }
.forn-h { grid-template-columns: minmax(0, 1fr) auto 24px; }
.forn-h h2::before { content: none; }
.forn-h h2 { font-size: 15px; }
.chev-forn { display: grid; place-items: center; color: var(--muted); transition: transform .15s; }
.chev-forn svg { width: 20px; height: 20px; }
details.forn[open] .chev-forn { transform: rotate(180deg); }
.forn-h .acabou { color: var(--bad); font-weight: 600; }
.forn-corpo .forn-acoes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.forn-corpo .forn-acoes .muted { font-size: 12.5px; }
.mais-forn { width: 100%; justify-content: center; height: 44px; }
.copia-manual { width: calc(100% - 40px); margin: 0 20px 12px; font: 13px/1.4 ui-monospace, monospace; padding: 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--ink); }
.forn-corpo > .nota.warn { margin: 12px 20px 8px; }

/* modal do produto (T26) */
.modal-h h2 { font-size: 20px; font-weight: 600; }
.pv { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.pv-g { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.pv-g i, .legend i.dash { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pv-g i.dash, .legend i.dash { height: 0; width: 14px; border-radius: 0; border-top: 2px dashed var(--muted); background: none !important; }
.pv-i + .pv-i { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.empty .acoes { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }

/* erro com ação (T25) e aviso rápido */
.card.erro h2 { font-size: 16px; color: var(--ink); margin-bottom: 4px; }
.card.erro p { margin: 0 0 14px; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow-lg); transition: opacity .3s, transform .3s; max-width: min(92vw, 460px); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* menu: selo "novo" vira um ponto (T28) */
.nav-novo { width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--st-warn); font-size: 0; margin-left: auto; flex: none; }
.nav a .curto, .nav-mais, .mais-sheet { display: none; }


/* ------------------------------------------------ tablet / celular */
@media (max-width: 1180px) {
  .r-21 > .dest { order: -1; } /* destaques antes do gráfico quando empilha */
}
@media (max-width: 860px) {
  /* navegação: barra inferior fixa com 4 páginas + "Mais" (T3) */
  .side {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 50; height: auto; flex-direction: row; align-items: stretch;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); gap: 0; border-top: 1px solid rgba(255,255,255,.1);
  }
  .side .brand-row, .store-chip, .side-foot { display: none; }
  .nav { flex-direction: row; flex: 1; gap: 2px; }
  .nav a, .nav-mais {
    flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; align-items: center; gap: 3px; padding: 6px 2px;
    min-height: 54px; font-size: 11px; position: relative; white-space: nowrap; border-radius: 10px;
  }
  .nav a .full { display: none; }
  .nav a .curto, .nav-mais .curto { display: block; }
  .nav a.sec { display: none; }
  .nav-mais { display: flex; border: 0; background: transparent; color: var(--side-muted); cursor: pointer; font: inherit; font-size: 11px; }
  .nav-mais svg { width: 20px; height: 20px; }
  .side.mais-open .nav-mais { color: #fff; background: var(--side-active); }
  .nav-novo { position: absolute; top: 6px; right: calc(50% - 16px); margin: 0; }
  .mais-sheet { display: none; }
  .side.mais-open .mais-sheet {
    display: flex; flex-direction: column; gap: 2px; position: fixed; left: 8px; right: 8px; bottom: calc(68px + env(safe-area-inset-bottom));
    background: var(--side-bg); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 8px; box-shadow: 0 -8px 32px rgba(0,0,0,.35); z-index: 51;
  }
  .mais-sheet a, .mais-sheet button {
    display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 10px; color: var(--side-ink);
    text-decoration: none; background: transparent; border: 0; font: inherit; font-size: 15px; cursor: pointer; width: 100%; text-align: left;
  }
  .mais-sheet a svg, .mais-sheet button svg { width: 20px; height: 20px; color: var(--side-muted); }
  .mais-sheet a[aria-current="page"] { background: var(--side-active); }
  .mais-sheet .sheet-sep { height: 1px; background: rgba(255,255,255,.1); margin: 6px 4px; }
  .mais-sheet .sheet-info { color: var(--side-muted); font-size: 12px; padding: 4px 12px 2px; }
  .mais-sheet form { display: block; }

  /* alvos de toque ≥ 44px (T22) */
  .seg button, .ctl, .btn-sm, .chip-fixo { min-height: 44px; }
  .tip { position: relative; }
  .tip::after { content: ""; position: absolute; inset: -12px; }
  .help-ok { display: block; width: 100%; min-height: 44px; margin-top: 12px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
  .canal-f { flex: 1 1 auto; }
}
@media (max-width: 640px) {
  /* período/departamentos como painel inferior (T2) */
  .dd.open::after { content: ""; position: fixed; inset: 0; background: rgba(10,14,25,.45); z-index: 59; }
  .dd.open .pop {
    position: fixed; left: 10px; right: 10px; bottom: 10px; top: auto; min-width: 0; max-height: 78vh; overflow-y: auto;
    border-radius: 16px; z-index: 60; padding: 10px;
  }
  .pop .opt, .pop .cb { min-height: 46px; }
  .pop .apply { height: 46px; }
  .pop .range input { height: 44px; font-size: 16px; }

  /* tabelas viram lista de cartões (T1) */
  .tbl-wrap { margin: 0 -20px; background: none; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody { display: block; width: 100%; }
  .tbl tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 14px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
  .tbl tr:hover td { background: none; }
  .tbl td { display: flex; flex-direction: column; padding: 0 !important; border: 0; white-space: normal; text-align: left !important; min-width: 0; }
  .tbl td::before { content: attr(data-label); font-size: 11.5px; color: var(--muted); text-transform: none; }
  .tbl td:first-child { grid-column: 1 / -1; font-weight: 600; font-size: 14px; }
  .tbl td:first-child::before { display: none; }
  .tbl td.wrap { max-width: none; white-space: normal; overflow: visible; }
  .tbl td.empty { grid-column: 1 / -1; text-align: center !important; }
  .tbl td.empty::before { display: none; }
  .tbl .hide-m { display: none !important; }
  button.link { max-width: none; white-space: normal; font-weight: 600; color: var(--accent-ink); }
  .ord-sel { display: block; width: 100%; height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); padding: 0 10px; }
  .tbl-tools { flex-wrap: wrap; }
  .tbl-foot { flex-wrap: wrap; gap: 8px; }
  details.forn .tbl tr { padding: 12px 20px; }

  /* estoque: só a barra fina + lista (T15) */
  .segbar { height: 16px; }
  .segbar div { font-size: 0; }
  .seg-lista { flex-direction: column; gap: 8px; }
  .seg-lista li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 40px; gap: 10px; }
  .seg-lista small { text-align: right; }

  /* KPIs 2 × 2, sem minigráfico (T6) */
  .r-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .val { font-size: 22px; white-space: normal; }
  .kpi .spark-row { display: none; }
  .kpi .cmp-txt { display: none; }
  .kpi .canais { font-size: 11px; gap: 2px 8px; }
  .kpi .real { font-size: 11px; }
  .kpi .lbl { font-size: 12px; }
  .chip-fixo { height: 36px; }
  .forn-h { grid-template-columns: minmax(0, 1fr) auto 20px; gap: 10px; }
  .forn-tot span { font-size: 15px; }
  .hero-kpis b { font-size: 18px; }
  .toasts { bottom: 84px; }
  .pv { grid-template-columns: minmax(0, 1fr); }
  .card-h.wrap .seg { width: 100%; flex-wrap: wrap; overflow: visible; }
  .card-h.wrap .seg button { flex: 1 1 40%; }
}

/* clientes: um bloco por canal */
.canal-bloco { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.canal-bloco + .canal-bloco { margin-top: 18px; padding-top: 22px; border-top: 2px solid var(--border); }
.canal-bloco-h h2 { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.canal-bloco-h h2 i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.canal-bloco-h p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }

/* estoque e pedido por canal */
.seg-canal + .seg-canal { margin-top: 18px; }
.seg-canal h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.seg-canal h3 i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.prod-cel small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.canal-bloco-h p b { color: var(--ink); }
.canal-bloco-h .acabou { color: var(--bad); font-weight: 600; }

/* ---------- usuários e conta ---------- */
.user { text-decoration: none; color: inherit; border-radius: 10px; }
.user:hover { background: var(--side-hover); }
details.convite { padding: 0; }
details.convite summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; align-items: center; gap: 12px; min-height: 56px; }
details.convite summary::-webkit-details-marker { display: none; }
details.convite summary b { display: block; font-size: 15px; }
details.convite summary small { color: var(--ink-2); font-size: 12.5px; }
.conv-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.conv-ic svg { width: 18px; height: 18px; }
.form-convite, .form-senha { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.form-senha { padding: 0; max-width: 420px; gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-convite label, .form-senha label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.form-senha label { margin-top: 8px; }
.form-convite input[type=text], .form-senha input {
  height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); width: 100%; font-weight: 400; }
.form-senha .pw input { padding-right: 84px; }
.papeis { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.papeis legend { font-size: 13px; font-weight: 600; margin-bottom: 6px; padding: 0; }
.radio-card { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px !important; border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 12px; cursor: pointer; font-weight: 400 !important; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.radio-card b { display: block; font-size: 14px; }
.radio-card small { color: var(--ink-2); font-size: 12.5px; }
.form-msg { color: var(--bad); font-size: 13px; }
.form-msg:empty { display: none; }
.btn-inline { margin-top: 4px; align-self: flex-start; padding: 0 22px; }
.pw-dica { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.senha-box { background: var(--good-bg); border: 1px solid color-mix(in srgb, var(--good) 35%, transparent); border-radius: var(--radius); padding: 16px 18px; }
.senha-tit { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.senha-val { font-size: 26px; font-weight: 700; letter-spacing: .04em; margin: 4px 0; font-family: ui-monospace, "Cascadia Mono", monospace; user-select: all; }
.senha-box p { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); }
.senha-box .acoes { display: flex; gap: 8px; flex-wrap: wrap; }
.senha-area:empty { display: none; }
.u-nome small { color: var(--muted); font-weight: 400; }
.u-nome .u-login { display: block; font-size: 12px; }
.u-acoes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.u-acoes .btn-sm { height: 30px; font-size: 12.5px; padding: 0 10px; }
.btn-sm.perigo { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border-strong)); }
.pill.papel-admin { background: var(--accent-soft); color: var(--accent-ink); }
.hist { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.hist li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.hist li:last-child { border-bottom: 0; }
.dados { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px 14px; margin: 0; font-size: 14px; }
.dados dt { color: var(--ink-2); }
.dados dd { margin: 0; font-weight: 600; }
.dados dd small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
/* senha provisória: só a troca de senha fica disponível */
body.forcar-senha .nav a, body.forcar-senha .user, body.forcar-senha #filters { pointer-events: none; opacity: .35; }
@media (max-width: 640px) {
  .form-grid, .papeis { grid-template-columns: minmax(0, 1fr); }
  .u-acoes { justify-content: flex-start; }
  .u-acoes .btn-sm { height: 40px; }
  .dados { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dados dd { margin-bottom: 8px; }
}
.row.inverte > :last-child { order: -1; }

/* acesso limitado */
.editor-acesso { display: flex; flex-direction: column; gap: 12px; }
.papeis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.telas { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.telas[hidden] { display: none; }
.telas legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.tela-cb { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px !important; padding: 8px 6px; border-radius: 8px; cursor: pointer; font-weight: 400 !important; min-height: 44px; }
.tela-cb:hover { background: var(--surface-2); }
.tela-cb input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.tela-cb b { display: block; font-size: 13.5px; }
.tela-cb small { color: var(--muted); font-size: 12px; }
.u-acesso small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; max-width: 260px; white-space: normal; }
.pill.papel-restrito { background: color-mix(in srgb, var(--st-warn) 22%, transparent); color: var(--warn-ink); }
.modal-sm { width: min(720px, 100%); margin-top: 6vh; }
.modal-body .acoes { display: flex; gap: 8px; align-items: center; }
@media (max-width: 860px) { .papeis, .telas { grid-template-columns: minmax(0, 1fr); } }
.tela-cb.sem-custos { grid-column: 1 / -1; border-top: 1px dashed var(--border); border-radius: 0; padding-top: 12px; margin-top: 4px; }

/* filtros das tabelas */
.tbl-filtros { border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 14px 16px; margin: 0 0 12px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 18px; }
.tbl-filtros[hidden] { display: none; }
.f-grupo { border: 0; padding: 0; margin: 0; min-width: 0; }
.f-grupo legend { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.f-ops { display: flex; flex-wrap: wrap; gap: 6px; }
.f-ops.muitos { max-height: 132px; overflow-y: auto; padding-right: 4px; }
.f-op { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; min-height: 30px; }
.f-op:hover { border-color: var(--accent); }
.f-op[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.f-ate { display: flex; align-items: center; gap: 8px; }
.f-ate input { width: 100%; min-width: 0; height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 10px; background: var(--surface); }
.f-ate span { font-size: 12px; color: var(--muted); }
.f-rodape { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 10px; }
.filtro-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.filtro-chips:empty { display: none; }
.f-chip { border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); color: var(--ink); border-radius: 999px;
  padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.f-chip b { font-weight: 600; }
.f-chip:hover { border-color: var(--accent); }
.f-chip.limpar { background: transparent; color: var(--accent-ink); border-style: dashed; }
.btn-sm .badge-count[hidden] { display: none; }
@media (max-width: 640px) {
  .tbl-filtros { grid-template-columns: minmax(0, 1fr); }
  .f-op { min-height: 38px; padding: 6px 12px; }
  .f-ate input { height: 44px; font-size: 16px; }
}

/* ---------- Painel do dono do sistema ---------- */
.sis-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 32px; background: var(--surface); border-bottom: 1px solid var(--border); }
.sis-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: var(--ink); }
.sis-tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); }
.sis-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sis-user form { margin: 0; }
.sis-quem { font-size: 13.5px; color: var(--ink-2); margin-right: 4px; }
.sis-main { margin: 0 auto; }
.sis-atencao li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.sis-atencao small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.sis-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.sis-inline { display: flex; gap: 8px; align-items: center; }
.sis-inline input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.sis-perigo { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.sis-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid select { height: 40px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.snip { margin: 8px 0 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; overflow-x: auto; white-space: pre; }
.erro-snip { white-space: pre-wrap; color: var(--bad); }
.passos { margin-top: 14px; font-size: 13.5px; }
.passos summary { cursor: pointer; font-weight: 600; }
.passos ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.passos code { font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.sis-pill-dono { background: var(--surface-2); }
.modal-sec .dados { margin-top: 12px; grid-template-columns: 190px minmax(0, 1fr); }
@media (max-width: 860px) {
  .sis-top { padding: 10px 16px; }
  .sis-grid3 { grid-template-columns: minmax(0, 1fr); }
  .sis-atencao li { grid-template-columns: auto minmax(0, 1fr); }
  .sis-atencao li .btn-sm { grid-column: 2; justify-self: start; }
  .sis-quem { display: none; }
}
.modal-sec .form-convite { padding: 0; margin-top: 12px; }
