/* Tela do armazem (/tv). UM LAYOUT SO: o tamanho das letras cresce com a largura da tela (TV grande = letras grandes),
   o mouse sempre aparece e clicar abre o detalhe. Abaixo de 1000 px (celular/tablet) as colunas se empilham e a pagina rola.
   Usa os tokens do main.css (tema claro/escuro). */
.tv-body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); overflow-x: hidden;
  font-size: clamp(14px, 1.1vw, 34px); }
#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- topo, avisos, resumo ---------- */
.tv-topo { display: flex; align-items: center; justify-content: space-between; gap: 1em; padding: .7em 1.2em; border-bottom: 1px solid var(--border); background: var(--bg-elev); flex-wrap: wrap; }
.tv-marca { font-weight: 700; font-size: 1.35em; letter-spacing: -0.01em; }
.tv-marca small { font-weight: 500; color: var(--text-dim); font-size: .6em; margin-left: .5em; }
.tv-acoes { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; }
.tv-abas { display: flex; gap: .5em; }
.tv-abas button, .tv-revezar { font: inherit; font-weight: 650; background: transparent; color: var(--text-dim); border: 1px solid var(--border); border-radius: 999px; padding: .35em 1em; cursor: pointer; display: inline-flex; align-items: center; gap: .5em; }
.tv-abas button.ativa { background: var(--accent); border-color: var(--accent); color: var(--accent-fg, #fff); }
.tv-abas .badge-atraso { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 .55em; font-size: .8em; font-family: var(--font-mono); }
.tv-direita { display: flex; align-items: center; gap: 1em; flex-wrap: wrap; justify-content: flex-end; }
.tv-ferramentas { display: flex; gap: .5em; flex-wrap: wrap; }
.tv-relogio { text-align: right; line-height: 1.15; }
.tv-relogio .hora { font-family: var(--font-mono); font-weight: 600; font-size: 1.7em; letter-spacing: -0.02em; }
.tv-conexao { display: block; font-size: .72em; color: var(--text-dim); }
.tv-conexao.ruim { color: var(--bad); font-weight: 700; }
.tv-aviso { margin: .6em 1.2em 0; padding: .6em 1em; border-radius: 10px; border: 1px solid var(--bad); color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); font-weight: 650; }

/* topo: KPIs a esquerda | medidor do faturamento no meio | bloco do mes a direita */
.tv-resumo { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1em; padding: .8em 1.2em .2em; align-items: stretch; }
.tv-kpis { display: flex; gap: .6em; align-items: stretch; }
.tv-kpis .tv-kpi { min-width: 5.2em; padding: .45em .75em; text-align: center; display: flex; flex-direction: column; justify-content: center; } /* (11/11) numero e texto centralizados no bloco */
.tv-kpis .tv-kpi .n { font-size: 1.7em; } /* (11/11) mesmo tamanho dos numeros do bloco do mes (.tv-mes-nums b / .tv-mes-pct .n) */
.tv-meio { display: flex; justify-content: center; align-items: center; min-width: 0; }
.tv-resumo .tv-mes { margin-left: 0; }

/* medidor "de gasolina" do % da meta de faturamento (tv-medidor.js) */
.tv-medidor { --md-cor: var(--good); display: flex; align-items: center; gap: .9em; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: .3em 1.1em .3em .7em; min-width: 0; }
.tv-medidor.neutro { --md-cor: var(--accent-text, #a78bfa); }
.tv-medidor.medio { --md-cor: #f59e0b; } .tv-medidor.ruim { --md-cor: var(--bad); } .tv-medidor.batida { --md-cor: var(--good); }
/* o desenho encolhe junto com o espaco (nunca sai do bloco); o texto tem prioridade */
.md-svg { width: 8.7em; height: auto; flex: 0 1 8.7em; min-width: 3.5em; aspect-ratio: 200 / 112; overflow: visible; }
.tv-medidor { overflow: hidden; }
/* telas estreitas (1000-1279 px): KPIs e medidor um pouco menores para tudo caber */
@media (min-width: 1000px) and (max-width: 1279px), (min-width: 640px) and (max-width: 1279px) and (orientation: landscape) {
  .tv-resumo { gap: .6em; }
  .tv-kpis { gap: .4em; }
  .tv-kpis .tv-kpi { min-width: 0; padding: .4em .55em; }
  .tv-kpis .tv-kpi .n { font-size: 1.7em; }
  .tv-medidor { font-size: .9em; gap: .6em; padding: .3em .8em .3em .5em; }
  /* o bloco do mes desce para a linha de baixo, ocupando a largura toda */
  .tv-resumo { grid-template-columns: auto minmax(0, 1fr); }
  .tv-resumo .tv-mes { grid-column: 1 / -1; justify-content: center; }
}
.md-trilho { fill: none; stroke: color-mix(in srgb, var(--text) 12%, transparent); stroke-width: 16; stroke-linecap: round; }
.md-cheio { fill: none; stroke: var(--md-cor); stroke-width: 16; stroke-linecap: round; }
.md-tick { stroke: var(--text-dim); stroke-width: 2.5; stroke-linecap: round; }
.md-rot { fill: var(--text-dim); font: 800 15px var(--font-sans, system-ui), sans-serif; }
.md-ritmo { stroke: var(--text); stroke-width: 3.5; stroke-linecap: round; }
/* setinha: cor pela faixa do % (corDaSeta em tv-medidor.js); dourado/verde iguais aos do placar do grupo, por tema */
/* laranja AVERMELHADO (11/11): o #f59e0b se confundia com o dourado */
.tv-medidor { --md-seta: var(--bad); --md-ouro: #e3b85a; --md-verde: #4ade80; --md-laranja: #f97316; }
:root[data-theme="light"] .tv-medidor { --md-ouro: #9a6b12; --md-verde: #15803d; --md-laranja: #ea580c; }
.tv-medidor.seta-laranja { --md-seta: var(--md-laranja); }
.tv-medidor.seta-dourada { --md-seta: var(--md-ouro); }
.tv-medidor.seta-verde { --md-seta: var(--md-verde); }
.md-agulha { stroke: var(--md-seta); stroke-width: 5; stroke-linecap: round; }
.md-eixo { fill: var(--text); stroke: var(--bg-elev); stroke-width: 3; }
.md-txt { display: flex; flex-direction: column; line-height: 1.1; flex: 0 0 auto; }
.md-pct { font-family: var(--font-mono); font-weight: 800; font-size: 2.3em; letter-spacing: -0.03em; color: var(--md-cor); white-space: nowrap; }
.md-r { font-size: .8em; color: var(--text); font-weight: 700; white-space: nowrap; }
.md-sub { font-size: .72em; color: var(--text-dim); margin-top: .15em; white-space: nowrap; }
.tv-medidor.batida .md-sub { color: var(--good); font-weight: 700; }
.tv-kpi { flex: 0 0 auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: .5em 1.1em; min-width: 8em; }
.tv-kpi .n { font-family: var(--font-mono); font-weight: 700; font-size: 2.4em; line-height: 1.05; letter-spacing: -0.03em; }
.tv-kpi .r { font-size: .8em; color: var(--text-dim); font-weight: 600; }
/* caixa de faturamento (topo, a direita dos KPIs) */
.tv-fat { margin-left: auto; flex: 0 1 26em; min-width: 0; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: .4em .9em; display: flex; align-items: center; gap: .9em; flex-wrap: wrap; }
.tv-fat.atrasado { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--bg-elev)); }
.tv-fat-topo { display: flex; align-items: center; gap: .5em; cursor: pointer; }
.tv-fat-n { font-family: var(--font-mono); font-weight: 800; font-size: 2.4em; line-height: 1.05; letter-spacing: -0.03em; }
.tv-fat-r { font-size: .8em; color: var(--text-dim); font-weight: 600; line-height: 1.15; }
.tv-fat-r small { display: block; color: var(--bad); font-weight: 700; }
.tv-fat-lista { list-style: none; margin: 0; padding: 0; display: flex; gap: .5em; flex-wrap: wrap; min-width: 0; }
.tv-fat-item, .tv-fat-mais { display: flex; flex-direction: column; border: 1px solid var(--border); border-left: .3em solid var(--good); border-radius: 8px; padding: .1em .55em; background: var(--bg); cursor: pointer; line-height: 1.1; }
.tv-fat-item.atrasado { border-left-color: var(--bad); }
.tv-fat-item.atencao { border-left-color: #f59e0b; }
.tv-fat-item b { font-family: var(--font-mono); font-weight: 800; font-size: 1.25em; }
.tv-fat-item span { font-size: .72em; color: var(--text-dim); font-weight: 600; }
.tv-fat-mais { justify-content: center; font-weight: 800; color: var(--text-dim); border-left-width: 1px; }
.tv-fat-zero { color: var(--text-dim); font-weight: 600; }
.tv-mes { margin-left: auto; flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: .4em .9em; display: flex; align-items: center; gap: 1.2em; }
.tv-mes-pct { display: flex; align-items: center; gap: .5em; }
.tv-mes-pct .n { font-family: var(--font-mono); font-weight: 800; font-size: 1.7em; /* era 2.4em; a pedido da usuaria (11/11) = mesmo tamanho dos numeros ao lado (.tv-mes-nums b) */ line-height: 1.05; letter-spacing: -0.03em; }
.tv-mes-pct .r { font-size: .8em; color: var(--text-dim); font-weight: 600; line-height: 1.15; }
.tv-mes-pct .r small { display: block; font-weight: 500; }
.tv-mes.bom .n { color: var(--good); } .tv-mes.medio .n { color: #f59e0b; } .tv-mes.ruim .n { color: var(--bad); }
.tv-mes-nums { display: flex; gap: .9em; padding-left: 1.1em; border-left: 1px solid var(--border); }
.tv-mes-nums div { display: flex; flex-direction: column; line-height: 1.1; }
.tv-mes-nums b { font-family: var(--font-mono); font-weight: 800; font-size: 1.7em; }
.tv-mes-nums span { font-size: .72em; color: var(--text-dim); font-weight: 600; }
.tv-mes-nota { flex-basis: 100%; font-size: .7em; color: var(--text-dim); }
.tv-kpi.atrasado .n { color: var(--bad); }
.tv-kpi.atencao .n { color: #f59e0b; }
.tv-kpi.ok .n { color: var(--good); }
.tv-kpi.sac .n { color: #38bdf8; }
.tv-kpi.atrasado:not(.zero) { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--bg-elev)); }

/* ---------- colunas (5: atrasados + 4 etapas) ---------- */
.tv-colunas { flex: 1 1 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1em; padding: .8em 1.2em 1em; width: 100%; box-sizing: border-box; align-items: stretch; min-height: 0; }
.tv-colunas > .tv-col { min-width: 0; box-sizing: border-box; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.tv-col { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; padding: .7em .8em; position: relative; }
.tv-col.tem-mais { padding-bottom: 1.6em; }
.tv-col h2 { margin: 0 0 .55em; font-size: 1.05em; display: flex; justify-content: space-between; align-items: baseline; gap: .5em; font-weight: 700; min-width: 0; cursor: pointer; }
.tv-col h2 span { min-width: 0; overflow-wrap: anywhere; }
.tv-col h2:hover span { text-decoration: underline; }
.tv-col h2 b { font-family: var(--font-mono); font-size: 1.9em; line-height: 1; letter-spacing: -0.03em; }
.tv-col ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .4em; width: 100%; flex: 1 1 0; min-height: 0; overflow: hidden; align-content: start; }
.tv-col.atrasados { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, var(--bg-elev)); }
.tv-col.atrasados h2 span, .tv-col.atrasados h2 b { color: var(--bad); }
.tv-nota-atraso { margin: -.35em 0 .5em; font-size: .78em; font-weight: 700; color: var(--bad); overflow-wrap: anywhere; }

/* ---------- cartoes ---------- */
.tv-card, .tv-grupo, .tv-mais, .tv-sep { min-width: 0; max-width: 100%; box-sizing: border-box; }
.tv-card { border: 1px solid var(--border); border-left: .38em solid var(--good); border-radius: 10px; padding: .2em .6em; background: var(--bg); cursor: pointer; }
.tv-card:hover, .tv-grupo:hover { filter: brightness(1.12); }
.tv-card.atencao { border-left-color: #f59e0b; background: color-mix(in srgb, #f59e0b 9%, var(--bg)); }
.tv-card.atrasado { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, var(--bg)); }
.tv-card.sac { border-left-color: #38bdf8; background: color-mix(in srgb, #38bdf8 8%, var(--bg)); }
.tv-card.sem, .tv-card.semdata { border-left-color: var(--text-faint); }
.tv-card.semdata .c-prazo { color: var(--text-dim); }
.tv-card .c-topo { display: flex; justify-content: space-between; align-items: center; gap: .4em; flex-wrap: nowrap; min-width: 0; }
.tv-card .c-ped { font-family: var(--font-mono); font-weight: 800; font-size: 2.5em; line-height: 1.05; letter-spacing: -0.02em; min-width: 0; flex: 0 1 auto; }
.tv-card .c-lado { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; min-width: 0; flex: 1 1 auto; line-height: 1.2; }
.tv-card .c-tempo { font-size: .72em; font-weight: 600; color: var(--text-dim); white-space: nowrap; }
.tv-card .c-etapa, .tv-grupo .c-etapa { font-size: .72em; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.tv-card .c-cli { font-weight: 600; font-size: .92em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.tv-card .c-prazo { font-size: .88em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.tv-card .c-prazo .c-sub { font-weight: 500; color: var(--text-dim); }
.tv-card.atrasado .c-prazo { color: var(--bad); }
.tv-card.atencao .c-prazo { color: #f59e0b; }
.tv-card.ok .c-prazo { color: var(--good); }
.tv-card.sac .c-prazo { color: #38bdf8; }
.tv-tag { display: inline-block; font-size: .42em; font-weight: 800; padding: .15em .6em; border-radius: 999px; background: #d97706; color: #fff; margin-left: .5em; vertical-align: middle; white-space: nowrap; letter-spacing: .02em; }
.tv-tag.sac { background: #0284c7; } .tv-tag.redesp { background: #0f766e; }
/* (11/11) numero + etiquetas sempre numa linha so (a etiqueta REDESP. quebrava a linha e o cartao ficava mais alto) */
.tv-card .c-ped { white-space: nowrap; flex: 0 0 auto; }
.tv-card .tv-tag { margin: 0 .35em 0 0; padding: .12em .55em; font-size: 1.55em; line-height: 1.1; vertical-align: middle; letter-spacing: .04em; }   /* (11/11) GRANDE de proposito: a usuaria quer chamativo (pode tampar o "ha X") */   /* (11/11) etiquetas na linha do "ha X", antes do texto: numero e prazo ficam livres */   /* etiquetas mais justas no cartao: o prazo nao pode ser cortado */
/* no CARTAO e na lista a etiqueta de redespacho e "RED" (com o texto inteiro o prazo era cortado; escolha da usuaria 11/11); o detalhe diz REDESPACHO */
 .tv-tag.cfop { background: #6d28d9; } .tv-tag.leroy { background: #0e7a3d; } .tv-tag.parado { background: #7c2d12; }
.tv-mais { position: absolute; left: .8em; right: .8em; bottom: .3em; text-align: center; color: var(--text-dim); font-weight: 700; font-size: .85em; line-height: 1.1; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-mais:hover { text-decoration: underline; }
.tv-sep { list-style: none; margin: .35em 0 .1em; padding: .25em .2em 0; border-top: 1px dashed var(--bad); font-size: .72em; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--bad); opacity: .85; }
.tv-vazio { margin: auto; text-align: center; color: var(--text-dim); padding: 3em 1em; font-size: 1.2em; }
.tv-col .tv-vazio { padding: 1.5em .5em; font-size: .95em; }

.tv-grupo { border: 1px solid var(--border); border-left: .38em solid var(--good); border-radius: 10px; padding: .55em .7em; background: var(--bg); cursor: pointer; }
.tv-grupo.atencao { border-left-color: #f59e0b; }
.tv-grupo.atrasado { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, var(--bg)); }
.tv-grupo .g-data { font-weight: 800; font-size: 1.15em; }
.tv-grupo .g-qtd { font-family: var(--font-mono); font-size: 1.6em; font-weight: 700; line-height: 1.1; }
.tv-grupo .g-sub { font-size: .82em; color: var(--text-dim); }

.tv-card:focus-visible, .tv-grupo:focus-visible, .tv-mais:focus-visible, .tv-col h2:focus-visible { outline: 2px solid var(--accent-text, #a78bfa); outline-offset: 2px; }
.tv-rodape { padding: .5em 1.2em .9em; color: var(--text-dim); font-size: .85em; }
.tv-rodape b { color: var(--bad); }
.tv-link { color: var(--bad); font-weight: 700; text-decoration: underline; cursor: pointer; }
.tv-dica { margin-left: .8em; color: var(--text-faint); }

/* ---------- senha ---------- */
.tv-login { max-width: 380px; margin: 12vh auto; display: grid; gap: 12px; padding: 0 16px; }
.tv-login input { background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 11px 12px; font: inherit; }
.tv-login .erro { color: var(--bad); min-height: 18px; margin: 0; font-size: .9em; }

/* ---------- tela fixa (sem rolagem) em telas de 1000 px ou mais: as colunas ocupam a altura que sobra ---------- */
/* (11/11/2026) tela DEITADA >= 640 px tambem e TV: TV de 32" espelhada/Fire TV reporta ~960x540 (mesma regra do placar do grupo) */
@media (min-width: 1000px), (min-width: 640px) and (orientation: landscape) {
  #app { height: 100vh; overflow: hidden; }
}
/* TV que reporta tela pequena (640-999 px deitada, ex.: 32" com 960x540): letras um pouco menores para caber 4 colunas */
@media (min-width: 640px) and (max-width: 999px) and (orientation: landscape) {
  .tv-body { font-size: 12px; }
  .tv-card .c-ped { font-size: 2em; }
  .tv-card .c-prazo { font-size: .8em; }   /* (11/11) "vence em 23 h 59 min" cabe inteiro na TV de 32" */
  .tv-card .c-tempo { font-size: .68em; }
  .tv-col h2 { font-size: 1em; }
  .tv-col h2 b { font-size: 1.7em; }
  .tv-mes { padding: .25em .9em; }
  .tv-mes-pct .n { font-size: 1.45em; }
  .tv-kpis .tv-kpi .n { font-size: 1.45em; }
  .tv-mes-nums b { font-size: 1.45em; }
}
/* o lado direito do cartao nunca passa por cima do numero: corta com "…" */
.tv-card .c-lado { overflow: hidden; }
.tv-card .c-tempo { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- celular / tablet EM PE (ou < 640 px): colunas empilhadas, a pagina rola ---------- */
@media (max-width: 999px) and (orientation: portrait), (max-width: 639px) {
  .tv-body { font-size: 15px; }
  .tv-topo { padding: .6em .9em; }
  .tv-colunas { grid-template-columns: 1fr; padding: .6em .8em; }
  .tv-colunas > .tv-col { overflow: visible; }
  .tv-col ul { overflow: visible; flex: 0 0 auto; }
  .tv-resumo { padding: .6em .8em 0; grid-template-columns: minmax(0, 1fr); }
  .tv-kpis { overflow-x: auto; }
  .tv-meio { justify-content: stretch; } .tv-medidor { width: 100%; box-sizing: border-box; }
  .tv-relogio .hora { font-size: 1.3em; }
}

/* ---------- painel de detalhes (abre ao clicar) ---------- */
#tv-modal[hidden] { display: none; }
.tv-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 50; display: flex; justify-content: flex-end; }
.tv-painel { position: relative; width: min(600px, 100vw); height: 100%; overflow-y: auto; background: var(--bg-elev); border-left: 1px solid var(--border); padding: 1.2em 1.4em 2em; box-shadow: -8px 0 32px rgba(0,0,0,.4); font-size: clamp(15px, 1vw, 26px); }
.tv-painel h2 { margin: .2em 2em .1em 0; font-size: 1.35em; line-height: 1.25; }
.tv-painel h3 { margin: 1.3em 0 .4em; font-size: .85em; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.tv-painel .tv-tag { font-size: .55em; }
.tv-x { position: absolute; top: .5em; right: .7em; border: 0; background: transparent; color: var(--text-dim); font-size: 2em; line-height: 1; cursor: pointer; padding: .1em .3em; }
.tv-x:hover { color: var(--text); }
.tv-voltar { border: 0; background: transparent; color: var(--accent-text, #a78bfa); cursor: pointer; font: inherit; font-weight: 600; padding: 0 0 .6em; }
.d-cli { font-weight: 700; font-size: 1.1em; margin: .3em 0 0; }
.d-sub { color: var(--text-dim); margin: .15em 0 .8em; }
.d-prazo { border: 1px solid var(--border); border-left: .4em solid var(--good); border-radius: 10px; padding: .6em .8em; background: var(--bg); }
.d-prazo.atencao { border-left-color: #f59e0b; } .d-prazo.sac { border-left-color: #38bdf8; }
.d-prazo.atrasado { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--bg)); }
.d-prazo .d-prazo-txt { font-weight: 800; font-size: 1.15em; }
.d-prazo.atrasado .d-prazo-txt { color: var(--bad); } .d-prazo.atencao .d-prazo-txt { color: #f59e0b; } .d-prazo.ok .d-prazo-txt { color: var(--good); } .d-prazo.sac .d-prazo-txt { color: #38bdf8; }
.d-prazo small { display: block; margin-top: .4em; color: var(--text-dim); line-height: 1.4; }
.d-tempo { list-style: none; margin: 0 0 0 .4em; padding: 0; border-left: 2px solid var(--border); }
.d-tempo li { position: relative; padding: .3em 0 .3em 1em; display: flex; justify-content: space-between; gap: 1em; }
.d-tempo li::before { content: ''; position: absolute; left: -.42em; top: .75em; width: .7em; height: .7em; border-radius: 50%; background: var(--border); }
.d-tempo li.feito::before { background: var(--good); }
.d-tempo li.pendente { color: var(--text-faint); }
.d-tempo .t-quando { text-align: right; } .d-tempo i { color: var(--text-dim); font-style: normal; font-size: .9em; }
.d-dados { display: grid; grid-template-columns: max-content 1fr; gap: .3em 1em; margin: 0; }
.d-dados dt { color: var(--text-dim); } .d-dados dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.d-alerta { white-space: pre-line; }
.d-vazio { color: var(--text-dim); text-align: center; padding: 1.5em 0; }
#lista-busca { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: .55em .7em; font: inherit; margin-bottom: .6em; box-sizing: border-box; }
.d-tabela table { width: 100%; border-collapse: collapse; font-size: .92em; }
.d-tabela th { text-align: left; color: var(--text-dim); font-size: .78em; padding: .4em; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-elev); }
.d-tabela td { padding: .45em .4em; border-bottom: 1px solid var(--border); vertical-align: top; }
.d-tabela tr[data-pedido] { cursor: pointer; } .d-tabela tr[data-pedido]:hover { background: var(--bg); }
.d-tabela td .sub { display: block; color: var(--text-dim); font-size: .85em; }
.d-tabela tr.atrasado .prazo { color: var(--bad); font-weight: 700; } .d-tabela tr.atencao .prazo { color: #f59e0b; font-weight: 700; } .d-tabela tr.ok .prazo { color: var(--good); } .d-tabela tr.sac .prazo { color: #38bdf8; }
@media (max-width: 700px) { .tv-painel { width: 100vw; border-left: 0; } }

.tv-revezar { font-size: .8em; font-weight: 600; padding: .3em .8em; }
.tv-revezar.ligado { color: var(--good); border-color: color-mix(in srgb, var(--good) 50%, var(--border)); }

/* troca de tema instantanea (sem animacao do main.css: mais leve em TV e nao deixa a pagina meio escura/meio clara) */
.tv-body, .tv-body * { transition: none !important; }

/* linha "N atrasados" do bloco do mes (clicavel) e itens fora do indicador na linha do tempo */
.tv-mes-atr { display: block; margin-top: .15em; font-weight: 600; color: var(--bad); }
.tv-mes-atr span { font-weight: 500; color: var(--text-dim); font-size: .85em; }
.tv-mes-atr.zero { color: var(--good); }
.tv-mes-n { font: inherit; font-family: var(--font-mono); font-weight: 800; font-size: 1.15em; color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); border: 1px solid var(--bad); border-radius: 6px; padding: 0 .45em; cursor: pointer; }
.tv-mes-n:hover { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.d-tempo li.nao-conta { opacity: .6; }

/* resumo dos passos do atraso (detalhe de pedido fora do prazo) */
.d-resumo { list-style: none; margin: .5em 0; padding: 0; display: grid; gap: .25em; }
.d-resumo li { display: grid; grid-template-columns: 8.5em 1fr auto; gap: .6em; align-items: baseline; }
.d-resumo .rr { color: var(--text-dim); font-weight: 600; }
.d-resumo .rq { font-family: var(--font-mono); font-weight: 600; }
.d-resumo .rs { font-size: .85em; font-weight: 700; }
.d-resumo .rs.ok { color: var(--good); }
.d-resumo .rs.atraso { color: var(--bad); }
.d-resumo li.destaque { border-top: 1px solid var(--border); padding-top: .25em; margin-top: .15em; }
.d-resumo li.destaque .rr { color: var(--text); }
