/* Painel de ofertas v2 (docs/design.md, partes B e D).
   CSP: sem inline. Cor, espaço e fonte só por var(--…); os valores moram em :root.
   Fontes Barlow / Barlow Condensed (SIL OFL 1.1) servidas de /static/fontes/. */

@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap;
  src: local("Barlow"), url("/static/fontes/Barlow-Regular.ttf") format("truetype"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-style: normal; font-display: swap;
  src: local("Barlow SemiBold"), url("/static/fontes/Barlow-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-style: normal; font-display: swap;
  src: local("Barlow Condensed ExtraBold"), url("/static/fontes/BarlowCondensed-ExtraBold.ttf") format("truetype"); }

/* ---------- tokens ---------- */
:root {
  color-scheme: light dark;
  --bg: #F4F4F5; --surface: #FFFFFF; --surface-2: #FAFAFA; --surface-3: #F0F0F2; --border: #E4E4E7;
  --borda-controle: #8A8A93;
  --text: #18181B; --text-2: #52525B; --text-3: #63636B;
  --accent: #1D4ED8; --accent-text: #FFFFFF;
  --ok: #15803D; --warn: #B45309; --err: #B91C1C; --info: #1D4ED8;
  --ok-bg: #F0FDF4; --warn-bg: #FFFBEB; --err-bg: #FEF2F2; --info-bg: #EFF6FF;
  --foco: #1D4ED8; --scrim: rgb(0 0 0 / .45);
  --qr-fundo: #FFFFFF; --qr-tinta: #000000; /* QR sempre preto sobre branco, nos dois temas */
  --placa: #FFFFFF; /* foto de produto sempre sobre placa clara, nos dois temas */

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --s12: 48px; --s16: 64px;

  --fonte: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fonte-num: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --t-xs: .75rem; --t-sm: .875rem; --t-md: 1rem; --t-lg: 1.25rem; --t-xl: 1.5rem; --t-2xl: 2.5rem;
  --lh-corpo: 1.5; --lh-titulo: 1.25;

  --raio: 8px; --raio-sm: 6px; --raio-lg: 12px; --raio-pill: 999px;
  --sombra: 0 1px 2px rgb(0 0 0 / .06);
  --sombra-2: 0 4px 12px rgb(0 0 0 / .08);
  --anel: 0 0 0 2px var(--surface), 0 0 0 4px var(--foco);
  --dur-1: 120ms; --dur-2: 180ms; --dur-3: 250ms;

  --alvo: 44px; --alvo-fino: 36px; --nav-h: 56px; --faixa-h: 52px; --lateral-w: 240px; --conteudo-max: 1120px;
  --thumb: 96px; --thumb-sm: 56px; --qr-lado: 280px; --switch-w: 44px; --switch-h: 28px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --bg: #0B0B0D; --surface: #18181B; --surface-2: #1F1F23; --surface-3: #27272A; --border: #2F2F35;
    --borda-controle: #6B6B75;
    --text: #FAFAFA; --text-2: #A1A1AA; --text-3: #9A9AA3;
    --accent: #60A5FA; --accent-text: #0B0B0D;
    --ok: #4ADE80; --warn: #FBBF24; --err: #F87171; --info: #60A5FA;
    --ok-bg: #052E16; --warn-bg: #2E1F05; --err-bg: #2F0A0A; --info-bg: #0B1E3A;
    --foco: #93C5FD; --sombra: none; --sombra-2: none;
  }
}
:root[data-tema="escuro"] {
  --bg: #0B0B0D; --surface: #18181B; --surface-2: #1F1F23; --surface-3: #27272A; --border: #2F2F35;
  --borda-controle: #6B6B75;
  --text: #FAFAFA; --text-2: #A1A1AA; --text-3: #9A9AA3;
  --accent: #60A5FA; --accent-text: #0B0B0D;
  --ok: #4ADE80; --warn: #FBBF24; --err: #F87171; --info: #60A5FA;
  --ok-bg: #052E16; --warn-bg: #2E1F05; --err-bg: #2F0A0A; --info-bg: #0B1E3A;
  --foco: #93C5FD; --sombra: none; --sombra-2: none;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font-family: var(--fonte); font-size: var(--t-md); line-height: var(--lh-corpo);
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font-size: var(--t-xl); font-weight: 600; line-height: var(--lh-titulo); }
h2, h3 { font-size: var(--t-md); font-weight: 600; line-height: var(--lh-titulo); }
a { color: var(--accent); text-underline-offset: .15em; }
img { max-width: 100%; display: block; }
code, kbd, .mono { font-family: var(--mono); font-size: .9em; }
.num { font-variant-numeric: tabular-nums; }
.aux { font-size: var(--t-sm); color: var(--text-2); }
.aux-xs { font-size: var(--t-xs); color: var(--text-3); }
.terceiros { font-size: var(--t-sm); overflow-wrap: anywhere; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-leitor { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
/* controles que só fazem sentido com JS: somem quando o navegador não roda script */
.so-semjs { display: none; }
@media (scripting: none) {
  .so-js { display: none !important; }
  .so-semjs { display: block; }
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--anel);
}
.pular { position: absolute; left: var(--s4); top: var(--s2); z-index: 100; padding: var(--s2) var(--s4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio);
  transform: translateY(-200%); }
.pular:focus { transform: none; }

/* ---------- login (legado do auth; só fora do shell do painel) ---------- */
body:not(.app-corpo) { display: grid; place-items: center; padding: var(--s4); }
body:not(.app-corpo) .cartao { width: 100%; max-width: 25rem; padding: var(--s6); }
body:not(.app-corpo) label { display: block; margin: var(--s4) 0 var(--s1); font-weight: 600; font-size: var(--t-sm); }
body:not(.app-corpo) input, body:not(.app-corpo) button {
  width: 100%; min-height: var(--alvo); font: inherit; padding: var(--s2) var(--s3);
}
body:not(.app-corpo) input { border: 1px solid var(--borda-controle); border-radius: var(--raio); background: var(--surface); color: inherit; }
body:not(.app-corpo) button { margin-top: var(--s6); cursor: pointer; border: 0; border-radius: var(--raio);
  background: var(--accent); color: var(--accent-text); font-weight: 600; }
.erro { margin: var(--s4) 0 0; color: var(--err); font-size: var(--t-sm); }

/* ---------- shell ---------- */
.app { min-height: 100dvh; }
.app > header { display: contents; }
.conteudo {
  padding: var(--s4) var(--s4) calc(var(--nav-h) + var(--s6) + env(safe-area-inset-bottom));
  max-width: var(--conteudo-max); margin-inline: auto; min-width: 0;
}
.conteudo:focus { outline: none; }
.pagina { display: grid; gap: var(--s6); min-width: 0; }
.pagina > * { min-width: 0; }
.pagina-cab { display: grid; gap: var(--s1); }
.secao { display: grid; gap: var(--s3); min-width: 0; align-content: start; }
.secao-cab { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.grade { display: grid; gap: var(--s4); min-width: 0; }
.grade > * { min-width: 0; }
.pilha { display: grid; gap: var(--s3); }
.linha { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.linha-entre { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.linha-entre > * { min-width: 0; }
.linha-entre > .pilha { flex: 1 1 12rem; }

/* faixa do kill switch: sempre visível (o bloco inteiro gruda no topo) */
.faixa-bloco { position: sticky; top: 0; z-index: 30; }
.faixa {
  min-height: var(--faixa-h); display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s1) var(--s4); background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: var(--t-sm); font-weight: 600;
}
.faixa__estado { display: flex; align-items: center; gap: var(--s2); min-width: 0; flex: 1; }
.faixa__estado > span { min-width: 0; overflow-wrap: break-word; }
.faixa--pausada { background: var(--err-bg); color: var(--err); border-bottom-color: var(--err); }
.faixa form { margin: 0; }
.faixa > .botao { flex: none; }
.faixa__menu { display: grid; place-items: center; flex: none; width: var(--alvo); height: var(--alvo);
  margin-left: calc(var(--s2) * -1); background: none; border: 0; border-radius: var(--raio-sm); color: var(--text); cursor: pointer;
  transition: background-color var(--dur-1) ease-out; }
.faixa__menu:hover { background: var(--surface-3); }
.faixa__menu .icone { width: 1.5rem; height: 1.5rem; }

/* navegação: grupos compartilhados entre a lateral (>= 1024) e a gaveta */
.nav-lateral { display: none; }
.marca { display: block; padding: var(--s2) var(--s3) var(--s4); color: var(--text); text-decoration: none;
  font-family: var(--fonte-num); font-weight: 800; font-size: var(--t-lg); line-height: 1; letter-spacing: .01em; }
.nav-grupo { display: grid; gap: var(--s1); }
.nav-grupo + .nav-grupo { margin-top: var(--s4); }
.nav-grupo__rotulo { padding: var(--s1) var(--s3); font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3); }
.nav-grupo ul { display: grid; gap: 2px; }
.nav-lista { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.nav-lista > form { margin-top: auto; padding-top: var(--s4); }
.nav-lista > form + * { margin-top: 0; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: var(--s3); width: 100%;
  min-height: var(--alvo); padding: var(--s1) var(--s3); border-radius: var(--raio-sm);
  color: var(--text-2); text-decoration: none; font: inherit; font-size: var(--t-sm); font-weight: 600;
  background: none; border: 0; cursor: pointer; text-align: left;
  transition: background-color var(--dur-1) ease-out, color var(--dur-1) ease-out;
}
.nav-item .icone { width: 1.25rem; height: 1.25rem; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--info-bg); color: var(--text); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: var(--s2); bottom: var(--s2);
  width: 2px; border-radius: var(--raio-pill); background: var(--accent); }
@media (pointer: fine) { .nav-item { min-height: var(--alvo-fino); } }

/* barra inferior (celular) */
.nav-inferior {
  position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.nav-inferior > * { min-width: 0; }
.nav-inferior .nav-item { flex-direction: column; justify-content: center; gap: var(--s1); border-radius: 0;
  padding: var(--s1); font-size: var(--t-xs); height: 100%; text-align: center; }
.nav-inferior .nav-item .icone { width: 1.5rem; height: 1.5rem; }
.nav-inferior .nav-item[aria-current="page"] { background: none; color: var(--accent); }
.nav-inferior .nav-item[aria-current="page"]::before { left: var(--s4); right: var(--s4); top: 0; bottom: auto; width: auto; height: 2px; }

/* gaveta (< 1024): popover à esquerda, altura total */
.gaveta {
  position: fixed; inset: 0 auto 0 0; margin: 0; width: min(86vw, 320px); height: 100dvh; max-height: none;
  padding: var(--s4) var(--s3); border: 0; border-right: 1px solid var(--border); border-radius: 0;
  background: var(--surface-2); color: var(--text); overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(-100%);
  transition: transform 150ms ease-in, display 150ms allow-discrete, overlay 150ms allow-discrete;
}
.gaveta:popover-open { display: flex; flex-direction: column; transform: none;
  transition: transform var(--dur-3) ease-out, display var(--dur-3) allow-discrete, overlay var(--dur-3) allow-discrete; }
.gaveta::backdrop { background: var(--scrim); opacity: 0; transition: opacity 200ms ease-out, display 200ms allow-discrete, overlay 200ms allow-discrete; }
.gaveta:popover-open::backdrop { opacity: 1; }
@starting-style {
  .gaveta:popover-open { transform: translateX(-100%); }
  .gaveta:popover-open::backdrop { opacity: 0; }
}
.gaveta__cab { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding-right: var(--s1); }
.gaveta__cab .marca { padding-bottom: var(--s4); }
.gaveta__fechar { display: grid; place-items: center; width: var(--alvo); height: var(--alvo); background: none; border: 0;
  border-radius: var(--raio-sm); color: var(--text-2); cursor: pointer; }
.gaveta__fechar:hover { background: var(--surface-3); }

/* folhas e diálogos (popover) */
.folha {
  margin: auto; padding: var(--s4); border: 1px solid var(--border); border-radius: var(--raio-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--sombra-2);
  opacity: 1; transition: opacity var(--dur-2) ease-out, transform var(--dur-2) ease-out,
    overlay var(--dur-2) allow-discrete, display var(--dur-2) allow-discrete;
}
.folha::backdrop { background: var(--scrim); }
@starting-style { .folha:popover-open { opacity: 0; transform: scale(.96); } }
.folha:not(:popover-open) { opacity: 0; }
.folha--dialogo { width: min(calc(100vw - var(--s8)), 28rem); }
.folha__acoes { display: grid; gap: var(--s2); margin-top: var(--s4); }
/* folha de edição: de baixo no celular, painel lateral >= 1024 */
.folha--edicao { inset: auto 0 0 0; margin: 0; width: 100%; max-height: 92dvh; overflow-y: auto;
  border-radius: var(--raio-lg) var(--raio-lg) 0 0; }
.folha--edicao > .pilha { gap: var(--s4); }
.folha--ampliada { width: min(calc(100vw - var(--s8)), 36rem); padding: var(--s3); }
.folha--ampliada .tema__ampliada { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain;
  background: var(--surface-2); border-radius: var(--raio-sm); display: none; }
.folha__cab { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }

/* ---------- ícones ---------- */
.icone { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icone--lg { width: 2.5rem; height: 2.5rem; }

/* ---------- cartão v2 ---------- */
.cartao { background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio-lg);
  padding: var(--s4); box-shadow: var(--sombra);
  transition: border-color var(--dur-1) ease-out; }
.cartao:hover, .cartao:focus-within { border-color: var(--borda-controle); }
.cartao > * + * { margin-top: var(--s3); }
.cartao--aviso { background: var(--warn-bg); border-color: var(--warn); }
.cartao--info { background: var(--info-bg); border-color: var(--info); }
.cartao--aviso:hover, .cartao--info:hover { border-color: inherit; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio-lg);
  padding: var(--s4); box-shadow: var(--sombra); display: grid; gap: var(--s2); min-width: 0; align-content: start;
  transition: border-color var(--dur-1) ease-out; }
.kpi:hover, .kpi:focus-within { border-color: var(--borda-controle); }
.kpi__topo { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s2); }
.kpi__rotulo { font-size: var(--t-sm); color: var(--text-2); }
.kpi__chip { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--raio-sm);
  background: var(--info-bg); color: var(--info); }
