/* =====================================================
   Hub de Análises (demonstração) — folha de estilo copiada do sistema real
   Paleta validada (dataviz): 8 slots categóricos, claro e escuro
   ===================================================== */

:root {
  color-scheme: light;

  --page:            #f9f9f7;
  --surface:         #fcfcfb;
  --surface-2:       #f2f1ed;
  --text-primary:    #0b0b0b;
  --text-secondary:  #52514e;
  --text-muted:      #898781;
  --grid:            #e1e0d9;
  --axis:            #c3c2b7;
  --border:          rgba(11, 11, 11, 0.10);
  --border-strong:   rgba(11, 11, 11, 0.18);
  --shadow:          0 1px 2px rgba(11, 11, 11, .04), 0 4px 16px rgba(11, 11, 11, .04);

  --series-1: #2a78d6;  /* azul     */
  --series-2: #eb6834;  /* laranja  */
  --series-3: #1baf7a;  /* água     */
  --series-4: #eda100;  /* amarelo  */
  --series-5: #e87ba4;  /* magenta  */
  --series-6: #008300;  /* verde    */
  --series-7: #4a3aa7;  /* violeta  */
  --series-8: #e34948;  /* vermelho */

  --good:     #0ca30c;
  --warning:  #fab219;
  --serious:  #ec835a;
  --critical: #d03b3b;
  --delta-up: #006300;
  --delta-down: #d03b3b;

  --seq-100: #cde2fb; --seq-250: #86b6ef; --seq-400: #3987e5;
  --seq-550: #1c5cab; --seq-700: #0d366b;

  --radius: 10px;
  --radius-sm: 7px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page:           #0d0d0d;
    --surface:        #1a1a19;
    --surface-2:      #232322;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --grid:           #2c2c2a;
    --axis:           #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --border-strong:  rgba(255, 255, 255, 0.18);
    --shadow:         0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);

    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --series-4: #c98500; --series-5: #d55181; --series-6: #008300;
    --series-7: #9085e9; --series-8: #e66767;
    --delta-up: #0ca30c;
    --seq-100: #0d366b; --seq-250: #184f95; --seq-400: #256abf;
    --seq-550: #3987e5; --seq-700: #86b6ef;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:           #0d0d0d;
  --surface:        #1a1a19;
  --surface-2:      #232322;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --grid:           #2c2c2a;
  --axis:           #383835;
  --border:         rgba(255, 255, 255, 0.10);
  --border-strong:  rgba(255, 255, 255, 0.18);
  --shadow:         0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --series-4: #c98500; --series-5: #d55181; --series-6: #008300;
  --series-7: #9085e9; --series-8: #e66767;
  --delta-up: #0ca30c;
  --seq-100: #0d366b; --seq-250: #184f95; --seq-400: #256abf;
  --seq-550: #3987e5; --seq-700: #86b6ef;
}

* { box-sizing: border-box; }

/* O atributo hidden precisa vencer qualquer display definido por classe.
   Sem esta regra, .modal-fundo e .login-fundo (display:flex) ficavam
   visíveis o tempo todo mesmo com hidden. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- cabeçalho */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1520px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.brand h1 { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.brand .sub { font-size: 12px; color: var(--text-muted); }

.status-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px; padding: 5px 11px;
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); flex: none; }
.dot.ok { background: var(--good); }
.dot.warn { background: var(--warning); }
.dot.err { background: var(--critical); }
.dot.run { background: var(--series-1); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

/* ------------------------------------------------------------------ botões */

button, .btn {
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:active { transform: translateY(0.5px); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary {
  background: var(--series-1);
  border-color: var(--series-1);
  color: #fff;
}
button.primary:hover { filter: brightness(1.06); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--surface-2); }

/* ============================================================
   Menu lateral recolhível
   ============================================================ */

.btn-menu {
  font-size: 17px;
  line-height: 1;
  padding: 6px 10px;
  flex: none;
}

.layout {
  display: grid;
  grid-template-columns: var(--largura-menu, 232px) minmax(0, 1fr);
  align-items: start;
  transition: grid-template-columns .16s ease;
}
/* recolhido = trilho de ícones, não desaparece */
.layout.recolhido { --largura-menu: 64px; }

.sidebar {
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 10px 0 24px;
  scrollbar-width: thin;
}

.sidebar nav { min-width: 0; }

.nav-grupo { padding: 2px 8px; }

/* ---- ícones ---- */
.nav-item .ico {
  width: 18px; height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .85;
}
.nav-item[aria-selected="true"] .ico { opacity: 1; color: var(--series-1); }
.nav-item .rotulo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- modo trilho ---- */
.layout.recolhido .nav-grupo { padding: 2px 10px; }
.layout.recolhido .nav-grupo-topo {
  height: 1px;
  padding: 0;
  margin: 8px 4px;
  background: var(--border);
  overflow: hidden;
  pointer-events: none;
}
.layout.recolhido .nav-grupo-topo .seta,
.layout.recolhido .nav-grupo-topo .rotulo { display: none; }
.layout.recolhido .nav-grupo:first-child .nav-grupo-topo { display: none; }
.layout.recolhido .nav-itens { display: grid !important; }  /* grupos não recolhem no trilho */
.layout.recolhido .nav-item {
  padding: 10px 0;
  justify-content: center;
  gap: 0;
}
.layout.recolhido .nav-item .rotulo { display: none; }
.layout.recolhido .nav-item::before { display: none; }
.layout.recolhido .nav-item .ico { width: 20px; height: 20px; }

.nav-grupo-topo {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-align: left;
}
.nav-grupo-topo:hover { background: var(--surface-2); color: var(--text-secondary); }
.nav-grupo-topo .seta {
  font-size: 10px;
  transition: transform .15s ease;
  display: inline-block;
  width: 10px;
}
.nav-grupo-topo[aria-expanded="false"] .seta { transform: rotate(-90deg); }

.nav-itens {
  display: grid;
  gap: 1px;
  padding: 2px 0 6px;
}
.nav-itens[hidden] { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
}
.nav-item::before { display: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item[aria-selected="true"] {
  background: color-mix(in srgb, var(--series-1) 14%, transparent);
  color: var(--text-primary);
  font-weight: 640;
}
.nav-item[aria-selected="true"]::before { background: var(--series-1); opacity: 1; }

.conteudo { min-width: 0; }

/* telas estreitas: o menu vira sobreposição e o trilho some */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: 57px; left: 0;
    z-index: 60;
    width: 248px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .22);
  }
  .layout.recolhido .sidebar { display: none; }
}

/* ============================================================
   Texto explicativo recolhido por padrão
   ============================================================ */

