/* ==========================================================================
   Componentes PDV — o padrão visual mais atual da suíte
   Fonte: caixaDaLoja/index.html ("PDV — acesso de loja"), telas do app Syncrohub.
   Usa só os tokens de styles.css (carregar styles.css ANTES deste arquivo).
   Prefixo ds- para não colidir com os componentes antigos de styles.css.
   ========================================================================== */

/* ---------- Página ---------- */
.ds-page { padding: 24px 20px; }
@media (min-width: 1024px) { .ds-page { padding: 28px 32px; } }
.ds-head { margin-bottom: 20px; }
.ds-head .kicker { margin-bottom: 6px; }
.tnum { font-variant-numeric: tabular-nums; }
.ds-secao { margin-top: 28px; }
.ds-secao__titulo { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 4px; }
.ds-secao__sub { font-size: 12.5px; color: var(--muted-foreground); margin-bottom: 12px; max-width: 760px; }

/* ---------- Ícone em ladrilho (30px, raio 9) e tons ---------- */
.ds-ico { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--brand-tint); color: var(--brand-deep); }
.ds-ico svg { width: 15px; height: 15px; }
.ds-tom--brand    { background: var(--brand-tint); color: var(--brand-deep); }
.ds-tom--warning  { background: var(--warning-bg); color: var(--warning); }
.ds-tom--critical { background: var(--critical-bg); color: var(--critical); }
.ds-tom--teal     { background: color-mix(in oklab, var(--teal) 16%, var(--card)); color: var(--teal-deep); }
.ds-tom--clay     { background: color-mix(in oklab, var(--clay) 16%, var(--card)); color: var(--clay-deep); }
.ds-tom--navy     { background: color-mix(in oklab, var(--navy) 14%, var(--card)); color: var(--navy); }
.ds-tom--muted    { background: var(--muted); color: var(--foreground); }
:root[data-theme="dark"] .ds-tom--navy { background: color-mix(in oklab, #8ea2d4 18%, var(--card)); color: #aebde3; }

/* ---------- KPI (ícone à esquerda, rótulo em caixa alta, valor 19px) ---------- */
.ds-kpis { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 10px; }
@media (min-width: 640px)  { .ds-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .ds-kpis { grid-template-columns: repeat(var(--ds-cols, 4), minmax(0, 1fr)); } }
.ds-kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; text-align: left; color: inherit; font: inherit; transition: border-color .14s; }
button.ds-kpi, a.ds-kpi { cursor: pointer; }
button.ds-kpi:hover, a.ds-kpi:hover, .ds-kpi[aria-pressed="true"] { border-color: var(--brand); }
.ds-kpi .ds-ico { grid-row: 1 / -1; }
.ds-kpi__label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-kpi__valor { font-family: var(--font-display); font-size: 19px; font-weight: 600; line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; color: var(--foreground); }
.ds-kpi__valor.is-critical { color: var(--critical); } .ds-kpi__valor.is-brand { color: var(--brand-deep); }

/* ---------- Cartão de resumo (título + linhas chave/valor) ---------- */
.ds-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--sh-card); }
.ds-card--pad { padding: 14px 16px; }
.ds-card__topo { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ds-card__titulo { font-size: 13px; font-weight: 700; color: var(--foreground); }
.ds-card__texto { font-size: 12px; color: var(--muted-foreground); line-height: 1.5; }
.ds-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; line-height: 1.4; padding: 2px 0; }
.ds-kv > span:first-child { color: var(--muted-foreground); } .ds-kv > span:last-child { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
a.ds-card, button.ds-card { display: block; text-align: left; color: inherit; font: inherit; cursor: pointer; transition: border-color .14s, transform .14s; }
a.ds-card:hover, button.ds-card:hover { border-color: var(--brand); transform: translateY(-1px); }

/* ---------- Chips de filtro ---------- */
.ds-barra { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.ds-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ds-chip { height: 32px; padding: 0 12px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--muted-foreground); cursor: pointer; transition: border-color .14s, background-color .14s, color .14s; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.ds-chip:hover { border-color: color-mix(in oklab, var(--brand) 50%, transparent); }
.ds-chip[aria-pressed="true"] { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-deep); }
.ds-chip__n { font-size: 10.5px; opacity: .75; font-variant-numeric: tabular-nums; }

/* ---------- Campos (busca, seletor, botão de período) ---------- */
.ds-campo { height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); font-size: 12.5px; color: var(--foreground); transition: border-color .14s; }
.ds-campo:hover, .ds-campo:focus-within { border-color: var(--brand); }
.ds-campo svg { width: 14px; height: 14px; color: var(--muted-foreground); flex-shrink: 0; }
.ds-campo input, .ds-campo select { border: 0; outline: 0; background: none; font: inherit; color: inherit; min-width: 0; flex: 1; height: 100%; }
/* 19/11/2026: no tema escuro a lista do select abria branca com texto claro (ilegível): o navegador passa a desenhar os controles no modo escuro */
:root[data-theme="dark"] { color-scheme: dark; }
.ds-campo select option, select option { background: var(--card); color: var(--foreground); }
.ds-campo--busca { flex: 1 1 260px; max-width: 420px; }
.ds-campo__rotulo { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-foreground); }
.ds-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted-foreground); cursor: pointer; }
.ds-check input { accent-color: var(--brand); }