.kpi__valor { font-family: var(--fonte-num); font-weight: 800; font-size: var(--t-2xl); line-height: 1;
  font-variant-numeric: tabular-nums; }
.kpi__link { color: inherit; text-decoration: none; }
.kpi__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.kpi__link:focus-visible { box-shadow: none; outline: none; }
.kpi:has(.kpi__link:focus-visible) { box-shadow: var(--anel); }
.kpi__rodape { min-height: 1.5rem; display: flex; align-items: center; }
.delta { display: inline-flex; align-items: center; gap: var(--s1); padding: 2px var(--s2); border-radius: var(--raio-pill);
  font-size: var(--t-xs); font-weight: 600; line-height: 1.4; background: var(--surface-3); color: var(--text-2);
  animation: delta-entra 150ms ease-out; }
.delta--ok { background: var(--ok-bg); color: var(--ok); }
.delta--err { background: var(--err-bg); color: var(--err); }
.delta--sem { background: none; padding-inline: 0; color: var(--text-3); font-weight: 400; }
@keyframes delta-entra { from { opacity: 0; } to { opacity: 1; } }

/* ---------- selos ---------- */
.selo { display: inline-flex; align-items: center; gap: var(--s1); padding: var(--s1) var(--s2);
  border-radius: var(--raio-pill); font-size: var(--t-xs); font-weight: 600; line-height: 1.2;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.selo .icone { width: .875rem; height: .875rem; stroke-width: 2.5; }
.selo--ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.selo--warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.selo--err { background: var(--err-bg); color: var(--err); border-color: var(--err); }
.selo--info { background: var(--info-bg); color: var(--info); border-color: var(--info); }
.selo--fonte { background: var(--surface); color: var(--text); }

/* ---------- botões ---------- */
.botao {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--alvo); padding: var(--s2) var(--s4); border-radius: var(--raio);
  border: 1px solid var(--borda-controle); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-1) ease-out, border-color var(--dur-1) ease-out;
}
.botao:hover { background: var(--surface-3); }
.botao--primario { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.botao--primario:hover { background: var(--accent); filter: brightness(1.1); }
.botao--perigo { color: var(--err); border-color: var(--err); }
.botao--perigo:hover { background: var(--err-bg); }
.botao--bloco { width: 100%; }
.botao[disabled], .botao[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.botao--link { border-color: transparent; background: none; color: var(--accent); min-height: var(--alvo); }
.botao--sm { min-height: var(--alvo-fino); padding: var(--s1) var(--s3); font-size: var(--t-sm); }
@media (pointer: coarse) { .botao--sm { min-height: var(--alvo); } }
/* rótulo normal e rótulo "ocupado" empilhados na mesma célula: a largura não pula */
.botao__rotulos { display: inline-grid; justify-items: center; }
.botao__texto, .botao__ocupado { grid-area: 1 / 1; }
.botao__ocupado { visibility: hidden; }
.htmx-request.botao, .htmx-request .botao[type="submit"], .htmx-request button[type="submit"].botao { pointer-events: none; }
.htmx-request.botao .botao__texto, .htmx-request .botao[type="submit"] .botao__texto { animation: oculta 0s 150ms forwards; }
.htmx-request.botao .botao__ocupado, .htmx-request .botao[type="submit"] .botao__ocupado { animation: mostra 0s 150ms forwards; }
.htmx-request.botao::before, .htmx-request .botao[type="submit"]::before {
  content: ""; position: absolute; left: var(--s3); top: calc(50% - 8px); width: 16px; height: 16px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  opacity: 0; animation: gira 700ms linear infinite, mostra-op 0s 150ms forwards;
}
.htmx-request .interruptor { opacity: .6; pointer-events: none; }
@keyframes oculta { to { visibility: hidden; } }
@keyframes mostra { to { visibility: visible; } }
@keyframes mostra-op { to { opacity: 1; } }
@keyframes gira { to { transform: rotate(360deg); } }
.rodape-fixo { position: sticky; z-index: 20; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: var(--s3) 0; background: var(--bg); }

/* confirmação inline: o botão original dá lugar a "Confirmar: …" + "Cancelar" */
.confirma { display: inline-flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.confirma[hidden] { display: none; }

/* ---------- formulários ---------- */
.campo { display: grid; gap: var(--s1); }
.campo__rotulo { font-size: var(--t-sm); font-weight: 600; }
.campo__ajuda { font-size: var(--t-sm); color: var(--text-2); }
.campo__erro { font-size: var(--t-sm); color: var(--err); display: flex; gap: var(--s1); align-items: flex-start; }
.entrada, .campo input[type="text"], .campo input[type="password"], .campo input[type="number"],
.campo input[type="url"], .campo input[type="file"], .campo input[type="date"], .campo select, .campo textarea {
  width: 100%; min-height: var(--alvo); padding: var(--s2) var(--s3); font: inherit; font-size: max(var(--t-md), 16px);
  color: var(--text); background: var(--surface); border: 1px solid var(--borda-controle); border-radius: var(--raio);
}
.campo textarea { min-height: calc(var(--alvo) * 2); resize: vertical; }
.campo textarea.mono { font-family: var(--mono); }
.campo [aria-invalid="true"] { border-color: var(--err); }
.campo :disabled { opacity: .5; cursor: not-allowed; }
.opcao { display: flex; align-items: flex-start; gap: var(--s3); min-height: var(--alvo); padding: var(--s2) 0; }
.opcao input { width: 1.25rem; height: 1.25rem; margin-top: var(--s1); flex: none; accent-color: var(--accent); }
details.secao-recolhivel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio-lg); }
details.secao-recolhivel > summary { min-height: var(--alvo); padding: var(--s3) var(--s4); font-weight: 600; cursor: pointer; }
details.secao-recolhivel > .pilha { padding: 0 var(--s4) var(--s4); }

/* interruptor */
.interruptor { display: inline-flex; align-items: center; gap: var(--s3); min-height: var(--alvo);
  background: none; border: 0; padding: 0; font: inherit; color: var(--text); cursor: pointer; }
.interruptor__trilho { position: relative; width: var(--switch-w); height: var(--switch-h); flex: none;
  border-radius: var(--raio-pill); background: var(--borda-controle); transition: background-color var(--dur-1) ease-out; }
.interruptor__trilho::after { content: ""; position: absolute; top: var(--s1); left: var(--s1);
  width: calc(var(--switch-h) - var(--s2)); height: calc(var(--switch-h) - var(--s2));
  border-radius: 50%; background: var(--surface); transition: transform var(--dur-1) ease-out; }
.interruptor[aria-checked="true"] .interruptor__trilho { background: var(--ok); }
.interruptor[aria-checked="true"] .interruptor__trilho::after { transform: translateX(calc(var(--switch-w) - var(--switch-h))); }
.interruptor__texto { font-weight: 600; }
.interruptor[disabled], .interruptor[aria-busy="true"] { opacity: .5; cursor: not-allowed; }

/* segmentado e chips */
.segmentado { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--borda-controle);
  border-radius: var(--raio); background: var(--surface); overflow: hidden; width: 100%; }
