/* =========================================================================
   Tokens
   ========================================================================= */
:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --border: #e2e7ee;
  --border-strong: #cdd5e0;
  --text: #0f1b2d;
  --text-2: #475569;
  --text-3: #7b8799;
  --brand: #1f4e79;
  --brand-strong: #173c5e;
  --accent: #2a78d6;
  --accent-strong: #1c5cab;
  --accent-soft: #e8f1fc;
  --focus: #2a78d6;

  --sidebar: #0f2440;
  --sidebar-2: #16304f;
  --sidebar-text: #b9c7d8;
  --sidebar-text-strong: #ffffff;
  --sidebar-muted: #7b8fa8;

  /* Séries de gráfico (paleta validada: CVD e contraste) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --track: #e8edf3;

  /* Status (reservados; sempre com rótulo) */
  --ok: #1a7f4b;      --ok-bg: #e5f4eb;
  --warn: #8a5d00;    --warn-bg: #fff3d6;
  --info: #1c5cab;    --info-bg: #e7f0fb;
  --danger: #b42318;  --danger-bg: #fdecea;
  --neutral: #556274; --neutral-bg: #edf0f4;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 1px rgba(15, 27, 45, .04);
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 1px 3px rgba(15, 27, 45, .03);
  --shadow-lg: 0 20px 60px rgba(15, 27, 45, .22);
  --sidebar-w: 256px;
}

/* Tema escuro: pelo Windows (automático) ou pela escolha do usuário */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;
    --bg: #0e131a;
    --surface: #161c25;
    --surface-2: #1b222d;
    --surface-3: #222a36;
    --border: #283241;
    --border-strong: #354152;
    --text: #e8edf3;
    --text-2: #a9b5c4;
    --text-3: #7c8898;
    --brand: #3a78b8;
    --brand-strong: #2f6399;
    --accent: #3987e5;
    --accent-strong: #5598e7;
    --accent-soft: #1a2b42;
    --focus: #5598e7;
    --sidebar: #0a111b;
    --sidebar-2: #131d2b;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --track: #252e3b;
    --ok: #4cc38a;      --ok-bg: #14301f;
    --warn: #e5b24a;    --warn-bg: #33280e;
    --info: #74abee;    --info-bg: #15263c;
    --danger: #f27a6e;  --danger-bg: #3a1714;
    --neutral: #a3afbf; --neutral-bg: #232b36;
    --shadow-sm: none;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
color-scheme: dark;
  --bg: #0e131a;
  --surface: #161c25;
  --surface-2: #1b222d;
  --surface-3: #222a36;
  --border: #283241;
  --border-strong: #354152;
  --text: #e8edf3;
  --text-2: #a9b5c4;
  --text-3: #7c8898;
  --brand: #3a78b8;
  --brand-strong: #2f6399;
  --accent: #3987e5;
  --accent-strong: #5598e7;
  --accent-soft: #1a2b42;
  --focus: #5598e7;
  --sidebar: #0a111b;
  --sidebar-2: #131d2b;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --track: #252e3b;
  --ok: #4cc38a;      --ok-bg: #14301f;
  --warn: #e5b24a;    --warn-bg: #33280e;
  --info: #74abee;    --info-bg: #15263c;
  --danger: #f27a6e;  --danger-bg: #3a1714;
  --neutral: #a3afbf; --neutral-bg: #232b36;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
}

/* =========================================================================
   Base
   ========================================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }
.tab-num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.sec { color: var(--text-2); }
.carregando { padding: 64px 24px; text-align: center; color: var(--text-2); max-width: 560px; margin: 0 auto; line-height: 1.7; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* =========================================================================
   Estrutura: sidebar + área principal
   ========================================================================= */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, .07);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; color: var(--sidebar-text-strong); }
