/* Placa em Dia — app do dono do carro (mobile first) */
:root {
  --cor: #f97316; --cor-esc: #ea580c; --cor-2: #fff7ed;
  --navy: #0f172a; --navy-2: #1e293b;
  --bg: #f1f5f9; --card: #fff; --txt: #0f172a; --mut: #64748b; --borda: #e2e8f0;
  --ok: #15803d; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7; --bad: #dc2626; --bad-bg: #fee2e2; --info: #1d4ed8; --info-bg: #dbeafe;
  --r: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--txt); font-size: 16px; line-height: 1.45; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.mut { color: var(--mut); }
.peq { font-size: .85rem; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* topo */
.topo { background: var(--navy); color: #fff; padding: max(14px, env(safe-area-inset-top)) 0 14px; position: sticky; top: 0; z-index: 20; }
.topo .wrap { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.topo .voltar { background: rgba(255,255,255,.1); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 1.3rem; cursor: pointer; flex: none; }
.topo .titulo { flex: 1; min-width: 0; }
.topo .titulo b { display: block; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo .titulo small { color: #94a3b8; font-size: .8rem; }
.topo .acao { background: rgba(255,255,255,.1); border: 0; color: #fff; height: 40px; min-width: 40px; padding: 0 12px; border-radius: 12px; cursor: pointer; font-weight: 600; flex: none; text-decoration: none; display: grid; place-items: center; }
.logo { width: 38px; height: 38px; border-radius: 10px; flex: none; }
main { padding: 16px 0 calc(40px + env(safe-area-inset-bottom)); }

/* cartões e botões */
.card { background: var(--card); border: 1px solid var(--borda); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.card h2 { font-size: 1.05rem; margin-bottom: 10px; }
.card h3 { font-size: .95rem; }
.sec-tit { display: flex; justify-content: space-between; align-items: center; margin: 22px 2px 10px; }
.sec-tit h2 { font-size: 1.05rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--borda); background: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 46px; }
.btn.pri { background: var(--cor); border-color: var(--cor); color: #fff; }
.btn.pri:active { background: var(--cor-esc); }
.btn.esc { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.zap { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.perigo { color: var(--bad); border-color: #fecaca; }
.btn.bloco { width: 100%; }
.btn.mini { min-height: 36px; padding: 7px 12px; font-size: .88rem; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--cor-esc); font-weight: 600; cursor: pointer; padding: 4px 0; text-decoration: none; }
.linha-btn { display: flex; gap: 8px; flex-wrap: wrap; }
.linha-btn > * { flex: 1 1 auto; }

/* formulários */
label.campo { display: block; margin-bottom: 12px; }
label.campo > span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 5px; color: #334155; }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 12px; padding: 12px 14px; background: #fff; font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--cor) 25%, transparent); border-color: var(--cor); }
.dois { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; margin: 6px 0 14px; }
.check input { width: 20px; height: 20px; flex: none; margin-top: 2px; accent-color: var(--cor); }
.ajuda { font-size: .8rem; color: var(--mut); margin-top: 4px; }

/* placa padrão Mercosul */
.placa { display: inline-flex; flex-direction: column; align-items: stretch; background: #fff; border: 2px solid #111827; border-radius: 6px; overflow: hidden; font-family: 'Arial Narrow', Arial, sans-serif; line-height: 1; flex: none; }
.placa i { background: #1d4ed8; color: #fff; font-style: normal; font-size: .5rem; letter-spacing: .12em; text-align: center; padding: 2px 6px; font-weight: 700; }
.placa b { font-size: 1.05rem; letter-spacing: .06em; padding: 3px 8px 4px; text-align: center; color: #111827; }
.placa.g b { font-size: 1.6rem; padding: 4px 12px 6px; }
.placa.g i { font-size: .6rem; }
.placa-input { font-family: 'Arial Narrow', Arial, sans-serif; font-size: 1.8rem; font-weight: 700; letter-spacing: .12em; text-align: center; text-transform: uppercase; border: 3px solid #111827; border-top-width: 16px; border-top-color: #1d4ed8; border-radius: 10px; padding: 8px; }

/* carros na home */
.carro { display: flex; gap: 14px; align-items: center; cursor: pointer; text-decoration: none; }
.carro .info { flex: 1; min-width: 0; }
.carro .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carro .seta { color: #94a3b8; font-size: 1.4rem; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #f1f5f9; color: #334155; }
.pill.vencido, .pill.urgente { background: var(--bad-bg); color: var(--bad); }
.pill.provavel, .pill.proximo, .pill.atencao { background: var(--warn-bg); color: var(--warn); }
.pill.ok, .pill.pago { background: var(--ok-bg); color: var(--ok); }
.pill.info, .pill.acao { background: var(--info-bg); color: var(--info); }

/* avisos */
.aviso { display: flex; gap: 12px; align-items: flex-start; border-left: 5px solid var(--warn); }
.aviso.urgente { border-left-color: var(--bad); }
.aviso.acao { border-left-color: var(--cor); }
.aviso .ico { font-size: 1.4rem; line-height: 1; flex: none; margin-top: 2px; }
.aviso .corpo { flex: 1; min-width: 0; }
.aviso .corpo b { display: block; }
.aviso .corpo p { margin: 3px 0 10px; font-size: .9rem; color: var(--mut); }

/* destaque da km */
.km-card { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border: 0; }
.km-card .v { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.km-card .l { color: #94a3b8; font-size: .85rem; }
.km-card .alerta { background: rgba(249,115,22,.18); color: #fed7aa; border-radius: 10px; padding: 8px 10px; font-size: .88rem; margin: 10px 0; }

/* abas */
.abas { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 4px -16px 14px; padding: 0 16px; position: sticky; top: calc(68px + env(safe-area-inset-top)); z-index: 10; background: var(--bg); padding-top: 6px; padding-bottom: 6px; }
.abas::-webkit-scrollbar { display: none; }
.abas a { flex: none; padding: 9px 14px; border-radius: 99px; background: #fff; border: 1px solid var(--borda); text-decoration: none; font-weight: 600; font-size: .9rem; }
.abas a.ativo { background: var(--navy); color: #fff; border-color: var(--navy); }

/* manutenções */
.manut { padding: 14px 0; border-top: 1px solid var(--borda); }
.manut:first-of-type { border-top: 0; padding-top: 2px; }
.manut .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.barra { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.barra i { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.barra i.proximo, .barra i.provavel { background: #f59e0b; }
.barra i.vencido { background: var(--bad); }

/* linha do tempo */
.tempo { position: relative; padding-left: 22px; }
.tempo::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: #cbd5e1; }
.evento { position: relative; }
.evento::before { content: ''; position: absolute; left: -20px; top: 20px; width: 12px; height: 12px; border-radius: 50%; background: var(--cor); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--cor); }
.evento.dono::before { background: #64748b; box-shadow: 0 0 0 2px #64748b; }
.evento ul { margin: 8px 0 0; padding-left: 18px; font-size: .92rem; }
.evento li { margin-bottom: 2px; }
.fotos { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; }
.fotos img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; flex: none; cursor: zoom-in; }
.trava { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 8px 10px; font-size: .82rem; color: var(--mut); margin-top: 8px; }

/* oficinas */
.oficina { display: flex; gap: 12px; align-items: center; }
.oficina .lg { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; flex: none; object-fit: cover; }
.oficina .info { flex: 1; min-width: 0; }

/* lista simples */
.item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--borda); }
.item:first-child { border-top: 0; padding-top: 0; }
.vazio { text-align: center; color: var(--mut); padding: 22px 10px; }
.vazio .ico { font-size: 2.2rem; margin-bottom: 6px; }

/* tela de entrada */
.entrada { min-height: 100vh; background: radial-gradient(1200px 500px at 50% -10%, #1e3a8a 0%, var(--navy) 55%); color: #fff; padding: max(28px, env(safe-area-inset-top)) 0 30px; }
.entrada .hero { text-align: center; padding: 10px 0 18px; }
.entrada .hero img { width: 76px; border-radius: 18px; }
.entrada h1 { font-size: 1.7rem; margin: 12px 0 6px; line-height: 1.15; }
.entrada .hero p { color: #cbd5e1; margin: 0 auto; max-width: 400px; }
.beneficios { display: grid; gap: 8px; margin: 18px 0; }
.beneficios div { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px 12px; font-size: .92rem; color: #e2e8f0; }
.entrada .card { color: var(--txt); }
.tabs2 { display: grid; grid-template-columns: 1fr 1fr; background: #f1f5f9; border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.tabs2 button { border: 0; background: none; padding: 10px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--mut); }
.tabs2 button.ativo { background: #fff; color: var(--txt); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.codigo { font-family: ui-monospace, Consolas, monospace; font-size: 1.6rem; font-weight: 800; letter-spacing: .1em; text-align: center; background: var(--cor-2); border: 2px dashed var(--cor); border-radius: 12px; padding: 14px; margin: 12px 0; color: var(--txt); }

/* folha (modal de baixo) */
.folha-bg { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.folha { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: sobe .2s ease-out; }
.folha .puxador { width: 44px; height: 5px; background: #cbd5e1; border-radius: 99px; margin: 0 auto 12px; }
.folha h2 { font-size: 1.15rem; margin-bottom: 4px; }
.folha .sub { color: var(--mut); font-size: .9rem; margin: 0 0 16px; }
@media (min-width: 600px) { .folha-bg { align-items: center; } .folha { border-radius: 22px; } }
@keyframes sobe { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chips label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cbd5e1; border-radius: 99px; padding: 8px 12px; font-size: .88rem; cursor: pointer; }
.chips input { width: auto; accent-color: var(--cor); }
.chips label:has(input:checked) { background: var(--cor-2); border-color: var(--cor); }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(120px); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 99; transition: transform .25s, opacity .25s; opacity: 0; visibility: hidden; max-width: 92vw; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#toast.on { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
#toast.err { background: var(--bad); }
.carregando { text-align: center; padding: 60px 0; color: var(--mut); }
.foto-grande { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 60; display: grid; place-items: center; padding: 16px; }
.foto-grande img { max-width: 100%; max-height: 90vh; border-radius: 10px; }
[data-instalar][hidden] { display: none !important; }

/* combustível */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 4px; }
.kpis .card { padding: 12px; margin-bottom: 8px; }
.kpi .l { color: var(--mut); font-size: .75rem; }
.kpi .v { font-size: clamp(.95rem, 4.3vw, 1.25rem); font-weight: 800; letter-spacing: -.02em; white-space: nowrap; line-height: 1.25; }
.kpi .v .rs { font-size: .62em; font-weight: 700; color: var(--mut); margin-right: 2px; }
.kpi .v small { font-size: .7rem; font-weight: 600; color: var(--mut); }

.barras { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 18px; }
.barras .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.barras .b i { display: block; width: 100%; max-width: 34px; background: var(--info); border-radius: 6px 6px 2px 2px; min-height: 4px; }
.barras .b i.et, .leg.et { background: var(--ok); }
.barras .b span { font-size: .72rem; font-weight: 700; margin-bottom: 3px; }
.barras .b small { font-size: .65rem; color: var(--mut); margin-top: 4px; }
.leg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--info); vertical-align: -1px; margin-left: 6px; }
input.lido { border-color: var(--ok); background: #f0fdf4; }
label.btn { cursor: pointer; }

/* gastos */
.cat { margin-bottom: 10px; }
.cat-top { display: flex; justify-content: space-between; gap: 10px; font-size: .92rem; }
.cat .barra { margin: 5px 0 0; }
.chips label:has(input[type=radio]:checked) { background: var(--cor-2); border-color: var(--cor); }

/* vistorias */
.laudo-it { padding: 12px 0; border-top: 1px solid var(--borda); }
.laudo-it:first-of-type { border-top: 0; padding-top: 0; }
.laudo-it .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.fotos .btn.mini { flex: none; }

/* botão fechar das janelas */
.folha { position: relative; }
.fechar-folha { position: sticky; top: 0; float: right; margin: -2px -6px 0 8px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: #f1f5f9; color: #334155; font-size: 1.05rem; font-weight: 700; cursor: pointer; z-index: 2; display: grid; place-items: center; }
.fechar-folha:hover { background: #e2e8f0; }

/* lançar rápido */
.acoes-rapidas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.acao-r { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: #fff; border: 1px solid var(--borda); border-radius: 14px; padding: 12px 6px; font-weight: 700; font-size: .82rem; cursor: pointer; min-height: 78px; text-align: center; line-height: 1.2; color: var(--txt); }
.acao-r span { font-size: 1.5rem; }
.acao-r:hover, .acao-r:active { border-color: var(--cor); background: var(--cor-2); }
.acoes-rapidas.compacta { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.acoes-rapidas.compacta .acao-r { min-height: 64px; font-size: .68rem; padding: 8px 2px; border-radius: 12px; }
.acoes-rapidas.compacta .acao-r span { font-size: 1.25rem; }
@media (max-width: 520px) { .acoes-rapidas.compacta { grid-template-columns: repeat(3, minmax(0, 1fr)); } .acoes-rapidas.compacta .acao-r { font-size: .75rem; } }
.fab { position: fixed; right: max(18px, calc(50vw - 300px)); bottom: calc(22px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--cor); color: #fff; font-size: 2rem; font-weight: 400; line-height: 1; box-shadow: 0 8px 24px rgba(249,115,22,.45); cursor: pointer; z-index: 30; display: grid; place-items: center; }
.fab:active { transform: scale(.95); }
main { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }

/* Placa em Dia Plus */
.plano-card { display: flex; gap: 12px; align-items: center; }
.plano-card > div:nth-child(2) { flex: 1; min-width: 0; }
.plano-card .ico { font-size: 1.7rem; }
.plano-card.of { background: #f0fdf4; border-color: #bbf7d0; }
.plano-card.fim { background: var(--warn-bg); border-color: #fde68a; }
.plano-card.gratis { background: #f8fafc; }
.acao-r { position: relative; }
.acao-r .cadeado { position: absolute; top: 6px; right: 8px; font-style: normal; font-size: .8rem; opacity: .75; }
.plus-lista { display: grid; gap: 6px; margin-bottom: 14px; font-size: .93rem; }
.planos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plano-op { position: relative; border: 2px solid var(--borda); background: #fff; border-radius: 16px; padding: 18px 10px 14px; cursor: pointer; text-align: center; }
.plano-op:first-child { border-color: var(--cor); background: var(--cor-2); }
.plano-op b { display: block; }
.plano-op .v { font-size: 1.5rem; font-weight: 800; margin: 4px 0; }
.plano-op small { color: var(--mut); font-size: .78rem; }
.plano-op .selo { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--cor); color: #fff; font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.sep-or { display: flex; align-items: center; gap: 10px; color: var(--mut); margin: 16px 0 10px; font-size: .85rem; }
.sep-or::before, .sep-or::after { content: ''; flex: 1; height: 1px; background: var(--borda); }

.cal select { width: 100%; margin-bottom: 6px; }
.multas summary { cursor: pointer; }
.passos-multa { padding-left: 20px; margin: 12px 0 0; display: grid; gap: 10px; font-size: .92rem; line-height: 1.45; }