.segmentado a, .segmentado button { display: flex; align-items: center; justify-content: center; min-height: var(--alvo);
  padding: var(--s2) var(--s3); color: var(--text-2); text-decoration: none; font: inherit; font-weight: 600;
  background: none; border: 0; cursor: pointer; }
.segmentado a:hover:not([aria-current="true"]), .segmentado button:hover:not([aria-pressed="true"]) { background: var(--surface-3); }
.segmentado [aria-current="true"], .segmentado [aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.chips { display: flex; gap: var(--s2); overflow-x: auto; padding: var(--s1) var(--s1) var(--s2); margin: calc(var(--s1) * -1) calc(var(--s1) * -1) 0;
  scrollbar-width: thin; }
.chips[role="group"], .chips--quebra { flex-wrap: wrap; overflow-x: visible; }
.chip { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--alvo); padding: var(--s1) var(--s4);
  flex: none; border-radius: var(--raio-pill); border: 1px solid var(--borda-controle); background: var(--surface);
  color: var(--text); text-decoration: none; font: inherit; font-weight: 600; font-size: var(--t-sm); cursor: pointer;
  transition: background-color var(--dur-1) ease-out, border-color var(--dur-1) ease-out; }
.chip:hover { background: var(--surface-3); }
.chip[aria-current="true"], .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chip__n { font-variant-numeric: tabular-nums; opacity: .8; }
@media (pointer: fine) { .chip { min-height: var(--alvo-fino); } }

