/* Uma coluna estreita como tabela de preços impressa: o número firme à direita, sempre com a data e a praça (ADR-009). */
:root {
  --bg: #f1f4f3; --sup: #ffffff; --sup2: #f7f9f8; --tinta: #14242a; --suave: #586a70; --linha: #e0e6e5; --linha-forte: #c7d1d0;
  --acento: #1e5868; --acento-forte: #163f4b; --acento-fundo: #e3eef0;
  --subiu: #a3322a; --subiu-fundo: #f8e8e6; --desceu: #24609f; --desceu-fundo: #e5edf7;
  --mudou-fundo: #fbf0c4; --atraso: #8a5a00; --atraso-fundo: #fbf0d6;
  --sombra: 0 1px 2px rgba(20, 36, 42, .06), 0 2px 8px rgba(20, 36, 42, .05);
  --f-num: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-txt: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --raio: 14px; color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0e1719; --sup: #152125; --sup2: #1a282d; --tinta: #e3ecee; --suave: #94a7ad; --linha: #24353a; --linha-forte: #34494f;
  --acento: #7fc0cf; --acento-forte: #a9d8e3; --acento-fundo: #193139;
  --subiu: #f2928a; --subiu-fundo: #3a201d; --desceu: #8fb8ee; --desceu-fundo: #1a2a3e;
  --mudou-fundo: #3a3316; --atraso: #e8c27a; --atraso-fundo: #3a2f17; --sombra: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--tinta); font: 15px/1.45 var(--f-txt); -webkit-font-smoothing: antialiased;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
.pad { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
main, .topo > * { max-width: 640px; margin-left: auto; margin-right: auto; }
h1, h2, h3 { font-family: var(--f-num); font-weight: 700; margin: 0; line-height: 1.15; }
h1 { font-size: 22px; } h2 { font-size: 17px; }
.rotulo { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--suave); font-weight: 600; }
.msg { color: var(--suave); font-size: 14px; margin: 0; }
.num, .preco, .grande { font-family: var(--f-num); font-variant-numeric: tabular-nums lining-nums; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

/* Topo fixo: o contexto (praça, cliente, linha) vale para todas as telas */
.topo { position: sticky; top: 0; z-index: 5; background: var(--sup); border-bottom: 1px solid var(--linha);
  padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-bottom: 10px; display: grid; gap: 8px; }
.topo .linha1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.contexto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.contexto label { display: grid; gap: 2px; min-width: 0; }
.campo { width: 100%; border: 1px solid var(--linha-forte); background: var(--sup); border-radius: 10px; padding: 8px 8px; min-height: 40px; }
.selo { display: inline-flex; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--acento-fundo); color: var(--acento); white-space: nowrap; }
.selo.atraso { background: var(--atraso-fundo); color: var(--atraso); }

/* Barra de baixo: três contextos, um toque */
.abas-baixo { position: fixed; inset: auto 0 0 0; z-index: 6; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--sup); border-top: 1px solid var(--linha); padding-bottom: env(safe-area-inset-bottom, 0px); }
.abas-baixo a { text-align: center; padding: 14px 4px; font-weight: 700; color: var(--suave); text-decoration: none; }
.abas-baixo a[aria-current="page"] { color: var(--acento); box-shadow: inset 0 3px 0 var(--acento); }

/* Blocos */
.bloco { margin: 14px 0; display: grid; gap: 8px; }
.bloco > h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bloco > h2 small { font: 600 13px var(--f-txt); color: var(--suave); }
.cartao { background: var(--sup); border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; }
.resumo { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.sobe { color: var(--subiu); } .desce { color: var(--desceu); }
.vazio { text-align: center; color: var(--suave); padding: 24px 8px; }

/* Linha de produto */
.prod { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; width: 100%; text-align: left; border: 0;
  border-bottom: 1px solid var(--linha); background: none; padding: 12px 14px; cursor: pointer; color: inherit; }
.prod:last-child { border-bottom: 0; }
.prod .nome { font-weight: 600; overflow-wrap: anywhere; }
.prod .meta { font-size: 12.5px; color: var(--suave); grid-column: 1; }
.prod .valor { grid-row: 1 / span 2; grid-column: 2; text-align: right; display: grid; justify-items: end; gap: 2px; align-content: start; }
.prod .preco { font-weight: 700; font-size: 21px; line-height: 1.05; }
.prod.mudou .preco { background: var(--mudou-fundo); border-radius: 6px; padding: 0 5px; margin-right: -5px; }
.prod .sem { font-size: 13px; color: var(--suave); }
.var { font: 700 12.5px var(--f-num); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.var.sobe { background: var(--subiu-fundo); } .var.desce { background: var(--desceu-fundo); }
.antes { text-decoration: line-through; color: var(--suave); font-size: 12.5px; }
.spark { width: 64px; height: 18px; display: block; }
.spark polyline { fill: none; stroke: var(--acento); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
details.sessao > summary { list-style: none; cursor: pointer; padding: 13px 14px; display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
details.sessao > summary::-webkit-details-marker { display: none; }
details.sessao[open] > summary { border-bottom: 1px solid var(--linha); background: var(--sup2); }
details.sessao > summary small { font-weight: 600; color: var(--suave); }

/* Ferramentas */
.ferramentas { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 12px; }
.btn { border: 0; border-radius: 10px; padding: 10px 14px; background: var(--acento); color: var(--sup); font-weight: 700; cursor: pointer; min-height: 42px; }
.btn.sec { background: var(--acento-fundo); color: var(--acento); }

/* Comparar e detalhe */
.grade { width: 100%; border-collapse: collapse; font-size: 14px; }
.grade th, .grade td { padding: 8px 6px; border-bottom: 1px solid var(--linha); text-align: right; }
.grade th:first-child, .grade td:first-child { text-align: left; }
.grade td.escolhida { color: var(--acento); font-weight: 700; }
.grande { font-size: 40px; font-weight: 800; line-height: 1; }
.grafico { width: 100%; height: 70px; display: block; }
.grafico polyline { fill: none; stroke: var(--acento); stroke-width: 2; vector-effect: non-scaling-stroke; }
.fatos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; padding: 14px; margin: 0; }
.fatos dt { font-size: 11px; text-transform: uppercase; color: var(--suave); font-weight: 600; } .fatos dd { margin: 0; font-weight: 600; }
.voltar { border: 0; background: none; color: var(--acento); font-weight: 700; padding: 10px 0; cursor: pointer; }

/* ADR-012: nome real (portal) abaixo do apelido */
.prod .meta .real { display: block; font-size: 11.5px; color: var(--suave); text-transform: uppercase; letter-spacing: .02em; overflow-wrap: anywhere; }
.nome-real { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 13px; color: var(--suave); }
.btn.mini { min-height: 32px; padding: 4px 10px; font-size: 13px; }
