/* Winner Hub — direção "Placar" (ver docs/DESIGN.md) */

:root {
  --ink: #0B0B0C;
  --ink-2: #2A2A2E;
  --muted: #6B6B73;
  --line: #E6E6E3;
  --paper: #FAFAF7;
  --surface: #FFFFFF;
  --zebra: #F6F6F2;
  --volt: #D4FF3A;
  --volt-ink: #4A5A00;
  --on-ink: #FFFFFF;

  --ok: #1F9D55;   --ok-bg: #E7F6EC;
  --warn: #B7791F; --warn-bg: #FDF3E1;
  --crit: #D64545; --crit-bg: #FCE9E9;
  --info: #2F6FEB; --info-bg: #E8F0FE;

  --sidebar: #0B0B0C;
  --sidebar-ink: #F2F2EE;
  --sidebar-muted: #9A9AA2;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 11, 12, .04), 0 1px 0 rgba(11, 11, 12, .02);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #F2F2EE;
    --ink-2: #D6D6D0;
    --muted: #9A9AA2;
    --line: #2A2A2E;
    --paper: #0E0E10;
    --surface: #17171A;
    --zebra: #1B1B1F;
    --volt-ink: #D4FF3A;
    --on-ink: #0B0B0C;
    --ok-bg: #12301F; --ok: #4CC17E;
    --warn-bg: #33270F; --warn: #E0A84A;
    --crit-bg: #3A1717; --crit: #F07171;
    --info-bg: #142440; --info: #6E9CF5;
    --sidebar: #050506;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.app { --side-w: 240px; background: linear-gradient(to right, var(--sidebar) var(--side-w), var(--paper) var(--side-w)); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 12px; background: var(--zebra); padding: 1px 5px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--volt); color: #0B0B0C; padding: 8px 12px; z-index: 100; font-weight: 700; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.icon { flex: none; vertical-align: -4px; }
:focus-visible { outline: 3px solid var(--volt); outline-offset: 2px; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 20;
  background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 24px 20px 20px; }
.brand { display: block; line-height: 0; }
.brand img { width: 140px; height: auto; }
.nav-toggle { display: none; }
.sidebar-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 8px; border: 0; background: none;
  color: var(--sidebar-ink); text-decoration: none; font: inherit; font-weight: 500; cursor: pointer; text-align: left;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); }
