/* EV Ponto Portátil — paleta oficial (IDV): marinho #132D46, azul #214889, azul médio #3E74C1,
   verde #3BD77E, verde-limão #ADF683, creme #F0FFD8 */
:root {
  --marinho: #132D46; --azul: #214889; --azul-m: #3E74C1; --verde: #3BD77E; --verde-esc: #1FAE5E; --limao: #ADF683; --creme: #F0FFD8;
  --perigo: #D9443A; --alerta: #E8A317;
  --raio: 16px;
  --grad: linear-gradient(135deg, #214889 0%, #3E74C1 45%, #3BD77E 100%);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
/* Tema diurno (padrão) — também forçado no relatório exportado */
:root, [data-tema="claro"] {
  --fundo: #F4F7FB; --cartao: #FFFFFF; --campo: #FFFFFF; --texto: #132D46; --texto-2: #5B6B7E; --borda: #E1E7EF;
  --azul-tx: #214889; --sombra: 0 2px 10px rgba(19, 45, 70, .07); --painel: #132D46; --acesso-fundo: #F0FFD8;
  --t-verde: #E7F8EE; --t-azul: #E8EEF9; --t-alerta: #FDF3DD; --t-cinza: #F1F2F4; --t-perigo: #FCE8E6; --t-creme: #F0FFD8;
  --tx-alerta: #7A5200; --tx-ok: #146b3a; --tx-perigo: #8f2019; --tx-creme: #3d7a12; --brilho: #7c8ea3;
  color-scheme: light;
}
/* Tema noturno */
[data-tema="escuro"] {
  --fundo: #0B1724; --cartao: #132235; --campo: #0F1C2C; --texto: #E6EDF5; --texto-2: #9AAABD; --borda: #24384F;
  --azul-tx: #8DB4F0; --sombra: 0 2px 10px rgba(0, 0, 0, .35); --painel: #0E2A44; --acesso-fundo: #0E2A44;
  --t-verde: rgba(59, 215, 126, .16); --t-azul: rgba(62, 116, 193, .22); --t-alerta: rgba(232, 163, 23, .18); --t-cinza: #1E3046;
  --t-perigo: rgba(217, 68, 58, .22); --t-creme: rgba(173, 246, 131, .14);
  --tx-alerta: #F2C46B; --tx-ok: #74E3A6; --tx-perigo: #FF9C94; --tx-creme: #BDF59A; --brilho: #5E7389;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fundo); color: var(--texto); -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--azul-m); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
.oculto { display: none !important; }
.mudo { color: var(--texto-2); font-size: .88rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Estrutura ---------- */
.topo { position: sticky; top: 0; z-index: 20; background: var(--cartao); border-bottom: 1px solid var(--borda); display: flex; align-items: center;
  gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.topo .logo { height: 40px; display: block; }
.topo .espaco { flex: 1; }
.topo-titulo { font-weight: 800; color: var(--texto); font-size: .95rem; line-height: 1.15; padding-left: 10px; border-left: 2px solid var(--verde); }
@media (max-width: 480px) { .topo { gap: 8px; } .topo .logo { height: 34px; } .topo-titulo { font-size: .8rem; padding-left: 8px; } .topo .btn-icone { width: 36px; } }
.slogan { text-align: center; font-weight: 800; font-size: 1.15rem; color: var(--azul-tx); margin: -8px 0 18px; letter-spacing: .01em; }
.btn-icone { position: relative; border: 0; background: transparent; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--texto); }
.btn-icone:hover { background: var(--fundo); }
.btn-icone svg { width: 24px; height: 24px; }
.selo { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--perigo); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px 16px 96px; }
.barra-sim { background: var(--alerta); color: #fff; text-align: center; font-size: .8rem; font-weight: 600; padding: 4px; }

.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--cartao); border-top: 1px solid var(--borda); display: flex;
  padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; text-decoration: none;
  color: var(--texto-2); font-size: .72rem; font-weight: 600; }
.nav a svg { width: 24px; height: 24px; }
.nav a { position: relative; }
.nav .selo { top: 3px; right: auto; left: calc(50% + 6px); }
.corta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a.ativo { color: var(--azul-tx); }
.nav a.ativo svg { color: var(--verde-esc); }

@media (min-width: 900px) {
  body.sim .nav { top: 88px; }
  .nav { top: 61px; bottom: 0; right: auto; width: 210px; flex-direction: column; border-top: 0; border-right: 1px solid var(--borda); padding: 12px 10px; gap: 4px; }
  .nav a { flex: 0; flex-direction: row; gap: 12px; padding: 11px 14px; border-radius: 12px; font-size: .92rem; }
  .nav a.ativo { background: var(--t-creme); }
  .nav .selo { position: static; margin-left: auto; }
  main { margin-left: 210px; padding: 24px 28px 40px; max-width: none; }
  .conteudo { max-width: 1000px; margin: 0 auto; }
}

/* ---------- Componentes ---------- */
.cartao { background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); padding: 16px; margin-bottom: 14px; }
.cartao.plano { box-shadow: none; border: 1px solid var(--borda); }
.titulo-pag { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.titulo-pag h1 { margin: 0; }
.grade { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.linha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.linha.entre { justify-content: space-between; }
.pilha > * + * { margin-top: 10px; }

.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--azul); color: #fff; transition: transform .05s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.verde { background: var(--verde); color: var(--marinho); }
.btn.perigo { background: var(--perigo); }
.btn.claro { background: var(--fundo); color: var(--texto); border: 1px solid var(--borda); }
.btn.fantasma { background: transparent; color: var(--azul-tx); padding: 8px 10px; }
.btn.bloco { width: 100%; }
.btn.grande { padding: 16px 20px; font-size: 1.05rem; border-radius: 14px; }
.btn.peq { padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
.btn svg { width: 20px; height: 20px; }

label.campo { display: block; margin-bottom: 12px; }
label.campo > span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; color: var(--texto-2); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--borda); border-radius: 12px; background: var(--campo); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--azul-m); box-shadow: 0 0 0 3px rgba(62, 116, 193, .15); }
.senha-caixa { position: relative; display: block; }
.senha-caixa input { padding-right: 48px; }
.olho { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: transparent;
  color: var(--texto-2); display: grid; place-items: center; cursor: pointer; border-radius: 10px; }