details.info {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
details.info summary {
  cursor: pointer;
  list-style: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
details.info summary::-webkit-details-marker { display: none; }
details.info summary::before {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  color: var(--text-muted);
}
details.info[open] summary { border-bottom: 1px solid var(--border); color: var(--text-primary); }
details.info .info-corpo {
  padding: 10px 14px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}
details.info .info-corpo strong { color: var(--text-primary); }

.filtros-card { padding: 12px 16px; }
.filtros-card + .filtros-card { margin-top: 10px; }

/* selos de evidência e ação (previsibilidade) */
.tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag.forte    { color: var(--series-3); border-color: color-mix(in srgb, var(--series-3) 55%, transparent); }
.tag.moderada { color: var(--series-1); border-color: color-mix(in srgb, var(--series-1) 55%, transparent); }
.tag.fraca    { color: var(--text-muted); border-color: var(--border-strong); }
.tag.programar { color: var(--series-3); border-color: color-mix(in srgb, var(--series-3) 55%, transparent); }
.tag.acordo    { color: var(--series-2); border-color: color-mix(in srgb, var(--series-2) 55%, transparent); }
.tag.estoque   { color: var(--series-1); border-color: color-mix(in srgb, var(--series-1) 55%, transparent); }
.tag.sob       { color: var(--text-muted); border-color: var(--border-strong); }

/* tela Produtos: origem do produto e relação do cliente com a empresa */
.tag.importado  { color: var(--series-2); border-color: color-mix(in srgb, var(--series-2) 55%, transparent); }
.tag.nacional   { color: var(--text-muted); border-color: var(--border-strong); }
.tag.novo       { color: var(--series-3); border-color: color-mix(in srgb, var(--series-3) 55%, transparent); }
.tag.recorrente { color: var(--series-1); border-color: color-mix(in srgb, var(--series-1) 55%, transparent); }
.tag.unico      { color: var(--series-4); border-color: color-mix(in srgb, var(--series-4) 55%, transparent); }

.chip.forte[aria-pressed="true"]    { background: var(--series-3); border-color: var(--series-3); }
.chip.moderada[aria-pressed="true"] { background: var(--series-1); border-color: var(--series-1); }
.chip.fraca[aria-pressed="true"]    { background: var(--text-muted); border-color: var(--text-muted); }

/* ----------------------------------------------------------------- filtros */

.filters {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.filters-inner {
  max-width: 1520px;
  margin: 0 auto;
  padding: 11px 20px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
}
select, input[type="date"] {
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  min-width: 132px;
  max-width: 220px;
}
select[multiple] { min-height: 34px; }

.presets { display: flex; gap: 3px; flex-wrap: wrap; }
.preset {
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.preset[aria-pressed="true"] {
  background: var(--series-1);
  border-color: var(--series-1);
  color: #fff;
  font-weight: 600;
}

/* --------------------------------------------------------------- conteúdo */

main {
  max-width: 1520px;
  margin: 0 auto;
  padding: 20px;
}
.panel { display: none; }
.panel.active { display: block; }

.grid { display: grid; gap: 14px; }
/* colunas de alturas diferentes: cada card fica do tamanho do seu conteúdo */
.grid.topo { align-items: start; }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) {
  .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.k3, .grid.k2 { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .grid.k4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card + .card, .grid + .grid, .grid + .card, .card + .grid { margin-top: 14px; }
/* dentro de uma grade o espaço vem do gap; a margem acima desalinhava os cartões */
.grid > .card { margin-top: 0; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.card h2 { font-size: 14.5px; font-weight: 640; margin: 0; letter-spacing: -0.005em; }
.card .hint { font-size: 12px; color: var(--text-muted); margin: 2px 0 12px; }

/* --------------------------------------------------------------- KPI tiles */

.kpi .label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
}
.kpi .value {
  font-size: 27px;
  font-weight: 660;
  letter-spacing: -0.02em;
  margin: 5px 0 2px;
  line-height: 1.15;
}
.kpi .value.sm { font-size: 21px; }
.kpi .delta { font-size: 12.5px; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; }
.kpi .delta strong { font-weight: 640; white-space: nowrap; }
.kpi .delta { flex-wrap: wrap; column-gap: 5px; row-gap: 0; }
.delta.up strong { color: var(--delta-up); }
.delta.down strong { color: var(--delta-down); }

/* ------------------------------------------------------------------ gráfico */

.chart-wrap { position: relative; width: 100%; }
.chart-wrap.h240 { height: 240px; }
.chart-wrap.h300 { height: 300px; }
.chart-wrap.h360 { height: 360px; }
.chart-wrap.h420 { height: 420px; }

/* ------------------------------------------------------------------ tabelas */

.table-scroll { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 7px 9px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}
thead th.no-sort { cursor: default; }
thead th .arrow { opacity: .45; margin-left: 3px; font-size: 10px; }
tbody td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--grid);
  vertical-align: top;
}
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.strong { font-weight: 600; }
.muted { color: var(--text-muted); }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bar-cell { position: relative; }
.bar-cell .bar {
  position: absolute; left: 0; top: 4px; bottom: 4px;
  background: color-mix(in srgb, var(--series-1) 16%, transparent);
  border-radius: 0 4px 4px 0;
  z-index: 0;
}
.bar-cell span { position: relative; z-index: 1; }

/* --------------------------------------------------------------- diversos */

.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  border: 1px solid var(--border-strong);
  white-space: nowrap;
}
.pill.a { background: color-mix(in srgb, var(--series-1) 15%, transparent); border-color: transparent; }
.pill.b { background: color-mix(in srgb, var(--series-4) 22%, transparent); border-color: transparent; }
.pill.c { background: var(--surface-2); border-color: transparent; }
.pill.ok { background: color-mix(in srgb, var(--good) 16%, transparent); border-color: transparent; }
.pill.err { background: color-mix(in srgb, var(--critical) 16%, transparent); border-color: transparent; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12.5px; color: var(--text-secondary); }
.legend .item { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }

.empty { padding: 26px 10px; text-align: center; color: var(--text-muted); font-size: 13px; }

.loading { position: relative; min-height: 90px; }
.loading::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--surface);
  opacity: .6;
}

.skeleton {
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--grid) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: 0 0 } }

.toast {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 90;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--series-1);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: 380px;
}
.toast.err { border-left-color: var(--critical); }
.toast.ok { border-left-color: var(--good); }
.toast-acao { margin-left: 12px; border: none; background: none; padding: 0; font: inherit; font-weight: 640;
  color: var(--series-1); text-decoration: underline; cursor: pointer; }

footer {
  max-width: 1520px;
  margin: 0 auto;
  padding: 18px 20px 40px;
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =====================================================
   Análises portadas do Apps Script
   ===================================================== */

.tab-sep {
  flex: none;
  width: 1px;
  margin: 8px 6px;
  background: var(--border-strong);
}

.aviso {
  background: color-mix(in srgb, var(--series-4) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--series-4) 34%, transparent);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.aviso strong { color: var(--text-primary); }

.filtros-locais {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.filtros-locais .field { flex: 1 1 170px; min-width: 150px; }
.filtros-locais input[type="search"],
.filtros-locais input[type="date"],
.filtros-locais select {
  width: 100%;
  max-width: none;
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
}

/* ------------------------------------------------------------ chips de mês */

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 100px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
}
.chip[aria-pressed="true"] {
  background: var(--series-1);
  border-color: var(--series-1);
  color: #fff;
}
.chip.todos[aria-pressed="true"] {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--surface);
}

/* --------------------------------------------------------- abas por RCA */

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 14px 0;
}
.subtab {
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
}
.subtab[aria-pressed="true"] {
  background: var(--series-1);
  border-color: var(--series-1);
  color: #fff;
}
.subtab.analisar { border-color: color-mix(in srgb, var(--critical) 55%, transparent); }
.subtab.analisar[aria-pressed="true"] {
  background: var(--critical);
  border-color: var(--critical);
}

/* ------------------------------------------------- seletor de dois estados */

.seg { display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 2px; }
.seg button {
  border: none;
  background: transparent;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 5px;
  color: var(--text-secondary);
}
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 640;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* ------------------------------------------------ cores por responsável */