/* busca de cliente e barra de filtros */
.barra-filtro { display: grid; gap: var(--s3); min-width: 0; }
.barra-filtro[hidden] { display: none; }
.busca { position: relative; display: flex; align-items: center; gap: var(--s3); min-width: 0; flex-wrap: wrap; }
.busca__campo { position: relative; flex: 1 1 100%; min-width: 0; }
.busca__campo .icone { position: absolute; left: var(--s3); top: 50%; margin-top: -.625rem; color: var(--text-3); pointer-events: none; }
.busca input[type="search"] { width: 100%; min-height: var(--alvo); padding: var(--s2) var(--s3) var(--s2) calc(var(--s3) + 1.75rem);
  font: inherit; font-size: max(var(--t-md), 16px); color: var(--text); background: var(--surface);
  border: 1px solid var(--borda-controle); border-radius: var(--raio); }
@media (pointer: fine) { .busca input[type="search"] { min-height: var(--alvo-fino); } }
.busca__contador { min-width: 4rem; }
.filtro-vazio { display: grid; justify-items: center; gap: var(--s2); text-align: center; padding: var(--s6) var(--s4);
  background: var(--surface); border: 1px dashed var(--borda-controle); border-radius: var(--raio-lg); }

/* ---------- banners ---------- */
.banner { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4);
  border-radius: var(--raio); border: 1px solid var(--border); border-left: 4px solid var(--info);
  background: var(--info-bg); color: var(--text); }