.sb-logo { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, #2a78d6, #1f4e79); display: grid; place-items: center; flex: none; }
.sb-logo svg { width: 20px; height: 20px; stroke: #fff; }
.sb-brand b { display: block; font-size: 15px; letter-spacing: .2px; }
.sb-brand small { display: block; color: var(--sidebar-muted); font-size: 12px; }
.sb-sec { padding: 14px 12px 4px; }
.sb-sec-t { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--sidebar-muted); padding: 0 10px 6px; }
.sb-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
}
.sb-link:hover { background: rgba(255, 255, 255, .06); color: var(--sidebar-text-strong); text-decoration: none; }
.sb-link.ativo { background: rgba(58, 135, 229, .18); color: var(--sidebar-text-strong); box-shadow: inset 3px 0 0 #5598e7; }
.sb-link .sb-extra { margin-left: auto; font-size: 12px; color: var(--sidebar-muted); font-variant-numeric: tabular-nums; }
.sb-dot { width: 8px; height: 8px; border-radius: 50%; background: #5598e7; flex: none; margin: 0 5px; }
.sb-rodape { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 6px; }
.sb-user .nome { color: var(--sidebar-text-strong); font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .perfil { font-size: 12px; color: var(--sidebar-muted); }
.sb-user > div:not(.avatar) { min-width: 0; flex: 1; }
.sb-acoes { display: flex; gap: 6px; margin-top: 8px; }

.sb-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  color: var(--sidebar-text);
  border-radius: 7px;
  padding: 7px 8px;
  font-size: 12px;
  cursor: pointer;
}
.sb-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.sb-user .sb-btn-ic { flex: none; width: 32px; height: 32px; padding: 0; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  background: var(--accent-soft); color: var(--accent-strong);
  flex: none;
}
.sidebar .avatar { background: #2a78d6; color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar-mobile { display: none; }
.pagina { padding: 30px 36px 72px; max-width: 1360px; width: 100%; margin: 0 auto; }

/* =========================================================================
   Cabeçalho de página e abas
   ========================================================================= */
.pg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.migalha { font-size: 13px; color: var(--text-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.migalha a { color: var(--text-3); }
.pg-head h1 { font-size: 25px; line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: -.6px; }
.pg-head .sub { color: var(--text-2); margin-top: 4px; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; }

.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -8px 0 24px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.abas::-webkit-scrollbar { display: none; }
.aba {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border: none; background: none; cursor: pointer; text-decoration: none !important;
  color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap;
}
.aba:hover { color: var(--text); }
.aba.ativa { color: var(--accent); border-bottom-color: var(--accent); }
.aba .cont { font-size: 12px; background: var(--surface-3); color: var(--text-2); padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.aba.ativa .cont { background: var(--accent-soft); color: var(--accent-strong); }

/* =========================================================================
   Botões
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primario:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-perigo { color: var(--danger); }
.btn-perigo:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-perigo-cheio { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-perigo-cheio:hover { background: #9c1f16; border-color: #9c1f16; }
.btn-fantasma { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn-fantasma:hover { background: var(--surface-3); color: var(--text); }
.btn-peq { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icone { width: 36px; padding: 0; }
.btn-peq.btn-icone { width: 30px; }

/* =========================================================================
   Cards
   ========================================================================= */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; flex-wrap: wrap; }
.card-cab h2 { font-size: 14.5px; margin: 0; font-weight: 650; letter-spacing: -.1px; }
.card-cab .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.card-corpo { padding: 16px 20px 20px; }
.card-rodape { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); font-size: 13px; color: var(--text-2); }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.auto-cards { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

/* KPI */
.kpi { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.kpi-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-strong); }
.kpi-ic.laranja { background: color-mix(in srgb, var(--series-2) 14%, transparent); color: var(--series-2); }
.kpi-ic.verde { background: color-mix(in srgb, var(--series-3) 16%, transparent); color: var(--series-3); }
.kpi-ic.neutro { background: var(--surface-3); color: var(--text-2); }
.kpi-rot { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi-val { font-size: 25px; font-weight: 650; letter-spacing: -.6px; margin-top: 1px; white-space: nowrap; }
.kpi-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

/* Card de linha (painel) */
.linha-card { display: flex; flex-direction: column; color: inherit; text-decoration: none; transition: border-color .12s, transform .12s; }
.linha-card:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 6px 20px rgba(15, 27, 45, .08); }
.linha-card .lc-top { display: flex; align-items: center; gap: 12px; padding: 18px 20px 4px; }
.linha-card .lc-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.linha-card h3 { margin: 0; font-size: 16px; }
.linha-card .lc-desc { font-size: 13px; color: var(--text-3); }
.linha-card .lc-seta { margin-left: auto; color: var(--text-3); }
.linha-card .lc-kpis { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); margin-top: auto; }
.linha-card .lc-kpis > div { padding: 12px 20px; }
.linha-card .lc-kpis > div + div { border-left: 1px solid var(--border); }
.linha-card .lc-kpis .r { font-size: 12px; color: var(--text-3); }
.linha-card .lc-kpis .v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Card de produto (estoque) */
.prod-card { padding: 18px 20px; }
.prod-card .pc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.prod-card .pc-nome { font-weight: 700; }
.prod-card .pc-val { font-size: 27px; font-weight: 650; letter-spacing: -.7px; margin-top: 8px; }
.prod-card .pc-val small { font-size: 14px; font-weight: 600; color: var(--text-3); margin-left: 4px; }
.prod-card .pc-sub { font-size: 12.5px; color: var(--text-3); margin-top: 10px; display: flex; justify-content: space-between; gap: 8px; }

/* =========================================================================
   Gráficos (barras em HTML)
   ========================================================================= */
.legenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.legenda span { display: inline-flex; align-items: center; gap: 7px; }
.legenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-1 { background: var(--series-1); }
.sw-2 { background: var(--series-2); }
.sw-3 { background: var(--series-3); }

.meter { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--series-1) 16%, var(--track)); overflow: hidden; margin-top: 12px; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--series-1); }
.meter.baixo > span { background: #e0a100; }
.meter.critico > span { background: var(--danger); }

.chart-est { display: grid; grid-template-columns: minmax(80px, 140px) minmax(0, 1fr) auto; gap: 12px 14px; align-items: center; }
.chart-est .ce-rot { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-est .ce-rot small { display: block; font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.chart-est .ce-val { font-size: 13px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pilha { display: flex; gap: 2px; height: 14px; }
.pilha > span { height: 100%; min-width: 0; cursor: default; }
.pilha > span:first-child { border-radius: 4px 0 0 4px; }
.pilha > span:last-child { border-radius: 0 4px 4px 0; }
.pilha > span:only-child { border-radius: 4px; }
.pilha > span:hover, .pilha > span:focus-visible { filter: brightness(1.1); outline: none; }
.pilha.grossa { height: 18px; }
.pilha .vazio-barra { background: var(--track); }

.fin-lista { display: grid; gap: 2px; margin-top: 16px; }
.fin-lista > div { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.fin-lista > div:last-child { border-bottom: none; }
.fin-lista i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.fin-lista b { margin-left: auto; font-variant-numeric: tabular-nums; }
.fin-lista .pct { color: var(--text-3); font-size: 12px; width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

#tip {
  position: fixed; z-index: 200; pointer-events: none;
  background: var(--text); color: var(--surface);
  padding: 7px 10px; border-radius: 7px; font-size: 12.5px; line-height: 1.4;
  box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .08s; max-width: 260px;
}
#tip.on { opacity: 1; }

/* =========================================================================
   Tabelas
   ========================================================================= */
.tabela-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 13px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th { font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .6px; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: var(--accent-soft); }
tr.clicavel:active td { background: var(--surface-3); }
tr.cancelado td { opacity: .55; }
tr.cancelado .cli-nome { text-decoration: line-through; }
tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); border-bottom: none; }
.cli-nome { font-weight: 600; }
.cli-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; background: var(--surface-3); color: var(--text-2); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.chip b { color: var(--text); font-weight: 600; }
.pag { font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.pag.ok { color: var(--ok); }
.pag.pend { color: var(--text-3); }
.vazio { padding: 40px 20px; text-align: center; color: var(--text-3); }
.vazio svg { width: 32px; height: 32px; margin-bottom: 8px; opacity: .6; }
.tab-precos td:first-child, .tab-precos th:first-child { padding-left: 20px; }

/* Status */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px 3px 8px; border-radius: 99px; white-space: nowrap;
  background: var(--warn-bg); color: var(--warn);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.quitado { background: var(--ok-bg); color: var(--ok); }
.status.aguardando-saldo, .status.aguardando-sinal { background: var(--info-bg); color: var(--info); }
.status.cancelado { background: var(--neutral-bg); color: var(--neutral); }

.status-lista > div { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); }
.status-lista > div:last-child { border-bottom: none; }
.status-lista b { font-variant-numeric: tabular-nums; }

.selo { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px; }
.selo-master { background: color-mix(in srgb, var(--series-2) 15%, transparent); color: var(--series-2); }
.selo-representante { background: var(--info-bg); color: var(--info); }
.selo-supervisor { background: var(--ok-bg); color: var(--ok); }
.selo-visualizador { background: var(--neutral-bg); color: var(--neutral); }
.ponto { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.ponto::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.ponto.off::before { background: var(--text-3); }
.ponto.pend::before { background: #e0a100; }

/* Filtros */
.barra-filtros { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.busca { position: relative; flex: 0 1 280px; min-width: 180px; }
.busca svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.busca input { padding-left: 34px !important; }
.segmentos { display: flex; gap: 4px; flex-wrap: wrap; }
.seg { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg:hover { border-color: var(--border-strong); color: var(--text); }
.seg.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.seg .n { font-variant-numeric: tabular-nums; opacity: .75; }
.barra-filtros .conta { margin-left: auto; font-size: 13px; color: var(--text-3); }

/* Linha do tempo (movimentações / auditoria) */
.timeline { padding: 8px 20px 16px; }
.tl-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: center; }
.tl-item:last-child { border-bottom: none; }
.tl-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); }
.tl-ic.saida { background: var(--danger-bg); color: var(--danger); }
.tl-item .t1 { font-weight: 600; }
.tl-item .t2 { font-size: 12.5px; color: var(--text-3); }
.tl-item .q { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* =========================================================================
   Formulários
   ========================================================================= */
[hidden] { display: none !important; }
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.campo > label, .rot-campo { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.ajuda { font-size: 12.5px; color: var(--text-3); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  height: 40px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0 12px; background: var(--surface); width: 100%; min-width: 0;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-3); }
input[type=number] { font-variant-numeric: tabular-nums; }
.com-sufixo { position: relative; }
.com-sufixo input { padding-right: 44px; text-align: right; }
.com-sufixo .suf { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; pointer-events: none; }
.linha-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-bottom: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.erro-form { background: var(--danger-bg); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-weight: 600; font-size: 13.5px; }
.erro-form:empty { display: none; }
input.excedido { border-color: var(--danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent) !important; }
.aviso-linha { color: var(--danger); font-size: 12px; font-weight: 600; min-height: 0; }
.form-sec { margin-bottom: 22px; }
.form-sec-t { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); margin-bottom: 12px; }
.tabela-form th, .tabela-form td { padding: 8px 10px; }
.tabela-form td:first-child, .tabela-form th:first-child { padding-left: 20px; }
.tabela-form input { height: 34px; }
.tabela-form input[type=number] { text-align: right; }

.item-prod { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.item-prod:last-child { border-bottom: none; }
.item-prod .ip-nome { font-weight: 600; }
.item-prod .ip-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.item-prod .ip-sub b { color: var(--text-2); font-weight: 600; }

.resumo-pedido { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.resumo-pedido .rp-linha { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13.5px; color: var(--text-2); }
.resumo-pedido .rp-linha b { color: var(--text); font-variant-numeric: tabular-nums; }
.resumo-pedido .rp-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; }
.resumo-pedido .rp-total span { font-weight: 600; }
.resumo-pedido .rp-total b { font-size: 22px; font-weight: 650; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.info-pedido { font-size: 12.5px; color: var(--text-3); margin-top: 14px; }

/* =========================================================================
   Telas de acesso (login, configuração inicial, troca de senha)
   ========================================================================= */
.acesso {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background: #0b1a2f url("fundo-login.svg") center / cover no-repeat;
  position: relative;
}
.acesso::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(620px 520px at 50% 50%, rgba(6, 16, 30, .72) 0%, rgba(6, 16, 30, .35) 55%, transparent 80%);
}
.acesso-caixa { position: relative; }
.acesso-caixa { width: 100%; max-width: 420px; }
.acesso-caixa.larga { max-width: 520px; }
.acesso-marca { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; text-align: center; color: #fff; }
.acesso-marca .sb-logo { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.acesso-marca .sb-logo svg { width: 28px; height: 28px; }
.acesso-marca b { display: block; font-size: 18px; letter-spacing: -.2px; }
.acesso-marca small { display: block; color: #a9bdd6; font-size: 13px; margin-top: 2px; }
.acesso-card { padding: 30px 28px; border: none; box-shadow: 0 24px 60px rgba(5, 15, 30, .45); }
.acesso-card h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.2px; }
.acesso-card p.sec { margin: 0 0 22px; font-size: 13.5px; }
.acesso-card .btn[type=submit] { width: 100%; height: 42px; margin-top: 4px; }
.acesso-rodape { text-align: center; color: #8ba0ba; font-size: 12.5px; margin-top: 20px; }
.acesso-rodape a { color: #c6d6e8; }

/* =========================================================================
   Modal e painel lateral
   ========================================================================= */
.fundo-modal { position: fixed; inset: 0; background: rgba(8, 15, 26, .5); z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 48px 16px; overflow-y: auto; animation: fade .15s; }
.fundo-modal.lateral { justify-content: flex-end; padding: 0; align-items: stretch; overflow: hidden; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.lateral .modal { max-width: 600px; border-radius: 0; height: 100vh; animation: entra .18s ease-out; }
.modal-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-cab h2 { font-size: 18px; margin: 0; }
.modal-cab .sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.modal-corpo { padding: 22px 24px; }
.lateral .modal-corpo { flex: 1; overflow-y: auto; }
.modal-rodape { display: flex; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
.lateral .modal-rodape { border-radius: 0; }
.modal-rodape .dir { display: flex; gap: 8px; margin-left: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes entra { from { transform: translateX(40px); opacity: .4; } }

.modal.estreito { max-width: 440px; }
.fundo-modal.acima { z-index: 70; align-items: center; }
.texto-confirma { margin: 0; color: var(--text-2); line-height: 1.6; }
.texto-confirma b { color: var(--text); }

/* Barra de progresso */
#progresso {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  opacity: 0; transition: opacity .15s; z-index: 400; pointer-events: none;
}
#progresso.on { opacity: 1; animation: desliza 1.1s infinite linear; }
@keyframes desliza { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* Colunas ordenáveis */
th.ord { cursor: pointer; user-select: none; }
th.ord:hover { color: var(--text); background: var(--surface-3); }
th.ord.on { color: var(--accent); }
th.ord > span { display: inline-flex; align-items: center; gap: 4px; }
th.ord.num > span { justify-content: flex-end; width: 100%; }
th.primeira { padding-left: 20px; }
th .seta { transition: transform .15s; }
th .seta.desc { transform: rotate(180deg); }

/* Toast */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 300;
  background: var(--text); color: var(--surface);
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s; pointer-events: none;
  max-width: calc(100vw - 48px); font-weight: 500;
}
#toast.visivel { opacity: 1; transform: none; }
#toast.erro { background: var(--danger); color: #fff; }

/* =========================================================================
   Responsivo
   ========================================================================= */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2-1, .g-1-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .shell.menu-aberto .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell.menu-aberto::after { content: ""; position: fixed; inset: 0; background: rgba(8, 15, 26, .45); z-index: 55; }
  .topbar-mobile { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--sidebar); color: #fff; position: sticky; top: 0; z-index: 40; }
  .topbar-mobile b { font-size: 15px; }
  .topbar-mobile .btn-icone { background: transparent; border-color: rgba(255, 255, 255, .2); color: #fff; box-shadow: none; }
  .pagina { padding: 20px 16px 48px; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-marca { padding: 28px 24px; }
  .login-marca h2 { font-size: 24px; margin-top: 28px; }
  .login-marca ul, .login-marca .rodape { display: none; }
}
@media (max-width: 560px) {
  .g-4, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .pg-head h1 { font-size: 22px; }
  .kpi-val { font-size: 21px; }
  .chart-est { grid-template-columns: minmax(0, 1fr) auto; }
  .chart-est .pilha { grid-column: 1 / -1; order: 3; }
  .item-prod { grid-template-columns: minmax(0, 1fr) 120px; }
  .busca { flex: 1 1 100%; }
  .barra-filtros .conta { margin-left: 0; }
  .linha-card .lc-kpis > div { padding: 10px 12px; }
}

/* Armazém: situação do produto, entrega do pedido e resultado da conferência */
.status.negativo { background: var(--danger-bg); color: var(--danger); }
.prod-card .pc-desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-card .pc-sub b { color: var(--text-2); font-weight: 600; }
.chip.entrega-ok { background: var(--ok-bg); color: var(--ok); }
.chip.entrega-pend { background: var(--warn-bg); color: var(--warn); }
.chip.entrega-parc { background: var(--info-bg); color: var(--info); }
.chip .i.sm { width: 12px; height: 12px; }