tbody tr[data-cor] td:first-child { border-left: 3px solid transparent; }
tbody tr[data-cor="c1"]      td { background: color-mix(in srgb, var(--series-1) 9%, transparent); }
tbody tr[data-cor="c1"]      td:first-child { border-left-color: var(--series-1); }
tbody tr[data-cor="c2"]     td { background: color-mix(in srgb, var(--series-3) 11%, transparent); }
tbody tr[data-cor="c2"]     td:first-child { border-left-color: var(--series-3); }
tbody tr[data-cor="c3"]  td { background: color-mix(in srgb, var(--series-7) 11%, transparent); }
tbody tr[data-cor="c3"]  td:first-child { border-left-color: var(--series-7); }
tbody tr[data-cor="analisar"] td { background: color-mix(in srgb, var(--critical) 11%, transparent); }
tbody tr[data-cor="analisar"] td:first-child { border-left-color: var(--critical); }
tbody tr[data-cor="master"]   td { background: color-mix(in srgb, var(--series-2) 13%, transparent); }
tbody tr[data-cor="master"]   td:first-child { border-left-color: var(--series-2); }
tbody tr[data-cor="outros"]   td { background: color-mix(in srgb, var(--series-4) 10%, transparent); }
tbody tr[data-cor="outros"]   td:first-child { border-left-color: var(--series-4); }

tbody tr.top5 td { background: color-mix(in srgb, var(--good) 13%, transparent); }
tbody tr.total-row td {
  background: var(--surface-2);
  font-weight: 700;
  border-top: 2px solid var(--border-strong);
}

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
  padding: 3px 7px;
  border-radius: 100px;
  white-space: nowrap;
  color: #fff;
}
.badge.master   { background: #8a4b08; }
.badge.analisar { background: var(--critical); }
.badge.semrca   { background: #7a271a; }
.badge.auto     { background: transparent; color: var(--text-muted); border: 1px solid var(--border-strong); }

/* -------------------------------------------------------- medidor / meter */

.meter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--grid);
}
.meter-row:last-child { border-bottom: 0; }
.meter-row .nome { font-size: 12.5px; font-weight: 600; }
.meter-row .valor { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.meter-row .track {
  grid-column: 1 / -1;
  display: block;
  height: 8px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 2px;
}
/* span é inline por padrão e ignora height; precisa ser bloco para a barra aparecer */
.meter-row .fill { display: block; height: 100%; background: var(--series-1); border-radius: 100px; }
.meter-row .desc { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-muted); }

/* ------------------------------------------------------------ gap / cards */

.gap-card, .comp-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  background: var(--surface);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}
.gap-card:hover, .comp-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  background: var(--surface);
}
.gap-card .rot, .comp-card .rot {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  display: block;
}
.gap-card .big, .comp-card .big {
  font-size: 20px;
  font-weight: 660;
  letter-spacing: -0.015em;
  margin-top: 6px;
}
.gap-card .sub, .comp-card .sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}
.gap-card .sub.perda { color: var(--critical); font-weight: 600; }

.comp-card.total    { background: color-mix(in srgb, var(--series-2) 12%, var(--surface)); }
.comp-card.desconto { background: color-mix(in srgb, var(--series-3) 12%, var(--surface)); }
.comp-card.residual { background: color-mix(in srgb, var(--series-4) 14%, var(--surface)); }
.comp-card.share    { background: var(--surface-2); cursor: default; }
.comp-card.share:hover { transform: none; box-shadow: none; }

tbody tr.clicavel { cursor: pointer; }
tbody tr.clicavel:hover td { background: var(--surface-2); }

.analise-rapida { font-size: 13px; line-height: 1.7; }
.analise-rapida strong { font-weight: 700; }

/* =====================================================
   Login por sessão e edição do responsável
   ===================================================== */

.usuario-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  padding-left: 4px;
}
.usuario-chip button { font-size: 12px; padding: 4px 9px; }

.login-fundo {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--page);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
}
.login-card h1 { font-size: 19px; font-weight: 660; margin: 0; letter-spacing: -0.01em; }
.login-card .sub { font-size: 12.5px; color: var(--text-muted); margin: 4px 0 22px; }
.login-card label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.login-card input {
  font: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin-bottom: 16px;
  width: 100%;
}
.login-card input:focus {
  outline: none;
  border-color: var(--series-1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-1) 18%, transparent);
}
.login-card button { padding: 10px 14px; font-size: 14px; margin-top: 4px; }

/* olho de mostrar/ocultar senha, dentro do campo */
.campo-senha { position: relative; }
.login-card .campo-senha { margin-bottom: 16px; }
.login-card .campo-senha input { margin-bottom: 0; }
/* mais específico que .login-card input e .modal-corpo input, que definem o padding */
.login-card .campo-senha input,
.modal-corpo .campo-senha input { padding-right: 42px; }
.campo-senha input::-ms-reveal { display: none; } /* o Edge desenharia um segundo olho */
.campo-senha .ver-senha {
  position: absolute;
  top: 0;
  right: 2px;
  bottom: 0;
  width: 38px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: none;
}
.campo-senha .ver-senha:hover { background: transparent; color: var(--text-primary); }
.campo-senha .ver-senha:focus-visible {
  outline: 2px solid var(--series-1);
  outline-offset: -4px;
  border-radius: var(--radius-sm);
}
.campo-senha .ver-senha svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.login-erro {
  font-size: 12.5px;
  color: var(--critical);
  background: color-mix(in srgb, var(--critical) 10%, transparent);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 0 0 12px;
}

/* --------------------------------------------------------------- modal */

.modal-fundo {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(11, 11, 11, .48);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-caixa {
  width: min(540px, 100%);
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  overflow: hidden;
}
.modal-topo {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  font-size: 14.5px;
  font-weight: 650;
}
.modal-corpo { padding: 18px; }
.modal-corpo label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin: 14px 0 5px;
}
.modal-corpo textarea {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  resize: vertical;
}
.modal-estreito { width: min(420px, 100%); }
.modal-corpo input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}
.modal-corpo input:focus {
  outline: none;
  border-color: var(--series-1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-1) 18%, transparent);
}
.modal-estreito .hint { margin: 6px 0 0; }
.modal-estreito .login-erro { margin: 14px 0 0; }
.modal-cliente { font-size: 15px; font-weight: 650; }
.modal-comparar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 16px 0 4px;
}
.modal-comparar .lado {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.modal-comparar .rot {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.modal-comparar .seta { color: var(--text-muted); font-size: 18px; }
.modal-acoes {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 18px 18px;
}

/* ------------------------------------------------- seletor na tabela */

.resp-editor { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.resp-editor select {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 7px;
  min-width: 145px;
  max-width: 180px;
}
.resp-editor select:disabled { opacity: .75; cursor: not-allowed; }

.pendente-aviso {
  background: color-mix(in srgb, var(--series-2) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--series-2) 40%, transparent);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

/* ------------------------------------------------- lista dos dados de origem
   Cartão que abre no fim do painel quando se clica num elemento do gráfico.
   É criado pelo JavaScript, um por painel, então não existe no HTML. */

.card-lista, #fun-detalhe-card {
  /* a barra do topo é fixa e tem 57px; sem esta margem de rolagem o título
     do cartão para debaixo dela ao abrir */
  scroll-margin-top: 72px;
}
.card-lista { border-color: var(--border-strong); }

/* grupo de ações no canto de um card-head; serve ao cartão de lista e ao
   botão de baixar da Recorrência */
.lista-acoes {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.lista-acoes button {
  font-size: 12px;
  padding: 4px 9px;
}
.card-lista .lista-csv:disabled { opacity: .45; cursor: not-allowed; }
.card-lista .lista-sub { margin-bottom: 10px; }

/* ------------------------------- cartão de comparação da Previsibilidade
   Portado do painel gerado pelo pipeline: passar o mouse numa linha abre o
   perfil ao lado do cursor, clicar fixa. Fica no nível do body porque é
   position:fixed. */

#prev-card {
  position: fixed;
  z-index: 60;
  width: 456px;
  max-height: 88vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .22);
  padding: 16px 18px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
#prev-card h3 {
  font-size: 15px; font-weight: 640; margin: 0 0 2px;
  line-height: 1.25; color: var(--text-primary);
}
#prev-card .meta { color: var(--text-muted); font-size: 11.5px; margin-bottom: 10px; }
#prev-card h4 {
  font-size: 10.5px; color: var(--text-muted); font-weight: 640;
  text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 5px;
}
#prev-card .fechar {
  position: absolute; top: 8px; right: 10px;
  border: 0; background: none; font-size: 17px; line-height: 1;
  color: var(--text-muted); cursor: pointer; padding: 2px 5px; display: none;
}
#prev-card.fixo .fechar { display: block; }

