:root {
  color-scheme: light;
  --bg: #f4f4f2; --surface: #fcfcfb; --surface-2: #efeeea; --border: #e2e1dc;
  --text: #0b0b0b; --text-2: #52514e; --muted: #7a7974;
  --accent: #2a78d6; --accent-ink: #fff;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --good: #0f7b3e; --bad: #c42b2b; --grid: #e7e6e1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #2e2e2b;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
    --accent: #3987e5;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --good: #4cc27f; --bad: #ef6b6b; --grid: #2a2a27;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.muted { color: var(--muted); font-weight: 400; } .small { font-size: 12.5px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 650; font-size: 15px; }
.brand .muted { font-size: 12px; margin-left: 6px; }
nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav button, .seg button { border: 0; background: transparent; color: var(--text-2); padding: 6px 11px; border-radius: 7px; cursor: pointer; font: inherit; }
nav button.on { background: var(--surface-2); color: var(--text); font-weight: 600; }
.sync-badge { margin-left: auto; font-size: 12px; color: var(--text-2); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 2px; flex-wrap: wrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); font-weight: 600; }
input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px; }
.dates { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 12.5px; }
.chip i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chip.off { opacity: .45; } .chip.off i { background: var(--muted) !important; }
main { padding: 18px 20px 40px; max-width: 1400px; margin: 0 auto; }
.view { display: none; } .view.on { display: block; }
.banner { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; color: var(--text-2); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.kpi .l { color: var(--text-2); font-size: 12.5px; }
.kpi .v { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .d { font-size: 12px; margin-top: 2px; color: var(--muted); }
.up { color: var(--good); } .down { color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin: 0 0 14px; padding: 12px 14px; }
.card.pad { padding: 16px 18px; } .card h3 { margin: 0 0 8px; font-size: 15px; }
figcaption { font-weight: 600; margin-bottom: 8px; }
.chart { position: relative; height: 280px; } .chart.short { height: 210px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th { color: var(--text-2); font-weight: 600; font-size: 12.5px; position: sticky; top: 0; background: var(--surface); }
th:first-child, td:first-child, td.l, th.l { text-align: left; }
td.wrap { white-space: normal; min-width: 220px; text-align: left; }
tr.total td { font-weight: 650; border-top: 2px solid var(--border); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.toolbar, .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.btn { display: inline-block; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 6px 12px; border-radius: 8px; cursor: pointer; font: inherit; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.cfg { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 16px; margin-bottom: 12px; }
.cfg label { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 12.5px; }
.tag { font-size: 11px; border-radius: 5px; padding: 1px 6px; background: var(--surface-2); color: var(--text-2); }
.tag.warn { color: var(--bad); }
.conta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.conta[hidden] { display: none; }
button.link { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.dlg { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 18px 20px; max-width: 360px; width: calc(100% - 32px); }
.dlg::backdrop { background: rgba(0,0,0,.35); }
.dlg h3 { margin: 0 0 10px; font-size: 15px; }
.dlg label, .login-box label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 12.5px; color: var(--text-2); }
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { width: 100%; max-width: 340px; }
.login-box h1 { font-size: 18px; margin: 0; }
.login-box .btn { width: 100%; margin-top: 4px; }
.passos { padding-left: 18px; line-height: 1.6; }
body.leitura .so-admin-ctl { display: none !important; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
tr.hist > td { background: var(--surface-2); padding: 8px 12px 10px; }
table.mini { width: auto; min-width: 60%; margin-bottom: 4px; }
table.mini th { background: var(--surface-2); position: static; }
table.mini th, table.mini td { padding: 4px 10px; }
.btn.mini-btn { padding: 2px 8px; font-size: 12px; }
.tip { position: fixed; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.15); z-index: 20; }
.prog { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; width: 220px; display: inline-block; vertical-align: middle; margin: 0 8px; }
.prog b { display: block; height: 100%; background: var(--accent); }
@media (max-width: 600px) { .top, .filters, main { padding-left: 16px; padding-right: 16px; } .kpi .v { font-size: 19px; } }

/* pedidos: mostrar cancelados / devoluções */
.chk-ped { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; cursor: pointer; }
.chk-ped input { width: 16px; height: 16px; margin: 0; }
#cardDevol { margin-bottom: 14px; }
#tbDevol tr.tot td { border-top: 1px solid var(--border); }
.small { font-size: 12px; }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(5, 1fr); } } /* 10 cartões = 2 linhas de 5 */

/* hoje x ontem até a mesma hora */
#cardHoje { margin-bottom: 14px; }
#tbHoje td:nth-child(2) b { font-size: 15px; }