/* ---------- Abas sublinhadas ---------- */
.ds-abas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; margin-bottom: 20px; }
.ds-aba { position: relative; padding: 10px 16px; font-size: 13px; font-weight: 600; white-space: nowrap; margin-bottom: -1px; color: var(--muted-foreground); transition: color .14s; cursor: pointer; background: none; border: 0; }
.ds-aba:hover { color: var(--foreground); }
.ds-aba[aria-current="page"], .ds-aba[aria-selected="true"] { color: var(--brand-deep); }
.ds-aba[aria-current="page"]::after, .ds-aba[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 999px; background: var(--brand); }
.ds-aba__n { font-weight: 500; color: var(--muted-foreground); }

/* ---------- Cartão de tabela + paginação ---------- */
.ds-tabela { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--sh-card); overflow: hidden; }
.ds-tabela__topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ds-tabela__titulo { font-family: var(--font-display); font-size: 12.5px; font-weight: 600; color: var(--foreground); display: flex; align-items: center; gap: 6px; }
.ds-tabela__corpo { overflow: auto; }
.ds-tabela table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12.5px; }
.ds-tabela thead th { position: sticky; top: 0; z-index: 1; background: var(--card); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); padding: 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.ds-tabela thead th[data-ordem] { cursor: pointer; } .ds-tabela thead th[data-ordem]:hover { color: var(--foreground); }
.ds-tabela tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ds-tabela tbody tr { height: 52px; }
.ds-tabela tbody tr:last-child td { border-bottom: 0; }
.ds-tabela tbody tr:hover { background: color-mix(in oklab, var(--muted) 40%, transparent); }
.ds-tabela tbody tr[data-id], .ds-tabela tbody tr.is-click { cursor: pointer; }
.ds-tabela .td-fraco { font-size: 12px; color: var(--muted-foreground); }
.ds-tabela .td-cod { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 12px; font-weight: 700; }
.ds-tabela .td-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ds-vazio { padding: 28px 16px; text-align: center; font-size: 12.5px; color: var(--muted-foreground); }
.ds-pag { display: flex; align-items: center; gap: 8px; }
.ds-pag__n { font-family: var(--font-display); font-size: 11.5px; color: var(--muted-foreground); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ds-pag__b { width: 26px; height: 26px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted-foreground); display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; padding: 0; transition: border-color .14s, color .14s, background-color .14s; }
.ds-pag__b svg { width: 14px; height: 14px; }
.ds-pag__b:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-tint); }
.ds-pag__b:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Pílula de situação (ponto de 5px) ---------- */
.ds-pilula { display: inline-flex; align-items: center; gap: 6px; width: fit-content; white-space: nowrap; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); }
.ds-pilula::before { content: ""; width: 5px; height: 5px; border-radius: 999px; background: currentColor; flex-shrink: 0; }
.ds-pilula.sem-ponto::before { display: none; }

/* ---------- Botões da topbar e do conteúdo ---------- */
.ds-btn { height: 32px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border-radius: var(--radius-md); font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--foreground); cursor: pointer; white-space: nowrap; text-decoration: none; transition: border-color .14s, background-color .14s, opacity .14s; }
.ds-btn:hover { border-color: var(--brand); }
.ds-btn svg { width: 15px; height: 15px; }
.ds-btn--prim { background: var(--brand); border-color: var(--brand); color: var(--brand-foreground); }
.ds-btn--prim:hover { opacity: .9; }
.ds-btn--icone { width: 32px; padding: 0; justify-content: center; }
.ds-btn--perigo { color: var(--critical); }

/* ---------- Casca: página estática com a sidebar e a topbar da suíte ---------- */
.ds-app { display: flex; height: 100dvh; overflow: hidden; background: var(--background); }
.ds-app__main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.ds-app__conteudo { flex: 1; overflow-y: auto; }
.sidebar__rodape { border-top: 1px solid var(--line); padding: 10px 12px; font-size: 11px; color: var(--muted-foreground); line-height: 1.45; }
.topbar__acoes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ds-menu-btn { display: none; }
@media (max-width: 900px) {
  .ds-app .sidebar { position: fixed; z-index: 70; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--sh-float); }
  .ds-app.menu-aberto .sidebar { transform: none; }
  .ds-menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; gap: 10px; }
}