.pv-grade {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px;
  margin: 10px 0; padding: 10px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.pv-grade span { display: block; font-size: 10.5px; color: var(--text-muted); }
.pv-grade b {
  font-size: 14px; font-weight: 640; color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.pv-grade b .sufixo { font-size: 10px; font-weight: 500; color: var(--text-muted); }

.pv-lista { list-style: none; margin: 0; padding: 0; }
.pv-lista li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.pv-lista li:last-child { border-bottom: 0; }
.pv-lista em {
  font-style: normal; color: var(--text-muted); font-size: 10.5px; display: block;
}
.pv-lista .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.pv-porque {
  background: var(--surface-2); border-left: 3px solid var(--series-1);
  padding: 8px 11px; margin-top: 10px; font-size: 12px; line-height: 1.5;
}
.pv-alerta { color: var(--critical); font-size: 11.5px; margin-top: 8px; }
.pv-spark { display: block; width: 100%; height: 72px; }
.pv-spark rect.mb { cursor: default; }
.pv-erro { color: var(--critical); }
.pv-versao-linha { margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pv-versao-linha button { padding: 3px 10px; font-size: 12px; }
.pv-ficha .card-head h3 { font-size: 14px; }
.pv-ficha > .grid.topo { margin-top: 12px; }

#prev-dica {
  position: fixed; z-index: 70; pointer-events: none; max-width: 320px;
  background: var(--text-primary); color: var(--surface);
  font-size: 11.5px; line-height: 1.45; padding: 7px 10px; border-radius: 5px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

/* linha que ficou fixada com o clique */
tbody tr.fixa {
  background: color-mix(in srgb, var(--series-1) 12%, var(--surface));
  box-shadow: inset 3px 0 0 var(--series-1);
}
#panel-previsibilidade tbody tr { cursor: pointer; }

/* ------------------------------------ popup de pedidos da Recorrência
   Abre ao passar o mouse numa célula mês × cliente. Não recebe o mouse, então
   nunca rouba o hover da tabela e some assim que o cursor sai da célula. */

#rec-popup,
#rp-popup {
  position: fixed;
  z-index: 65;
  pointer-events: none;
  min-width: 380px;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .22);
  padding: 12px 14px 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
#rec-popup h3,
#rp-popup h3 {
  font-size: 13.5px; font-weight: 640; margin: 0 0 1px;
  color: var(--text-primary); line-height: 1.25;
}
#rec-popup .meta,
#rp-popup .meta { color: var(--text-muted); font-size: 11.5px; margin-bottom: 8px; }

.rec-pedidos { width: 100%; border-collapse: collapse; }
.rec-pedidos th {
  font-size: 10.5px; font-weight: 640; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); text-align: left; padding: 4px 8px 4px 0;
  border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
.rec-pedidos td {
  padding: 5px 8px 5px 0; border-bottom: 1px solid var(--border);
  vertical-align: top; color: var(--text-primary); white-space: nowrap;
}
.rec-pedidos em {
  display: block; font-style: normal; font-size: 10.5px; color: var(--text-muted);
}
.rec-pedidos .n { text-align: right; font-variant-numeric: tabular-nums; }
.rec-pedidos em.rp-ciclo { white-space: nowrap; }
.rec-pedidos em.rp-ciclo b { font-weight: 600; color: var(--text-secondary, var(--text-muted)); }
.rec-pedidos tfoot td {
  border-bottom: 0; border-top: 1px solid var(--border-strong);
  font-weight: 640; padding-top: 6px;
}

/* a célula com pedidos se anuncia no hover */
#tb-recorrencia td.rec-mes { cursor: pointer; }
#tb-recorrencia td.rec-mes:hover {
  background: color-mix(in srgb, var(--series-1) 12%, transparent);
  box-shadow: inset 0 -2px 0 var(--series-1);
}

/* célula cujo popup foi fixado com clique */
#tb-recorrencia td.rec-mes.rec-fixa {
  background: color-mix(in srgb, var(--series-1) 20%, transparent);
  box-shadow: inset 0 -2px 0 var(--series-1), inset 0 0 0 1px var(--series-1);
}
#rec-popup .rec-porque,
#rp-popup .rec-porque {
  margin: -2px 0 8px; padding: 6px 9px; font-size: 11.5px; line-height: 1.45;
  background: var(--surface-2); border-left: 3px solid var(--series-1);
  color: var(--text-secondary);
}

/* ------------------------------------------------- desconto (regra da 111) */

.bloco-111 .table-scroll + .hint,
.bloco-111 .hint + .table-scroll { margin-top: 12px; }
.espaco-acima { margin-top: 14px; }

/* ------------------------------------------------- períodos e números clicáveis */

.periodos {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.grid.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .grid.k5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .grid.k5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .grid.k5 { grid-template-columns: 1fr; } }
/* 6 cartões (Previsão de compra, com o lead time): 6 → 3 → 2 → 1 */
.grid.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1280px) { .grid.k6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .grid.k6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .grid.k6 { grid-template-columns: 1fr; } }
.grid + .aviso, .aviso + .card { margin-top: 14px; }

.kpi.clicavel { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.kpi.clicavel:hover, .kpi.clicavel:focus-visible {
  border-color: color-mix(in srgb, var(--series-1) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--series-1) 40%, transparent), var(--shadow);
  outline: none;
}