.olho:hover { background: var(--fundo); color: var(--azul); }
.olho svg { width: 22px; height: 22px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--verde-esc); }

.etiqueta { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--fundo); color: var(--texto-2); }
.etiqueta::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.etiqueta.livre { background: var(--t-verde); color: var(--verde-esc); }
.etiqueta.uso { background: var(--t-azul); color: var(--azul-tx); }
.etiqueta.minha { background: var(--t-creme); color: var(--tx-creme); }
.etiqueta.alerta { background: var(--t-alerta); color: var(--tx-alerta); }
.etiqueta.off { background: var(--t-cinza); color: var(--texto-2); }
.etiqueta.erro { background: var(--t-perigo); color: var(--tx-perigo); }
.etiqueta.sem-ponto::before { display: none; }

/* Cartão de equipamento */
.equip { position: relative; overflow: hidden; }
.equip .cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.equip .regiao { font-size: .75rem; font-weight: 700; letter-spacing: .06em; color: var(--azul-m); text-transform: uppercase; }
.equip h2 { margin: 2px 0 0; font-size: 1.15rem; }
.medidas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.medida { background: var(--fundo); border-radius: 12px; padding: 8px 10px; }
.medida b { display: block; font-size: 1.1rem; }
.medida small { color: var(--texto-2); font-size: .72rem; font-weight: 600; text-transform: uppercase; }
.equip.carregando { box-shadow: 0 0 0 2px var(--verde), var(--sombra); }
.equip .faixa { position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--grad); }