/* ---------- Pop-up de conteúdo (componentes-pdv.js: links com data-popup) ---------- */
.ds-popup { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; background: color-mix(in oklab, var(--navy-dark) 55%, transparent); backdrop-filter: blur(3px); }
.ds-popup.is-open { display: flex; }
.ds-popup__janela { width: min(1280px, 100%); height: min(88vh, 100%); background: var(--card); border-radius: var(--radius-xl); box-shadow: var(--sh-float); display: flex; flex-direction: column; overflow: hidden; }
.ds-popup__topo { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.ds-popup__titulo { flex: 1; min-width: 0; }
.ds-popup__titulo b { display: block; font-family: var(--font-display); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-popup__titulo span { display: block; font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 10.5px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-popup iframe { flex: 1; width: 100%; border: 0; background: var(--background); }
@media (max-width: 640px) { .ds-popup { padding: 0; } .ds-popup__janela { height: 100%; border-radius: 0; } }

/* ---------- Documento gerado de .md (gerarDocsHtml.py) ---------- */
.ds-doc-app { min-height: 100dvh; background: var(--background); }
.ds-doc-topo { position: sticky; top: 0; z-index: 10; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 8px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.ds-doc-topo .sidebar__brand-mark { width: 30px; height: 30px; flex-shrink: 0; }
.ds-doc-topo__txt { flex: 1; min-width: 0; }
.ds-doc-topo__txt b { display: block; font-family: var(--font-display); font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-doc-topo__txt span { display: block; font-size: 11px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-doc-grade { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 32px; max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; }
@media (max-width: 1000px) { .ds-doc-grade { grid-template-columns: 1fr; } .ds-doc-indice { display: none; } }
.ds-doc-indice { position: sticky; top: 76px; align-self: start; max-height: calc(100dvh - 96px); overflow: auto; font-size: 12px; }
.ds-doc-indice p { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted-foreground); margin-bottom: 8px; }
.ds-doc-indice a { display: block; padding: 4px 10px; border-left: 2px solid var(--line); color: var(--muted-foreground); line-height: 1.4; }
.ds-doc-indice a:hover { color: var(--brand-deep); border-color: var(--brand); }
.ds-doc-indice a.n3 { padding-left: 20px; font-size: 11.5px; }
.ds-doc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--sh-card); padding: 28px 32px; font-size: 13.5px; line-height: 1.65; min-width: 0; }
@media (max-width: 640px) { .ds-doc { padding: 18px; } .ds-doc-grade { padding: 16px 12px 40px; } }
.ds-doc > *:first-child { margin-top: 0; }
.ds-doc h1 { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; margin: 0 0 14px; }
.ds-doc h2 { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 30px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); scroll-margin-top: 72px; }
.ds-doc h3 { font-size: 14px; font-weight: 700; margin: 22px 0 8px; scroll-margin-top: 72px; }
.ds-doc h4, .ds-doc h5 { font-size: 13px; font-weight: 700; margin: 18px 0 6px; }
.ds-doc p { margin: 0 0 12px; }
.ds-doc ul, .ds-doc ol { margin: 0 0 12px 22px; } .ds-doc ul { list-style: disc; } .ds-doc ol { list-style: decimal; } .ds-doc li { margin: 3px 0; }
.ds-doc li > ul, .ds-doc li > ol { margin-top: 3px; margin-bottom: 3px; }
.ds-doc a { color: var(--brand-deep); text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--brand) 40%, transparent); text-underline-offset: 3px; }
.ds-doc a:hover { text-decoration-color: var(--brand); }
.ds-doc strong { font-weight: 700; }
.ds-doc code { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 12px; background: var(--muted); border-radius: 5px; padding: 1px 5px; word-break: break-word; }
.ds-doc a code { color: inherit; }
.ds-doc td code { white-space: nowrap; word-break: normal; }
.ds-doc td:first-child { min-width: 140px; }
.ds-doc pre { background: var(--muted); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 14px; overflow: auto; margin: 0 0 14px; font-size: 12px; line-height: 1.55; }
.ds-doc pre code { background: none; padding: 0; font-size: inherit; word-break: normal; }
.ds-doc blockquote { margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--brand); background: var(--brand-tint); border-radius: 0 var(--radius-md) var(--radius-md) 0; color: var(--foreground); }
.ds-doc blockquote p:last-child { margin-bottom: 0; }
.ds-doc hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.ds-doc .ds-doc__tabela { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: auto; margin: 0 0 16px; }
.ds-doc table { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.5; }
.ds-doc thead th { text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); background: var(--card); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ds-doc tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ds-doc tbody tr:last-child td { border-bottom: 0; }
.ds-doc tbody tr:hover { background: color-mix(in oklab, var(--muted) 40%, transparent); }
.ds-doc__quebrado { color: var(--muted-foreground); text-decoration: line-through dotted; cursor: help; }
.ds-doc-rodape { margin-top: 18px; font-size: 11.5px; color: var(--muted-foreground); }