.controles { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.card-head:has(.controles), .card-head:has(.busca-cliente) { align-items: center; flex-wrap: wrap; }
.subtitulo { margin: 0 0 6px; font-size: 12.5px; font-weight: 640; color: var(--text-secondary); }
/* cartões de meia largura: nomes longos não podem empurrar o valor para fora */
.grid.k2 .truncate, .grid.k3 .truncate { max-width: 210px; }
#tb-geo-top td.truncate:nth-child(2) { max-width: 150px; }

/* células de conversão: percentual em cima, a conta embaixo, clicáveis */
.conv-celula {
  display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px;
  padding: 3px 7px; margin: -3px -7px; border-radius: 6px; cursor: pointer;
  font-weight: 640; font-size: 14px;
}
.conv-celula small { font-weight: 400; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.conv-celula:hover, .conv-celula:focus-visible { background: var(--surface-2); outline: none; }
table.conversoes td { vertical-align: middle; padding-top: 10px; padding-bottom: 10px; }

/* tabelas longas rolam dentro do cartão, com o cabeçalho parado */
.table-scroll.alta { max-height: 460px; overflow: auto; }
.table-scroll.alta thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; }
.busca-cliente { flex: 1 1 320px; max-width: 520px; }
.busca-cliente input {
  width: 100%; font: inherit; font-size: 13px; color: var(--text-primary);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 10px;
}
.kpi.destaque .value { font-size: 17px; }
.kpi.destaque .label { text-transform: none; letter-spacing: 0; }

/* ------------------------------------------------- mapa de calor do Brasil */

.chart-wrap.h560 { height: 560px; }
.mapa-geo .hint { margin-bottom: 6px; }
.mapa svg { display: block; width: 100%; height: auto; max-height: 560px; }
.mapa path.uf {
  stroke: var(--surface); stroke-width: 1.4; stroke-linejoin: round;
  cursor: pointer; transition: filter .12s;
}
.mapa path.uf:hover, .mapa path.uf:focus-visible {
  stroke: var(--text-primary); stroke-width: 3; outline: none; filter: brightness(1.06);
}
.mapa path.uf.sem-venda { fill: var(--surface-2); stroke: var(--border-strong); cursor: default; }
.mapa path.uf.sem-venda:hover { stroke-width: 1.4; filter: none; }
.mapa text {
  font-size: 19px; font-weight: 650; text-anchor: middle; dominant-baseline: central;
  pointer-events: none; fill: var(--text-primary); opacity: .82;
}
.mapa text.claro { fill: #fff; opacity: .95; }
.mapa-legenda { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 11.5px; color: var(--text-secondary); }
.mapa-legenda span { white-space: nowrap; }
.mapa-legenda i {
  display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px;
  border: 1px solid var(--border);
}

/* ------------------------------------------------- recompra */

.rc-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.rc-topo .periodos { margin: 0; }
.pill.rc-forte    { background: color-mix(in srgb, var(--series-1) 18%, transparent); border-color: transparent; }
.pill.rc-moderada { background: color-mix(in srgb, var(--series-3) 20%, transparent); border-color: transparent; }
.pill.rc-fraca    { background: var(--surface-2); border-color: transparent; color: var(--text-muted); }
.pill.rc-estagio  { white-space: nowrap; border-color: transparent; }
.pill.rc-1d, .pill.rc-data { background: color-mix(in srgb, var(--series-8) 22%, transparent); }
.pill.rc-14d, .pill.rc-30d { background: color-mix(in srgb, var(--series-1) 16%, transparent); }
.pill.rc-atraso { background: color-mix(in srgb, var(--series-4) 26%, transparent); }
.pill.rc-churn  { background: color-mix(in srgb, var(--series-7) 22%, transparent); }
.rc-estagios { margin-top: 4px; }
tbody tr.rc-vivo td { background: color-mix(in srgb, var(--series-1) 5%, transparent); }

/* ciclo do cliente: situação e posição da compra na janela */
.pill[class*="cc-"] { white-space: nowrap; border-color: transparent; }
.pill.cc-observacao, .pill.cc-antecipada { background: color-mix(in srgb, var(--series-1) 16%, transparent); }
.pill.cc-unica      { background: var(--surface-2); color: var(--text-muted); }
.pill.cc-no_prazo   { background: color-mix(in srgb, var(--series-3) 22%, transparent); }
.pill.cc-atrasado, .pill.cc-atrasada { background: color-mix(in srgb, var(--series-4) 26%, transparent); }
.pill.cc-churn      { background: color-mix(in srgb, var(--series-8) 22%, transparent); }
tbody tr.cic-total td { font-weight: 640; background: var(--surface-2); }

/* placar do período: o resultado abre a lista das previsões */
.chip.rc-acertou     { border-color: color-mix(in srgb, var(--good) 55%, var(--border-strong)); }
.chip.rc-nao_comprou { border-color: color-mix(in srgb, var(--critical) 55%, var(--border-strong)); }
.chip.rc-antes, .chip.rc-depois { border-color: color-mix(in srgb, var(--series-4) 55%, var(--border-strong)); }

#detalhe .detalhe-resumo { padding: 0 18px 12px; }
.rc-evidencia {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 18px;
  font-size: 12px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px;
}
.rc-evidencia div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rc-evidencia span { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.rc-evidencia strong { font-weight: 560; color: var(--text-primary); line-height: 1.4; overflow-wrap: anywhere; }

/* ------------------------------------------------- dica de fórmula */

#dica {
  position: fixed; z-index: 120; pointer-events: none;
  max-width: 360px; min-width: 200px;
  background: var(--surface); color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  padding: 10px 12px; font-size: 12px; line-height: 1.45;
}
#dica .dica-titulo { display: block; font-size: 12.5px; margin-bottom: 4px; }
#dica .dica-formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px;
  background: var(--surface-2); border-radius: 5px; padding: 4px 7px; margin: 2px 0 6px;
}
#dica .dica-valores { width: 100%; border-collapse: collapse; font-size: 12px; }
#dica .dica-valores td { padding: 2px 0; border: 0; color: var(--text-secondary); }
#dica .dica-valores td.n { text-align: right; color: var(--text-primary); font-variant-numeric: tabular-nums; padding-left: 12px; white-space: nowrap; }
#dica .dica-resultado { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); font-weight: 640; }
#dica .dica-nota { margin-top: 6px; color: var(--text-muted); font-size: 11.5px; }
#dica .dica-clique { margin-top: 6px; color: var(--series-1); font-size: 11.5px; font-weight: 600; }

/* ------------------------------------------------- painel de detalhamento */

#detalhe-fundo {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10, 10, 10, .28);
}
#detalhe {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90;
  width: min(1240px, calc(100vw - 40px));
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: -12px 0 40px rgba(0, 0, 0, .2);
  display: flex; flex-direction: column;
}
#detalhe .detalhe-topo {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px 6px;
}
#detalhe .detalhe-topo h2 { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 660; }
#detalhe .detalhe-sub { margin: 0; padding: 0 18px 10px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
#detalhe .detalhe-corpo { flex: 1; overflow: auto; padding: 0 18px 18px; border-top: 1px solid var(--border); }
#detalhe .detalhe-corpo .table-scroll { overflow: visible; margin: 0; }
#detalhe thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; }
@media (max-width: 640px) {
  #detalhe .detalhe-topo { flex-wrap: wrap; padding: 12px 14px 6px; }
  #detalhe .detalhe-sub, #detalhe .detalhe-corpo { padding-left: 14px; padding-right: 14px; }
}

table.conta-111 { max-width: 760px; }
table.conta-111 thead { display: none; }
table.conta-111 td:first-child { width: 26px; text-align: center; }
table.conta-111 .op { font-weight: 700; color: var(--text-muted); }
table.conta-111 td:last-child { color: var(--text-muted); }
table.conta-111 tr.total td { font-weight: 640; border-top: 1px solid var(--border-strong); }
table.conta-111 tr.total td:last-child { font-weight: 400; }

/* ------------------------------------------ Ondas: saída média dos produtos */
.rotulo-campo {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
}
.saida-controles .field { flex: 0 1 auto; min-width: 0; }
.saida-controles .seg button { padding: 6px 11px; }
.saida-chips { margin: 12px 0 6px; min-height: 26px; }
.saida-chips .chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 330px; padding: 3px 4px 3px 9px;
  color: var(--text-primary); font-weight: 560;
}
.saida-chips .chip .traco { width: 14px; height: 0; border-top: 3px solid; border-radius: 2px; flex: none; }
.saida-chips .chip .traco.tracejada { border-top-style: dashed; border-top-width: 2px; }
.saida-chips .chip .nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saida-chips .chip button {
  border: none; background: transparent; padding: 0 6px; font-size: 14px; line-height: 1;
  color: var(--text-muted); border-radius: 100px;
}
.saida-chips .chip button:hover { color: var(--text-primary); background: var(--surface-2); }
.saida-chips .vazio { font-size: 12.5px; color: var(--text-muted); padding: 4px 0; }
.saida-add { white-space: nowrap; }
.saida-add.no-grafico { color: var(--text-muted); text-decoration: none; }
/* cabeçalho em duas linhas: com uma só, a tabela passava da largura do cartão */
#tb-ond-saida thead th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
#tb-ond-saida td.truncate { max-width: 230px; }
/* coluna de grade sem min-width:0 não encolhe: com a grade numa coluna só, as
   tabelas de "Produtos do período" empurravam a tela para 1.149 px no celular.
   Só abaixo de 1180 px, onde a grade vira uma coluna; no desktop nada muda. */