/* Botão deslizante */
.desliza { --c: var(--verde); --c-txt: var(--marinho); position: relative; height: 60px; border-radius: 30px; background: var(--t-verde); overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: none; }
.desliza.perigo { --c: var(--perigo); --c-txt: #fff; background: var(--t-perigo); }
.desliza-preenche { position: absolute; top: 0; bottom: 0; left: 0; width: 64px; background: var(--c); opacity: .9; border-radius: 30px; }
.desliza.esquerda .desliza-preenche { left: auto; right: 0; }
.desliza-texto { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 1rem; color: var(--marinho); padding: 0 66px;
  text-align: center; line-height: 1.15; pointer-events: none;
  background: linear-gradient(90deg, var(--texto) 0%, var(--texto) 40%, var(--brilho) 50%, var(--texto) 60%, var(--texto) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: brilho 2.8s linear infinite; }
.desliza.esquerda .desliza-texto { animation-direction: reverse; }
.desliza.perigo .desliza-texto { background-image: linear-gradient(90deg, var(--tx-perigo) 0%, var(--tx-perigo) 40%, #e58b84 50%, var(--tx-perigo) 60%, var(--tx-perigo) 100%); }
@keyframes brilho { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.desliza-botao { position: absolute; top: 4px; left: 4px; width: 52px; height: 52px; border-radius: 50%; background: #fff; color: var(--c);
  display: grid; place-items: center; box-shadow: 0 2px 8px rgba(19,45,70,.25); cursor: grab; z-index: 1; outline: none; }
.desliza-botao:focus-visible { box-shadow: 0 0 0 3px var(--azul-m), 0 2px 8px rgba(19,45,70,.25); }
.desliza.esquerda .desliza-botao { left: auto; right: 4px; }
.desliza-botao svg { width: 28px; height: 28px; stroke-width: 2.6; }
.desliza.arrastando .desliza-botao { cursor: grabbing; }
.desliza.animando .desliza-botao, .desliza.animando .desliza-preenche { transition: transform .25s ease, width .25s ease; }
.desliza.concluido .desliza-texto { -webkit-text-fill-color: var(--c-txt); animation: none; }
.desliza.desativado { opacity: .5; }
.desliza.desativado .desliza-botao { cursor: not-allowed; }
.desliza.dica .desliza-botao { animation: dica .6s ease; }
.desliza.esquerda.dica .desliza-botao { animation-name: dica-esq; }
@keyframes dica { 30% { transform: translateX(26px); } 60% { transform: translateX(-4px); } }
@keyframes dica-esq { 30% { transform: translateX(-26px); } 60% { transform: translateX(4px); } }
.painel-carga .desliza { background: rgba(255,255,255,.12); }
.painel-carga .desliza.perigo { background: rgba(217, 68, 58, .28); }
.painel-carga .desliza-texto, .painel-carga .desliza.perigo .desliza-texto { background-image: linear-gradient(90deg, #fff 0%, #fff 40%, #8fa3b8 50%, #fff 60%, #fff 100%); }

/* Painel de carga em andamento */
.painel-carga { background: var(--painel); color: #fff; border-radius: 20px; padding: 18px; margin-bottom: 14px; position: relative; overflow: hidden; }
.painel-carga::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(59,215,126,.35), transparent 70%); }
.painel-carga .valor-grande { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.painel-carga .mudo { color: #B9C6D6; }
.painel-carga .medidas .medida { background: rgba(255,255,255,.08); }
.painel-carga .medida small { color: #B9C6D6; }
.pulso { width: 10px; height: 10px; border-radius: 50%; background: var(--verde); display: inline-block; box-shadow: 0 0 0 0 rgba(59,215,126,.7); animation: pulso 1.6s infinite; }
@keyframes pulso { 70% { box-shadow: 0 0 0 10px rgba(59,215,126,0); } 100% { box-shadow: 0 0 0 0 rgba(59,215,126,0); } }

/* Detalhe da carga: pares rótulo/valor que quebram linha (sem rolagem lateral) */
.dados { display: grid; grid-template-columns: 1fr; gap: 0; padding: 4px 16px; }
.dado { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--borda); min-width: 0; }
.dado:last-child { border-bottom: 0; }
.dado span { color: var(--texto-2); font-size: .88rem; flex: none; }
.dado b { font-weight: 600; text-align: right; overflow-wrap: anywhere; min-width: 0; }
.concluido-cab { position: relative; text-align: center; background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); padding: 22px 16px 18px; margin-bottom: 14px; }
.concluido-cab h1 { margin: 10px 0 4px; }
.concluido-cab .fechar { position: absolute; top: 8px; right: 8px; }
.concluido-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--verde); color: var(--marinho); display: grid; place-items: center; margin: 0 auto; }
.concluido-ic.alerta { background: var(--alerta); color: #fff; font-size: 2rem; font-weight: 800; }
.concluido-ic svg { width: 36px; height: 36px; stroke-width: 3; }
main, .conteudo { min-width: 0; }
.conteudo { overflow-x: hidden; }

/* Tabelas */
.tabela-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--borda); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--cartao); }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--borda); white-space: nowrap; }
th { background: var(--fundo); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-2); }
td.d, th.d { text-align: right; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 800; background: var(--t-creme); }