.banner__corpo { display: grid; gap: var(--s2); min-width: 0; }
.banner__corpo > * { overflow-wrap: anywhere; }
.banner > .icone { margin-top: var(--s1); color: var(--info); }
.banner--erro { background: var(--err-bg); border-left-color: var(--err); }
.banner--erro > .icone { color: var(--err); }
.banner--aviso { background: var(--warn-bg); border-left-color: var(--warn); }
.banner--aviso > .icone { color: var(--warn); }
.banner--ok { background: var(--ok-bg); border-left-color: var(--ok); }
.banner--ok > .icone { color: var(--ok); }
#erros:empty { display: none; }

/* ---------- vazio, skeleton ---------- */
.vazio { display: grid; justify-items: center; gap: var(--s2); text-align: center; padding: var(--s8) var(--s4);
  background: var(--surface); border: 1px dashed var(--borda-controle); border-radius: var(--raio-lg); }
.vazio .icone { color: var(--text-3); }
.vazio p { max-width: 36rem; }
.vazio .botao { margin-top: var(--s2); }
.skeleton { display: grid; gap: var(--s3); }
.skeleton__bloco { background: var(--surface-3); border-radius: var(--raio-sm); height: var(--s4);
  animation: pulso 1.2s ease-in-out infinite; }
.skeleton__bloco--curto { width: 60%; }
.skeleton__bloco--quadrado { height: var(--qr-lado); width: var(--qr-lado); max-width: 100%; }
.skeleton__bloco--kpi { height: var(--s8); width: 40%; }
.skeleton .cartao .skeleton__bloco, .skeleton .kpi .skeleton__bloco { background: var(--surface-3); }
.skeleton-sobre { display: none; }
.skeleton-sobre.htmx-request { display: grid; position: absolute; inset: 0; z-index: 5; align-content: start; gap: var(--s3);
  background: var(--bg); animation: mostra-fade 150ms ease-out 150ms backwards; }
.lista-wrap { position: relative; min-width: 0; display: grid; gap: var(--s4); }
@keyframes pulso { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }
@keyframes mostra-fade { from { opacity: 0; } to { opacity: 1; } }
[aria-busy="true"] { cursor: progress; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 40; left: var(--s4); right: var(--s4);
  bottom: calc(var(--nav-h) + var(--s4) + env(safe-area-inset-bottom)); display: grid; gap: var(--s2);
  pointer-events: none; justify-items: center; }
.toast { pointer-events: auto; position: relative; display: flex; align-items: center; gap: var(--s3);
  width: 100%; max-width: 28rem; padding: var(--s3) var(--s4); border-radius: var(--raio);
  background: var(--text); color: var(--bg); box-shadow: 0 2px 8px rgb(0 0 0 / .25);
  animation: toast-entra var(--dur-3) ease-out; }
.toast--ok { animation: toast-entra var(--dur-3) ease-out, toast-sai 150ms ease-in 4s forwards; }
.toast .icone { color: var(--ok); filter: brightness(1.2); }
.toast--err .icone, .toast--warn .icone { color: var(--err); filter: none; }
.toast--err { border-left: 4px solid var(--err); }
.toast--warn { border-left: 4px solid var(--warn); }
.toast__texto { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast__fechar { appearance: none; position: relative; width: var(--alvo); height: var(--alvo); flex: none; margin: calc(var(--s2) * -1) calc(var(--s2) * -1) calc(var(--s2) * -1) 0;
  background: none; border: 0; border-radius: var(--raio-sm); color: inherit; cursor: pointer; }
.toast__fechar::after { content: "\2715"; position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--t-md); }
.toast:has(.toast__fechar:checked) { display: none; }
@keyframes toast-entra { from { opacity: 0; transform: translateY(var(--s2)); } to { opacity: 1; transform: none; } }
@keyframes toast-sai { to { opacity: 0; visibility: hidden; } }

