:root {
  /* —— Design tokens Agrocana (corporativo B2B) —— */
  --bg: #eef1eb;
  --bg-elevated: #f6f8f5;
  --surface: #ffffff;
  --ink: #1a241c;
  --ink-soft: #2e3a32;
  --muted: #5a665c;
  --line: #d5ddd6;
  --line-strong: #b8c4ba;

  --brand: #1f3d2b;
  --brand-hover: #183024;
  --brand-soft: #e8f0eb;
  --brand-mid: #2a5239;
  --on-brand: #f7f3ea;

  --danger: #9b2c2c;
  --danger-soft: #fdeeee;
  --warn: #9a6b12;
  --warn-soft: #fff6e5;
  --ok: #276749;
  --ok-soft: #e6f4ea;
  --info: #2b4c7e;
  --info-soft: #eef4fb;

  --touch: 44px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(26, 36, 28, .06);
  --shadow-md: 0 6px 18px rgba(26, 36, 28, .08);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --font: "Segoe UI", "Source Sans 3", system-ui, sans-serif;
  --text-xs: .75rem;
  --text-sm: .875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;

  --sidebar-w: 248px;
  --hz: #fff6c8;
  --hz-line: #e0c96a;

  font-family: var(--font);
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
#app {
  min-height: 100%;
  min-height: 100dvh;
  width: 100%;
}
button, input, select { font: inherit; }