@media (max-width: 1180px) {
  #panel-ondas .grid > div { min-width: 0; }
}
/* quadro faixa de saída × classe */
#tb-ond-saida-faixas { max-width: 860px; }
#tb-ond-saida-faixas tr.saida-subtotal td { background: var(--surface-2); }
#ond-saida-filtros { scroll-margin-top: 72px; }

/* ---------------------------------- Recorrência de produtos
   A tabela mistura mês faturado e mês previsto na mesma linha. O previsto
   precisa se anunciar sem virar outra tabela: fundo levemente destacado,
   borda tracejada à esquerda onde a projeção começa e o til no cabeçalho. */

#tb-recprod th.rp-prev,
#tb-recprod td.rp-prev {
  background: color-mix(in srgb, var(--series-4) 7%, transparent);
}
#tb-recprod th.rp-prev:first-of-type,
#tb-recprod tr > td.rp-prev:first-of-type {
  border-left: 1px dashed var(--border-strong);
}
#tb-recprod .rp-til {
  color: var(--series-4); font-weight: 700; margin-left: 2px;
}
/* a média histórica embaixo do número previsto, como referência */
#tb-recprod td.rp-prev .rp-media {
  display: block; font-style: normal; font-size: 10px;
  color: var(--text-muted); font-weight: 400; margin-top: 1px;
}
/* previsão que inclui par já atrasado: uma ressalva discreta, não um alarme —
   mais de um terço das células tem algum par atrasado dentro */
#tb-recprod td.rp-tem-atraso {
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--critical) 38%, transparent);
}

/* a célula com detalhamento se anuncia no hover, como na Recorrência */
#tb-recprod td.rp-cel { cursor: pointer; }
#tb-recprod td.rp-cel:hover {
  background: color-mix(in srgb, var(--series-1) 12%, transparent);
  box-shadow: inset 0 -2px 0 var(--series-1);
}
#tb-recprod td.rp-cel.rp-fixa {
  background: color-mix(in srgb, var(--series-1) 20%, transparent);
  box-shadow: inset 0 -2px 0 var(--series-1), inset 0 0 0 1px var(--series-1);
}

/* chip de mês previsto na barra de filtros */
.chip.rp-chip-prev[aria-pressed="true"] {
  background: var(--series-4); border-color: var(--series-4);
}
.chip[disabled] { opacity: .38; cursor: not-allowed; }

/* etiqueta da curva ABC na lista de produtos */
.badge.abc-a { background: var(--series-1); }
.badge.abc-b { background: var(--series-4); }
.badge.abc-c { background: transparent; color: var(--text-muted); border: 1px solid var(--border-strong); }

/* classe do par cliente × produto, nas cores que os chips da Recompra usam.
   `.badge` sem modificador é texto branco sem fundo: some no cartão claro. */
.badge.cl-forte    { background: var(--series-3); }
.badge.cl-moderada { background: var(--series-1); }
.badge.cl-fraca    { background: transparent; color: var(--text-muted); border: 1px solid var(--border-strong); }

/* ------------------------------------------- Previsão de compra por SKU */
.filtros-locais input.pc-num {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
}
.pc-sku-busca { flex: 0 1 380px; min-width: 0; }
.pc-sku-busca input {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
}
#pc-sku-card .card-head { flex-wrap: wrap; gap: 10px; }
#pc-sku-respostas { margin: 4px 0 14px; }
#pc-sku-respostas .kpi { box-shadow: none; background: var(--surface-2); }
#pc-sku-alertas .aviso { margin-bottom: 8px; }
.pc-sub { font-size: 14px; font-weight: 640; margin: 18px 0 2px; color: var(--text-primary); }
.pc-sku-grid { margin-top: 6px; }
/* seção recolhível do detalhe do produto (Pedidos do produto em 2026) */
details.pc-recolher > summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; user-select: none;
}
details.pc-recolher > summary::-webkit-details-marker { display: none; }
details.pc-recolher > summary .pc-sub::before {
  content: "▸"; display: inline-block; width: 1em; color: var(--text-muted); transition: transform .15s;
}
details.pc-recolher[open] > summary .pc-sub::before { transform: rotate(90deg); }
details.pc-recolher > summary .muted { font-size: 12px; }
#tb-pc-proj td .pc-falta { color: var(--critical); font-weight: 600; }
.pc-sku-grid > div { min-width: 0; }
#tb-pc-conta tr.pc-destaque td { font-weight: 700; color: var(--text-primary); background: color-mix(in srgb, var(--series-1) 8%, transparent); }

/* ------------------------------------------- Visão geral: meta do mês */
.meta-mes { margin-bottom: 14px; }
.meta-mes .card-head { flex-wrap: wrap; gap: 6px 12px; }
.meta-mes-numeros {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 6px 0 14px;
}
.meta-mes-num { display: flex; flex-direction: column; gap: 2px; min-width: 0; border-radius: var(--radius-sm); padding: 4px 6px; margin: -4px -6px; }
.meta-mes-num.clicavel { cursor: pointer; }
.meta-mes-num.clicavel:hover { background: var(--surface-2); }
.meta-mes-num .rot {
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted);
}
.meta-mes-num strong { font-size: 26px; font-weight: 680; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.meta-mes-num.destaque strong { font-size: 30px; }
.meta-mes-num small { font-size: 12.5px; color: var(--text-secondary); }
.meta-barra {
  position: relative;
  height: 14px;
  border-radius: 100px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: visible;
}
.meta-barra-feito {
  height: 100%;
  width: 0;
  border-radius: 100px;
  background: var(--series-1);
  transition: width .5s ease;
}
.meta-barra.atras .meta-barra-feito { background: var(--warning); }
.meta-barra.batida .meta-barra-feito { background: var(--good); }
.meta-barra-esperado {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: var(--text-primary);
  border-radius: 2px;
}
.meta-mes-rodape { margin-top: 10px; font-size: 12.5px; line-height: 1.55; color: var(--text-secondary); }
@media (max-width: 620px) {
  .meta-mes-numeros { grid-template-columns: 1fr; }
  .meta-mes-num strong, .meta-mes-num.destaque strong { font-size: 24px; }
}

/* ------------------------------ Visão geral: cabeçalho de seção destacado */
.secao-titulo {
  margin: 28px 0 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--series-1) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--series-1) 30%, transparent);
  border-left: 5px solid var(--series-1);
}
.secao-titulo h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text-primary);
}

/* ------------------------------------------ mapa de calor das cidades de um estado */
.geo-uf-barra {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--series-1) 8%, var(--surface)); border: 1px solid var(--border);
}
.geo-uf-barra strong { font-size: 15px; color: var(--text-primary); flex: 1 1 auto; }
.mapa path.mun {
  stroke: var(--surface); stroke-width: .7; stroke-linejoin: round;
  cursor: pointer; transition: filter .12s;
}
.mapa path.mun:hover, .mapa path.mun:focus-visible {
  stroke: var(--text-primary); stroke-width: 2.2; outline: none; filter: brightness(1.06);
}
.mapa path.mun.sem-venda { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: .5; cursor: default; }
.mapa path.mun.sem-venda:hover { stroke-width: 1.2; filter: none; }
.mapa text.mun-rotulo {
  font-size: 15px; font-weight: 650; paint-order: stroke; stroke: var(--surface); stroke-width: 3.5px;
  opacity: .95;
}
.mapa-fora { margin-top: 6px; font-size: 12px; color: var(--text-secondary); }
.mapa-fora [data-acao] { color: var(--series-1); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }

/* ------------------------------------------ ruptura (stockout) — ruptura.js */

.rup-form select { width: 100%; max-width: none; padding: 9px 11px; font-size: 14px; }
.rup-busca { position: relative; }
.rup-resultados {
  position: absolute;
  z-index: 5;
  left: 0; right: 0;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.rup-resultados li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}