/* ---------- listas e tabelas responsivas ---------- */
.so-desktop { display: none; }
.lista { display: grid; gap: var(--s3); min-width: 0; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio-lg);
  padding: var(--s3) var(--s4); box-shadow: var(--sombra); display: grid; gap: var(--s2); min-width: 0;
  transition: border-color var(--dur-1) ease-out; }
.item:hover, .item:focus-within { border-color: var(--borda-controle); }
.item__titulo { font-weight: 600; overflow-wrap: anywhere; }
.item__par { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--t-sm); }
.item__par dt { color: var(--text-2); }
.item__par dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.item__linha { display: flex; gap: var(--s3); align-items: flex-start; }
.item__corpo { flex: 1; min-width: 0; display: grid; gap: var(--s1); }

/* miniatura: caixa com placeholder atrás; a imagem cobre quando carrega */
.caixa-mini { position: relative; display: grid; place-items: center; flex: none; width: var(--thumb-sm); height: var(--thumb-sm);
  background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--raio-sm); color: var(--text-3); overflow: hidden; }
.caixa-mini--lg { width: var(--thumb); height: var(--thumb); }
.caixa-mini .icone { width: 1.5rem; height: 1.5rem; }
.miniatura { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--placa); }
.miniatura--falhou { display: none; }
.tabela-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio-lg); }
.tabela { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.tabela caption { text-align: left; }
.tabela th, .tabela td { padding: var(--s2) var(--s3); text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabela th { font-size: var(--t-xs); font-weight: 600; color: var(--text-2); background: var(--surface-2); }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr:hover td, .tabela tbody tr:hover th { background: var(--surface-3); }
.tabela td.num, .tabela th.num { text-align: right; }
.linha--erro { background: var(--err-bg); }

/* barra horizontal (CSS puro; largura por classe) */
.barra { height: var(--s2); background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--raio-pill); overflow: hidden; }
.barra__cheia { height: 100%; background: var(--accent); }
.barra-linha { display: grid; gap: var(--s1); }

/* QR */
.qr { width: var(--qr-lado); max-width: 100%; aspect-ratio: 1; padding: var(--s4); background: var(--qr-fundo);
  border: 1px solid var(--border); border-radius: var(--raio); color: var(--qr-tinta); }
.qr img { width: 100%; height: 100%; }
.passos { list-style: decimal; padding-left: var(--s6); display: grid; gap: var(--s2); }

/* ---------- status vivo (Visão geral) ---------- */
.ponto { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.ponto--ok { background: var(--ok); animation: pulso-ponto 2s ease-in-out infinite; }
.ponto--warn { background: var(--warn); }
.ponto--err { background: var(--err); }
@keyframes pulso-ponto { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.vivo__estado { display: flex; align-items: flex-start; gap: var(--s3); min-width: 0; }
.vivo__estado .ponto { margin-top: .5rem; }
.vivo__estado > div { min-width: 0; display: grid; gap: var(--s1); }
.vivo__estado strong { font-size: var(--t-md); }
[data-falha] .ponto { background: var(--warn); animation: none; }
.js-semsinal { display: none; color: var(--warn); }
[data-falha] .js-semsinal { display: block; }
.vivo-linhas { display: grid; gap: 0; }
.vivo-linha { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0;
  border-top: 1px solid var(--border); min-width: 0; }
.vivo-linha:first-child { border-top: 0; }
.vivo-linha__nome { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.vivo-linha__nome > span:last-child { min-width: 0; display: grid; }

/* linhas com miniatura (próximas, últimas, falhas) */
.linha-pub { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--border); min-width: 0; }
.linha-pub:first-child { border-top: 0; }
.linha-pub__corpo { flex: 1; min-width: 0; display: grid; gap: 2px; }
.linha-pub__titulo { font-size: var(--t-sm); font-weight: 600; }
.linha-pub__meta { font-size: var(--t-xs); color: var(--text-2); display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); }
.linha-pub .selo { flex: none; }
.cartao--lista { padding-block: var(--s2); }
.cartao--lista > * + * { margin-top: 0; }

/* ---------- Ofertas: cards ---------- */
.grade-ofertas { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); }
.oferta { position: relative; display: grid; gap: var(--s3); align-content: start; min-width: 0; padding: var(--s4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio-lg); box-shadow: var(--sombra);
  transition: border-color var(--dur-1) ease-out; }
.oferta:hover, .oferta:focus-within { border-color: var(--borda-controle); }
.oferta__topo { display: flex; gap: var(--s3); align-items: flex-start; min-width: 0; }
.oferta__corpo { flex: 1; min-width: 0; display: grid; gap: var(--s2); }
.oferta__preco { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s2); }
.preco { font-family: var(--fonte-num); font-weight: 800; font-size: var(--t-xl); line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.preco-de { font-size: var(--t-sm); color: var(--text-3); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.pilula-desc { display: inline-flex; padding: 1px var(--s2); border-radius: var(--raio-pill); background: var(--ok-bg); color: var(--ok);
  font-size: var(--t-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.oferta__selos { display: flex; flex-wrap: wrap; gap: var(--s2); }
.oferta__rodape { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.oferta__rodape form { margin: 0; }
.oferta__sel { display: none; position: absolute; top: var(--s3); right: var(--s3); z-index: 2; width: 1.5rem; height: 1.5rem; accent-color: var(--accent); cursor: pointer; }
.selecionando .oferta__sel { display: block; }
.oferta.htmx-swapping { opacity: 0; transition: opacity 200ms ease-out; }
.barra-lote { position: fixed; z-index: 35; left: var(--s4); right: var(--s4); bottom: calc(var(--nav-h) + var(--s4) + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--borda-controle); border-radius: var(--raio-lg); box-shadow: var(--sombra-2); }
.barra-lote[hidden] { display: none; }
.paginacao { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }

/* ---------- Agenda: linha do tempo ---------- */
.tempo { display: grid; min-width: 0; }
.tempo__hora { position: sticky; top: var(--faixa-h); z-index: 4; padding: var(--s2) 0; background: var(--bg);
  font-size: var(--t-sm); font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tempo__item { display: flex; align-items: center; gap: var(--s3); min-width: 0; padding: var(--s3); margin-bottom: var(--s2);
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--borda-controle); border-radius: var(--raio);
  transition: border-color var(--dur-1) ease-out; }
.tempo__item:hover { border-color: var(--borda-controle); }
.tempo__item--ok { border-left-color: var(--ok); }
.tempo__item--info { border-left-color: var(--info); }
.tempo__item--warn { border-left-color: var(--warn); }
.tempo__item--err { border-left-color: var(--err); }
.tempo__corpo { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tempo__titulo { font-size: var(--t-sm); font-weight: 600; }
.tempo__meta { font-size: var(--t-xs); color: var(--text-2); }
.tempo__lado { display: grid; justify-items: end; gap: var(--s1); flex: none; max-width: 45%; }
.tempo__lado .aux-xs { text-align: right; }
.tempo__divisor { display: flex; align-items: center; gap: var(--s3); margin: var(--s2) 0 var(--s3); color: var(--text-3);
  font-size: var(--t-xs); font-weight: 600; }
.tempo__divisor::before, .tempo__divisor::after { content: ""; flex: 1; border-top: 1px dashed var(--borda-controle); }
.tempo__divisor--agora { color: var(--accent); }
.tempo__divisor--agora::before, .tempo__divisor--agora::after { border-top: 2px solid var(--accent); }
.tempo__item.htmx-swapping { opacity: 0; transition: opacity 200ms ease-out; }

/* ---------- Canais ---------- */
.avatar { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-3); color: var(--text); font-family: var(--fonte-num); font-weight: 800; font-size: var(--t-lg); line-height: 1; }
.cartao-canal { display: grid; gap: var(--s3); align-content: start; min-width: 0; padding: var(--s4); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--raio-lg); box-shadow: var(--sombra);
  transition: border-color var(--dur-1) ease-out; }
.cartao-canal:hover, .cartao-canal:focus-within { border-color: var(--borda-controle); }
.cartao-canal__cab { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.cartao-canal__cab > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cartao-canal__acoes { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.cartao-canal.htmx-swapping { opacity: 0; transition: opacity 200ms ease-out; }
.controle-linha { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.controle-linha > div { min-width: 0; display: grid; gap: 2px; flex: 1 1 14rem; }

/* ---------- movimento HTMX ---------- */
.htmx-indicator { opacity: 0; transition: opacity var(--dur-2) ease-out; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; transition-delay: 150ms; }
.htmx-swapping { opacity: 0; transition: opacity 200ms ease-out; }
.htmx-added { opacity: 0; }
.htmx-settling .htmx-added, .htmx-added.htmx-settling { opacity: 1; transition: opacity 150ms ease-out; }

/* ---------- tablet 768+ ---------- */
@media (min-width: 768px) {
  .conteudo { padding: var(--s6) var(--s6) var(--s8); }
  .nav-inferior, .so-mobile { display: none; }
  .so-desktop { display: block; }
  .toasts { bottom: var(--s6); left: auto; right: var(--s6); justify-items: end; }
  .kpis { grid-template-columns: repeat(4, 1fr); gap: var(--s4); }
  .grade--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rodape-fixo { bottom: 0; }
  .segmentado { width: auto; }
  .busca__campo { flex: 0 1 320px; }
  .barra-lote { left: auto; right: var(--s6); bottom: var(--s6); width: min(28rem, calc(100vw - var(--s12))); }
  .folha--edicao { inset: 0 0 0 auto; width: 28rem; max-height: none; height: 100dvh; border-radius: 0; border-width: 0 0 0 1px; }
  .folha--edicao:not(:popover-open) { transform: translateX(100%); }
}

/* ---------- desktop 1024+ ---------- */
@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: var(--lateral-w) minmax(0, 1fr); grid-template-rows: auto 1fr; align-items: start;
    /* a coluna da lateral é pintada aqui, não no nav: cobre a página toda, inclusive em captura full-page */
    background: linear-gradient(90deg, var(--surface-2) calc(var(--lateral-w) - 1px), var(--border) 0 var(--lateral-w), transparent 0); }
  .faixa-bloco { grid-column: 2; grid-row: 1; }
  .faixa__menu { display: none; }
  .nav-lateral { display: flex; flex-direction: column; grid-column: 1; grid-row: 1 / -1; position: sticky; top: 0;
    height: 100dvh; padding: var(--s4) var(--s3); overflow-y: auto; overscroll-behavior: contain; }
  .conteudo { grid-column: 2; grid-row: 2; width: 100%; padding: var(--s8); }
  .grade-ofertas { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .tempo__hora { top: var(--faixa-h); }
}
@media (max-width: 1023.98px) {
  .grade-ofertas { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
}
@media (max-width: 719.98px) {
  .grade-ofertas { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  .skeleton__bloco { animation: none; opacity: .8; }
  .ponto--ok { animation: none; }
  .toast, .toast--ok { animation: toast-fade-entra var(--dur-3) ease-out; }
  .toast--ok { animation: toast-fade-entra var(--dur-3) ease-out, toast-sai 150ms ease-in 4s forwards; }
  .folha { transition: opacity var(--dur-2) ease-out, overlay var(--dur-2) allow-discrete, display var(--dur-2) allow-discrete; }
  @starting-style { .folha:popover-open { transform: none; } }
  .folha--edicao:not(:popover-open) { transform: none; }
  .gaveta { transform: none; opacity: 0;
    transition: opacity 150ms ease-out, display 150ms allow-discrete, overlay 150ms allow-discrete; }
  .gaveta:popover-open { opacity: 1; transition: opacity 150ms ease-out, display 150ms allow-discrete, overlay 150ms allow-discrete; }
  @starting-style { .gaveta:popover-open { transform: none; opacity: 0; } }
  .htmx-swapping, .htmx-settling, .htmx-added, .oferta.htmx-swapping, .tempo__item.htmx-swapping,
  .cartao-canal.htmx-swapping { transition: none; }
  .htmx-request.botao::before, .htmx-request .botao[type="submit"]::before { animation: mostra-op 0s 150ms forwards; border-right-color: currentColor; }
  .delta { animation: none; }
}
@keyframes toast-fade-entra { from { opacity: 0; } to { opacity: 1; } }

/* ---------- larguras de barra: w-0 … w-100 de 5 em 5 ---------- */
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

/* ---------- telas (rewrite) ---------- */
.texto-leitura { max-width: 65ch; }
.quebra { overflow-wrap: anywhere; word-break: break-all; }
.acoes { display: flex; flex-wrap: wrap; gap: var(--s2); }
.filtros-form { display: grid; gap: var(--s3); }
.filtro-linha { display: grid; gap: var(--s2); }
.lista--numerada { list-style: none; padding: 0; margin: 0; }
.num-pos { color: var(--text-3); font-variant-numeric: tabular-nums; }
.campo--colagem { white-space: pre; overflow-x: auto; }
.cartao--qr { display: grid; place-items: center; }
.passos { margin: 0; padding-left: var(--s6); display: grid; gap: var(--s2); }
.app-login { min-height: 100dvh; display: grid; place-items: center; padding: var(--s4); }
.login { width: 100%; max-width: 25rem; display: grid; gap: var(--s6); padding: var(--s6);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio-lg); box-shadow: var(--sombra); }
.login h1 { margin: 0; font-size: var(--t-xl); }
@media (min-width: 768px) {
  .kpis--5 { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
  .filtros-form { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); align-items: end; }
  .grade--wa { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .grade--ml { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}

/* ---------- Temas (design.md B.7 nº 11 e D.7) ---------- */
.faixa-tema { display: grid; gap: var(--s3); padding: var(--s4); background: var(--info-bg);
  border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: var(--raio-lg); }
.faixa-tema__corpo { display: grid; gap: var(--s1); min-width: 0; }
.faixa-tema__estado { margin: 0; font-size: var(--t-md); font-weight: 600; overflow-wrap: anywhere; }
.grade-temas { display: grid; gap: var(--s6); grid-template-columns: minmax(0, 1fr); }
.tema { display: grid; gap: var(--s3); align-content: start; min-width: 0; padding: var(--s4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--raio-lg); box-shadow: var(--sombra);
  transition: border-color var(--dur-1) ease-out; }
.tema:hover, .tema:focus-within { border-color: var(--borda-controle); }
.tema > p { margin: 0; }
.tema__previa { position: relative; aspect-ratio: 1; width: 100%; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--raio-sm); overflow: hidden; }
.tema__espera { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: var(--t-sm); }
/* previews de tema e peças nunca recebem filtro, opacidade ou overlay (#PUBLI sempre visível) */
.tema__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; background: var(--surface-2); }
.tema:has(.seletor-fonte__r--shopee:checked) .tema__img--shopee,
.tema:has(.seletor-fonte__r--mercado_livre:checked) .tema__img--mercado_livre,
.tema:has(.seletor-fonte__r--shopee:checked) .tema__ampliada--shopee,
.tema:has(.seletor-fonte__r--mercado_livre:checked) .tema__ampliada--mercado_livre { display: block; }
.tema__ampliar { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; padding: 0; background: none; border: 0;
  cursor: zoom-in; }
.tema__falha { position: absolute; inset: 0; z-index: 2; display: grid; align-content: center; justify-items: center; gap: var(--s3);
  padding: var(--s4); background: var(--err-bg); text-align: center; font-size: var(--t-sm); }
.tema__falha[hidden] { display: none; }
.tema__falha p { margin: 0; }
.seletor-fonte { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--borda-controle);
  border-radius: var(--raio); overflow: hidden; background: var(--surface); }
.seletor-fonte__r { position: absolute; opacity: 0; pointer-events: none; }
.seletor-fonte label { display: flex; align-items: center; justify-content: center; min-height: var(--alvo);
  padding: var(--s2) var(--s3); color: var(--text-2); font-weight: 600; cursor: pointer; }
.seletor-fonte__r:checked + label { background: var(--accent); color: var(--accent-text); }
.seletor-fonte__r:focus-visible + label { outline: 2px solid var(--foco); outline-offset: -3px; }
.tema__cab { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.tema__titulo { min-width: 0; }
.tema__titulo h2 { margin: 0; font-size: var(--t-md); font-weight: 600; overflow-wrap: anywhere; }
.tema__titulo p { margin: 0; }
.tema__cab .selo { flex: none; }
.tema__fixado { display: flex; align-items: center; justify-content: center; min-height: var(--alvo); font-weight: 600; color: var(--info); }
@media (min-width: 768px) {
  .faixa-tema { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s6); }
  .faixa-tema .botao--bloco { width: auto; }
  .grade-temas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grade-temas { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 479.98px) { .faixa { padding-inline: var(--s2); gap: var(--s2); } .faixa__estado > .icone { display: none; } }