.topbar {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 14px 18px; background: var(--brand); color: #f7f3ea;
}
.brand { font-size: 1.35rem; font-weight: 700; }
.brand-sub { font-size: .85rem; opacity: .85; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  align-items: stretch;
}
.sidebar {
  background: var(--brand);
  color: var(--on-brand);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-3);
  padding-left: max(var(--space-3), env(safe-area-inset-left));
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  z-index: 30;
}
.sidebar-brand { padding: var(--space-1) var(--space-2) var(--space-2); }
.sidebar .brand { color: #fff; font-size: var(--text-lg); }
.sidebar .brand-sub { color: #d9d2c3; opacity: 1; font-size: var(--text-sm); }
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: var(--touch);
  min-height: var(--touch);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.1);
  color: #fff;
  cursor: pointer;
}
.sidebar-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.tabbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: 0;
  background: transparent;
  border: 0;
  position: static;
  flex: 1;
  min-height: 0;
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.nav-group-label {
  margin: 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #c5bead;
}
.nav-group-admin {
  padding-top: var(--space-3);
  border-top: 1px solid rgba(255,255,255,.16);
}
.tab, .btn {
  min-height: var(--touch); min-width: var(--touch); padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.tab:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--brand-mid);
  outline-offset: 2px;
}
.ui-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: .92;
}
.ui-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .tab {
  width: 100%;
  justify-content: flex-start;
  position: relative;
  background: transparent;
  border-color: transparent;
  color: #f0ebe0;
  font-weight: 500;
  padding-left: 14px;
}
.sidebar .tab:hover { background: rgba(255,255,255,.12); }
.tab.active,
.sidebar .tab.active {
  background: #fff;
  color: var(--brand);
  border-color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.sidebar .tab.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: #c4a35a;
}
.sidebar .tab.tab-sensitive {
  /* Sensível = confirmação ao clicar; visual igual aos demais itens do grupo */
  border-color: transparent;
  background: transparent;
}
.sidebar .tab.tab-audit {
  font-weight: 700;
}
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.4); color: inherit; }
.btn.danger-outline {
  background: rgba(155, 44, 44, .28);
  border-color: #f0b4b4;
  color: #ffe8e8;
  font-weight: 700;
}
.btn.danger-outline:hover,
.btn.danger-outline:focus-visible {
  background: rgba(155, 44, 44, .5);
  border-color: #ffd0d0;
  color: #fff;
}
.btn.tiny { min-height: 32px; padding: 0 10px; font-size: .8rem; }
.btn:disabled { opacity: .55; cursor: wait; }
.sidebar-user {
  margin-top: auto;
  padding: var(--space-3) var(--space-2) var(--space-1);
  border-top: 1px solid rgba(255,255,255,.18);
  display: grid;
  gap: var(--space-3);
}
.sidebar-user-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.28);
  color: #fff;
  flex: 0 0 auto;
}
.sidebar-user-text { min-width: 0; }
.sidebar-user-name {
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .meta {
  color: #d9d2c3;
  margin-top: 2px;
  line-height: 1.3;
}
.sidebar-user-actions {
  display: grid;
  gap: var(--space-2);
}
.sidebar-user .btn.danger-outline { width: 100%; }
.btn-link-side {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d9d2c3;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.btn-link-side:hover,
.btn-link-side:focus-visible {
  color: #fff;
  outline: none;
}
.btn-link-side:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  border-radius: 4px;
}
.app-main {
  min-width: 0;
  width: 100%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.sidebar-backdrop {
  display: none;
}
.content-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px clamp(12px, 2vw, 28px);
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 20;
}
.content-toolbar .btn-voltar-sistema {
  font-weight: 600;
  border-color: var(--brand);
  color: var(--brand);
  background: #fff;
}
.content-toolbar .btn-voltar-sistema:hover {
  background: var(--brand-soft);
}
.content-toolbar-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.content-toolbar-meta strong {
  font-size: 0.95rem;
  color: var(--brand);
}
.content-toolbar-session {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.content-toolbar-session .session-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid var(--line);
}
.content-toolbar-session .session-chip .meta {
  font-weight: 500;
  color: var(--muted);
}
.content-toolbar-session .btn-sair-top {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff;
  font-weight: 600;
}
.content-toolbar-session .btn-sair-top:hover,
.content-toolbar-session .btn-sair-top:focus-visible {
  background: var(--danger-soft);
}
.content {
  padding: var(--space-4) clamp(12px, 2vw, 28px) 48px;
  padding-bottom: max(48px, env(safe-area-inset-bottom));
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 1;
}

/* Mobile / tablet: sidebar em drawer colapsável */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 36, 28, .45);
    z-index: 40;
  }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-md);
    z-index: 50;
    padding-top: max(var(--space-4), env(safe-area-inset-top));
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-brand {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
  }
  .sidebar .brand { font-size: 1.15rem; }
  .sidebar .brand-sub { font-size: .75rem; }
  .sidebar-toggle {
    display: inline-flex;
  }
  .content {
    padding: 12px 10px max(28px, env(safe-area-inset-bottom));
  }
  .content-toolbar {
    padding: 8px 10px;
    gap: 8px;
  }
  .content-toolbar-session .session-chip span.meta { display: none; }
  .page-head {
    align-items: stretch;
  }
  .page-head h2 { font-size: 1.25rem; }
  .page-head .tools {
    width: 100%;
  }
  .page-head .tools .btn {
    flex: 1 1 auto;
  }
  .grid-kpi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filter-bar,
  .periodo-row,
  .periodo-row.rel-filtros,
  .periodo-row.rel-filtros-ym {
    grid-template-columns: 1fr !important;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .calc-panel {
    position: static;
    max-height: none;
  }
  .rede-table-wrap,
  .relatorios-venda .table-wrap {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -2px;
    padding-bottom: 4px;
    max-height: none;
  }
  .product-list { display: grid; gap: 10px; }
  .nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rede-charts { grid-template-columns: 1fr; }
  .rede-filtros { grid-template-columns: 1fr; }
  .chart-bar-row { grid-template-columns: unset; }
  .loja-pick-grid { grid-template-columns: 1fr 1fr; }
  .calc-math {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .calc-math-op { display: none; }
  .ind-kpis { grid-template-columns: 1fr; }
  .atencao-grid { grid-template-columns: 1fr; }
  .sugestao-qtde { font-size: 2.1rem; }
  .login { width: 100%; max-width: 420px; }
  .center { padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
}

@media (max-width: 480px) {
  .loja-pick-grid { grid-template-columns: 1fr; }
  .grid-kpi { gap: 8px; }
  .card { padding: 12px; border-radius: 12px; }
  .sidebar .tab { font-size: .78rem; padding: 0 10px; }
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.page-head {
  display: flex; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; align-items: end;
}
.page-head h2 { margin: 0; font-size: 1.55rem; letter-spacing: -.02em; }
.page-head .tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }

.meta, .hint { color: var(--muted); font-size: var(--text-sm); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.field input, .field select,
.search input, .search select {
  min-height: var(--touch); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 12px; width: 100%; background: #fff;
}

/* Horizonte */
.hz-card { padding: 0; overflow: hidden; }
.hz-top {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.cotacao-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.cotacao-meta > div {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
  background: #f6f8f6;
  border: 1px solid #e4ebe5;
  border-radius: 10px;
  padding: 8px 10px;
}
.cotacao-meta span { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.cotacao-meta b { font-size: .92rem; word-break: break-word; color: var(--ink); }
.cotacao-meta .cotacao-erp { grid-column: 1 / -1; }

/* Abas de solicitação por empresa */
.empresa-tabs-card { padding-bottom: 12px; }
.empresa-tabs-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin-bottom: 10px;
}
.empresa-tabs {
  display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto;
  padding-bottom: 4px; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.empresa-tab {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: var(--touch); padding: 8px 14px;
  border-radius: 12px; border: 1px solid var(--line);
  background: #f7f9f6; color: var(--ink); cursor: pointer;
  font-weight: 600; white-space: nowrap;
}
.empresa-tab:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); }
.empresa-tab.active {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.empresa-tab:disabled { opacity: .55; cursor: not-allowed; }
.empresa-tab .emp-cod {
  font-size: .72rem; font-weight: 800; letter-spacing: .03em;
  opacity: .75; font-variant-numeric: tabular-nums;
}
.empresa-tab.active .emp-cod { opacity: .9; }
.empresa-tab .emp-nome { font-size: .92rem; }
.empresa-tab .emp-itens {
  min-width: 1.6rem; padding: 2px 7px; border-radius: 999px;
  font-size: .75rem; font-weight: 800; font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,.08); color: inherit;
}
.empresa-tab .emp-cots {
  font-size: .72rem; font-weight: 700; opacity: .8;
}
.empresa-tab.active .emp-itens { background: rgba(255,255,255,.22); }

/* Filtro ERP: Empresa + Nº cotação */
.filtro-solic { padding-bottom: 14px; }
.filtro-solic-head { margin-bottom: 12px; }
.filtro-solic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px 16px;
  align-items: end;
}
.filtro-solic .field span {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 6px;
}
.filtro-solic select {
  width: 100%;
  min-height: var(--touch);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}
.filtro-solic select:focus {
  outline: 2px solid var(--brand-soft);
  border-color: var(--brand);
}
.filtro-solic-actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: end;
  padding-bottom: 2px;
}
.btn.danger {
  background: #9b2c2c; color: #fff; border-color: #9b2c2c;
}
.btn.danger:disabled { opacity: .45; }
.btn.ghost-danger {
  background: #fff; color: #9b2c2c; border-color: #e2b4b4;
}
.btn.ghost-danger:hover { background: #fdf2f2; }
.cotacao-lista-wrap { margin-top: 14px; }
.cotacao-lista {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 220px; overflow-y: auto;
}
.cotacao-lista-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; padding: 4px 6px 4px 4px;
}
.cotacao-lista-item.on {
  border-color: var(--brand); background: var(--brand-soft);
}
.cotacao-lista-open {
  flex: 1; min-width: 0; text-align: left;
  border: 0; background: transparent; cursor: pointer;
  padding: 8px 10px; display: flex; flex-direction: column; gap: 2px;
}
.cotacao-lista-open b { font-variant-numeric: tabular-nums; }
.cotacao-lista-del { flex: 0 0 auto; }
.hz-body {
  padding: 14px 16px; background: var(--hz); border-top: 3px solid var(--hz-line);
}
.hz-label { font-weight: 700; margin-bottom: 4px; }
.hz-help { margin: 0 0 10px; font-size: .85rem; color: #6b5a1e; }
.month-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 38px; padding: 0 12px; border-radius: 8px;
  border: 1px solid #c9b56a; background: #fff; cursor: pointer;
  text-transform: uppercase; font-size: .78rem; font-weight: 700;
}
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip.pending:not(.on) { outline: 2px dashed var(--brand); }
.hz-actions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px;
}
.hz-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.7);
  font-size: .85rem;
}
.hz-status.dirty { background: #ffe08a; font-weight: 600; }

/* KPIs */
.grid-kpi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi, .kpi-stat {
  text-align: left;
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--line);
  min-height: 88px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.kpi {
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.kpi:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(26, 36, 28, .06); }
.kpi:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.kpi strong, .kpi-stat strong { display: block; font-size: 1.85rem; line-height: 1.05; letter-spacing: -.02em; }
.kpi span, .kpi-stat span { color: var(--muted); font-size: .84rem; font-weight: 600; }
.kpi small, .kpi-stat small { color: var(--muted); font-size: .72rem; margin-top: 2px; }
.kpi.COMPRAR, .kpi-stat.COMPRAR { border-left-color: var(--danger); background: linear-gradient(180deg, #fff 0%, #fff8f8 100%); }
.kpi.BLOQUEADO_PARADO, .kpi-stat.BLOQUEADO_PARADO { border-left-color: #5c2b2b; background: linear-gradient(180deg, #fff 0%, #faf4f4 100%); }
.kpi.TRANSFERIR, .kpi-stat.TRANSFERIR { border-left-color: var(--warn); background: linear-gradient(180deg, #fff 0%, #fffaf2 100%); }
.kpi.SUBSTITUIR, .kpi-stat.SUBSTITUIR { border-left-color: var(--info); background: linear-gradient(180deg, #fff 0%, #f7f9fc 100%); }
.kpi.NAO_COMPRAR, .kpi-stat.NAO_COMPRAR { border-left-color: var(--ok); background: linear-gradient(180deg, #fff 0%, #f6faf7 100%); }
.kpi.COMPRAR strong, .kpi-stat.COMPRAR strong { color: var(--danger); }
.kpi.TRANSFERIR strong, .kpi-stat.TRANSFERIR strong { color: var(--warn); }
.kpi.SUBSTITUIR strong, .kpi-stat.SUBSTITUIR strong { color: var(--info); }
.kpi.NAO_COMPRAR strong, .kpi-stat.NAO_COMPRAR strong { color: var(--ok); }
.kpi.active {
  box-shadow: 0 0 0 2px var(--brand);
  border-color: var(--brand);
}
.kpi.active::after {
  content: "filtro ativo";
  position: absolute; top: 8px; right: 10px;
  font-size: .65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--brand);
}

.filter-bar {
  position: sticky; top: 62px; z-index: 15;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  display: grid; gap: 10px;
  box-shadow: 0 1px 0 rgba(26, 36, 28, .03);
}
.filter-bar .search-row {
  display: grid; gap: 8px;
}
.status-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.status-chip {
  min-height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: .78rem; font-weight: 700;
  color: var(--muted);
}
.status-chip:hover { border-color: var(--brand); color: var(--brand); }
.status-chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.status-chip.on.COMPRAR { background: var(--danger); border-color: var(--danger); }
.status-chip.on.TRANSFERIR { background: var(--warn); border-color: var(--warn); color: #fff; }
.status-chip.on.SUBSTITUIR { background: var(--info); border-color: var(--info); }
.status-chip.on.NAO_COMPRAR { background: var(--ok); border-color: var(--ok); }

.list-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap;
  padding: 2px 2px 0;
}
.list-toolbar .count {
  font-size: .9rem; font-weight: 700; color: var(--ink);
}
.list-toolbar .count span { color: var(--muted); font-weight: 500; }

.badge {
  display: inline-flex; align-items: center; min-height: 28px;
  padding: 0 10px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  white-space: nowrap;
}
.badge.COMPRAR { background: #fde8e8; color: var(--danger); }
.badge.TRANSFERIR { background: #fff3d6; color: var(--warn); }
.badge.SUBSTITUIR { background: #e7eef8; color: var(--info); }
.badge.BLOQUEADO_PARADO { background: #2b1d1d; color: #ffd0d0; }
.badge.NAO_COMPRAR { background: #e6f4ea; color: var(--ok); }
.badge.ATENCAO { background: #fff3d6; color: #8a5a00; border: 1px solid #e2c56a; }
.badge.ABC-A { background: #1f3d2b; color: #fff; }
.badge.ABC-B { background: #c4a35a; color: #1a241c; }
.badge.ABC-C { background: #d5ddd6; color: #1a241c; }
.badge.GIRO-ALTO { background: #e6f4ea; color: var(--ok); }
.badge.GIRO-MEDIO { background: #e7eef8; color: var(--info); }
.badge.GIRO-BAIXO { background: #fff3d6; color: var(--warn); }
.badge.GIRO-PARADO { background: #fde8e8; color: var(--danger); }
.badge.DIAS-D0_29 { background: #eef1eb; color: #5a665c; }
.badge.DIAS-D30_59 { background: #fff3d6; color: #8a5a00; }
.badge.DIAS-D60_89 { background: #ffe0b8; color: #8a4b00; }
.badge.DIAS-D90_179 { background: #fde8e8; color: #9b2c2c; }
.badge.DIAS-D180_MAIS { background: #2b1d1d; color: #ffd0d0; }
.chip-row-dias {
  margin-top: 6px;
  align-items: center;
}
.chip-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  margin-right: 4px;
}
.badge.GIRO-SEM_ESTOQUE,
.badge.GIRO-SEM_GIRO { background: #f0f2f0; color: var(--muted); }

.loja-pill-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.loja-pill {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; min-width: 140px; text-align: left;
}
.loja-pill.on {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; cursor: pointer; font-size: .82rem;
}
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.abc-bars { display: flex; flex-direction: column; gap: 8px; }
.abc-bar-row { display: grid; grid-template-columns: 36px 1fr minmax(140px,auto); gap: 10px; align-items: center; }
.abc-bar-track { height: 10px; background: #eef1eb; border-radius: 999px; overflow: hidden; }
.abc-bar-fill { height: 100%; border-radius: 999px; }
.abc-bar-fill.ABC-A { background: #1f3d2b; }
.abc-bar-fill.ABC-B { background: #c4a35a; }
.abc-bar-fill.ABC-C { background: #9aa89c; }
.abc-bar-meta { display: flex; flex-direction: column; gap: 2px; font-size: .82rem; }
.abc-bar-meta b { font-size: .88rem; }
.abc-curva-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 8px;
}
.abc-curva-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  justify-content: space-between;
  align-items: flex-end;
}
.abc-recorte-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: min(100%, 420px);
}
.abc-recorte-filtros .field { flex: 1 1 160px; margin: 0; }
.abc-criterio-line { margin-top: 4px; }
.abc-pareto-hint { margin-top: 10px; }
.abc-filtros-direita {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin: 8px 0 4px;
}
.abc-filtros-direita .field { margin: 0; }
.abc-filtros-loja-primeiro .field-loja-abc {
  grid-column: 1 / -1;
}
.abc-filtros-loja-primeiro .field-loja-abc select {
  font-weight: 600;
  border-color: var(--brand);
}
.abc-filtros-direita .field:last-child { grid-column: 1 / -1; }
.loja-pick.on {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.abc-grupo-rede {
  border-left: 3px solid var(--brand);
}
.abc-indisponivel {
  margin-top: 10px;
  padding: 12px 14px;
  background: #f6f3ea;
  border: 1px solid #e2d8c0;
  border-radius: 8px;
}
.abc-indisponivel .hint { margin: 0 0 4px; }
.grid-kpi-compact {
  margin: 8px 0 10px;
}
.grid-kpi-compact .kpi {
  padding: 10px 12px;
}
.grid-kpi-compact .kpi strong {
  font-size: 1.05rem;
}
.abc-recorte-line { margin: 2px 0 6px; }
.abc-curva-grid-compact { margin-top: 6px; }
button.linkish {
  border: 0; background: none; padding: 0; color: var(--brand);
  font: inherit; font-weight: 600; cursor: pointer; text-align: left;
}
button.linkish:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .abc-curva-grid { grid-template-columns: 1fr; }
  .abc-recorte-filtros { min-width: 100%; }
  .abc-filtros-direita { grid-template-columns: 1fr; }
  .abc-filtros-direita .field:last-child { grid-column: auto; }
}

/* Importação lote operacional */
.imp-auto-pick {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--brand);
  background: var(--brand-soft);
  cursor: pointer;
}
.imp-auto-pick span { font-size: .88rem; color: var(--brand); }
.imp-file-row.imp-recog-ok { border-color: #b7d4c0; background: #f6faf7; }
.imp-recog {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-right: 6px;
}
.imp-recog.ok { color: var(--ok); }
.imp-recog.warn { color: var(--warn); }

/* Aviso diário de importação */
.base-aviso-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 12px 16px;
  border-bottom: 1px solid transparent;
}
.base-aviso-warn {
  background: #fff6e5;
  border-bottom-color: #e0c96a;
  color: #6b4e12;
}
.base-aviso-erro {
  background: #fdeeee;
  border-bottom-color: #e0a0a0;
  color: #7a2424;
}
.base-aviso-text {
  display: grid;
  gap: 2px;
  min-width: min(100%, 280px);
  flex: 1;
}
.base-aviso-text strong { font-size: .92rem; }
.base-aviso-text span { font-size: .84rem; line-height: 1.35; opacity: .95; }
.base-aviso-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.base-aviso-banner .btn.ghost {
  background: transparent;
  border-color: currentColor;
  opacity: .85;
}

.inicio-page { gap: var(--space-5); }
.inicio-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.inicio-page-head h1 {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1.25;
}
.inicio-page-sub {
  margin: var(--space-2) 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.4;
}
.inicio-tech-meta {
  font-size: var(--text-xs);
  color: var(--muted);
  opacity: .7;
}

/* Banner de status de importação (destaque principal) */
.status-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.status-banner-ok {
  background: var(--ok-soft);
  border-color: #b7d7c2;
}
.status-banner-aviso {
  background: var(--warn-soft);
  border-color: #e8d59a;
}
.status-banner-erro {
  background: var(--danger-soft);
  border-color: #efc0c0;
}
.status-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.7);
  color: inherit;
  flex: 0 0 auto;
}
.status-banner-ok .status-banner-icon { color: var(--ok); }
.status-banner-aviso .status-banner-icon { color: var(--warn); }
.status-banner-erro .status-banner-icon { color: var(--danger); }
.status-banner-body { min-width: 0; }
.status-banner-body h2 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.25;
}
.status-banner-body p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-soft);
  line-height: 1.4;
}
.status-banner-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
}
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.status-pill-ok { background: #fff; color: var(--ok); border: 1px solid #b7d7c2; }
.status-pill-aviso { background: #fff; color: var(--warn); border: 1px solid #e8d59a; }
.status-pill-erro { background: #fff; color: var(--danger); border: 1px solid #efc0c0; }
@media (max-width: 720px) {
  .status-banner {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }
  .status-banner-actions {
    grid-column: 1 / -1;
    align-items: stretch;
  }
  .status-banner-actions .btn { width: 100%; }
}

/* Tabela de arquivos operacionais */
.op-files-card { padding: 0; overflow: hidden; }
.op-files-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--line);
}
.op-files-head h2 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 700;
}
.op-files-table-wrap { overflow-x: auto; }
.op-files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.op-files-table th,
.op-files-table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.op-files-table th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  font-weight: 700;
  background: var(--bg-elevated);
  white-space: nowrap;
}
.op-files-table tbody tr:last-child td { border-bottom: 0; }
.op-files-table tbody tr.row-ok { background: #fbfdfb; }
.op-files-table tbody tr.row-atrasado { background: #fffaf2; }
.op-files-table tbody tr.row-critico { background: #fff6f0; box-shadow: inset 3px 0 0 var(--warn); }
.op-files-table tbody tr.row-nunca { background: #fff5f5; box-shadow: inset 3px 0 0 var(--danger); }
.op-files-name { font-weight: 700; color: var(--ink); }
.op-files-type {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
}
.op-files-type.obrigatorio {
  background: #fff3d6;
  color: #8a5a00;
  border-color: #e2c56a;
}
.file-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}
.file-status-ok { background: var(--ok-soft); color: var(--ok); }
.file-status-atrasado { background: var(--warn-soft); color: var(--warn); }
.file-status-critico { background: #ffe8d6; color: #8a4b00; }
.file-status-nunca { background: var(--danger-soft); color: var(--danger); }
.file-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* Atalhos do dia */
.shortcut-section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}
.shortcut-section-head h2 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 700;
}
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
.shortcut-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: inherit;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.shortcut-card:hover {
  border-color: var(--brand-mid);
  box-shadow: var(--shadow-sm);
}
.shortcut-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.shortcut-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.shortcut-card b {
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
}
.shortcut-card .meta {
  margin-top: 2px;
  font-size: var(--text-xs);
}
@media (min-width: 720px) {
  .shortcut-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.sidebar-toggle-bar {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: var(--touch);
  min-height: var(--touch);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
  cursor: pointer;
  flex: 0 0 auto;
}
.sidebar-toggle-bar:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
@media (max-width: 900px) {
  .sidebar-toggle-bar { display: inline-flex; }
}

/* KPIs análise de estoque da loja */
.rede-loja-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.rede-periodo-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .75rem;
  font-weight: 700;
}
.rede-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.rede-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  min-height: 108px;
  box-shadow: 0 1px 0 rgba(26, 36, 28, .03);
}
button.rede-kpi {
  font: inherit;
  cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
button.rede-kpi:hover {
  transform: translateY(-1px);
  border-color: #b9c7bc;
  box-shadow: 0 6px 16px rgba(26, 36, 28, .06);
}
.rede-kpi-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.rede-kpi-label em {
  font-style: normal;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: #8a968c;
  font-size: .7rem;
}
.rede-kpi-value {
  font-size: 1.55rem;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
}
.rede-kpi-value small {
  margin-left: 4px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}
.rede-kpi-sub {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.3;
}
.rede-kpi-valor { border-top: 3px solid var(--brand); }
.rede-kpi-giro { border-top: 3px solid var(--info); }
.rede-kpi-abc { border-top: 3px solid #c4a35a; padding-top: 12px; }
.rede-kpi-abc .abc-tri-card { gap: 6px; }
.rede-kpi-parado { border-top: 3px solid var(--warn); }
.rede-kpi-parado .rede-kpi-value { color: #8a5a00; }
.rede-kpi-parado.on {
  border-color: var(--warn);
  box-shadow: 0 0 0 2px rgba(154, 107, 18, .25);
  background: #fffaf2;
}
.abc-tri-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.abc-tri-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}
.abc-tri-meta {
  font-style: normal;
  font-size: .7rem;
  font-weight: 600;
  color: #8a968c;
}
.abc-tri-card.compact .rede-abc-cell b { font-size: 1.05rem; }
.rede-abc-tri {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 2px;
}
.rede-abc-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 8px 7px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #f6f8f6;
  font: inherit;
  text-align: left;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
button.rede-abc-cell { cursor: pointer; }
button.rede-abc-cell:hover { background: #eef3ef; border-color: var(--line); }
.rede-abc-cell.on {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}
.rede-abc-cell .badge {
  min-height: 22px;
  padding: 0 8px;
  font-size: .7rem;
}
.rede-abc-cell b {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
}
.rede-abc-cell small {
  font-size: .68rem;
  color: var(--muted);
  font-weight: 600;
}
.abc-bars-under-tri { margin-top: 12px; }
.abc-mini {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: .78rem;
  color: var(--muted);
}
.abc-mini .badge {
  min-height: 18px;
  padding: 0 6px;
  font-size: .65rem;
}
.rede-kpis-compact .rede-kpi { min-height: 96px; }
.abc-curva-card .abc-tri-card {
  padding: 12px 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-top: 3px solid #c4a35a;
}
@media (min-width: 960px) {
  .rede-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rede-kpi-value { font-size: 1.65rem; }
}

/* Ajuda indicadores ABC/giro — fechada até clicar */
.rede-help {
  padding: 0;
  overflow: hidden;
}
.rede-help-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-weight: 600;
  color: var(--brand);
}
.rede-help-summary::-webkit-details-marker { display: none; }
.rede-help-summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 500;
  transition: transform .15s ease;
}
.rede-help:not([open]) .rede-help-summary::after { transform: rotate(-90deg); }
.rede-help-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}
.rede-help-dl {
  display: grid;
  gap: 12px;
  margin: 0;
}
.rede-help-dl dt {
  font-weight: 700;
  font-size: .88rem;
  margin-bottom: 2px;
}
.rede-help-dl dd {
  margin: 0;
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.45;
}
.rede-help-dl code {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .78rem;
}

/* Tabela estoque rede — usa a largura toda */
.rede-loja .rede-table-wrap,
.rede-loja .table-wrap.rede-table-wrap {
  display: block !important;
  width: 100%;
  overflow-x: auto;
}
table.rede-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}
.rede-table th, .rede-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e7eee8;
  vertical-align: middle;
  font-size: .88rem;
}
.rede-table th {
  position: sticky; top: 0; z-index: 2;
  background: #eef3ef;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 700;
  color: #3d4a40;
}
.rede-table col.col-abc { width: 56px; }
.rede-table col.col-prod { width: 28%; }
.rede-table col.col-curva { width: 18%; }
.rede-table col.col-num-w { width: 12%; }
.rede-table col.col-num-sm { width: 8%; }
.rede-table col.col-faixa { width: 10%; }
.rede-table .col-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rede-table .col-produto { word-break: break-word; }
.rede-table .col-curva-abc { min-width: 140px; }

.item-abc { display: flex; flex-direction: column; gap: 4px; }
.item-abc-top {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: .78rem; font-variant-numeric: tabular-nums;
}
.item-abc-track {
  height: 8px; background: #e8eee9; border-radius: 999px; overflow: hidden;
}
.item-abc-fill { display: block; height: 100%; border-radius: 999px; }
.item-abc-fill.ABC-A { background: #1f3d2b; }
.item-abc-fill.ABC-B { background: #c4a35a; }
.item-abc-fill.ABC-C { background: #9aa89c; }
.rede-export-hint { margin-top: 8px; }

.periodo-card { padding-bottom: 14px; }
.periodo-head {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  align-items: flex-start; margin-bottom: 12px;
}
.periodo-row {
  display: grid;
  grid-template-columns: 140px 140px auto 1fr;
  gap: 10px;
  align-items: end;
}
.periodo-totais {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  justify-content: flex-end;
}
.periodo-totais > div { display: flex; flex-direction: column; gap: 2px; }
.periodo-totais b { font-size: 1.05rem; }

table.rede-table-wide { min-width: 1280px; table-layout: auto; }
.rede-table-wide th, .rede-table-wide td { padding: 9px 10px; }

.periodo-row.rel-filtros {
  grid-template-columns: 1.2fr 140px 140px auto;
}
.periodo-row.rel-filtros-ym {
  grid-template-columns: minmax(160px, 1.1fr) minmax(200px, 1fr) minmax(200px, 1fr) auto;
  gap: 12px;
  margin-top: 14px;
}
.rel-periodo-block {
  background: #f5f8f5;
  border: 1px solid #d7e3da;
  border-radius: 12px;
  padding: 12px 14px;
}
.rel-ano-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 8px;
}
.ano-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ano-tab {
  border: 1px solid #c5d4c9;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  min-height: var(--touch);
}
.ano-tab:hover { border-color: var(--brand); }
.ano-tab.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.rel-ano-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.rel-mes-chips { margin-top: 2px; }
.rel-mes-chips .chip.pick {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.rel-ym-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rel-ym-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.rel-ym-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.periodo-row.rel-filtros-cat {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}
.rel-filtro-erp .rel-erp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.rel-erp-field-wide { grid-column: 1 / -1; }
.rel-erp-label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 6px;
}
.rel-erp-field select {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
}
.rel-emissao-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.rel-emissao-a {
  font-weight: 700;
  color: var(--muted);
  padding: 0 2px;
}
.rel-table-pro { min-width: 1100px; }
@media (max-width: 900px) {
  .rel-filtro-erp .rel-erp-grid {
    grid-template-columns: 1fr;
  }
}

.rel-resultado-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  cursor: pointer;
  padding: 4px 2px 8px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 4px;
}
.rel-resultado-head:hover {
  background: #f5f8f5;
  border-radius: 8px;
}
.rel-resultado {
  position: relative;
}
.relatorios-venda thead {
  cursor: pointer;
}
.rel-loja-chips .chip {
  font-size: .78rem;
  padding: 6px 10px;
}
@media (max-width: 900px) {
  .periodo-row.rel-filtros-cat {
    grid-template-columns: 1fr;
  }
}
tr.row-on td { background: #f3f7f4; }

.rede-charts {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}
.chart-bars { display: flex; flex-direction: column; gap: 10px; }
.chart-bar-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  border: 0;
  background: transparent;
  padding: 6px 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
  min-width: 0;
}
.chart-bar-row:hover .chart-bar-fill { filter: brightness(1.08); }
.chart-bar-row:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.chart-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.chart-bar-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.chart-bar-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.loja-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.chart-bar-track {
  height: 10px; background: #e8eee9; border-radius: 999px; overflow: hidden; width: 100%;
}
.chart-bar-fill {
  display: block; height: 100%; background: var(--brand); border-radius: 999px;
}
.chart-bar-val {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  flex: 0 0 auto;
  white-space: nowrap;
}

.abc-donut-wrap {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  margin-top: 8px;
}
.abc-donut {
  width: 132px; height: 132px; border-radius: 50%;
  box-shadow: inset 0 0 0 28px var(--surface);
}
.abc-donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }
.abc-donut-legend > div { display: flex; align-items: center; gap: 8px; }

.loja-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 12px;
  margin-top: 8px;
  align-items: stretch;
}
.loja-pick {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  min-width: 0;
  height: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow-sm);
}
.loja-pick:hover { border-color: var(--brand); background: var(--brand-soft); }
.loja-pick:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.loja-pick-name {
  font-weight: 700;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  line-height: 1.2;
}
.loja-pick-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.loja-pick-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: -.01em;
}
.loja-pick-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 2px;
  border-top: 1px solid var(--line);
}
.loja-pick-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.loja-pick-stat-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.loja-pick-stat-val {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.loja-pick-abc {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: auto;
}
.loja-pick-abc-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  font-size: .72rem;
  color: var(--ink-soft);
}
.loja-pick-abc-item b {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
}
.loja-pick-abc-item .badge {
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
}
.loja-pick-spark {
  display: block;
  width: 100%;
  height: 4px;
  background: #e8eee9;
  border-radius: 999px;
  overflow: hidden;
}
.loja-pick-spark > span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}

.giro-mini {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
  margin-top: 6px;
}
.giro-mini-item {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; text-align: left;
}
.giro-mini-item b { font-size: 1.15rem; }
.giro-mini-item span { font-size: .75rem; color: var(--muted); }
.giro-mini-item.on { border-color: var(--brand); background: var(--brand-soft); }

.prod-cell { display: flex; flex-direction: column; gap: 2px; }
.prod-cell b { font-variant-numeric: tabular-nums; }

.rede-filtros {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: 10px;
  align-items: end;
}
.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.th-sort:hover { color: var(--brand); }
.th-sort.on { color: var(--brand); font-weight: 700; }

.export-menu {
  position: fixed;
  z-index: 9999;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(26, 36, 28, .16);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.export-menu-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 6px 10px 4px;
}
.export-menu button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.export-menu button:hover { background: var(--brand-soft); color: var(--brand); }

@media (max-width: 900px) {
  .rede-charts { grid-template-columns: 1fr; }
  .chart-bar-row { grid-template-columns: unset; }
  .rede-filtros { grid-template-columns: 1fr 1fr; }
}

/* Workspace: tabela + painel de cálculo */
.workspace {
  display: grid; gap: 14px; align-items: start;
}
.workspace-main {
  min-width: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.calc-panel {
  background: linear-gradient(180deg, #f7faf7 0%, #f1f5f1 100%);
  border: 1px solid #b7d4c0;
  border-radius: 16px; padding: 16px;
  scroll-margin-top: 80px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 8px 24px rgba(31, 61, 43, .06);
}
.calc-panel.flash {
  animation: calcFlash .7s ease;
}
@keyframes calcFlash {
  0%, 100% { box-shadow: none; }
  30% { box-shadow: 0 0 0 3px rgba(31, 61, 43, .35); }
}
.calc-kicker {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--brand); margin: 0;
}
.calc-panel h3 { margin: 0 0 4px; font-size: 1rem; color: var(--brand); }
.calc-panel .calc-product { font-weight: 700; margin: 0; font-size: 1.05rem; line-height: 1.25; }
.calc-code { margin: 0; }
.calc-empty { color: var(--muted); font-size: .9rem; margin: 0; }

.sugestao-hero {
  border-radius: 14px; padding: 14px 14px 12px;
  border: 2px solid var(--line); background: #fff;
}
.sugestao-hero.COMPRAR {
  background: linear-gradient(165deg, #fff5f5 0%, #fde8e8 100%);
  border-color: #c75a5a;
}
.sugestao-hero.TRANSFERIR {
  background: linear-gradient(165deg, #fffaf0 0%, #fff1d1 100%);
  border-color: #d4a017;
}
.sugestao-hero.SUBSTITUIR {
  background: linear-gradient(165deg, #f5f8fd 0%, #e4ecf8 100%);
  border-color: #5b7fad;
}
.sugestao-hero.NAO_COMPRAR {
  background: linear-gradient(165deg, #f3faf5 0%, #e2f3e8 100%);
  border-color: #4a9a68;
}
.sugestao-hero-top {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.sugestao-hero-label {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted);
}
.sugestao-qtde {
  font-size: 2.6rem; font-weight: 800; line-height: 1.05;
  letter-spacing: -.02em; margin-top: 6px; color: var(--ink);
}
.sugestao-hero.COMPRAR .sugestao-qtde { color: var(--danger); }
.sugestao-hero.TRANSFERIR .sugestao-qtde { color: var(--warn); }
.sugestao-hero.SUBSTITUIR .sugestao-qtde { color: var(--info); }
.sugestao-hero.NAO_COMPRAR .sugestao-qtde { color: var(--ok); }
.sugestao-unidade {
  font-size: .78rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.sugestao-motivo {
  margin: 10px 0 0; font-size: .88rem; line-height: 1.35; color: var(--ink);
}

.calc-math {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 4px; align-items: stretch;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 8px;
}
.calc-math-cell {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 6px; border-radius: 8px; background: #f3f6f3;
  text-align: center; min-width: 0;
}
.calc-math-cell span {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); font-weight: 600;
}
.calc-math-cell b { font-size: 1.05rem; }
.calc-math-cell.highlight {
  background: #fff; border: 1px solid var(--line);
}
.calc-math-cell.highlight.COMPRAR { background: #fdeeee; border-color: #e0a0a0; }
.calc-math-cell.highlight.TRANSFERIR { background: #fff8e8; border-color: #e2c56a; }
.calc-math-cell.highlight.SUBSTITUIR { background: #eef3fb; border-color: #9db6d8; }
.calc-math-cell.highlight.NAO_COMPRAR { background: #eaf6ee; border-color: #9dceb0; }
.calc-math-op {
  display: grid; place-items: center;
  font-weight: 800; color: var(--muted); font-size: 1.1rem; padding: 0 2px;
}

.calc-section {
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px;
}
.calc-section-title {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--brand); margin-bottom: 8px;
}
.calc-tiles {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.calc-tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.calc-tiles > div {
  background: #f3f6f3; border-radius: 8px; padding: 8px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.calc-tiles span {
  font-size: .68rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: .02em; font-weight: 600;
}
.calc-tiles b { font-size: .92rem; word-break: break-word; }
.calc-tiles .tile-emphasis {
  grid-column: 1 / -1;
  background: var(--brand-soft); border: 1px solid #b7d4c0;
}
.calc-note {
  display: grid; gap: 2px;
  padding: 8px 10px; border-radius: 10px;
  background: #fff; border: 1px dashed var(--line);
  font-size: .82rem;
}
.calc-note.muted { color: var(--muted); margin-top: 8px; }
.rede-table td.muted { color: var(--muted); }
.calc-note.formula-tag {
  margin-top: 8px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .78rem;
  background: #e8f0ea;
  border: 1px dashed #b7d4c0;
  border-radius: 8px;
  padding: 8px 10px;
  color: #2a4a35;
}
.calc-more summary::-webkit-details-marker { display: none; }
.calc-more[open] summary { margin-bottom: 4px; }

/* Indicadores — painel ampliado */
.ind-panel { padding: 12px 14px 14px; }
.ind-summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
  cursor: pointer; list-style: none; user-select: none;
  margin-bottom: 0;
}
.ind-summary::-webkit-details-marker { display: none; }
.ind-summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
  font-size: .85rem;
  transition: transform .15s ease;
}
.ind-panel:not([open]) .ind-summary::after { transform: rotate(-90deg); }
.ind-summary-hint {
  font-size: .68rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.ind-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.ind-kpi {
  background: #f3f6f3;
  border: 1px solid #e0e8e1;
  border-radius: 10px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ind-kpi span {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
}
.ind-kpi b {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--ink);
}
.ind-kpi em {
  font-style: normal;
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.3;
}
.ind-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.ind-block-title {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--brand);
  margin-bottom: 8px;
}
.ind-bars { display: grid; gap: 8px; }
.ind-bar-row { display: grid; gap: 4px; }
.ind-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: .78rem;
}
.ind-bar-label span { color: var(--muted); font-weight: 600; }
.ind-bar-label b { font-variant-numeric: tabular-nums; }
.ind-bar-track {
  height: 10px;
  background: #e8eee9;
  border-radius: 999px;
  overflow: hidden;
}
.ind-bar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 0;
  transition: width .25s ease;
}
.ind-bar-fill.tone-hist { background: #1f3d2b; }
.ind-bar-fill.tone-recent { background: #5b8f6e; }
.ind-bar-fill.tone-fc { background: #c4a35a; }

/* —— Comparativo sazonal (painel de atenção) —— */
.saz-panel {
  border: 1px solid #c5d6c9;
  background:
    linear-gradient(180deg, #f4f8f5 0%, #ffffff 42%);
  box-shadow: 0 1px 0 rgba(31, 61, 43, 0.04);
}
.saz-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.saz-head-sub {
  margin: 4px 0 0;
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.35;
}
.saz-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #1f3d2b;
  color: #f4f8f5;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.saz-metricas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.saz-metrica {
  border-radius: 14px;
  padding: 12px 12px 10px;
  border: 1px solid #d5e0d7;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.saz-metrica.tone-media {
  border-color: #1f3d2b;
  background: linear-gradient(180deg, #e8f0ea 0%, #ffffff 55%);
}
.saz-metrica.tone-ultimo {
  border-color: #6f9a7c;
  border-width: 2px;
  background: linear-gradient(180deg, #eef7f0 0%, #f7fbf8 100%);
}
.saz-metrica.tone-fc {
  border-color: #d4bc7a;
  background: linear-gradient(180deg, #fbf6ea 0%, #ffffff 60%);
}
.saz-metrica-kicker {
  display: flex;
  align-items: center;
  min-height: 22px;
}
.saz-metrica-kicker > span:not(.saz-badge) {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.saz-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: #1f3d2b;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.saz-metrica-label {
  font-size: .78rem;
  font-weight: 700;
  color: #2a382e;
}
.saz-metrica-valor {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #14261b;
  letter-spacing: -.02em;
}
.saz-metrica.tone-ultimo .saz-metrica-valor { color: #1f3d2b; }
.saz-metrica.tone-fc .saz-metrica-valor { color: #6e5420; }
.saz-metrica-bar {
  height: 8px;
  margin-top: 4px;
  background: #e6ece7;
  border-radius: 999px;
  overflow: hidden;
}
.saz-metrica-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
}
.saz-metrica-bar i.tone-hist { background: #1f3d2b; }
.saz-metrica-bar i.tone-recent { background: #4f8661; }
.saz-metrica-bar i.tone-fc { background: #c4a35a; }
.saz-metrica-hint {
  margin: 4px 0 0;
  font-size: .72rem;
  color: #5a665c;
  line-height: 1.35;
}
.saz-legenda {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed #b7c9bb;
  background: #f7faf7;
  font-size: .78rem;
  color: #3d4a40;
  line-height: 1.4;
}
.saz-meses-block { margin-top: 14px; }
.saz-meses-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}
.saz-meses-title span {
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #1f3d2b;
}
.saz-meses-title em {
  font-style: normal;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 600;
}
.saz-meses-note {
  margin: 0 0 10px;
  font-size: .74rem;
  color: #5a665c;
  line-height: 1.35;
}
.saz-meses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.saz-mes-card {
  background: #fff;
  border: 1px solid #d5e0d7;
  border-radius: 14px;
  padding: 12px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.saz-mes-card.has-ultimo {
  border-color: #8fb398;
  box-shadow: inset 0 0 0 1px rgba(31, 61, 43, 0.06);
}
.saz-mes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.saz-mes-nome {
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #1f3d2b;
}
.saz-mes-tag {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #1f3d2b;
  background: #dfeae2;
  border-radius: 999px;
  padding: 2px 7px;
}
.saz-mes-valor {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: #14261b;
}
.saz-mes-sub {
  font-size: .7rem;
  color: var(--muted);
  font-weight: 600;
}
.saz-ano-list {
  display: grid;
  gap: 3px;
  margin-top: 6px;
}
.saz-ano-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 4px 7px;
  border-radius: 8px;
  background: #f2f5f2;
  font-size: .72rem;
  color: #4a554d;
}
.saz-ano-row b { font-variant-numeric: tabular-nums; }
.saz-ano-row.on {
  background: #1f3d2b;
  color: #fff;
}
.saz-mes-callout {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #e7f2ea;
  border: 1px solid #b7d0be;
  font-size: .74rem;
  color: #1f3d2b;
  font-weight: 600;
}
.saz-mes-callout strong {
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
}
.saz-mes-formula {
  display: block;
  margin-top: 6px;
  padding: 5px 7px;
  border-radius: 8px;
  background: #f6f7f6;
  border: 1px dashed #cfd8d1;
  font-size: .66rem;
  color: #5a665c;
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
}
@media (max-width: 720px) {
  .saz-metricas { grid-template-columns: 1fr; }
}
.calc-formula-stack {
  display: grid;
  gap: 4px;
  margin: 8px 0 12px;
  background: #fff;
  border: 1px solid #d5e3d9;
  border-radius: 12px;
  padding: 8px;
}
.calc-formula-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: .86rem;
}
.calc-formula-row span { color: var(--muted); }
.calc-formula-row b { font-variant-numeric: tabular-nums; font-size: 1.02rem; }
.calc-formula-row.result {
  background: var(--brand-soft);
  border: 1px solid #b7d4c0;
  margin-top: 4px;
  font-weight: 700;
}
.calc-formula-row.result span { color: var(--brand); font-weight: 700; }

/* Caixas coloridas (não as linhas da fórmula) */
.calc-boxes {
  display: grid;
  gap: 8px;
}
.calc-boxes-2 { grid-template-columns: 1fr 1fr; }
.calc-boxes-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.calc-math-boxes {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 6px;
  align-items: stretch;
}
.calc-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 12px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  border-left: 5px solid #8a968c;
  background: #f3f5f4;
  min-width: 0;
}
.calc-box span {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
}
.calc-box b {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
}
.calc-box em.meta {
  display: block;
  font-style: normal;
  font-size: .72rem;
  color: var(--muted);
  margin-top: 2px;
}
.calc-math-boxes .calc-box {
  text-align: center;
  align-items: center;
  padding: 10px 8px;
}
.calc-math-boxes .calc-box b { font-size: 1.2rem; }

.calc-box.box-pedido {
  background: #f3ecf8;
  border-color: #dcc8ec;
  border-left-color: #6b4c8a;
}
.calc-box.box-pedido b { color: #5a3d75; }

.calc-box.box-saldo {
  background: #e7f3eb;
  border-color: #b7d4c0;
  border-left-color: #276749;
}
.calc-box.box-saldo b { color: #276749; }

.calc-box.box-sugestao {
  background: #e8f0eb;
  border-color: #b7d4c0;
  border-left-color: var(--brand);
}
.calc-box.box-sugestao b { color: var(--brand); }
.calc-box.box-sugestao.COMPRAR {
  background: #fdeeee;
  border-color: #e0a0a0;
  border-left-color: var(--danger);
}
.calc-box.box-sugestao.COMPRAR b { color: var(--danger); }
.calc-box.box-sugestao.TRANSFERIR {
  background: #fff8e8;
  border-color: #e2c56a;
  border-left-color: var(--warn);
}
.calc-box.box-sugestao.TRANSFERIR b { color: var(--warn); }

.calc-box.box-ressuprimento {
  background: #fff6e5;
  border-color: #e8d59a;
  border-left-color: #c4922a;
}
.calc-box.box-ressuprimento b { color: #8a5a00; }
.calc-box.box-ressuprimento.is-warn {
  background: #fdeeee;
  border-color: #e0a0a0;
  border-left-color: #9b2c2c;
}
.calc-box.box-ressuprimento.is-warn b { color: #9b2c2c; }

.calc-box.box-custo {
  background: #eef3f7;
  border-color: #c5d2db;
  border-left-color: #4a6670;
}
.calc-box.box-custo b { color: #3a5058; }
.calc-box.box-total {
  background: #eaf6f0;
  border-color: #b7d4c0;
  border-left-color: #276749;
}
.calc-box.box-total b { color: #276749; }
.calc-box.box-prazo {
  background: #f7f3ea;
  border-color: #e0d4b8;
  border-left-color: #8a7340;
}
.calc-box.box-prazo b { color: #6b5a2e; }
.calc-box.box-entrega {
  background: #eaf5f7;
  border-color: #b8d4da;
  border-left-color: #2a6f7a;
}
.calc-box.box-entrega b { color: #2a6f7a; }
.calc-box.box-base {
  background: #f2f4f2;
  border-color: #d0d8d1;
  border-left-color: #5a665c;
}
.calc-box.box-base b { color: #3d4a40; }

.calc-box.box-cobertura {
  background: #eef4fb;
  border-color: #c3d2e8;
  border-left-color: #2b4c7e;
}
.calc-box.box-cobertura b { color: #2b4c7e; }
.calc-box.box-giro {
  background: #e8f3ec;
  border-color: #b7d4c0;
  border-left-color: #276749;
}
.calc-box.box-giro b { color: #276749; }
.calc-box.box-vendas12 {
  background: #fff6e8;
  border-color: #e8d59a;
  border-left-color: #9a6b12;
}
.calc-box.box-vendas12 b { color: #8a5a00; }
.calc-box.box-margem {
  background: #f3ecf8;
  border-color: #dcc8ec;
  border-left-color: #6b4c8a;
}
.calc-box.box-margem b { color: #5a3d75; }
.calc-box.box-pico {
  background: #eef2f8;
  border-color: #c5cedd;
  border-left-color: #3d5a80;
}
.calc-box.box-pico b { color: #3d5a80; }

@media (max-width: 720px) {
  .calc-boxes-2,
  .calc-boxes-3 { grid-template-columns: 1fr; }
  .calc-math-boxes {
    grid-template-columns: 1fr;
  }
  .calc-math-boxes .calc-math-op { padding: 2px 0; }
}
.calc-alert-neg {
  background: #fdeeee;
  border: 1px solid #e0a0a0;
  color: #8a3030;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: .84rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.calc-formula-row.result-warn {
  background: #fff5f5;
  border-color: #e8b4b4;
}
.calc-formula-row.result-warn span,
.calc-formula-row.result-warn b { color: #8a3030; }

.atencao-box {
  border-radius: 14px;
  padding: 12px 14px;
  border: 2px solid #e2c56a;
  background: linear-gradient(165deg, #fffaf0 0%, #fff1d1 100%);
  display: grid;
  gap: 8px;
}
.atencao-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.atencao-kicker {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: #8a5a00;
}
.atencao-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.atencao-grid > div {
  background: rgba(255,255,255,.65);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.atencao-grid span {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: #8a5a00;
}
.atencao-grid b {
  font-size: 1.25rem; font-variant-numeric: tabular-nums; color: var(--ink);
}
.atencao-grid b.neg { color: #8a3030; }
.atencao-txt {
  margin: 0; font-size: .84rem; line-height: 1.35; color: #5c4510;
}
.atencao-inline {
  color: #8a5a00 !important;
  font-weight: 600;
  margin-top: 4px;
}
.rec-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.demanda-table .col-saldo-proj.is-atencao,
.demanda-table td.is-atencao {
  color: #8a3030;
  font-weight: 700;
}
.demanda-table tr.row-atencao td {
  background: #fffaf0;
}
.nums .num-warn b { color: #8a3030; }
.calc-tiles-2 { grid-template-columns: 1fr 1fr; }
.calc-tiles .tile-warn {
  background: #fff5f5;
  border: 1px solid #e8b4b4;
}
.calc-tiles em.meta {
  display: block;
  font-style: normal;
  margin-top: 2px;
  font-size: .72rem;
}
.calc-steps {
  margin: 0 0 8px;
  padding-left: 1.2rem;
  display: grid;
  gap: 6px;
  font-size: .84rem;
  color: var(--ink);
  line-height: 1.35;
}
.calc-steps li::marker { color: var(--brand); font-weight: 700; }
@media (max-width: 1100px) {
  .calc-tiles-2 { grid-template-columns: 1fr; }
}
.forecast-note {
  background: #faf8f2; border-style: solid; border-color: #e5d9b8;
}
.forecast-note span { color: var(--muted); font-size: .72rem; text-transform: uppercase; font-weight: 700; }
.forecast-note b { font-size: 1.15rem; }
.forecast-note em { font-style: normal; color: var(--muted); font-size: .8rem; }

.acao-box {
  border-radius: 10px; padding: 10px 12px; margin: 8px 0 4px; border: 1px solid var(--line);
  background: #fff;
}
.acao-box.TRANSFERIR { background: #fff8e8; border-color: #e2c56a; }
.acao-box.SUBSTITUIR { background: #eef3fb; border-color: #9db6d8; }
.acao-box.COMPRAR { background: #fdeeee; border-color: #e0a0a0; }
.acao-box.NAO_COMPRAR { background: #eaf6ee; border-color: #9dceb0; }
.acao-list { margin: 0; padding-left: 1.1rem; display: grid; gap: 4px; font-size: .88rem; }
.acao-cell { white-space: normal !important; min-width: 160px; max-width: 280px; font-size: .82rem; }
.refs-box {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; margin-bottom: 8px;
}
.refs-box > div:last-child { grid-column: 1 / -1; }
.refs-box .meta { display: block; font-size: .75rem; }
.refs-box b { font-size: .95rem; }
.transf-grid { display: grid; gap: 10px; }
.transf-card {
  background: #fff8e8; border: 1px solid #e2c56a; border-radius: 12px; padding: 12px 14px;
}
.transf-title { font-weight: 700; color: var(--brand); margin-bottom: 4px; }
@media (min-width: 960px) {
  .transf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Detalhe de transferências — tabela legível por loja origem */
.transf-detail { padding: 16px 18px 18px; }
.transf-detail-list { display: grid; gap: 14px; }
.transf-detail-block {
  border: 1px solid #e2c56a;
  border-radius: 14px;
  background: #fffdf6;
  overflow: hidden;
}
.transf-detail-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 14px;
  background: #fff8e8;
  border-bottom: 1px solid #e8d59a;
}
.transf-detail-loja {
  font-size: 1.05rem; font-weight: 800; color: var(--brand);
  letter-spacing: -.01em;
}
.transf-detail-stats {
  display: flex; gap: 16px;
}
.transf-detail-stats > div {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
}
.transf-detail-stats b { font-size: 1.1rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.transf-detail-stats span {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700;
}
.transf-table-wrap {
  overflow-x: auto;
  background: #fff;
}
.transf-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
}
.transf-table th,
.transf-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #eee6d2;
  vertical-align: middle;
}
.transf-table th {
  background: #faf6ea;
  color: #5a5135;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
  white-space: nowrap;
}
.transf-table tbody tr:last-child td { border-bottom: none; }
.transf-table tbody tr:hover td { background: #fffaf0; }
.transf-table .col-prod {
  text-align: left;
  min-width: 220px;
  width: 46%;
}
.transf-table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 110px;
  width: 18%;
}
.transf-table .col-qtde {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--warn);
}
.transf-table .prod-name {
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.transf-table .prod-meta {
  color: var(--muted);
  font-size: .78rem;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.product-list { display: grid; gap: 10px; }
.product-card {
  cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease;
  border-left: 4px solid var(--line);
}
.product-card.COMPRAR { border-left-color: var(--danger); }
.product-card.BLOQUEADO_PARADO { border-left-color: #5c2b2b; }
.product-card.TRANSFERIR { border-left-color: var(--warn); }
.product-card.SUBSTITUIR { border-left-color: var(--info); }
.product-card.NAO_COMPRAR { border-left-color: var(--ok); }
.product-card h3 { margin: 0 0 4px; font-size: 1rem; line-height: 1.3; }
.product-card.selected {
  outline: 2px solid var(--brand); outline-offset: -2px;
  box-shadow: 0 4px 14px rgba(31, 61, 43, .08);
}
.product-card .card-top {
  display: flex; justify-content: space-between; gap: 8px; align-items: flex-start;
}
.nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.nums div { background: #f3f6f3; border-radius: 10px; padding: 8px; }
.nums b { display: block; font-size: 1.02rem; }
.nums .meta { font-size: .72rem; }

.table-wrap {
  display: none; overflow: auto; border: 1px solid var(--line);
  border-radius: 14px; max-height: min(72vh, 760px); background: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
table.demanda-table { width: 100%; min-width: 860px; border-collapse: separate; border-spacing: 0; background: #fff; }
.demanda-table th, .demanda-table td {
  padding: 12px 14px; border-bottom: 1px solid #e7eee8;
  text-align: left; font-size: .88rem; vertical-align: middle;
}
.demanda-table th {
  position: sticky; top: 0; z-index: 3;
  background: #eef3ef; color: #3d4a40; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
  border-bottom: 1px solid #d5ddd6;
}
.demanda-table .col-produto { white-space: normal; min-width: 200px; max-width: 280px; }
.demanda-table .col-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.demanda-table .col-saldo-proj { color: var(--brand); font-weight: 700; }
.demanda-table .col-acao { white-space: normal; min-width: 120px; max-width: 200px; font-size: .82rem; color: var(--muted); }
.demanda-table .prod-name { font-weight: 700; color: var(--ink); line-height: 1.3; }
.demanda-table .prod-meta { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.demanda-table .qtde-rec { font-size: 1.05rem; font-weight: 800; color: var(--ink); }
.demanda-table tr[data-codigo] { cursor: pointer; }
.demanda-table tr[data-codigo]:hover td { background: #f7faf7; }
.demanda-table tr.row-selected td { background: var(--brand-soft); }
.demanda-table tr.row-selected:hover td { background: #e2ede6; }
.demanda-table tr.row-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--brand);
}
.demanda-table tr.status-COMPRAR td:first-child { box-shadow: inset 3px 0 0 #e8a0a0; }
.demanda-table tr.status-TRANSFERIR td:first-child { box-shadow: inset 3px 0 0 #e2c56a; }
.demanda-table tr.status-SUBSTITUIR td:first-child { box-shadow: inset 3px 0 0 #9db6d8; }
.demanda-table tr.status-NAO_COMPRAR td:first-child { box-shadow: inset 3px 0 0 #9dceb0; }
.demanda-table tr.row-selected.status-COMPRAR td:first-child,
.demanda-table tr.row-selected.status-TRANSFERIR td:first-child,
.demanda-table tr.row-selected.status-SUBSTITUIR td:first-child,
.demanda-table tr.row-selected.status-NAO_COMPRAR td:first-child {
  box-shadow: inset 3px 0 0 var(--brand);
}
/* Produto sticky à esquerda */
.demanda-table th.col-produto,
.demanda-table td.col-produto {
  position: sticky; left: 0; z-index: 2; background: #fff;
}
.demanda-table th.col-produto { background: #eef3ef; z-index: 4; }
.demanda-table tr:hover td.col-produto { background: #f7faf7; }
.demanda-table tr.row-selected td.col-produto { background: var(--brand-soft); }

.center { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: min(420px, 100%); }
.login h1 { margin: 0 0 6px; color: var(--brand); }
.error { color: var(--danger); background: #fde8e8; padding: 10px 12px; border-radius: 10px; }
.ok { color: var(--ok); background: #e6f4ea; padding: 10px 12px; border-radius: 10px; }
.upload input[type=file] { width: 100%; min-height: var(--touch); }

.user-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  align-items: end;
}
.user-form .btn { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 720px) {
  .user-form { grid-template-columns: 1fr; }
}
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px 12px;
  margin-top: 8px;
}
.perm-item {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .88rem; cursor: pointer;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.perm-item input { margin-top: 3px; }
.perfil-list { display: flex; flex-direction: column; gap: 12px; }
.perfil-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px; background: #fbfcfb;
}
.perfil-card-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap;
}
.perm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-tag {
  font-size: .75rem; padding: 3px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}
.user-form-actions { grid-column: 1 / -1; }
.col-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(26, 36, 28, .45);
  display: grid; place-items: center; padding: 20px;
}
.modal-backdrop.hidden { display: none; }
.modal-card { width: min(420px, 100%); box-shadow: 0 12px 40px rgba(0,0,0,.18); }

.imp-lote { gap: 12px; }
.imp-file-row {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 280px);
  gap: 10px 14px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfb;
}
.imp-file-row.has-file {
  border-color: #9bb39f;
  background: #f3f8f4;
}
.imp-file-row input[type=file] {
  width: 100%;
  min-height: var(--touch);
}
.imp-file-name {
  margin-top: 4px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}
.imp-lote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
@media (max-width: 720px) {
  .imp-file-row {
    grid-template-columns: 1fr;
  }
}
.hidden { display: none !important; }
.loading-bar {
  height: 3px; background: linear-gradient(90deg, transparent, var(--brand), transparent);
  background-size: 200% 100%; animation: load 1s linear infinite; border-radius: 2px;
}
@keyframes load { to { background-position: -200% 0; } }

@media (min-width: 960px) {
  .grid-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filter-bar .search-row { grid-template-columns: 1fr; }
  .product-list { display: none; }
  .table-wrap { display: block; }
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 34vw);
  }
  .calc-panel {
    position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow: auto;
    padding: 18px 20px;
    order: 1;
  }
  .workspace-main { order: 0; }
}

@media (min-width: 1200px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(480px, 32vw);
  }
}

@media (min-width: 1600px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(520px, 28vw);
  }
  .content {
    padding-left: clamp(20px, 2.5vw, 40px);
    padding-right: clamp(20px, 2.5vw, 40px);
  }
}
