body.tv-mode{margin:0;background:#e8edf3}
.tv-mode #app{width:100%;height:100dvh;background:#e8edf3}
.tv-shell{--tv-font:clamp(10px,min(1.05vw,1.8dvh),32px);font-size:var(--tv-font);height:100%;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:.7em;padding:.8em;color:#203149}
.tv-shell *{min-width:0;box-sizing:border-box}
.tv-header{display:flex;align-items:center;gap:1.3em;padding:.7em 1em;border-radius:.7em;background:linear-gradient(118deg,#13223b,#24456f);color:white}
.tv-brand{display:flex;align-items:center;gap:1em;flex-shrink:0}
.tv-brand img{width:6em;height:auto}.tv-brand b{display:block;font-size:1.15em}.tv-brand span{display:block;margin-top:.25em;font-size:.75em;color:#c5d6eb}
.tv-filters{display:flex;gap:.8em;flex-shrink:0}.tv-filters label{display:flex;flex-direction:column;gap:.35em;font-size:.8em}.tv-filters label>span{font-family:'IBM Plex Mono',monospace;font-size:.7em;letter-spacing:.12em;color:#748194}
.tv-filters select{font-size:1.05em;font-weight:500;padding:0 1.4em 0 0;height:1.8em;background:transparent;border:0;max-width:13em;color:#192231;cursor:pointer}.tv-filters select:focus-visible{outline:3px solid rgba(37,99,235,.22);outline-offset:2px;border-radius:.3em}
.tv-actions{display:flex;gap:.5em;margin-left:auto}.tv-actions button{font-size:.75em;border:1px solid #ffffff40;border-radius:.4em;background:#ffffff15;padding:.7em;color:#fff;white-space:nowrap}.tv-actions button[aria-pressed=true]{background:#2563eb}
.tv-tabs{display:grid;grid-template-columns:repeat(var(--tv-tabs,10),minmax(0,1fr));gap:.5em}.tv-tabs button{font-size:.95em;font-weight:500;padding:.65em .4em;border:1px solid #d9e2ed;border-radius:.5em;background:#fff;color:#52657d}.tv-tabs button.active{background:#2563eb;border-color:#2563eb;color:white}
.tv-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.7em}.tv-kpi{background:#fff;border:1px solid #dce4ed;border-radius:.6em;padding:.8em 1em}.tv-kpi>span{font-size:.8em;color:#5a6b81}.tv-kpi strong{display:block;font-size:2.2em;line-height:1.15;margin:.2em 0;font-weight:600;font-variant-numeric:tabular-nums}.tv-kpi strong small{font-size:.42em;font-weight:400;color:#75859a}.tv-kpi p{font-size:.72em;color:#738299;line-height:1.3}
.tv-content{width:100%;max-width:none;padding:0;margin:0;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,24%);gap:.7em}
.tv-map,.tv-summary{background:#fff;border:1px solid #dce4ed;border-radius:.6em;min-height:0}
.tv-map{display:flex;flex-direction:column;padding:.9em 1em;gap:.7em}.tv-map-heading{flex-shrink:0;display:flex;align-items:flex-start;justify-content:space-between;gap:1em}.tv-map-heading h1{font-size:1.2em;font-weight:600;letter-spacing:0}.tv-map-heading p{font-size:.75em;margin-top:.3em;color:#738299}
.tv-map-canvas{flex:1;min-height:0;position:relative;background:#f5f7fa;border-radius:.3em}.tv-map-canvas svg{position:absolute;width:100%;height:100%;inset:0}.tv-cell-code{font:14px 'IBM Plex Mono',monospace;fill:#fff;text-anchor:middle;dominant-baseline:middle;paint-order:stroke;stroke:#243d4c;stroke-width:2px}
.tv-legend{display:flex;gap:.8em;flex-wrap:wrap;align-items:center;font-size:.75em;color:#53657a}.tv-legend span{display:flex;align-items:center;gap:.4em}.tv-legend i{width:.7em;height:.7em;border-radius:2px}
.tv-summary{padding:1em;display:flex;flex-direction:column;justify-content:space-between;gap:.8em}.tv-summary h2{font-size:1.05em}.tv-breakdown>div:first-child{display:flex;gap:.5em;justify-content:space-between;font-size:.95em}.tv-breakdown p{font-size:.75em;color:#6d7e92;margin-top:.5em}.tv-progress{height:.4em;background:#e9eef5;border-radius:1em;margin-top:.6em;overflow:hidden}.tv-progress i{height:100%;display:block;border-radius:1em}.tv-area-note{font-size:.7em;line-height:1.4;color:#7f8a99}
.tv-footer{display:flex;justify-content:space-between;gap:1em;color:#66788f;font-size:.67em;line-height:1.3}
@media(max-width:1000px){.tv-header{flex-wrap:wrap;gap:.6em}.tv-brand{margin-right:auto}.tv-actions{margin-left:auto}.tv-content{grid-template-columns:minmax(0,1fr) minmax(0,28%)}}
@media(max-width:600px){.tv-shell{--tv-font:clamp(10px,2.6vw,14px);padding:.6em;gap:.5em}.tv-header{gap:.5em}.tv-actions{width:100%;justify-content:flex-end}.tv-filters{gap:.4em}.tv-tabs{grid-template-columns:repeat(3,minmax(0,1fr))}.tv-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:.5em}.tv-kpi{padding:.6em}.tv-kpi strong{font-size:1.8em}.tv-content{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto}.tv-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));padding:.6em;gap:.5em}.tv-summary h2,.tv-area-note{grid-column:1/-1}.tv-summary h2{font-size:.85em}.tv-breakdown>div:first-child{font-size:.8em;flex-wrap:wrap}.tv-breakdown p{font-size:.65em}.tv-footer{font-size:.6em}.tv-footer>span:last-child{max-width:30%}}

/* Toque: arrastar com um dedo, pinça com dois; botões de zoom discretos */
body.tv-mode{touch-action:manipulation}
.tv-map-canvas svg{touch-action:none}
.tv-zoom{position:absolute;right:.6em;bottom:.6em;display:flex;flex-direction:column;gap:.35em}
.tv-zoom button{width:2.4em;height:2.4em;border:1px solid #c6d2e0;border-radius:.45em;background:#fffffff2;color:#18314e;font-size:1.1em;font-weight:600;box-shadow:0 1px 5px #1a2c4433}
.tv-zoom button:active{background:#dbe7f6}

.tv-map-canvas svg{cursor:grab}.tv-map-canvas svg.middle-panning,.tv-map-canvas svg.middle-panning *{cursor:grabbing}

/* Sem cabeçalho: botões (alternar, tela cheia, voltar) ao lado do seletor de área */
.tv-map-tools{display:flex;align-items:flex-start;gap:1.2em}.tv-map-tools .tv-actions{margin-left:0;flex-wrap:wrap;justify-content:flex-end}.tv-map-tools .tv-actions button{font-size:.8em;font-weight:500;border:1px solid #d9e2ed;background:#fff;color:#52657d;padding:.55em .9em;border-radius:.5em}.tv-map-tools .tv-actions button[aria-pressed=true]{background:#2563eb;border-color:#2563eb;color:#fff}
@media(max-width:600px){.tv-map-heading{flex-wrap:wrap}.tv-map-tools{width:100%;justify-content:space-between}}
/* Botão de malha: esconde linhas e códigos; as cores de avanço continuam */
.tv-map-canvas.sem-malha polygon[stroke-dasharray]{display:none}.tv-map-canvas.sem-malha polygon[stroke="#fff"]{display:none}.tv-map-canvas.sem-malha .tv-cell-code{display:none}

.tv-map-canvas polygon[stroke="#fff"]{fill-opacity:var(--tv-paint,.65)}.tv-opacity{margin-left:auto;display:flex;align-items:center;gap:.6em}.tv-opacity input{width:12em;accent-color:#2f6fd0}.tv-opacity input:disabled{opacity:.4}.tv-opacity output{min-width:3em;font-variant-numeric:tabular-nums}