/* Lista em cartões (celular) */
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--borda); }
.item:last-child { border-bottom: 0; }
.item .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--t-creme); display: grid; place-items: center; color: var(--verde-esc); flex: none; }
.item .ic svg { width: 22px; height: 22px; }
.item .meio { flex: 1; min-width: 0; }
.item .meio b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .dir { text-align: right; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--cartao); border-radius: 14px; padding: 12px 14px; box-shadow: var(--sombra); }
.kpi small { color: var(--texto-2); font-weight: 600; font-size: .75rem; text-transform: uppercase; }
.kpi b { display: block; font-size: 1.35rem; margin-top: 2px; }

/* Gráficos SVG */
.grafico { width: 100%; height: auto; display: block; }
.grafico text { font-size: 11px; fill: var(--texto-2); }

/* Abas */
.abas { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; }
.abas button { border: 1px solid var(--borda); background: var(--cartao); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: .88rem; cursor: pointer; white-space: nowrap; color: var(--texto-2); }
.abas button.ativo { background: var(--azul); border-color: var(--azul); color: #fff; }

/* Acesso (login/cadastro) */
.acesso { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(180deg, var(--fundo) 0%, var(--acesso-fundo) 100%); }
.acesso .caixa { width: 100%; max-width: 400px; }
.acesso .logo-v { display: block; width: 190px; margin: 0 auto 22px; }
.acesso .cartao { padding: 22px; }

.ou { display: flex; align-items: center; gap: 10px; color: var(--texto-2); font-size: .85rem; margin: 16px 0 12px; }
.ou::before, .ou::after { content: ''; flex: 1; height: 1px; background: var(--borda); }
.google-btn { display: flex; justify-content: center; min-height: 44px; }

/* Toast e modal */
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: var(--marinho); color: #fff; padding: 12px 18px;
  border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s; z-index: 100; max-width: calc(100% - 32px); text-align: center; }
#toast.vis { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.erro { background: var(--perigo); }
.modal-fundo { position: fixed; inset: 0; background: rgba(19, 45, 70, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--cartao); width: 100%; max-width: 520px; border-radius: 20px 20px 0 0; padding: 20px 18px; padding-bottom: max(20px, env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto; }
@media (min-width: 700px) { .modal-fundo { align-items: center; } .modal { border-radius: 20px; } }
.modal h2 { margin-bottom: 12px; }
.modal .acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.vazio { text-align: center; padding: 30px 10px; color: var(--texto-2); }
.vazio img { width: 110px; opacity: .9; margin-bottom: 8px; }
.aviso { background: var(--t-alerta); color: var(--tx-alerta); border-radius: 12px; padding: 10px 12px; font-size: .88rem; margin-bottom: 12px; }
.aviso.info { background: var(--t-azul); color: var(--azul-tx); }
.aviso.ok { background: var(--t-verde); color: var(--tx-ok); }

/* Relatório para exportar (PDF/imagem) */
#relatorio-exportar { background: #fff; color: var(--texto); }
.rel-cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 3px solid var(--verde); padding-bottom: 10px; margin-bottom: 12px; }
.rel-cab img { height: 40px; }
.carregando-pag { text-align: center; padding: 40px; color: var(--texto-2); }

/* Início com carregamento em andamento: painel + outros pontos (lado a lado no computador) */
.inicio-layout { display: grid; gap: 4px; }
.secao { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-2); margin: 6px 0 10px; }
@media (min-width: 900px) {
  .inicio-layout { grid-template-columns: minmax(360px, 1fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
  .inicio-layout .secao { margin-top: 0; }
  .inicio-layout .grade { grid-template-columns: 1fr; }
}
.seletor-tema { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seletor-tema button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--borda); background: var(--fundo); color: var(--texto); font-weight: 700; }
.seletor-tema button svg { width: 20px; height: 20px; }
.seletor-tema button.ativo { border-color: var(--verde); background: var(--t-verde); box-shadow: 0 0 0 2px var(--verde) inset; }

/* Tema noturno: logos (texto azul-escuro) ganham um fundo claro para manter a identidade visual */
[data-tema="escuro"] .topo .logo, [data-tema="escuro"] .logo-v { background: #fff; border-radius: 12px; padding: 4px 8px; }
[data-tema="escuro"] .logo-v { padding: 10px 14px; }
[data-tema="escuro"] .grafico text { fill: var(--texto-2); }