.rup-resultados li span { font-size: 11.5px; color: var(--text-muted); }
.rup-resultados li:hover, .rup-resultados li.ativo { background: var(--surface-2); }
.rup-resultados li.rup-vazio { cursor: default; color: var(--text-muted); }
.rup-escolhido {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.rup-escolhido > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rup-escolhido strong { font-size: 13.5px; }
.rup-rot {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.rup-sub { font-size: 12px; color: var(--text-secondary); }
.modal-corpo label.rup-check {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}
.modal-corpo label.rup-check input { width: auto; }
.rup-novo {
  padding: 2px 12px 12px;
  margin-top: 8px;
  border-left: 3px solid var(--series-3);
  background: color-mix(in srgb, var(--series-3) 6%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.rup-erro { color: var(--critical); font-size: 13px; margin: 12px 0 0; }
.rup-ok { color: var(--good); font-size: 13px; margin: 12px 0 0; }
.rup-acoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-caixa.rup-modal { max-height: calc(100vh - 40px); overflow-y: auto; }

/* página avulsa aberta pela extensão */
body.rup-pagina { background: var(--page); color: var(--text-primary); font-family: var(--font); margin: 0; padding: 16px; }
.rup-caixa { margin: 0 auto; box-shadow: var(--shadow); border: 1px solid var(--border); }
.rup-quem { font-weight: 500; color: var(--text-muted); font-size: 13px; }
.rup-ultimos { border-top: 1px solid var(--border); }
.rup-ultimos ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-secondary); }

/* tela Estoque: produto clicável para ruptura */
.rup-resumo-acoes { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* tela Estoque: lista de produtos ocupa quase a altura toda da janela */
.table-scroll.alta.est-lista-alta { max-height: max(640px, calc(100vh - 150px)); }

/* ------------------------------------------ forecast específico de cliente */

.fc-tag {
  color: var(--c);
  border-color: color-mix(in srgb, var(--c) 45%, transparent);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  white-space: nowrap;
}
.fc-filtros { margin: 4px 0 14px; }
.fc-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); margin-left: auto; padding-bottom: 7px; }

/* modal em passos */
.fc-modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}
.fc-topo { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 6px; }
.fc-topo > div { flex: 1; min-width: 0; }
.fc-topo h2 { margin: 0 0 4px; font-size: 19px; }
.fc-topo .hint { margin: 0; }
.fc-x { border-radius: 50%; width: 34px; height: 34px; padding: 0; flex: none; }
.fc-corpo { overflow-y: auto; padding: 4px 20px 16px; }

.fc-passo { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.fc-passo:first-child { border-top: 0; }
.fc-num {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  color: var(--surface);
  background: var(--series-1);
}
.fc-passo-corpo { flex: 1; min-width: 0; }
.fc-passo-corpo h3 { margin: 3px 0 10px; font-size: 14.5px; }
.fc-passo-corpo > label, #fc-manual > label {
  display: block; font-size: 12px; font-weight: 650; color: var(--text-secondary); margin-bottom: 5px;
}
.fc-passo input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.fc-passo input:focus {
  outline: none;
  border-color: var(--series-1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-1) 18%, transparent);
}
.fc-linha { display: flex; gap: 8px; }
.fc-linha .rup-busca { flex: 1; min-width: 0; }
.fc-linha input { font-size: 17px; letter-spacing: .02em; }
.fc-linha .rup-resultados li strong { font-variant-numeric: tabular-nums; }
/* no modal do forecast a lista de sugestões entra no fluxo (não flutua):
   antes ela ficava cortada dentro do corpo rolável, com duas barras de rolagem */
.fc-modal .rup-resultados { position: static; box-shadow: none; max-height: 320px; margin-top: 6px; }
.fc-modal .rup-resultados li { padding: 9px 11px; }
.fc-modal .rup-resultados li + li { border-top: 1px solid var(--border); border-radius: 0; }
.fc-res-l1 { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.fc-res-l1 strong { flex: none; font-size: 14px; }
.fc-res-l1 em { font-style: normal; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-corpo { flex: 1 1 auto; min-height: 0; }
.fc-linha { align-items: flex-start; }
.fc-linha > button { align-self: stretch; max-height: 47px; }
.fc-linha .rup-resultados mark { background: color-mix(in srgb, var(--series-1) 22%, transparent); color: inherit; border-radius: 2px; }
.fc-link {
  background: none; border: 0; padding: 0; margin-top: 8px;
  font: inherit; font-size: 12.5px; color: var(--series-1); cursor: pointer; text-decoration: underline;
}
.fc-passo .rup-escolhido { margin: 0; }

.fc-itens { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.fc-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit; font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
}
.fc-item:hover, .fc-item:focus-visible { border-color: var(--series-1); background: color-mix(in srgb, var(--series-1) 6%, var(--surface)); outline: none; }
.fc-item-nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-item-qtd { flex: none; color: var(--text-secondary); font-size: 12.5px; }

.fc-retiradas { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.fc-ret {
  display: grid;
  grid-template-columns: 150px 130px 1fr 34px;
  gap: 8px 10px;
  align-items: end;
}
.fc-ret label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 650; color: var(--text-secondary); }
.fc-ret input { font-size: 14px; padding: 8px 10px; }
.fc-aviso {
  align-self: center;
  margin-top: 16px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--text-muted);
  background: var(--surface-2);
}
.fc-aviso.ok { color: color-mix(in srgb, var(--series-3) 80%, var(--text-primary)); background: color-mix(in srgb, var(--series-3) 12%, transparent); }
.fc-aviso.aten { color: color-mix(in srgb, var(--serious) 75%, var(--text-primary)); background: color-mix(in srgb, var(--warning) 20%, transparent); }
.fc-rem { width: 34px; height: 36px; padding: 0; }

.fc-mais { margin-top: 14px; }
.fc-mais summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.fc-mais-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 10px; }
.fc-mais-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 650; color: var(--text-secondary); }
.fc-mais-grid input { font-size: 14px; padding: 8px 10px; }
.fc-mais-grid .fc-obs { grid-column: 1 / -1; }
.fc-ajuda { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }

