:root {
  /* Padrão visual Renovar LIVE: fundo verde-escuro, cartões em degradê, destaque verde-limão */
  color-scheme: dark;
  --fundo: #06130d;
  --superficie: #0b2117;
  --superficie-2: #0e2a1d;
  --linha: #214330;
  --grade: #173524;
  --texto: #f3fbf5;
  --texto-2: #b9cebf;
  --texto-3: #91aa99;
  --acento: #34d66f;
  --acento-claro: #1f6b3d;
  --lima: #a8fb58;
  --azul: #6fc7ff;
  --muted: #3d5a48;
  --bom: #a8fb58;
  --atencao: #ffc94f;
  --critico: #ff625e;
  --lateral: #041009;
  --lateral-texto: #d6e8db;
  --sombra: 0 10px 24px rgba(0,0,0,.18);
  --raio: 13px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 Inter, "Segoe UI", Arial, sans-serif; color: var(--texto);
  background: radial-gradient(circle at 20% -20%, #17472e 0, transparent 36%), linear-gradient(180deg, #071a11, #06130d 55%, #05110c) fixed; }
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 9px; padding: 9px 16px; background: linear-gradient(180deg, #3fe47a, #25b95a); color: #04140b; font-weight: 800; }
button:hover { filter: brightness(1.07); }
button.secundario { background: transparent; color: var(--texto); border: 1px solid var(--linha); font-weight: 600; }
button.link { background: none; color: inherit; padding: 4px 0; font-weight: 400; text-decoration: underline; opacity: .85; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid var(--linha); border-radius: 9px; background: #071a11; color: var(--texto); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(168,251,88,.45); outline-offset: 1px; }
label { display: grid; gap: 4px; font-size: 11px; color: var(--texto-3); text-transform: uppercase; letter-spacing: .6px; font-weight: 800; }
label input, label select { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 14px; }
.erro { color: var(--critico); min-height: 1.2em; margin: 0; }
.dica { font-size: 12px; color: var(--texto-3); margin: 0; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-caixa { width: min(400px, 100%); background: linear-gradient(180deg, rgba(14,42,29,.96), rgba(8,28,19,.98)); border: 1px solid var(--linha); border-radius: 16px; padding: 28px; display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.login-caixa .marca { color: var(--texto); }
.sub { margin: -8px 0 4px; color: var(--texto-3); font-size: 13px; }
.marca { display: grid; gap: 4px; }
.marca img { width: 100%; max-width: 200px; height: auto; display: block; }
.marca span { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 1.6px; color: var(--lima); }
.login-caixa .marca img { max-width: 240px; margin: 0 auto; }
.login-caixa .marca span { text-align: center; }

/* Estrutura */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .22s ease; }
.lateral { background: linear-gradient(180deg, #051a10, #031009); border-right: 1px solid var(--grade); color: var(--lateral-texto); padding: 20px 16px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.selo { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; padding: 4px 10px; border-radius: 999px; background: #0b2a1c; border: 1px solid var(--linha); color: var(--atencao); }
.selo::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--atencao); box-shadow: 0 0 10px var(--atencao); }
nav { display: grid; gap: 2px; margin-top: 6px; }
nav a { color: var(--lateral-texto); text-decoration: none; padding: 9px 12px; border-radius: 9px; opacity: .85; font-weight: 600; border: 1px solid transparent; }
nav a:hover { background: rgba(52,214,111,.08); opacity: 1; }
nav a.ativo { background: linear-gradient(90deg, rgba(52,214,111,.22), rgba(52,214,111,.06)); border-color: rgba(52,214,111,.45); color: var(--lima); opacity: 1; font-weight: 800; }
.rodape-lateral { margin-top: auto; display: grid; gap: 4px; font-size: 13px; justify-items: start; }
main { padding: 24px 28px 48px; min-width: 0; }
.topo { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.topo h1 { margin: 0; font-size: 26px; font-weight: 950; letter-spacing: -.6px; }
.atualizado { color: var(--texto-3); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border: 1px solid var(--linha); border-radius: 999px; background: #0b2a1c; }
.atualizado:not(:empty)::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lima); box-shadow: 0 0 10px var(--lima); }

/* Blocos */
.grade-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: linear-gradient(180deg, rgba(14,42,29,.96), rgba(8,28,19,.98)); border: 1px solid var(--linha); border-radius: var(--raio); padding: 12px 14px; position: relative; overflow: hidden; box-shadow: var(--sombra); }
.kpi::after { content: ""; position: absolute; width: 70px; height: 70px; border-radius: 50%; right: -28px; top: -30px; background: rgba(168,251,88,.06); }
.kpi .rotulo { font-size: 10px; color: var(--texto-3); text-transform: uppercase; letter-spacing: .8px; font-weight: 900; line-height: 1.3; position: relative; z-index: 1; }
/* o número nunca é cortado: o script reduz a fonte até caber (ajustarValores) */
.kpi .valor { font-size: clamp(20px, 1.9vw, 28px); font-weight: 950; line-height: 1.1; margin-top: 7px; padding-bottom: 1px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; letter-spacing: -.3px; }
.kpi .det { font-size: 11px; color: var(--texto-2); margin-top: 6px; }
.kpi.destaque { border-color: rgba(52,214,111,.5); }
.kpi.destaque .valor { font-size: clamp(22px, 2.2vw, 32px); color: var(--lima); }
.kpi.atencao { border-color: rgba(255,201,79,.45); } .kpi.atencao .valor { color: var(--atencao); }
.kpi.info { border-color: rgba(111,199,255,.4); } .kpi.info .valor { color: var(--azul); }
.delta-pos { color: var(--bom); } .delta-neg { color: var(--critico); }
.cartao { background: linear-gradient(180deg, rgba(14,42,29,.96), rgba(8,28,19,.98)); border: 1px solid var(--linha); border-radius: var(--raio); padding: 14px 16px; margin-bottom: 16px; min-width: 0; box-shadow: var(--sombra); }
.cartao h2 { font-size: 12.5px; margin: 0 0 8px; font-weight: 950; text-transform: uppercase; letter-spacing: .4px; }
.cartao .nota { font-size: 12px; color: var(--texto-3); margin: 0 0 12px; }
.duas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.alertas { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.alertas li { padding: 10px 12px; border-radius: 9px; border: 1px solid rgba(255,255,255,.07); border-left: 3px solid var(--texto-3); background: #0a2419; }
.alertas li.atencao { border-color: var(--atencao); } .alertas li.positivo { border-color: var(--bom); } .alertas li.info { border-color: var(--acento); }
.aviso { padding: 12px 14px; border-radius: 9px; background: #2b2412; border: 1px solid rgba(255,201,79,.32); color: #ffe3a3; margin-bottom: 16px; }

/* Tabelas */
.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 900; color: var(--texto-3); border-bottom: 1px solid var(--linha); padding: 7px 8px; white-space: nowrap; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; }
td { border-bottom: 1px solid var(--grade); padding: 7px 8px; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.barra { position: relative; height: 6px; border-radius: 3px; background: var(--grade); min-width: 60px; }
.barra > span { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: linear-gradient(90deg, var(--acento), var(--lima)); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tag.ativo { background: rgba(168,251,88,.12); color: var(--bom); }
.tag.em_risco { background: rgba(255,201,79,.14); color: var(--atencao); }
.tag.inativo { background: rgba(255,98,94,.14); color: var(--critico); }

/* Gráficos */
.grafico svg { width: 100%; height: auto; display: block; }
.grafico text { fill: var(--texto-2); font-size: 11px; }
.grafico .valor-rotulo { fill: var(--texto); font-weight: 600; }
.legenda { display: flex; gap: 16px; font-size: 12px; color: var(--texto-2); margin: 0 0 8px; flex-wrap: wrap; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Filtros */
.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.atalhos { display: flex; gap: 6px; flex-wrap: wrap; }
.atalhos button { background: #0b2a1c; color: var(--texto); border: 1px solid var(--linha); padding: 7px 12px; font-weight: 700; }
.atalhos button.ativo { border-color: rgba(168,251,88,.6); color: var(--lima); background: rgba(52,214,111,.12); }
.atalhos button:disabled { opacity: .35; cursor: not-allowed; filter: none; }
.trimestres { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.trimestres button { min-width: 64px; }

/* Agente */
.chat { display: grid; gap: 12px; }
.msg { padding: 12px 14px; border-radius: 10px; max-width: 860px; white-space: pre-wrap; }
.msg.eu { background: rgba(52,214,111,.12); border: 1px solid rgba(52,214,111,.3); justify-self: end; }
.msg.ia { background: var(--superficie); border: 1px solid var(--linha); }
.chat form { display: flex; gap: 8px; }
.chat textarea { flex: 1; font: inherit; padding: 10px; border-radius: 8px; border: 1px solid var(--linha); background: var(--superficie); color: var(--texto); min-height: 64px; }

dialog { border: 1px solid var(--linha); border-radius: 12px; background: var(--superficie); color: var(--texto); width: min(420px, 92vw); }
dialog form { display: grid; gap: 12px; }
dialog h2 { margin: 0; font-size: 17px; }
.acoes { display: flex; justify-content: flex-end; gap: 8px; }
.carregando { color: var(--texto-3); padding: 24px 0; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; }
  .duas { grid-template-columns: 1fr; }
  main { padding: 16px; }
}

/* Botão como link e formulários do admin */
a.botao { display: inline-block; background: var(--acento); color: #04140b; text-decoration: none; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.linha-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
textarea.area { width: 100%; font: inherit; padding: 10px; border: 1px solid var(--linha); border-radius: 8px; background: var(--superficie); color: var(--texto); margin-bottom: 8px; }
.acoes { align-items: center; }

/* Mapa do Paraná */
main.largo { padding-right: 16px; }
.mapa-grade { display: grid; grid-template-columns: 250px minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.mapa-grade > * { min-width: 0; }
.mapa-grade .cartao { margin-bottom: 0; }
.mapa-filtros { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; position: sticky; top: 12px; }
.mapa-filtros > * { min-width: 0; }
.mapa-filtros select, .mapa-filtros input:not([type=checkbox]) { width: 100%; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.mapa-filtros h2 { margin-bottom: 0; }
.lista-cart { display: grid; gap: 4px; }
.lista-cart .cart { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 6px; align-items: center; font-size: 13px; color: var(--texto); }
.lista-cart .cart span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-cart i, i.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lista-cart small { color: var(--texto-3); font-variant-numeric: tabular-nums; }
.acoes-f { display: flex; gap: 6px; flex-wrap: wrap; }
.acoes-f button { padding: 6px 10px; }
.mapa-barra { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
label.check { display: flex; flex-direction: row; gap: 6px; align-items: center; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }

/* Área do mapa: proporção do Paraná, fundo = oceano */
.mapa-wrap { position: relative; border: 1px solid var(--linha); border-radius: 8px; overflow: hidden; background: #c9dff0; width: 100%; max-height: 78vh; aspect-ratio: 16 / 10; }
/* Tela cheia do mapa: barra de modos e opções em cima, mapa ocupa o resto, painel completo da cidade */
.mapa-tela:fullscreen { background: radial-gradient(circle at 20% -20%, #17472e 0, transparent 36%), var(--fundo); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.mapa-tela:fullscreen .mapa-barra { margin: 0; }
.mapa-tela:fullscreen .mapa-wrap { flex: 1; min-height: 0; max-height: none; aspect-ratio: auto; }
.mapa-tela:fullscreen .mapa-cidade { width: min(480px, 40%); }
.mapa-cidade .cid-full .cid-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mapa-cidade .cid-full .cid-lista, .mapa-cidade .cid-full .cid-prod { grid-template-columns: minmax(0, 1fr); }
.mapa-cidade .cid-full .cid-cab { position: sticky; top: -14px; background: var(--superficie); z-index: 2; }
.mapa-cidade .cid-full .cid-abas { position: sticky; top: 50px; background: var(--superficie); z-index: 1; }
#mapa-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; font-family: Arial, "Helvetica Neue", sans-serif; }
#mapa-svg:active { cursor: grabbing; }
#g-terra path { fill: #ebe8e1; stroke: none; }
#g-estados path { fill: none; stroke: #8a8f98; stroke-width: 1.1; stroke-dasharray: 6 3 1.5 3; vector-effect: non-scaling-stroke; }
#g-grade path { fill: none; stroke: #7b8794; stroke-width: .6; stroke-opacity: .45; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
#mapa-svg .mun { stroke: #5b6573; stroke-opacity: .45; stroke-width: .55; vector-effect: non-scaling-stroke; cursor: pointer; }
#mapa-svg .mun:hover { stroke: #0f172a; stroke-opacity: 1; stroke-width: 1.6; }
#mapa-svg .mun.sel { stroke: #0f172a; stroke-opacity: 1; stroke-width: 2.4; }
#g-lagos path { fill: #a9cce6; stroke: #5b9bd0; stroke-width: .6; vector-effect: non-scaling-stroke; pointer-events: none; }
#g-rios path { fill: none; stroke: #4f97d1; stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
#g-rios path.grande { stroke-width: 1.6; }
#g-cart path { fill: none; stroke: #1f2937; stroke-opacity: .8; stroke-width: 1.7; vector-effect: non-scaling-stroke; stroke-linecap: round; pointer-events: none; }
#g-uf path { fill: none; stroke: #2b3440; stroke-width: 2.3; vector-effect: non-scaling-stroke; stroke-linecap: round; pointer-events: none; }
#mapa-svg .rod { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; pointer-events: stroke; }
#mapa-svg .rod.br { stroke: #d01c1c; stroke-width: 1.8; }
#mapa-svg .rod.pr { stroke: #e2702a; stroke-width: 1.05; }
#mapa-svg .escudo rect { stroke: #ffffff; vector-effect: non-scaling-stroke; stroke-width: 1; }
#mapa-svg .escudo.br rect { fill: #b91c1c; }
#mapa-svg .escudo.pr rect { fill: #c2581b; }
#mapa-svg .escudo text { fill: #ffffff; font-weight: 700; text-anchor: middle; pointer-events: none; }
#mapa-svg .sede { fill: #111827; stroke: #ffffff; pointer-events: none; }
#mapa-svg .sede.polo { fill: #ffffff; stroke: #111827; }
#mapa-svg .pt { cursor: pointer; }
#mapa-svg .pt.aprox { opacity: 0.8; }
#g-rotulos text { fill: #111827; stroke: #ffffff; paint-order: stroke; stroke-linejoin: round; text-anchor: middle; pointer-events: none; }
#g-rotulos text.t1 { font-weight: 700; }
#g-rotulos text.t2 { font-weight: 600; }
#g-rotulos text.t3 { font-weight: 400; fill: #1f2937; }
#g-ctx-rotulos text { fill: #6b7280; text-anchor: middle; pointer-events: none; font-weight: 500; }
#g-ctx-rotulos text.mar { fill: #3b78b0; font-style: italic; }
.mapa-zoom { position: absolute; top: 10px; right: 10px; display: grid; gap: 4px; }
.mapa-zoom button { width: 34px; height: 32px; padding: 0; background: #fff; color: #0f172a; border: 1px solid #cbd5e1; font-weight: 700; font-size: 16px; line-height: 1; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.mapa-escala { position: absolute; left: 10px; bottom: 10px; background: rgba(255,255,255,.85); color: #1f2937; font-size: 11px; padding: 3px 6px 2px; border-radius: 4px; pointer-events: none; }
.mapa-escala span { display: block; height: 5px; border: 1.5px solid #1f2937; border-top: 0; margin-bottom: 2px; }
.mapa-aviso { position: absolute; inset: auto 50% 14px auto; transform: translateX(50%); background: rgba(15,23,42,.85); color: #fff; font-size: 12.5px; padding: 6px 12px; border-radius: 999px; pointer-events: none; white-space: nowrap; }
.mapa-tip { position: absolute; pointer-events: none; background: #0f172a; color: #f8fafc; font-size: 12px; padding: 8px 10px; border-radius: 8px; max-width: 260px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }

/* Legenda abaixo do mapa (não cobre o desenho) */
.mapa-legenda { display: grid; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--texto-2); }
.mapa-legenda > div { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.mapa-legenda b { color: var(--texto); font-weight: 600; min-width: 108px; }
.mapa-legenda .item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mapa-legenda i { display: inline-block; width: 14px; height: 11px; border-radius: 2px; border: 1px solid rgba(0,0,0,.15); }
.mapa-legenda i.grad { width: 70px; }
.mapa-legenda i.pt-leg { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #64748b; }
/* amostras de linha sobre fundo claro (como aparecem no mapa) */
.mapa-legenda i.ln { width: 26px; height: 12px; border: 0; border-radius: 3px; background: #eceee9 linear-gradient(var(--c), var(--c)) center / 100% var(--h) no-repeat; }
.mapa-legenda i.ln.cart { --c: #1f2937; --h: 2px; }
.mapa-legenda i.ln.uf { --c: #2b3440; --h: 3px; }
.mapa-legenda i.ln.br { --c: #d01c1c; --h: 2.5px; }
.mapa-legenda i.ln.pr { --c: #e2702a; --h: 1.5px; }
.mapa-legenda i.ln.rio { --c: #4f97d1; --h: 1.5px; }
.mapa-legenda i.sede-leg { width: 7px; height: 7px; border-radius: 50%; background: #f3fbf5; border: 0; }
.mapa-legenda i.sede-leg.polo { width: 9px; height: 9px; background: transparent; border: 2px solid #f3fbf5; }
.mapa-legenda .fonte { color: var(--texto-3); font-size: 11px; }

.mapa-painel { max-height: calc(78vh + 120px); overflow: auto; }
.mapa-painel table { font-size: 12.5px; }
.mapa-painel th, .mapa-painel td { padding: 6px 5px; }
.mapa-painel td:first-child { white-space: nowrap; }
.abas { display: flex; gap: 4px; margin-bottom: 12px; }
.abas button { flex: 1; background: var(--fundo); color: var(--texto); border: 1px solid var(--linha); padding: 6px 8px; font-weight: 500; }
.abas button.ativo { border-color: var(--acento); color: var(--acento); font-weight: 600; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: var(--fundo); }
.mini-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.mini-kpis div { background: var(--fundo); border-radius: 8px; padding: 6px; font-size: 11px; color: var(--texto-2); display: grid; }
.mini-kpis b { font-size: 15px; color: var(--texto); }
/* Coluna de filtros: rolagem própria, nunca passa por cima do painel de baixo */
.mapa-filtros { max-height: calc(100vh - 24px); overflow-y: auto; align-self: start; }
@media (max-width: 1560px) {
  .mapa-grade { grid-template-columns: 240px minmax(0, 1fr); }
  .mapa-filtros { grid-row: 1 / span 2; }
  .mapa-painel { grid-column: 2; max-height: none; }
}
@media (max-width: 860px) {
  .mapa-grade { grid-template-columns: minmax(0, 1fr); }
  .mapa-filtros { position: static; grid-row: auto; max-height: none; }
  .mapa-painel { grid-column: 1; }
  .mapa-wrap { max-height: none; aspect-ratio: 4 / 5; }
  .mapa-cidade { width: auto !important; left: 8px; right: 8px; top: auto !important; max-height: 62%; }
}

/* Painel da cidade (abre ao clicar no mapa) */
#mapa-svg .pt.fora { opacity: .16; }
#mapa-svg .anel { fill: none; stroke: #f59e0b; pointer-events: none; }
.mapa-cidade { position: absolute; top: 10px; left: 10px; bottom: 10px; width: min(390px, 46%); overflow-y: auto; overscroll-behavior: contain;
  background: var(--superficie); color: var(--texto); border: 1px solid var(--linha); border-radius: 10px; padding: 14px 14px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.28); font-size: 13px; z-index: 2; }
.cid-cab { display: flex; justify-content: space-between; align-items: start; gap: 8px; padding: 2px 0 8px; }
.mapa-cidade .cid-cab { position: sticky; top: -14px; background: var(--superficie); margin-top: -2px; z-index: 1; }
.cid-cab h2 { margin: 0; font-size: 18px; }
.cid-cab p { margin: 2px 0 0; color: var(--texto-3); font-size: 12px; }
.mapa-cidade h3, .cid-full h3 { font-size: 11px; margin: 14px 0 6px; color: var(--texto-3); text-transform: uppercase; letter-spacing: .6px; font-weight: 900; }
.cid-ir { width: 100%; margin-top: 12px; }
/* Visão completa da cidade na aba Detalhe (abaixo do mapa) */
.cid-full .cid-kpis { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cid-full .cid-meio { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.cid-full .cid-abas { position: static; }
.cid-full .cid-lista { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cid-full .cid-prod { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.mapa-cidade .fechar { background: transparent; color: var(--texto-2); border: 1px solid var(--linha); width: 30px; height: 30px; padding: 0; font-size: 18px; line-height: 1; border-radius: 8px; }
.cid-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.cid-kpis div { background: var(--fundo); border-radius: 8px; padding: 7px 9px; display: grid; }
.cid-kpis span { font-size: 11px; color: var(--texto-3); }
.cid-kpis b { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.cid-kpis small { font-size: 11px; color: var(--texto-2); }
.cid-barra { display: flex; height: 10px; border-radius: 99px; overflow: hidden; margin: 12px 0 4px; border: 1px solid var(--linha); }
.cid-barra span { display: block; min-width: 3px; }
.cid-barra-leg { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 11px; color: var(--texto-2); }
.cid-barra-leg i, .mapa-cidade i.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1px solid #64748b; margin-right: 4px; vertical-align: -1px; }
.graf-meses { width: 100%; height: auto; display: block; }
.graf-meses rect { fill: var(--acento, #2563eb); }
.graf-meses text { fill: var(--texto-3); font-size: 9px; text-anchor: middle; }
.cid-abas { display: flex; gap: 4px; margin: 12px 0 6px; position: sticky; top: 46px; background: var(--superficie); padding: 4px 0; z-index: 1; }
.cid-abas button { flex: 1; font-size: 12px; padding: 6px 4px; background: var(--fundo); color: var(--texto); border: 1px solid var(--linha); font-weight: 500; }
.cid-abas button.ativo { border-color: var(--acento); color: var(--acento); font-weight: 600; }
.cid-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cid-lista .cli { border: 1px solid var(--linha); border-radius: 8px; padding: 8px 9px; cursor: pointer; display: grid; gap: 3px; }
.cid-lista .cli:hover, .cid-lista .cli.ativo { border-color: #f59e0b; }
.cid-lista .cli.ativo { box-shadow: 0 0 0 1px #f59e0b inset; background: rgba(245,158,11,.06); }
.cid-lista .l1 { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cid-lista .l2 { font-size: 11.5px; color: var(--texto-3); }
.cid-lista .l2.alerta { color: #b45309; }
.cid-lista .l3 { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: center; font-size: 12px; color: var(--texto-2); }
.cid-lista .tag { font-size: 10.5px; padding: 1px 6px; border-radius: 99px; background: var(--fundo); color: var(--texto-2); }
.cid-lista .vazio { color: var(--texto-3); padding: 10px 0; }
.spark rect.c { fill: var(--acento, #2563eb); }
.spark rect.z { fill: var(--linha); }
.cid-acoes { margin: 12px 0 2px; display: flex; gap: 6px; }

/* Produtos · Curva ABC */
.abc-filtros label[hidden] { display: none; }
.abc-filtros input[list] { min-width: 240px; }
.abc-titulo { margin: -4px 0 14px; color: var(--texto-2); font-size: 13px; }
.abc-titulo b { color: var(--lima); }
.classe { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 6px; font-weight: 950; font-size: 12px; color: #04140b; }
.classe.cA { background: #a8fb58; } .classe.cB { background: #ffc94f; } .classe.cC { background: #6fc7ff; } .classe.c0 { background: var(--grade); color: var(--texto-3); }
.ref { margin-left: 5px; font-size: 11px; font-weight: 900; }
.ref.sobe { color: var(--lima); } .ref.desce { color: var(--critico); } .ref.novo { margin-left: 0; color: var(--azul); text-transform: uppercase; font-size: 10px; letter-spacing: .5px; }
.abc-tabela td small { color: var(--texto-3); }
.abc-tabela td b { font-weight: 700; }
.abc-barra-tabela { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 6px; }
.abc-barra-tabela h2 { margin: 0 8px 0 0; }
.abc-barra-tabela input { min-width: 240px; flex: 1; max-width: 380px; }
.curva-abc { width: 100%; height: auto; display: block; }
.curva-abc text { fill: var(--texto-3); font-size: 11px; }
.curva-abc text.zona { font-size: 16px; font-weight: 950; }
.curva-abc text.eixo { font-size: 10px; }
.oportunidades { border-color: rgba(168,251,88,.45); }
.opo-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; }
.opo { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 9px; background: #0a2419; border: 1px solid var(--grade); }
.opo .pos { font-weight: 950; color: var(--lima); text-align: center; }
.opo b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opo small { display: block; color: var(--texto-3); font-size: 11px; }
.opo .v { text-align: right; font-weight: 900; color: var(--lima); font-size: 12.5px; }
/* Produtos no painel da cidade */
.cid-prod { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cid-prod li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 6px 8px; border: 1px solid var(--linha); border-radius: 8px; font-size: 12px; }
.cid-prod li b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.cid-prod li small { color: var(--texto-3); font-size: 11px; }
.cid-prod li .v { text-align: right; font-weight: 800; }
.mapa-cidade a.link-abc { color: var(--lima); font-weight: 800; font-size: 12px; }
.atualizado:empty { display: none; }

/* Menu lateral: logo centralizada, ícones e modo recolhido */
.lateral { align-items: stretch; overflow: hidden; }
.lateral .marca { justify-items: center; text-align: center; margin-top: 6px; }
.lateral .marca img { max-width: 190px; }
.lateral .selo { align-self: center; }
.lateral .recolher { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; padding: 0; display: grid; place-items: center; background: #0b2a1c; border: 1px solid var(--linha); color: var(--texto-2); border-radius: 8px; z-index: 2; }
.lateral .recolher:hover { color: var(--lima); border-color: rgba(168,251,88,.5); filter: none; }
.lateral .recolher .ico { width: 16px; height: 16px; transition: transform .22s ease; }
.lateral { padding-top: 48px; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav a { display: flex; align-items: center; gap: 11px; white-space: nowrap; }
nav a .ico { opacity: .9; }
nav a.ativo .ico { color: var(--lima); }
.rodape-lateral { justify-items: stretch; }
.rodape-lateral .usuario, .rodape-lateral button.link { display: flex; align-items: center; gap: 10px; white-space: nowrap; text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--lateral-texto); }
.rodape-lateral button.link:hover { background: rgba(52,214,111,.08); opacity: 1; }
.rodape-lateral .ico { width: 18px; height: 18px; }
.rot { transition: opacity .15s ease; }
/* recolhido */
.app.recolhido { grid-template-columns: 76px minmax(0, 1fr); }
.app.recolhido .lateral { padding: 54px 10px 16px; }
.app.recolhido .rot { display: none; }
.app.recolhido .recolher { left: 50%; right: auto; transform: translateX(-50%); }
.app.recolhido .recolher .ico { transform: rotate(180deg); }
.app.recolhido .lateral .marca img { width: 46px; height: 46px; max-width: none; object-fit: cover; object-position: 2% 50%; border-radius: 10px; }
.app.recolhido .selo { padding: 5px; } .app.recolhido .selo::before { margin: 0; }
.app.recolhido nav a, .app.recolhido .rodape-lateral .usuario, .app.recolhido .rodape-lateral button.link { justify-content: center; padding: 10px 0; }
@media (max-width: 860px) {
  .app.recolhido { grid-template-columns: 1fr; }
  .app.recolhido .rot { display: inline; }
  .lateral .recolher { display: none; }
}

/* ---------------- filtro de mês e comparação (todas as telas com faturamento) */
.seletor-mes { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; padding: 8px 10px; border: 1px solid rgba(168,251,88,.28); border-radius: 12px; background: rgba(52,214,111,.06); }
.seletor-mes select { min-width: 150px; }
.seletor-mes label.check { font-size: 10.5px; padding-bottom: 8px; }
.seletor-mes label.check input { width: auto; }
.topo-bloco { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.topo-bloco h2 { margin: 0; }
.bloco-mes { border-color: rgba(168,251,88,.3); }
.bloco-mes .grade-kpi { margin-bottom: 12px; }
.bloco-mes .duas .cartao { margin-bottom: 0; background: rgba(5,18,12,.55); }
.periodo-nota { font-size: 12.5px; color: var(--texto-2); margin: -6px 0 12px; }
.periodo-nota b { color: var(--lima); font-weight: 800; }
.cartao .nota b { color: var(--texto); }
h2.secao { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--texto-3); font-weight: 950; margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--grade); }
.vs-txt { color: var(--texto-3); }
td.comp, .comp { color: var(--texto-3); }
.kpi.critico { border-color: rgba(255,98,94,.45); } .kpi.critico .valor { color: var(--critico); }
.cartao h3 { font-size: 11px; margin: 16px 0 6px; color: var(--texto-3); text-transform: uppercase; letter-spacing: .6px; font-weight: 900; }

/* ---------------- Clientes */
.cli-filtros .cli-busca { flex: 1 1 260px; }
.cli-filtros .cli-busca input { width: 100%; }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: rgba(168,251,88,.06); }
.tag.multi { background: rgba(111,199,255,.14); color: var(--azul); }
.cli-tabela small { color: var(--texto-3); }
.ficha-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; }
.ficha-fundo.aberta { opacity: 1; pointer-events: auto; }
.ficha-cliente { position: fixed; top: 0; right: 0; bottom: 0; width: min(980px, 96vw); background: var(--fundo); border-left: 1px solid var(--linha); box-shadow: -18px 0 40px rgba(0,0,0,.45); padding: 18px 20px 30px; overflow-y: auto; transform: translateX(102%); transition: transform .22s ease; z-index: 61; }
.ficha-cliente.aberta { transform: none; }
.ficha-topo { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.ficha-topo h2 { margin: 0 0 4px; font-size: 20px; color: var(--lima); }
.ficha-topo p { margin: 2px 0; color: var(--texto-2); font-size: 13px; }
.ficha-cliente .fechar { background: #0b2a1c; border: 1px solid var(--linha); color: var(--texto); width: 36px; height: 36px; border-radius: 10px; font-size: 22px; line-height: 1; padding: 0; flex: none; }
.ficha-cliente .grade-kpi { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ---------------- Mercado Livre */
table.dre td.dre-barra { width: 22%; }
table.dre tr.dre-total td { font-weight: 900; border-top: 1px solid var(--linha); }
table.dre tr.dre-total td:first-child { color: var(--lima); }
tr.destaque-linha td { color: var(--atencao); }
.tabela-wrap.lib { max-height: 260px; overflow-y: auto; }
.ml-resultado { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
table.dre td:first-child { white-space: nowrap; }
@media (max-width: 1400px) { .ml-resultado { grid-template-columns: 1fr; } }
.cli-tabela td:nth-child(3) { min-width: 250px; }
.cli-tabela td:nth-child(2), .cli-tabela td:nth-child(4) { white-space: nowrap; }
.ficha-cliente .duas { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.seletor-mes.com-vendedor { border-color: rgba(255,201,79,.55); background: rgba(255,201,79,.07); }
.seletor-mes.com-vendedor #fm-vend { border-color: var(--atencao); color: var(--atencao); font-weight: 700; }
.seletor-mes #fm-vend { min-width: 190px; }
a.filtra-vend { color: inherit; text-decoration: underline dotted rgba(168,251,88,.6); text-underline-offset: 3px; }
a.filtra-vend:hover { color: var(--lima); }

/* ---------------- mapa: período, comparação e vendedor */
.mapa-per { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; padding: 6px 8px; border: 1px solid var(--linha); border-radius: 10px; background: rgba(5,18,12,.5); }
.mapa-per.ativo { border-color: rgba(255,201,79,.55); background: rgba(255,201,79,.07); }
.mapa-per label { font-size: 9.5px; gap: 2px; }
.mapa-per select { padding: 5px 8px; font-size: 12.5px; min-width: 128px; }
.mapa-per select:disabled { opacity: .5; }
.mapa-per-faixa { position: absolute; left: 50%; transform: translateX(-50%); top: 10px; white-space: nowrap; background: rgba(6,19,13,.88); color: #e8f5ec; border: 1px solid rgba(255,201,79,.6); border-radius: 9px; padding: 6px 10px; font-size: 12.5px; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.35); max-width: 60%; }
.mapa-per-faixa b { color: var(--lima); } .mapa-per-faixa b.v { color: var(--atencao); } .mapa-per-faixa span { color: var(--texto-3); margin: 0 3px; }
.mapa-tela:fullscreen .mapa-per-faixa { font-size: 14px; padding: 8px 12px; }
.mapa-legenda i.pt-leg.apag { background: #94a3b8; opacity: .3; }
.cid-lista .l3.per { color: var(--atencao); }
.cid-lista .l3.per b { color: var(--atencao); }
b.per-cid { color: var(--atencao); font-weight: 800; }
.mapa-painel table.resumo-cart { font-size: 12px; }
.mapa-painel table.resumo-cart td:first-child { white-space: normal; }
.mapa-painel table.resumo-cart small { font-size: 10.5px; }
.usuario-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 8px; }
.usuario-form label { flex: 1 1 180px; } .usuario-form input, .usuario-form select { width: 100%; }
td.acoes-u { white-space: nowrap; } td.acoes-u button { padding: 5px 9px; font-size: 12px; margin-left: 4px; }
#dlg-provisoria .provisoria { max-width: 460px; }
#dlg-provisoria .cred { display: grid; gap: 6px; background: #071a11; border: 1px solid var(--linha); border-radius: 10px; padding: 12px; }
#dlg-provisoria code { font-size: 20px; letter-spacing: 1px; color: var(--lima); user-select: all; }
.abc-cli-classes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.abc-cli-classes > div { background: #0a2419; border: 1px solid var(--grade); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; }
.abc-cli-classes span { font-size: 12px; color: var(--texto-2); }
.cid-lista .cli-abc { margin-top: 6px; background: rgba(168,251,88,.08); color: var(--lima); border: 1px solid rgba(168,251,88,.35); border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.cid-lista .cli-abc:hover { background: rgba(168,251,88,.16); }
.mapa-tela:fullscreen .ficha-cliente, .mapa-tela:fullscreen .ficha-fundo { position: fixed; }
.ml-resultado { grid-template-columns: 1fr !important; }
/* barra de progresso fina no topo enquanto a plataforma busca dados */
body::before { content: ""; position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100; background: linear-gradient(90deg, var(--acento), var(--lima)); box-shadow: 0 0 8px rgba(168,251,88,.6); opacity: 0; transition: opacity .2s; }
body.buscando::before { opacity: 1; animation: buscando 1.2s ease-in-out infinite; }
@keyframes buscando { 0% { left: 0; width: 0; } 50% { left: 15%; width: 55%; } 100% { left: 100%; width: 0; } }
.selo.prod { color: var(--lima); } .selo.prod::before { background: var(--acento); box-shadow: 0 0 10px var(--acento); }

/* Menu lateral em telas baixas: logo mais acima e lista de módulos com rolagem (rodapé sempre visível) */
.lateral { padding-top: 40px; gap: 10px; }
.lateral .marca { margin-top: -4px; }
.lateral .marca img { max-width: 172px; }
.lateral nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; margin-right: -6px; padding-right: 6px; scrollbar-width: thin; scrollbar-color: rgba(52,214,111,.45) transparent; }
.lateral nav::-webkit-scrollbar { width: 6px; }
.lateral nav::-webkit-scrollbar-thumb { background: rgba(52,214,111,.45); border-radius: 6px; }
.lateral nav::-webkit-scrollbar-track { background: transparent; }
.lateral .rodape-lateral { flex: none; margin-top: 0; padding-top: 8px; border-top: 1px solid var(--grade); }
@media (max-height: 760px) {
  .lateral { padding-top: 36px; gap: 8px; }
  .lateral .marca img { max-width: 140px; }
  .lateral .marca span { font-size: 10px; }
  nav a { padding: 7px 12px; }
  .rodape-lateral .usuario, .rodape-lateral button.link { padding: 4px 12px; }
}
.app.recolhido .lateral nav { margin-right: 0; padding-right: 0; }
.mais-linhas { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--texto-3); flex-wrap: wrap; }
.mais-linhas button, button.mini { padding: 6px 12px; font-size: 12px; }
