:root {
  --fundo: #f4f5f2; --cartao: #fff; --tinta: #1c2421; --mudo: #66706b; --linha: #e1e4df;
  --verde: #14532d; --verde-2: #1f7a45; --verde-claro: #e3f1e7;
  --vermelho: #b42318; --vermelho-claro: #fdecea; --amarelo: #8a5a00; --amarelo-claro: #fff4d6;
  --azul: #1d4ed8; --raio: 12px; --sombra: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--tinta); background: var(--fundo);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 16px; line-height: 1.4; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
.mudo { color: var(--mudo); }
.erro { color: var(--vermelho); min-height: 1.2em; margin: 8px 0 0; }
.tela-centro { min-height: 100vh; display: grid; place-items: center; align-content: center; padding: 20px; gap: 6px; text-align: center; }
.marca { font-size: 22px; letter-spacing: -.01em; color: var(--verde); }
.marca b { font-weight: 800; }
.marca.pequena { font-size: 17px; color: #fff; }
.cartao { background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); padding: 16px; }
.login-caixa { width: min(360px, 100%); text-align: left; display: grid; gap: 12px; }
.login-caixa .marca { text-align: center; font-size: 24px; }
label { display: grid; gap: 4px; font-size: 14px; color: var(--mudo); font-weight: 500; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #cfd4cd; border-radius: 9px; background: #fff; color: var(--tinta); font-size: 16px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--verde-2); outline-offset: 1px; }
textarea { min-height: 70px; resize: vertical; }
.btn { border: 1px solid #cfd4cd; background: #fff; border-radius: 9px; padding: 10px 14px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
.btn:hover { background: #f6f7f5; }
.btn.primario { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn.primario:hover { background: var(--verde-2); }
.btn.perigo { color: var(--vermelho); border-color: #f0c4bf; }
.btn.pequeno { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.btn.largo { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }

/* topo e menu */
.topo { background: var(--verde); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 5; }
.quem { font-size: 13px; opacity: .9; text-align: right; }
.menu { display: flex; background: #fff; border-top: 1px solid var(--linha); position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; padding-bottom: env(safe-area-inset-bottom); }
.menu button { flex: 1; border: 0; background: none; padding: 8px 2px 9px; font-size: 12px; color: var(--mudo); display: grid; justify-items: center; gap: 2px; cursor: pointer; min-height: 56px; }
.menu button .ic { font-size: 20px; line-height: 1; }
.menu button.ativo { color: var(--verde); font-weight: 700; }
main { padding: 14px 14px 90px; max-width: 1100px; margin: 0 auto; outline: none; }
@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: 210px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
  .topo { grid-column: 1 / -1; }
  .menu { position: sticky; top: 52px; flex-direction: column; border: 0; border-right: 1px solid var(--linha); height: calc(100vh - 52px); padding: 10px 8px; gap: 2px; }
  .menu button { flex: none; grid-auto-flow: column; justify-content: start; gap: 10px; font-size: 15px; padding: 10px 12px; border-radius: 9px; min-height: 0; }
  .menu button.ativo { background: var(--verde-claro); }
  main { padding: 20px 24px 40px; width: 100%; }
}

/* blocos */
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
.linha-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.linha-topo h1 { margin: 0; }
.grade { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.numero { padding: 14px; border-radius: var(--raio); background: #fff; box-shadow: var(--sombra); border: 0; text-align: left; cursor: pointer; display: grid; gap: 2px; }
.numero .rot { font-size: 13px; color: var(--mudo); font-weight: 600; }
.numero .val { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.numero .sub { font-size: 13px; color: var(--mudo); }
.numero.ruim { background: var(--vermelho-claro); } .numero.ruim .val { color: var(--vermelho); }
.numero.atencao { background: var(--amarelo-claro); } .numero.atencao .val { color: var(--amarelo); }
.numero.bom .val { color: var(--verde); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.chip { border: 1px solid #cfd4cd; background: #fff; border-radius: 99px; padding: 7px 13px; white-space: nowrap; cursor: pointer; font-size: 14px; font-weight: 600; min-height: 38px; }
.chip.ativo { background: var(--verde); color: #fff; border-color: var(--verde); }
.lista { display: grid; gap: 8px; }
.item { background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); padding: 12px 14px; display: grid; gap: 8px; }
.item .cab { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.item .tit { font-weight: 700; }
.item .det { font-size: 14px; color: var(--mudo); }
.item .valor { font-weight: 800; font-size: 18px; white-space: nowrap; }
.item .acoes { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.item .acoes:empty { display: none; }
.etq { display: inline-block; line-height: 1.5; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #eef0ec; color: var(--mudo); }
.etq.ruim { background: var(--vermelho-claro); color: var(--vermelho); }
.etq.atencao { background: var(--amarelo-claro); color: var(--amarelo); }
.etq.bom { background: var(--verde-claro); color: var(--verde); }
.bola { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.vazio { text-align: center; color: var(--mudo); padding: 30px 10px; }
.total-faixa { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--verde-claro); border-radius: 10px; font-weight: 700; margin-bottom: 10px; }
.barra { height: 8px; background: #eef0ec; border-radius: 99px; overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: 99px; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--raio); overflow: hidden; box-shadow: var(--sombra); font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--linha); }
th { font-size: 12px; color: var(--mudo); text-transform: uppercase; letter-spacing: .03em; background: #fafbf9; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rolar { overflow-x: auto; border-radius: var(--raio); }
.cel { cursor: pointer; }
.cel:hover { background: #f6f8f5; }

/* formulários */
.form { display: grid; gap: 12px; }
.duas { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; align-items: end; }
.tres { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); align-items: end; }
@media (max-width: 520px) { .tres { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 8px; color: var(--tinta); font-size: 15px; }
.check input { width: 20px; height: 20px; }
.codigo { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; background: #f4f5f2; padding: 8px 10px; border-radius: 8px; word-break: break-all; }
.opcoes-novo { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.opcoes-novo .btn { flex-direction: column; min-height: 88px; font-size: 14px; }
.opcoes-novo .btn .ic { font-size: 26px; }
.resumo-total { font-size: 15px; display: grid; gap: 4px; background: #f6f7f5; padding: 10px 12px; border-radius: 10px; }
.resumo-total div { display: flex; justify-content: space-between; }
.resumo-total .grande { font-size: 19px; font-weight: 800; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100% - 20px)); max-height: calc(100vh - 30px); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,30,25,.45); }
#janela-corpo { padding: 18px; overflow-y: auto; max-height: calc(100vh - 30px); }
#janela-corpo h2 { margin-top: 0; }
.janela-rodape { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
@media (max-width: 600px) {
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92vh; }
  #janela-corpo { max-height: 92vh; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .janela-rodape .btn { flex: 1; }
}
.aviso { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px); background: #1c2421; color: #fff; padding: 11px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100% - 30px); font-size: 15px; }
.aviso.mostrar { opacity: 1; transform: translateX(-50%); }
.aviso.ruim { background: var(--vermelho); }
.lendo { display: flex; gap: 10px; align-items: center; padding: 14px; background: #f6f7f5; border-radius: 10px; }
.giro { width: 20px; height: 20px; border: 3px solid #cfd4cd; border-top-color: var(--verde); border-radius: 50%; animation: giro .8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
.previa-img { max-width: 100%; max-height: 180px; border-radius: 8px; display: block; margin: 0 auto; }

/* calendário */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cab { text-align: center; font-size: 12px; color: var(--mudo); font-weight: 700; padding: 4px 0; }
.cal-dia { border: 1px solid var(--linha); border-radius: 8px; min-height: 58px; padding: 4px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; cursor: pointer; font: inherit; color: inherit; }
.cal-dia.hoje { outline: 2px solid var(--verde-2); }
.cal-n { font-size: 13px; font-weight: 700; }
.cal-v { font-size: 10px; font-weight: 700; color: var(--vermelho); line-height: 1.1; white-space: nowrap; letter-spacing: -.02em; }
@media (min-width: 700px) { .cal-dia { min-height: 74px; padding: 6px; } .cal-v { font-size: 12px; } }

dialog.confirma { width: min(440px, calc(100% - 30px)); margin: auto; border-radius: 16px; }
@media (max-width: 600px) { dialog.confirma { margin: auto; border-radius: 16px; width: calc(100% - 24px); } }

/* pagar várias */
.barra-sel { position: sticky; bottom: 66px; z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; background: #1c2421; color: #fff; padding: 10px 14px; border-radius: 12px; margin-top: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
@media (min-width: 900px) { .barra-sel { bottom: 12px; } }
.item .sel { font-size: 14px; color: var(--verde); font-weight: 600; }
/* cédulas */
.cedulas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cedulas input { padding: 8px; text-align: center; }
@media (max-width: 420px) { .cedulas { grid-template-columns: repeat(2, 1fr); } }
/* trava com PIN */
.trava { position: fixed; inset: 0; z-index: 100; background: var(--fundo); display: grid; place-items: center; padding: 20px; }
.trava-caixa { width: min(320px, 100%); display: grid; gap: 12px; text-align: center; }

/* ================= Painel para TV ================= */
main:has(> .tv) { max-width: none; }
.tv { --f: #0b100e; --card: #121916; --card2: #172019; --linha: #233029; --tinta: #eef2ef; --mudo: #93a198; --ouro: #e3b553;
  position: relative; overflow: hidden; color: var(--tinta); border-radius: 20px; padding: clamp(14px, 1.6vw, 28px); margin: -6px -6px 0;
  background: radial-gradient(900px 420px at 0% 0%, rgba(57,135,229,.16), transparent 60%), radial-gradient(800px 420px at 100% 0%, rgba(217,89,38,.12), transparent 60%), var(--f);
  font-variant-numeric: tabular-nums; }
.tv-carregando { padding: 90px; text-align: center; color: var(--mudo); display: grid; gap: 12px; justify-items: center; }
.tv-entra .tv-kpi, .tv-entra .tv-card { animation: tvSobe .6s cubic-bezier(.2,.7,.2,1) both; }
.tv-entra .tv-kpi:nth-child(2) { animation-delay: .06s } .tv-entra .tv-kpi:nth-child(3) { animation-delay: .12s } .tv-entra .tv-kpi:nth-child(4) { animation-delay: .18s }
.tv-entra .tv-meio .tv-card { animation-delay: .2s } .tv-entra .tv-baixo .tv-card { animation-delay: .28s }
.tv-entra .tv-linha { stroke-dasharray: 3000; animation: tvDesenha 1.6s ease-out both; }
@keyframes tvSobe { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes tvDesenha { from { stroke-dashoffset: 3000; } to { stroke-dashoffset: 0; } }
@keyframes tvPulso { 0% { box-shadow: 0 0 0 0 rgba(248,113,113,.7); } 70% { box-shadow: 0 0 0 9px rgba(248,113,113,0); } 100% { box-shadow: 0 0 0 0 rgba(248,113,113,0); } }
@keyframes tvRoda { from { width: 0 } to { width: 100% } }
@media (prefers-reduced-motion: reduce) { .tv * { animation: none !important; } }
.tv-rodando { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: rgba(255,255,255,.06); }
.tv-rodando i { display: block; height: 100%; background: var(--ouro); animation: tvRoda 30s linear both; }
.tv-topo { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.tv-marca { font-size: clamp(13px, .9vw, 16px); color: var(--tinta); font-weight: 600; letter-spacing: .02em; }
.tv-coroa { color: var(--ouro); }
.tv-per { font-size: clamp(24px, 2.4vw, 44px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-top: 2px; }
.tv-per-loja { font-size: .5em; font-weight: 600; color: var(--mudo); margin-left: 8px; letter-spacing: 0; }
.tv-hora { text-align: right; }
.tv-relogio { font-size: clamp(28px, 2.6vw, 50px); font-weight: 200; letter-spacing: .02em; line-height: 1; }
.tv-hora .tv-mudo { font-size: 12px; margin-top: 4px; }
.tv-frase { font-size: clamp(15px, 1.15vw, 22px); color: #c9d2cc; margin: 10px 0 14px; line-height: 1.45; }
.tv-frase b { font-weight: 800; }
.tv-alerta { display: inline-flex; align-items: center; gap: 8px; margin-left: 6px; padding: 2px 10px; border-radius: 99px; background: rgba(248,113,113,.14); color: #fca5a5; font-weight: 700; font-size: .85em; white-space: nowrap; }
.tv-pulso { width: 9px; height: 9px; border-radius: 50%; background: #f87171; display: inline-block; animation: tvPulso 1.8s infinite; flex: none; }
.tv-controles { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 16px; }
.tv-seg { display: flex; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--linha); border-radius: 12px; flex-wrap: wrap; }
.tv-dir { margin-left: auto; background: transparent; border-color: transparent; gap: 6px; }
.tv-chip { background: transparent; color: var(--mudo); border: 0; border-radius: 9px; padding: 7px 13px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; min-height: 36px; transition: background .15s, color .15s; }
.tv-chip:hover { color: var(--tinta); background: rgba(255,255,255,.05); }
.tv-chip.ativo { background: var(--tinta); color: #0b100e; }
.tv-dir .tv-chip { border: 1px solid var(--linha); background: var(--card); color: var(--tinta); }
.tv-dir .tv-chip.ativo { background: var(--ouro); color: #1b1405; border-color: var(--ouro); }
.tv-chip-forte { background: linear-gradient(180deg, #1f2a25, #18211d) !important; }
.tv-mudo { color: var(--mudo); }
.tv-bom { color: #4ade80; } .tv-ruim { color: #f87171; }
.tv-pill { display: inline-block; font-size: 13px; font-weight: 800; padding: 2px 8px; border-radius: 99px; }
.tv-pill.bom { background: rgba(74,222,128,.14); color: #4ade80; } .tv-pill.ruim { background: rgba(248,113,113,.14); color: #f87171; }
.tv-kpis { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.tv-kpi { position: relative; background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--linha); border-radius: 18px; padding: 16px 18px 14px; min-width: 0; overflow: hidden; display: flex; flex-direction: column; gap: 4px; }
.tv-kpi-vendas { background: linear-gradient(135deg, rgba(57,135,229,.22), rgba(57,135,229,.04) 60%), var(--card); border-color: rgba(57,135,229,.35); }
.tv-kpi.kpi-bom::after, .tv-kpi.kpi-ruim::after { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: #4ade80; }
.tv-kpi.kpi-ruim::after { background: #f87171; }
.tv-krot { font-size: 12px; color: var(--mudo); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; display: flex; align-items: center; gap: 7px; }
.tv-krot i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.tv-kval { font-size: clamp(26px, 2.5vw, 50px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; white-space: nowrap; }
.tv-kres { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tv-ksub { font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tv-spark { width: 100%; height: 40px; display: block; margin-top: auto; padding-top: 6px; }
.tv-meta { margin-top: auto; padding-top: 8px; font-size: 13px; color: #c9d2cc; }
.tv-meta-bar { height: 8px; background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden; margin-bottom: 5px; }
.tv-meta-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #3987e5, #7fb2f0); }
.tv-atraso { margin-top: auto; padding-top: 8px; font-size: 13px; font-weight: 700; color: #4ade80; display: flex; align-items: center; gap: 8px; }
.tv-atraso.tem { color: #fca5a5; }
.tv-card { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--linha); border-radius: 18px; padding: 16px 18px; min-width: 0; }
.tv-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tv-cab h3 { margin: 0; font-size: clamp(15px, 1vw, 19px); font-weight: 800; letter-spacing: -.01em; }
.tv-legenda { display: flex; gap: 14px; font-size: 13px; color: var(--mudo); }
.tv-legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tv-meio { display: grid; grid-template-columns: 2.2fr 1fr; gap: 14px; margin-bottom: 14px; }
.tv-svg { width: 100%; height: auto; display: block; overflow: visible; }
.tv-grade { stroke: var(--linha); stroke-width: 1; }
.tv-base { stroke: #3a4840; stroke-width: 1.5; }
.tv-eixo { fill: var(--mudo); font-size: 14px; }
.tv-eixo-dest { fill: var(--tinta); font-weight: 800; }
.tv-formas { display: grid; grid-template-columns: minmax(150px, 1fr) 1.1fr; gap: 14px; align-items: center; }
.tv-rosca { width: 100%; max-width: 230px; justify-self: center; }
.tv-rosca circle[data-tip] { transition: stroke-width .15s; cursor: default; }
.tv-rosca circle[data-tip]:hover { stroke-width: 32; }
.tv-rosca-rot { fill: var(--mudo); font-size: 13px; }
.tv-rosca-val { fill: var(--tinta); font-size: 19px; font-weight: 800; }
.tv-leg-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 14px; }
.tv-leg-lista li { display: grid; grid-template-columns: 12px 1fr auto; gap: 2px 9px; align-items: center; }
.tv-leg-lista i { width: 12px; height: 12px; border-radius: 4px; }
.tv-leg-lista b { font-size: 15px; }
.tv-leg-lista em { grid-column: 2 / 4; font-style: normal; color: var(--mudo); font-size: 12px; margin-top: -3px; }
.tv-baixo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.tv-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tv-rank li, .tv-veic { display: flex; gap: 10px; align-items: flex-start; }
.tv-pos { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: #1e2823; color: var(--mudo); }
.tv-pos.p1 { background: linear-gradient(135deg, #f3d27a, #c9962e); color: #2a1d04; }
.tv-pos.p2 { background: linear-gradient(135deg, #e3e8e5, #9aa59f); color: #1a201d; }
.tv-pos.p3 { background: linear-gradient(135deg, #e4a878, #a8683b); color: #2a1606; }
.tv-rank-corpo { flex: 1; min-width: 0; }
.tv-rank-lin { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 5px; }
.tv-rank-lin > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-rank-sub { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; margin-top: 4px; font-weight: 600; }
.tv-trilho { height: 9px; background: rgba(255,255,255,.06); border-radius: 99px; overflow: hidden; display: flex; gap: 2px; }
.tv-trilho i { display: block; height: 100%; border-radius: 99px; min-width: 3px; transition: width .8s cubic-bezier(.2,.7,.2,1); }
.tv-cats { display: grid; gap: 12px; }
.tv-mini-seg { display: flex; padding: 2px; border: 1px solid var(--linha); border-radius: 9px; background: rgba(255,255,255,.03); }
.tv-mini-seg button { background: transparent; border: 0; color: var(--mudo); font: inherit; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 7px; cursor: pointer; }
.tv-mini-seg button.ativo { background: var(--tinta); color: #0b100e; }
.campo-veic.pede select { border-color: #c98500; box-shadow: 0 0 0 3px rgba(201,133,0,.18); }
.tv-veics, .tv-cats, .tv-rank { grid-template-columns: minmax(0, 1fr); }
.tv-veics { display: grid; gap: 12px; }
.tv-veic, .tv-rank li { min-width: 0; }
.tv-veic-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(201,133,0,.16); font-size: 17px; }
.tv-placa { font-size: 11px; font-weight: 800; letter-spacing: .06em; border: 1px solid #3a4840; border-radius: 5px; padding: 0 5px; color: var(--mudo); margin-left: 4px; }
.tv-nota { font-size: 13px; color: var(--mudo); margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--linha); }
.tv-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tv-tile { background: rgba(255,255,255,.035); border: 1px solid var(--linha); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tv-tile b { font-size: clamp(18px, 1.35vw, 26px); letter-spacing: -.02em; white-space: nowrap; }
.tv-tile .tv-mudo { font-size: 12px; }
.tv-tile-rot { font-size: 12.5px; font-weight: 700; color: #c9d2cc; }
.tv-tile.ruim { border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.07); } .tv-tile.ruim b { color: #fca5a5; }
.tv-tile.bom { border-color: rgba(74,222,128,.35); background: rgba(74,222,128,.06); } .tv-tile.bom b { color: #86efac; }
.tv-forn-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 26px; }
.tv-vazio { color: var(--mudo); padding: 22px 0; text-align: center; }
.tv-rodape { text-align: center; font-size: 12px; color: #6f7d75; margin: 14px 0 2px; }
.tv-dica { position: absolute; z-index: 5; pointer-events: none; background: rgba(246,248,247,.97); color: #0b100e; border-radius: 10px; padding: 9px 12px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.45); max-width: 280px; line-height: 1.45; }
.tv-dica b { display: block; margin-bottom: 2px; }
.tv-dica i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
[data-tip] { cursor: default; }
/* Modo TV: some o menu e o painel ocupa a tela toda */
body.modo-tv { background: #0b100e; }
body.modo-tv .topo, body.modo-tv .menu, body.modo-tv #menu { display: none !important; }
body.modo-tv #app { display: block; padding: 0; }
body.modo-tv main { padding: 0 !important; margin: 0; max-width: none; }
body.modo-tv .tv { border-radius: 0; margin: 0; min-height: 100vh; }
body.modo-tv .tv { padding: 18px 26px; } body.modo-tv .tv-frase { margin: 6px 0 10px; } body.modo-tv .tv-controles { margin-bottom: 12px; } body.modo-tv .tv-kpis, body.modo-tv .tv-meio, body.modo-tv .tv-baixo { gap: 12px; margin-bottom: 12px; }
body.modo-tv .tv-controles { opacity: .35; transition: opacity .2s; }
body.modo-tv .tv-controles:hover { opacity: 1; }
@media (max-width: 1250px) { .tv-baixo { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1000px) { .tv-kpis { grid-template-columns: 1fr 1fr; } .tv-meio { grid-template-columns: 1fr; } .tv-dir { margin-left: 0; } }
@media (max-width: 620px) { .tv { padding: 14px; border-radius: 16px; } .tv-baixo { grid-template-columns: 1fr; } .tv-kpis { gap: 10px; } .tv-kpi { padding: 12px; } .tv-kpi-vendas { grid-column: 1 / -1; }
  .tv-anel { width: 44px; height: 44px; } .tv-eixo { font-size: 24px; } .tv-formas { grid-template-columns: 1fr 1fr; } .tv-topo { align-items: flex-start; } .tv-seg { flex-wrap: wrap; } }

/* ===== Usuário "Só visualização": vê tudo, mas os botões de lançar/mudar/apagar somem ===== */
body.so-ver :is(#conteudo, #janela) .btn:not(:is([data-fechar], [data-recarregar], [data-voltar], [data-voltar-rel], [data-a="copiar"], [data-a="pixf"], [data-a="abrir"],
  [data-b="cp"], [data-b="pix"], [data-b="arq"], [data-b="comp"], [data-b="pixf"], [data-b="fatura"], [data-detalhar], [data-fi-voltar], [id^="csv-"], [data-csv-caixas], #volta-vales, #ir-folha, #recibos, #ir-contas, #ver-foto, #bancos, #f-pin .btn, .chat .btn)) { display: none !important; }
body.so-ver #janela :is(input, select, textarea), body.so-ver #conteudo form:not(#f-pin) :is(input, select, textarea) { pointer-events: none; }
body.so-ver #janela .janela-rodape:has(> .btn[data-fechar]:only-of-type)::before { content: '👁 Só visualização'; color: var(--mudo, #667); font-size: 13px; margin-right: auto; align-self: center; }

/* ===== Assistente (IA) ===== */
.chat { display: flex; flex-direction: column; min-height: calc(100vh - 170px); max-width: 760px; }
.chat-lista { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; }
.chat-vazio { color: var(--mudo, #667); font-size: 15px; }
.chat-bolha { max-width: 86%; padding: 10px 13px; border-radius: 16px; font-size: 15px; line-height: 1.45; box-shadow: 0 1px 2px rgba(0,0,0,.06); word-wrap: break-word; }
.chat-bolha.eu { align-self: flex-end; background: #dcf3e3; border-bottom-right-radius: 4px; }
.chat-bolha.ia { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.chat-bolha.erro { background: #fff7ed; }
.chat-pend { margin-top: 8px; padding: 10px; border-radius: 12px; background: #f6f7f5; border: 1px solid #e2e6e1; font-size: 14px; }
.chat-pend.feito { background: #ecfdf3; border-color: #a7e3bd; } .chat-pend.cancelado { opacity: .6; } .chat-pend.erro { background: #fef2f2; border-color: #fecaca; }
.chat-pend-bts { display: flex; gap: 8px; margin-top: 8px; }
.chat-pend-st { margin-top: 6px; font-weight: 700; font-size: 13px; }
.chat-caixa { position: sticky; bottom: 0; display: flex; gap: 6px; align-items: flex-end; background: var(--fundo, #f3f4f2); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
.chat-caixa textarea { flex: 1; resize: none; min-height: 46px; max-height: 140px; border-radius: 22px; padding: 11px 15px; font: inherit; font-size: 16px; border: 1px solid #cfd4cd; }
.chat-ic { min-width: 46px; height: 46px; border-radius: 50%; padding: 0; display: grid; place-items: center; font-size: 19px; cursor: pointer; }
.chat-ic.gravando { background: #fee2e2; animation: tvPulso 1.4s infinite; }
.chat-anexos { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-anexos button { border: 0; background: none; cursor: pointer; }
.giro.pequeno { width: 14px; height: 14px; border-width: 2px; display: inline-block; vertical-align: -2px; }
.chat-resumo { white-space: normal; line-height: 1.5; }

/* painel enquadrado na TV: sem rolagem */
html.tv-enquadrada, html.tv-enquadrada body { overflow: hidden; }
html.tv-enquadrada main:has(> .tv) { padding-bottom: 0; }
html.tv-enquadrada .tv-kpis { grid-template-columns: 1.25fr 1fr 1fr 1fr; }
html.tv-enquadrada .tv-meio { grid-template-columns: 2.2fr 1fr; }
html.tv-enquadrada .tv-baixo { grid-template-columns: repeat(4, 1fr); }
html.tv-enquadrada .tv-dir { margin-left: auto; }

/* ---------------- modo escuro (Mais → Aparência) ---------------- */
html.escuro { color-scheme: dark;
  --fundo: #0f1713; --cartao: #18221d; --tinta: #e8eeea; --mudo: #9aa8a0; --linha: #2a3631;
  --verde: #1d6b3c; --verde-2: #2f8f57; --verde-claro: #173a26;
  --vermelho: #f87171; --vermelho-claro: #3a1a1a; --amarelo: #fbbf24; --amarelo-claro: #3a2e10; --azul: #7fb2f0;
  --sombra: 0 1px 2px rgba(0,0,0,.4); --amarelo-escuro: #fbbf24; }
html.escuro body { background: var(--fundo); color: var(--tinta); }
html.escuro .marca { color: #6fcf97; }
html.escuro .marca.pequena { color: #fff; }
html.escuro input, html.escuro select, html.escuro textarea { background: #111a15; border-color: #34423b; color: var(--tinta); }
html.escuro input::placeholder, html.escuro textarea::placeholder { color: #6f7d75; }
html.escuro .btn, html.escuro .chip { background: #1c2721; border-color: #34423b; color: var(--tinta); }
html.escuro .btn:hover, html.escuro .cel:hover { background: #22302a; }
html.escuro .btn.primario, html.escuro .chip.ativo { background: var(--verde); border-color: var(--verde); color: #fff; }
html.escuro .btn.primario:hover { background: var(--verde-2); }
html.escuro .btn.perigo { color: #fca5a5; border-color: #5b2a2a; }
html.escuro .topo { background: #123a24; }
html.escuro .menu { background: #131c17; border-color: var(--linha); }
html.escuro .menu button.ativo { color: #6fcf97; }
html.escuro .numero, html.escuro .item, html.escuro .cartao, html.escuro table, html.escuro dialog { background: var(--cartao); color: var(--tinta); }
html.escuro th { background: #1c2721; }
html.escuro td, html.escuro th { border-color: var(--linha); }
html.escuro .etq, html.escuro .barra { background: #26322c; }
html.escuro .codigo, html.escuro .resumo-total, html.escuro .lendo { background: #111a15; }
html.escuro .giro { border-color: #34423b; border-top-color: #6fcf97; }
html.escuro .aviso, html.escuro .barra-sel { background: #e8eeea; color: #0f1713; }
html.escuro dialog::backdrop { background: rgba(0,0,0,.6); }
html.escuro [style*="background:#f6f7f5"], html.escuro [style*="background:#eef1ee"] { background: #111a15 !important; }
html.escuro [style*="background:#fff"]:not(.btn) { background: var(--cartao) !important; }
html.escuro .chat-bolha.eu { background: #1d4a30; }
html.escuro .chat-bolha.ia { background: var(--cartao); }
html.escuro .chat-bolha.erro { background: #3a2a10; }
html.escuro .chat-pend { background: #111a15; border-color: #34423b; }
html.escuro .chat-pend.feito { background: #133022; border-color: #2f6b47; }
html.escuro .chat-pend.erro { background: #3a1a1a; border-color: #6b2a2a; }
html.escuro .chat-caixa textarea { border-color: #34423b; }
html.escuro .chat-ic.gravando { background: #5b2a2a; }
html.escuro a { color: #7fb2f0; }

/* "Referente a" e mais filtros */
.ref-campos { border: 1px solid var(--borda, #dfe5df); border-radius: 12px; padding: 8px 12px 12px; margin: 0; min-width: 0; }
.ref-campos legend { font-size: 13px; font-weight: 700; padding: 0 6px; }
.mais-filtros { border: 1px solid var(--borda, #dfe5df); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
.mais-filtros summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.mais-filtros[open] summary { margin-bottom: 8px; }
.grade-filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 10px; margin-bottom: 8px; }
.grade-filtros label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 600; min-width: 0; }
.grade-filtros select, .grade-filtros input { width: 100%; min-width: 0; }
html.escuro .ref-campos, html.escuro .mais-filtros { border-color: #33403a; }

/* 28/11: atalhos do Início, quadros em 3, dias na lista de contas, botão + */
.atalhos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.atalho { border: 0; background: #fff; box-shadow: var(--sombra); border-radius: var(--raio); padding: 10px 4px; font-size: 13px; font-weight: 600; display: grid; justify-items: center; gap: 4px; cursor: pointer; color: var(--tinta); line-height: 1.2; text-align: center; }
.atalho span { font-size: 22px; line-height: 1; }
.aviso-topo { background: var(--amarelo-claro); border: 0; text-align: left; margin-bottom: 10px; width: 100%; font-size: 15px; }
.grade3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grade3 .numero { padding: 10px; }
.grade3 .numero .val { font-size: 17px; }
.grade3 .numero .rot, .grade3 .numero .sub { font-size: 12px; }
.linha-total { width: 100%; border: 0; margin: 10px 0 8px; font-size: 15px; cursor: pointer; color: var(--tinta); }
.dia-cab { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 4px 2px; font-size: 14px; color: var(--mudo); }
.dia-cab b { color: var(--tinta); font-size: 15px; }
.dia-cab.hoje b { color: var(--amarelo); }
.dia-cab.passou b { color: var(--vermelho); }
.item .valor { font-size: 20px; }
.topo-acoes { display: flex; gap: 6px; align-items: center; }
.menu-pont { position: relative; }
.menu-pont summary { list-style: none; min-width: 44px; }
.menu-pont summary::-webkit-details-marker { display: none; }
.menu-pont .pop { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 8px; display: grid; gap: 6px; z-index: 20; min-width: 240px; }
.menu-pont .pop .btn { justify-content: flex-start; width: 100%; }
.grupo-mais { margin: 18px 2px 8px; font-size: 15px; color: var(--mudo); text-transform: uppercase; letter-spacing: .04em; }
.fab { position: fixed; right: 16px; bottom: calc(70px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--verde); color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 6; cursor: pointer; }
.fab[hidden], body.modo-tv .fab { display: none; }
body:has(.barra-sel) .fab { display: none; }
@media (min-width: 900px) { .fab { bottom: 24px; right: 24px; } }
html.escuro .atalho, html.escuro .menu-pont .pop { background: #18231d; color: inherit; }
.grade3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade3 .numero { min-width: 0; }
.grade3 .numero .val { font-size: clamp(14px, 4.3vw, 19px); overflow-wrap: anywhere; }
.grade3 .numero .val { font-size: clamp(13px, 3.7vw, 19px); white-space: nowrap; overflow-wrap: normal; letter-spacing: -.02em; }

/* ===== Detalhar a fatura do cartão ===== */
.fi-resumo { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; font-size: 15px; margin-bottom: 8px; }
.fi-resumo.bom { background: var(--verde-claro); color: var(--verde); }
.fi-resumo.atencao { background: var(--amarelo-claro); color: var(--amarelo); }
.fi-nota { font-size: 13px; color: var(--mudo); margin: 4px 0 8px; }
.fi-sugestao { display: grid; gap: 8px; padding: 10px 12px; border: 1px dashed #cfd4cd; border-radius: 10px; font-size: 14px; margin-bottom: 8px; }
.fi-lista { display: grid; gap: 6px; }
.fi-item { border: 1px solid var(--linha); border-radius: 10px; padding: 8px 10px; display: grid; gap: 4px; min-width: 0; }
.fi-item.sug { border-color: #f1d48a; background: #fffbef; }
.fi-l1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.fi-desc { font-weight: 700; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.fi-val { white-space: nowrap; font-size: 15px; }
.fi-val.neg { color: var(--verde-2); }
.fi-l2 { font-size: 13px; color: var(--mudo); }
.fi-l2:empty { display: none; }
.fi-l3 { display: flex; gap: 6px; align-items: center; }
.fi-l3 select { flex: 1; min-width: 0; padding: 7px 8px; font-size: 14px; }
.fi-acoes { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.fi-acoes .btn { flex: 1; }
.fi-mais { border: 1px solid var(--linha); border-radius: 10px; padding: 8px 10px; }
.fi-mais summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--mudo); }
.fi-mais[open] summary { margin-bottom: 8px; }
.fat-linha { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--linha); padding-top: 6px; }
.fat-ver { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: 8px; border: 0; background: none; padding: 4px 0; font-size: 14px; color: var(--mudo); text-align: left; cursor: pointer; }
.fat-ver b { color: var(--tinta); white-space: nowrap; }
.fat-linha .btn { flex: none; }
html.escuro .fi-resumo.bom { background: #133022; color: #6fcf97; }
html.escuro .fi-resumo.atencao { background: #3a2a10; color: var(--amarelo-escuro); }
html.escuro .fi-item.sug { background: #2a2310; border-color: #6b5420; }
html.escuro .fi-sugestao, html.escuro .fi-item, html.escuro .fi-mais { border-color: #34423b; }
.item > .fat-linha:first-child { border-top: 0; padding-top: 0; }

/* ===== Contrato: como foi pago ===== */
.cp-tit { font-size: 15px; margin: 14px 0 6px; }
.cp-lista { display: grid; gap: 6px; }
.cp-item { border: 1px solid var(--linha); border-radius: 10px; padding: 8px 10px; display: grid; gap: 3px; min-width: 0; }
.cp-l1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.cp-nome { font-weight: 700; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.cp-l1 b { white-space: nowrap; }
.cp-l2 { font-size: 13px; color: var(--mudo); }
.cp-l3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--amarelo); }
.cp-l3 .cp-ok { color: var(--verde); }
.aviso-amarelo { background: var(--amarelo-claro); color: var(--amarelo); padding: 8px 10px; border-radius: 10px; }
.fi-parcela { margin-bottom: 8px; border-style: dashed; }
html.escuro .cp-item { border-color: #34423b; }
html.escuro .cp-l3 .cp-ok { color: #6fcf97; }

/* ===== Busca nas listas de cadastros ===== */
.busca-lista { margin-bottom: 10px; display: grid; gap: 6px; }
.busca-campo { width: 100%; }
.busca-lista .chips { margin-bottom: 0; }
.busca-vazio { margin: 4px 0 0; font-size: 14px; }

/* ===== Busca em tudo, fornecedor e baixa pelo comprovante ===== */
.busca-geral { background: none; border: 0; color: #fff; font-size: 20px; padding: 6px 10px; margin-left: auto; margin-right: 6px; cursor: pointer; min-height: 40px; }
.bg-res { margin-top: 10px; display: grid; gap: 12px; }
.bg-grupo { display: grid; gap: 4px; }
.bg-cab { display: flex; align-items: center; gap: 8px; }
.bg-cab .btn { margin-left: auto; }
.bg-item { display: flex; justify-content: space-between; gap: 8px; text-align: left; border: 1px solid var(--linha); border-radius: 10px; background: none; padding: 8px 10px; cursor: pointer; min-width: 0; }
.bg-tit { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.bg-det { font-size: 13px; color: var(--mudo); text-align: right; flex: none; max-width: 50%; }
.link-forn { background: none; border: 0; padding: 0; font: inherit; font-weight: inherit; color: inherit; text-align: left; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.forn-grade { grid-template-columns: 1fr 1fr; }
.forn-grade .val { font-size: 18px; }
.bx-item { border: 1px solid var(--linha); border-radius: 10px; padding: 10px; margin-bottom: 8px; display: grid; gap: 4px; }
.bx-item.sem { border-color: #f1d48a; background: var(--amarelo-claro); }
.bx-l1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.bx-l1 span { min-width: 0; overflow-wrap: anywhere; }
.bx-l2, .bx-dif { font-size: 13px; color: var(--mudo); }
.bx-dif { color: var(--amarelo); font-weight: 600; margin: 0; }
.bx-perg { margin: 4px 0 0; font-weight: 600; font-size: 14px; }
.bx-cand { font-size: 14px; align-items: flex-start; }
.bx-outra summary { cursor: pointer; font-size: 14px; color: var(--mudo); }
.bx-achadas { display: grid; gap: 4px; margin-top: 6px; }
.bx-pega { justify-content: flex-start; text-align: left; }
html.escuro .busca-geral { color: #fff; }
html.escuro .bg-item, html.escuro .bx-item { border-color: #34423b; }
html.escuro .bx-item.sem { background: #3a2a10; border-color: #6b5420; }
.bx-item.feito { border-color: var(--verde-2); }