.fc-rodape {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.fc-total { margin-left: auto; font-size: 12.5px; color: var(--text-muted); }
.fc-excluir { color: var(--critical); }

.fc-prods { display: flex; flex-direction: column; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.fc-prods:has(> .fc-vazio) { border: 0; }
.fc-data-box { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; max-width: 320px; }
.fc-data-box label { font-size: 11.5px; font-weight: 650; color: var(--text-secondary); }
.fc-data-box label span { font-weight: 400; color: var(--text-muted); }
.fc-prod-linha {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px;
  text-align: left; font: inherit; color: var(--text-primary);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.fc-prod-linha:hover .fc-prod-nome, .fc-prod-linha:focus-visible .fc-prod-nome { color: var(--series-1); }
.fc-prod-linha:focus-visible { outline: none; }
.fc-prod-linha .fc-prod-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-prod-linha .fc-prod-nome::before { content: '▸'; display: inline-block; width: 14px; color: var(--text-muted); }
.fc-prod.aberto .fc-prod-linha .fc-prod-nome::before { content: '▾'; }
.fc-prod-linha .fc-prod-sub { padding-left: 14px; }
.fc-compra.ok { color: color-mix(in srgb, var(--series-3) 80%, var(--text-primary)); }
.fc-compra.aten { color: color-mix(in srgb, var(--serious) 75%, var(--text-primary)); }
.fc-falta { color: var(--serious); }
.fc-prod-sub .tag { font-size: 10.5px; padding: 0 6px; margin-left: 4px; }
.fc-prod-edit { padding: 10px 0 2px 14px; }
.fc-prod { padding: 8px 12px; background: var(--surface); }
.fc-prod + .fc-prod { border-top: 1px solid var(--border); }
.fc-prod.aberto { background: color-mix(in srgb, var(--series-1) 4%, var(--surface)); }
.fc-prod-topo { display: flex; align-items: center; gap: 10px; }
.fc-prod-nome { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.35; }
.fc-prod-sub { display: block; font-size: 12px; color: var(--text-muted); }
.fc-tirar { flex: none; font-size: 12px; padding: 4px 9px; }
.fc-prod .fc-retiradas { margin-bottom: 6px; }
.fc-prod-pe { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
.fc-prod-pe .fc-link { margin-top: 0; }
.fc-lt-mini { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.fc-passo .fc-lt-mini input { width: 64px; font-size: 13px; padding: 5px 7px; }
.fc-prod-hint { margin: -4px 0 10px; }
.fc-vazio { font-size: 13px; color: var(--text-muted); margin: 0; }
.fc-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.fc-chip {
  font: inherit; font-size: 12px; color: var(--text-secondary);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fc-chip b { margin-left: 6px; color: var(--series-1); }
.fc-chip:hover { border-color: var(--series-1); }
#fc-sku-manual { margin-top: 10px; }

@media (max-width: 600px) {
  .fc-lt-mini { margin-left: 0; }
  .fc-ret { grid-template-columns: 1fr 1fr 34px; }
  .fc-aviso { grid-column: 1 / -1; grid-row: 2; margin-top: 0; }
  .fc-mais-grid { grid-template-columns: 1fr; }
  .fc-check { margin-left: 0; }
}

/* ------------------------------------------ Marketing: caminho do lead até a venda (README 7.14) */
#tb-mk-pessoas td { vertical-align: top; }
.mk-passo { display: inline-block; white-space: nowrap; font-size: 12px; }
.mk-passo b { font-weight: 600; color: var(--text-secondary); }
.mk-passo-orc { color: var(--text-primary); }
.mk-passo-venda { color: var(--text-primary); font-weight: 600; }
.mk-seta { margin: 0 6px; color: var(--text-muted); }
.mk-tag {
  display: inline-block; margin: 0 4px 3px 0; padding: 1px 7px; border-radius: 999px; font-size: 11px;
  background: var(--surface-2); color: var(--text-secondary); white-space: nowrap;
}
.mk-at { display: inline-block; font-size: 12px; white-space: nowrap; color: var(--text-secondary); }
.mk-at.aberto { color: var(--text-primary); font-weight: 600; }

/* Positivação de carteira: linha por RCA */
.pos-linha { display: flex; flex-direction: column; gap: 6px; }
.pos-linha-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pos-linha-rodape { margin: 0; text-align: center; font-size: 12px; }

/* ------------------------------------------------ tela Ação (README 7.16) */
.acao-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.acao-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--good); }
.acao-marca-info { display: block; font-size: 11px; color: var(--text-muted); margin-top: 3px; }
tr.acao-feito td:not(:first-child) { text-decoration: line-through; opacity: .5; }
tr.acao-feito td:not(:first-child) .pill { text-decoration: line-through; }
.acao-janela-atual { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--series-1) 12%, transparent); box-shadow: inset 0 0 0 1px var(--series-1); }
.acao-filtros .seg { margin-top: 2px; }

/* ------------------------------------- tela Cabeça, barriga e cauda (README 7.17) */
.dino-etapa { cursor: pointer; margin: 0; }
.dino-etapa:hover { box-shadow: inset 0 0 0 1px var(--series-1); }
.dino-etapa-topo { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 12px; margin-bottom: 8px; }
.dino-etapa-num { font-size: 15px; margin-bottom: 4px; }
.dino-etapa-num strong { font-size: 24px; }
.dino-barra-linha { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.dino-barra-rot { flex: 0 0 120px; font-size: 12px; color: var(--text-secondary); }
.dino-barra { flex: 1; display: flex; height: 26px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.dino-barra span { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11.5px; font-weight: 640; white-space: nowrap; overflow: hidden; }
@media (max-width: 600px) { .dino-barra-rot { flex-basis: 80px; } }
.dino-sugestao { display: inline-block; min-width: 190px; max-width: 260px; white-space: normal; font-size: 12.5px; }
#tb-dino td:nth-child(2) { min-width: 220px; }

/* Link externo no menu (Laudos dos pedidos): mesmo visual do .nav-item, sem o controle de painéis do app.js */
.nav-link-externo { display:flex; align-items:center; gap:10px; width:100%; text-align:left; border:none; background:transparent; border-radius:var(--radius-sm); padding:8px 11px; font-size:13.5px; font-weight:500; color:var(--text-secondary); text-decoration:none; }
.nav-link-externo:hover { background:var(--surface-2); color:var(--text-primary); }
.layout.recolhido .nav-link-externo { display:none; }

/* Ação (23/10/2026): botões do detalhe do cliente (lista principal × produtos que costuma comprar) */
.acao-vistas { margin-bottom: 2px; }
.acao-vistas button { font-size: 12.5px; padding: 6px 12px; }

/* Visão geral (23/10/2026): fechamento do mês, uma barra de progresso por linha (equipe e RCA) */
.eq-linha { padding: 8px 0 12px; }
.eq-linha + .eq-linha { border-top: 1px solid var(--border); margin-top: 4px; }
.eq-topo { display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; font-size: 13px; margin-bottom: 26px; }
.eq-topo span { color: var(--text-secondary); }
.eq-topo b { color: var(--text-primary); font-weight: 680; }
.eq-barra {
  position: relative; height: 14px; border-radius: 100px; margin: 0 8px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.eq-feito { height: 100%; border-radius: 100px; background: var(--series-1); transition: width .5s ease; }
.eq-barra.atras .eq-feito { background: var(--warning); }
.eq-barra.batida .eq-feito { background: var(--good); }
.eq-ponto { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; box-sizing: border-box; }
.eq-ponto.atual { background: var(--text-primary); border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--text-primary); }
.eq-ponto.esperado { background: var(--surface); border: 2px solid var(--text-primary); }
.eq-ponto span {
  position: absolute; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 11.5px; line-height: 1; color: var(--text-secondary);
}
.eq-ponto.atual span { bottom: 19px; color: var(--text-primary); font-weight: 640; }
.eq-ponto.esperado span { top: 19px; }
.eq-ponto.fim span { left: auto; right: -6px; transform: none; }
.eq-ponto.inicio span { left: -6px; transform: none; }
.eq-rodape { margin-top: 26px; font-size: 12.5px; line-height: 1.55; color: var(--text-secondary); }
.eq-rodape strong { color: var(--text-primary); }

/* Clientes (23/10/2026): histórico do cliente com busca */
/* ficha do cliente (tela Clientes, 26/10/2026): cadastro em blocos */
.hc-ficha {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.hc-ficha section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 11px 13px;
}
.hc-ficha h4 {
  margin: 0 0 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-muted);
}
.hc-ficha dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.hc-ficha dt { color: var(--text-muted); white-space: nowrap; }
.hc-ficha dd { margin: 0; color: var(--text-primary); overflow-wrap: anywhere; }
.hc-ficha dd a { color: inherit; }
.hc-ficha dd .muted { color: var(--text-muted); }
#hc-voltar { font-size: 13px; }
.hc-cabecalho { display: flex; flex-direction: column; gap: 3px; margin: 14px 0 12px; font-size: 13px; color: var(--text-secondary); }
.hc-cabecalho strong { font-size: 17px; font-weight: 680; color: var(--text-primary); margin-right: 6px; }
.hc-cabecalho .pill { align-self: flex-start; }
.hc-cabecalho > strong + .pill { margin-top: -2px; }
.hc-abas-linha { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.hc-abas-linha .seg button { font-size: 12.5px; padding: 6px 12px; }