.nav-item.is-active { background: var(--volt); color: #0B0B0C; font-weight: 700; }
.nav-item > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Ponto discreto = área ainda no sistema atual (em migração) */
.nav-tag { margin-left: auto; flex: none; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--sidebar-muted); }
.nav-item.is-active .nav-tag { border-color: #0B0B0C; }
.sidebar-user { margin-top: auto; padding: 16px 12px 20px; border-top: 1px solid #222226; }
.user-email { padding: 0 12px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-badge {
  display: inline-block; margin: 6px 12px 8px; padding: 1px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: #222226; color: var(--volt);
}
.logout-form { margin: 0; }
.nav-logout { color: var(--sidebar-muted); }

/* Recolher o menu (só desktop, precisa de JS; a escolha fica no cookie "nav") */
.nav-collapse { display: none; }
@media (min-width: 900px) {
  .js .nav-collapse {
    display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px;
    border: 1px solid #333338; border-radius: 8px; background: none; color: var(--sidebar-muted); cursor: pointer;
  }
  .js .nav-collapse:hover { color: var(--sidebar-ink); background: rgba(255, 255, 255, .07); }
  body.app.nav-min { --side-w: 68px; }
  .nav-min .sidebar-top { justify-content: center; padding: 20px 0 16px; }
  .nav-min .brand, .nav-min .nav-tag, .nav-min .user-email, .nav-min .role-badge { display: none; }
  .nav-min .nav, .nav-min .sidebar-user { padding-left: 10px; padding-right: 10px; }
  .nav-min .nav-item { justify-content: center; padding: 10px 0; }
  .nav-min .nav-item > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .nav-min .nav-collapse .icon { transform: scaleX(-1); }
}

/* ---------- Conteúdo ---------- */
.main { margin-left: var(--side-w); min-height: 100vh; }
.container { max-width: 1280px; margin: 0 auto; padding: 28px 24px 48px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { font-size: 28px; font-weight: 800; font-stretch: 125%; letter-spacing: -.01em; text-transform: uppercase; }
.page-sub { color: var(--muted); margin-top: 4px; }

.demo-banner {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 8px 12px;
  border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 13px;
}

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }

.period { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 12px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; container-type: inline-size;
}
.kpi-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
/* Fonte proporcional à largura do card (cqi): o valor cabe com o menu aberto ou recolhido. */
.kpi-value {
  font-size: 40px; font-size: clamp(22px, 15cqi, 40px);
  font-weight: 800; font-stretch: 125%; line-height: 1.1; margin-top: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kpi-value.is-long {
  font-size: 24px; font-size: clamp(16px, 10cqi, 28px); font-stretch: 100%; line-height: 1.45;
  white-space: normal; overflow-wrap: anywhere;
}
.kpi-note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi-hi { background: var(--volt); border-color: var(--volt); color: #0B0B0C; }
.kpi-hi .kpi-label, .kpi-hi .kpi-note { color: #3A4500; }

.rule-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 20px;
  color: var(--ink-2); font-size: 13px;
}
.rule-legend .icon { color: var(--muted); }

/* Cards e blocos */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; font-stretch: 112%; }
.card-sub { color: var(--muted); margin-top: 4px; font-size: 13px; max-width: 72ch; }
.block { margin-bottom: 32px; }
.block-head { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 3px solid var(--ink); }
.block-title { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; font-stretch: 125%; text-transform: uppercase; }
.block-sub { color: var(--muted); margin-top: 4px; }

/* Alertas */
.alert {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px;
  margin-bottom: 14px; border: 1px solid transparent;
}
.alert .icon { margin-top: 1px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-crit { background: var(--crit-bg); color: var(--crit); }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert span { color: var(--ink); }

/* Pílulas de status: texto + cor, nunca só cor */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-critico { background: var(--crit-bg); color: var(--crit); }
.pill-atencao { background: var(--warn-bg); color: var(--warn); }
.pill-ok { background: var(--ok-bg); color: var(--ok); }

/* Formulários */
.toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field small { color: var(--muted); font-weight: 400; }
.field.grow { flex: 1 1 240px; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline input { width: 96px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], select {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; min-height: 40px; width: 100%;
}
select { padding-right: 32px; }
.field-inline select { width: auto; }
input:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(212, 255, 58, .55); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink); cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 600; cursor: pointer; }
.hint { color: var(--muted); font-size: 12px; }
.toolbar .hint { align-self: center; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.inline-form { margin: 0; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--volt); color: #0B0B0C; border-color: var(--volt); }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { background: var(--zebra); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* Tabelas */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: var(--zebra); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .sku { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; font-weight: 600; }
.table .prod { min-width: 200px; }
.table .lojas { color: var(--ink-2); min-width: 160px; }
.table .chk { width: 44px; text-align: center; }
.table tr.is-done td { color: var(--muted); }
.table tr.is-done .sku { text-decoration: line-through; }
.table-compact td { padding: 6px 10px; }
.table-foot { color: var(--muted); font-size: 12px; margin-top: 8px; }
.sep-form .table-wrap { max-height: 68vh; }

/* Separação */
.sep-status { padding: 16px 20px; }
.progress-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
progress {
  -webkit-appearance: none; appearance: none; flex: 1 1 260px; height: 12px;
  border: 0; border-radius: 99px; background: var(--zebra); overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--zebra); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--ink); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--ink); border-radius: 99px; }
.progress-text { white-space: nowrap; }
.sep-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.sep-row form { margin: 0; }
.ref-date { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }

.pending > summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
.pending > summary::-webkit-details-marker { display: none; }
.pending > summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--ink); color: var(--on-ink); font-weight: 800; }
.pending[open] > summary::before { content: "−"; }
.pending-day { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.pending-title { font-size: 14px; font-weight: 800; margin-bottom: 10px; }

/* Estados vazios */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 16px; color: var(--muted); }
.empty .icon { width: 28px; height: 28px; }
.empty-text { color: var(--ink); font-weight: 600; }
.empty-hint { font-size: 13px; }

/* Layout dividido (gráfico + tabela) */
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.split .table-wrap { max-height: 560px; }

/* Configurações */
.config-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
fieldset { border: 0; padding: 0; margin: 0 0 20px; }
legend { font-size: 14px; font-weight: 800; font-stretch: 112%; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px; padding: 0; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
fieldset .hint { margin-top: 8px; }
.config-side .kpi { margin-bottom: 16px; }
.rule-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; font-size: 13px; }
.rule-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* Migração e erros */
.migration, .error-box { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 28px; }
.migration > .icon, .error-box > .icon { width: 32px; height: 32px; }
.migration p, .error-box p { color: var(--ink-2); max-width: 60ch; }

/* Gráficos SVG */
.chart { display: block; overflow: visible; font-family: var(--font); }
.chart .bar, .chart .col { fill: var(--ink); }
.chart .bar-hi, .chart .col-hi { fill: var(--volt); stroke: var(--ink); stroke-width: 1; }
.chart .col-missing { fill: var(--line); }
.chart .hit { fill: transparent; }
.chart g:hover .bar, .chart g:hover .col { opacity: .8; }
.chart .lbl { fill: var(--ink-2); font-family: var(--mono); font-size: 12px; font-weight: 600; }
.chart .val { fill: var(--ink); font-size: 12px; font-weight: 700; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .axis-y { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; font-weight: 600; }

/* ---------- Estoque (abas, grade, edição em tabela) ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 20px; -webkit-overflow-scrolling: touch; }
.tab { padding: 10px 12px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--volt); font-weight: 800; }
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 99px; text-decoration: none; font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--surface); }
.chip:hover { border-color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; min-height: 40px; }
.checks .check { min-height: 0; font-weight: 500; }
.table td input[type=text], .table td input[type=number], .table td input[type=date], .table td select { min-width: 72px; padding: 6px 8px; font-size: 13px; }
.table td input.w-s { width: 80px; }
.table td input.w-m { width: 130px; }
.table td input.w-l { min-width: 180px; width: 100%; }
.table tr.is-total td { font-weight: 800; background: var(--zebra); }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions form { display: inline; margin: 0; }
input[type=date], input[type=search], textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; min-height: 40px; }
textarea { width: 100%; min-height: 72px; resize: vertical; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn-danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--ink); text-decoration: underline; font-weight: 600; cursor: pointer; }
.pill-none, .pill-pendente, .pill-criada { background: var(--zebra); color: var(--muted); }
.pill-warn, .pill-parcial, .pill-cortador { background: var(--warn-bg); color: var(--warn); }
.pill-crit, .pill-cancelada { background: var(--crit-bg); color: var(--crit); }
.pill-costureira { background: var(--info-bg); color: var(--info); }
.pill-galpao { background: var(--ok-bg); color: var(--ok); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form-grid .field.span-2 { grid-column: span 2; }
.detail { margin-top: 20px; border-top: 3px solid var(--ink); padding-top: 16px; }
.detail h3 { font-size: 16px; font-weight: 800; font-stretch: 112%; margin: 18px 0 10px; }
details.box { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 14px; }
details.box > summary { cursor: pointer; font-weight: 700; }
.cap-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.stack > * + * { margin-top: 10px; }
.mono { font-family: var(--mono); }
@media (max-width: 1279px) {
  .kpis-5, .kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 899px) {
  .kpis-5, .kpis-6, .kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .field.span-2 { grid-column: auto; }
}

/* ---------- Login / telas sem menu ---------- */
body.auth { min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 36px 32px; box-shadow: 0 10px 30px rgba(11, 11, 12, .06);
  border-top: 6px solid var(--volt);
}
.auth-card .error-box { padding: 0; align-items: stretch; text-align: left; }
.auth-logo { display: block; width: 180px; height: auto; margin-bottom: 28px; }
.auth-title { font-size: 22px; font-weight: 800; font-stretch: 125%; text-transform: uppercase; margin-bottom: 4px; }
.auth-sub { color: var(--muted); margin-bottom: 20px; }
.auth-form { display: grid; gap: 14px; margin-bottom: 16px; }
.auth-help { color: var(--muted); font-size: 13px; text-align: center; }
.auth-foot { color: var(--muted); font-size: 12px; margin-top: 18px; letter-spacing: .04em; }
.demo-hint { margin-top: 20px; padding: 12px 14px; border-radius: 8px; background: var(--zebra); font-size: 13px; }
.demo-hint ul { margin: 6px 0 0; padding-left: 18px; }

@media (prefers-color-scheme: dark) {
  .auth-logo { filter: invert(1); }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .config-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 899px) {
  .sidebar { position: sticky; top: 0; inset: auto; width: auto; height: auto; }
  .sidebar-top { padding: 12px 16px; }
  .brand img { width: 112px; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
    border: 1px solid #333338; border-radius: 8px; background: none; color: var(--sidebar-ink); cursor: pointer;
  }
  .js .sidebar-body { display: none; }
  .js .nav-open .sidebar-body { display: flex; }
  .sidebar-body { max-height: calc(100vh - 66px); overflow-y: auto; border-top: 1px solid #222226; }
  .nav { padding: 8px 12px; }
  .main { margin-left: 0; }
  body.app { background: var(--paper); }
  .container { padding: 20px 16px 40px; }
  .page-title { font-size: 24px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 28px; font-size: clamp(20px, 15cqi, 28px); }
  .kpi-value.is-long { font-size: 20px; font-size: clamp(16px, 10cqi, 20px); }
  .card { padding: 16px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .toolbar .btn { flex: 1 1 auto; }
  .sep-row form, .sep-row form .btn { width: 100%; }
  .form-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 420px) {
  .auth-card { padding: 28px 20px; }
  .block-title { font-size: 17px; }
}
/* ---------- Sala de Estoque ---------- */
.sala-kpis .kpi-value { font-size: 30px; }
.sala-kpis .kpi-value.is-long { font-size: 20px; line-height: 1.5; }
.sala-ajuda ul { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink-2); }
.sala-ajuda { margin: 0 0 16px; }
kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }
.sala-filtros .toolbar { margin-bottom: 10px; }
.sala-sel-field { flex: 0 1 220px; }
.sala-zoom { align-items: center; }
.sala-zoom-label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.sala-zoom select { min-width: 64px; }
.sala-opcoes { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 12px; }
.sala-opcoes .subtabs { margin: 0; }
.sala-grid { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.sala-grid.is-baixo { grid-template-columns: minmax(0, 1fr); }
.sala-grid > .card { margin-bottom: 0; min-width: 0; }
.sala-mapa { padding: 12px; }
.sala-svg-wrap { width: 100%; overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.sala-svg { display: block; width: 100%; height: auto; font-family: var(--font); user-select: none; -webkit-user-select: none; }
.sala-svg.is-selecionavel { cursor: crosshair; touch-action: none; }
.sala-svg.is-carregando { opacity: .6; }
.sala-svg .sala-fundo { fill: var(--surface); }
.sala-svg .sala-eixo text { fill: var(--muted); font-weight: 600; }
.sala-svg .sala-lbl-bloco { fill: #6B7480; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-linejoin: round; }
.sala-svg .sala-sel-rect { fill: rgba(227, 162, 26, .16); stroke: #E3A21A; stroke-width: 2px; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.sala-mapa-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.sala-mapa-foot .inline-form { display: inline-flex; gap: 8px; }
.sala-painel h2 { margin-bottom: 4px; }
.sala-painel .card-sub { margin-bottom: 12px; }
.sala-painel .stack .btn { align-self: flex-start; }
.sala-painel .stack { display: flex; flex-direction: column; }
.sala-painel details.box > summary { font-size: 14px; }
.sala-painel details.box > form, .sala-painel details.box > .stack { margin-top: 12px; }
.sala-form-title { font-weight: 800; font-size: 14px; }
.sala-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sala-setas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.sala-setas .btn { font-size: 18px; padding: 6px 0; }
.sala-limpar { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sala-pilha-wrap { max-height: 52vh; }
.sala-pilha td { padding: 4px 6px; }
.sala-pilha td input[type=text], .sala-pilha td input[type=number], .sala-pilha td select { min-width: 0; min-height: 34px; padding: 4px 6px; }
.sala-pilha td select { width: 64px; padding-right: 18px; }
.sala-pilha td input.w-s { width: 64px; }
.sala-pilha td input.w-m { width: 120px; }
.sala-pilha td:nth-child(2) input { min-width: 120px; }
.sala-chao-extra { border-color: var(--ink); }
.sala-lista { max-height: 62vh; }
.sala-medidas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.sala-medidas-tab { max-height: 360px; margin-top: 8px; }
.sala-imp-opcoes { margin-top: 12px; }
.sala-legenda { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.sala-legenda .tam {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 24px; padding: 0 8px;
  border-radius: 4px; color: #fff; font-weight: 700; font-size: 12px;
}
.tam-p    { background: #93C47D; }
.tam-m    { background: #45818E; }
.tam-g    { background: #3C78D8; }
.tam-gg   { background: #6FA8DC; }
.tam-xg   { background: #5B3FA8; }
.tam-sem  { background: #8A94A0; }
.sala-legenda .tam-vazia { background: rgba(150,160,172,0.16); color: var(--muted); border: 1px solid rgba(150,160,172,0.55); }
/* 3D */
.sala-3d-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.sala-3d { position: relative; width: 100%; height: min(70vh, 700px); min-height: 360px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(var(--surface), var(--paper)); overflow: hidden; }
.sala-3d-canvas, .sala-3d-labels { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sala-3d-canvas { touch-action: none; cursor: grab; }
.sala-3d-canvas:active { cursor: grabbing; }
.sala-3d-labels { pointer-events: none; }
.sala-3d-tip { position: absolute; z-index: 2; max-width: 320px; padding: 8px 10px; border-radius: 6px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(11, 11, 12, .14); font-size: 13px; white-space: pre-line; pointer-events: none; }
.sala-3d-tip::first-line { font-weight: 700; }
.sala-3d-erro { position: absolute; inset: auto 16px 16px; padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.sala-mapa > .hint { margin-top: 8px; }
@media (max-width: 1100px) {
  .sala-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .sala-medidas { grid-template-columns: minmax(0, 1fr); }
  .sala-sel-field { flex: 1 1 100%; }
  .sala-3d { height: 60vh; }
}
/* Lojas */
.loja-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.loja-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 16px; margin: 0; }
.loja-meta dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.loja-meta dd { margin: 2px 0 0; font-weight: 600; }
.loja-divider { border-top: 1px solid var(--line); margin: 16px 0; }
.loja-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
.loja-actions .box { margin-top: 0; }
.loja-cookies textarea { width: 100%; font-family: var(--mono); font-size: 12px; }
.loja-saida { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 12px; background: var(--zebra); padding: 10px; border-radius: 6px; margin: 8px 0 0; max-height: 240px; overflow: auto; }
.loja .form-actions .inline-form { display: inline-flex; }
@media (max-width: 899px) {
  .loja-actions { grid-template-columns: minmax(0, 1fr); }
}
