/* JM Transportes — visual e fontes no padrão do app de assistência.
   Títulos: General Sans (Fontshare, licença livre). Texto: DM Sans (Google Fonts, OFL).
   Os arquivos ficam em /fontes, então o sistema funciona sem internet. */
@font-face { font-family: "General Sans"; src: url("/fontes/general-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("/fontes/general-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("/fontes/general-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("/fontes/general-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/fontes/dm-sans.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }

:root {
  --fonte-texto: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --fonte-titulo: "General Sans", "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --tinta: #13133D;          /* títulos */
  --tinta-forte: #0D0D2B;    /* botão principal */
  --suave: #7A7A93;          /* texto secundário */
  --fundo: #F2F2F5;
  --card: #FFFFFF;
  --linha: #E7E7EE;
  --chip: #ECECF1;
  --icone-bg: #EFEFF4;
  --indigo: #4338CA;
  --indigo-bg: #E6E4FB;
  --verde: #15803D; --verde-bg: #DCFCE7;
  --vermelho: #B42318; --vermelho-bg: #FDECEA;
  --ambar: #92400E; --ambar-bg: #FEF3C7;
  --ouro: #D4A24C;
  --raio: 18px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--fonte-texto);
  background: var(--fundo); color: var(--tinta); font-size: 16px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.suave { color: var(--suave); }
.erro { color: var(--vermelho); min-height: 1.2em; margin: 6px 0; font-size: .92rem; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.verde { color: var(--verde); } .vermelho { color: var(--vermelho); }

/* ---------- Topo ---------- */
.topo {
  position: sticky; top: 0; z-index: 20; background: var(--fundo);
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  max-width: 760px; margin: 0 auto;
}
.topo h1 { font-family: var(--fonte-titulo); grid-column: 2; font-size: 1.12rem; font-weight: 800; text-align: center; margin: 0; letter-spacing: -.01em; }
.circ {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--icone-bg);
  color: var(--tinta); display: grid; place-items: center; cursor: pointer; flex: none;
}
.circ:active { background: #E1E1E9; }
#btn-voltar { grid-column: 1; }
#btn-mais { grid-column: 3; justify-self: end; }

.mesbar {
  position: sticky; top: 0; z-index: 19; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 4px 16px 14px; max-width: 760px; margin: 0 auto; background: var(--fundo);
}
.mesbar span { font-family: var(--fonte-titulo); font-weight: 700; font-size: 1.05rem; }

.conteudo { max-width: 760px; margin: 0 auto; padding: 0 16px calc(130px + env(safe-area-inset-bottom)); }
.conteudo.com-acao { padding-bottom: calc(200px + env(safe-area-inset-bottom)); }

/* ---------- Rótulos de seção ---------- */
.rotulo {
  font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--suave); margin: 24px 4px 10px;
}
.rotulo:first-child { margin-top: 6px; }

/* ---------- Cartões ---------- */
.cartao { background: var(--card); border: 1px solid var(--linha); border-radius: var(--raio); overflow: hidden; }
.cartao + .cartao { margin-top: 12px; }
.destaque { background: var(--tinta-forte); color: #fff; border-radius: 22px; padding: 22px 24px; }
.destaque .leg { color: #A9A9C4; font-weight: 600; font-size: .95rem; }
.destaque .big { font-family: var(--fonte-titulo); font-size: clamp(2rem, 8vw, 2.9rem); font-weight: 800; letter-spacing: -.03em; color: #4ADE80; margin: 4px 0 6px; }
.destaque .big.neg { color: #FB7185; }
.destaque .det { color: #9898B6; font-size: .9rem; }

.duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--linha); border-radius: var(--raio); padding: 16px 18px; }
.kpi .leg { color: var(--suave); font-weight: 600; font-size: .88rem; }
.kpi .big { font-family: var(--fonte-titulo); font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin: 2px 0; }
.kpi .det { color: var(--suave); font-size: .82rem; }
.kpi.alerta { border-color: #F3C3BD; background: #FFF8F7; }
.kpi.alerta .det { color: var(--vermelho); font-weight: 700; }

/* linhas dentro de cartão */
.linha { display: flex; align-items: center; gap: 14px; padding: 15px 18px; width: 100%; background: none; border: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.linha + .linha { border-top: 1px solid var(--linha); }
.linha .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--icone-bg); color: var(--tinta); display: grid; place-items: center; flex: none; }
.linha .meio { flex: 1; min-width: 0; }
.linha .lab { display: block; font-size: .82rem; color: var(--suave); font-weight: 600; }
.linha .val { display: block; font-weight: 700; word-break: break-word; }
.linha .vlr { font-family: var(--fonte-titulo); font-weight: 700; text-align: right; white-space: nowrap; }
.linha .vlr small { display: block; font-weight: 500; font-size: .76rem; color: var(--suave); }
.linha .seta { color: #B9B9C8; flex: none; }
.linha:active { background: #FAFAFC; }
.linha.estatica { cursor: default; }
.linha.estatica:active { background: none; }
/* Em tela estreita, as linhas de lista quebram: situação e valor em cima, texto embaixo. */
@media (max-width: 620px) {
  .linha.lista { flex-wrap: wrap; row-gap: 8px; }
  .linha.lista > .chip { order: 1; }
  .linha.lista > .vlr { order: 2; margin-left: auto; }
  .linha.lista > .seta { order: 3; }
  .linha.lista > .meio { order: 4; flex-basis: 100%; }
  .linha.lista > .btn { order: 5; flex-basis: 100%; }
}

/* ---------- Chips e status ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); color: #3A3A57; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.chip svg { width: 16px; height: 16px; }
.chip.ponto::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.verde { background: var(--verde-bg); color: var(--verde); }
.chip.indigo { background: var(--indigo-bg); color: var(--indigo); }
.chip.ambar { background: var(--ambar-bg); color: var(--ambar); }
.chip.vermelho { background: var(--vermelho-bg); color: var(--vermelho); }

/* ---------- Título do detalhe ---------- */
.titulo-det { font-family: var(--fonte-titulo); font-size: 1.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: -.02em; margin: 4px 0 2px; line-height: 1.15; }
.sub-det { color: var(--suave); font-size: 1.02rem; text-transform: uppercase; margin-bottom: 16px; }

/* ---------- Atalhos (Ligar, Rota, …) ---------- */
.atalhos { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-bottom: 8px; }
.atalho { background: var(--card); border: 1px solid var(--linha); border-radius: 16px; padding: 14px 6px; display: grid; justify-items: center; gap: 8px; font: inherit; font-weight: 700; font-size: .88rem; color: var(--tinta); text-decoration: none; cursor: pointer; }
.atalho .ico { width: 42px; height: 42px; border-radius: 50%; background: var(--icone-bg); display: grid; place-items: center; }
.atalho:active { background: #FAFAFC; }

/* ---------- Histórico ---------- */
.linha-tempo { list-style: none; margin: 0; padding: 0 4px; }
.linha-tempo li { position: relative; padding: 0 0 20px 26px; }
.linha-tempo li::before { content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--indigo); }
.linha-tempo li::after { content: ""; position: absolute; left: 5px; top: 19px; bottom: 0; width: 2px; background: var(--linha); }
.linha-tempo li:last-child { padding-bottom: 0; }
.linha-tempo li:last-child::after { display: none; }
.linha-tempo li.cinza::before { background: #9CA3AF; }
.linha-tempo li.verde::before { background: #16A34A; }
.linha-tempo b { display: block; font-weight: 800; }
.linha-tempo span { color: var(--suave); font-size: .9rem; }

/* ---------- Botões ---------- */
.btn-principal {
  font-family: var(--fonte-titulo);
  width: 100%; background: var(--tinta-forte); color: #fff; border: none; border-radius: 16px;
  padding: 17px 20px; font: inherit; font-weight: 800; font-size: 1.02rem; cursor: pointer; min-height: 56px;
}
.btn-principal:disabled { background: #6B6B8A; cursor: not-allowed; }
.btn-principal.verde { background: var(--verde); }
.btn-principal.claro { background: var(--chip); color: var(--tinta); }
.btn-principal.ouro { background: var(--ouro); color: #1B1404; }
.btn-principal.perigo { background: var(--vermelho-bg); color: var(--vermelho); }
.btn { font: inherit; font-weight: 700; border: 1px solid var(--linha); border-radius: 14px; padding: 11px 16px; min-height: 46px; cursor: pointer; background: var(--card); color: var(--tinta); }
.btn.escuro { background: var(--tinta-forte); color: #fff; border-color: var(--tinta-forte); }
.btn.ouro { background: var(--ouro); color: #1B1404; border-color: var(--ouro); }
.btn.verde { background: var(--verde-bg); color: var(--verde); border-color: transparent; }
.btn.perigo { background: var(--vermelho-bg); color: var(--vermelho); border-color: transparent; }
.btn.pequeno { min-height: 38px; padding: 7px 13px; font-size: .86rem; border-radius: 11px; }
.acoes { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.acoes .btn { flex: 1 1 auto; }

.filtros { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 14px; padding: 0 16px 2px; }
.filtros::-webkit-scrollbar { display: none; }
.filtros button { flex: none; font: inherit; font-weight: 700; font-size: .88rem; border: 1px solid var(--linha); background: var(--card); color: #4B4B63; border-radius: 999px; padding: 9px 16px; cursor: pointer; min-height: 42px; }
.filtros button[aria-pressed="true"] { background: var(--tinta-forte); border-color: var(--tinta-forte); color: #fff; }
.resumo-linha { display: flex; gap: 16px; flex-wrap: wrap; color: var(--suave); font-size: .9rem; font-weight: 600; margin: -4px 4px 12px; }
.resumo-linha b { color: var(--tinta); }

.vazio { text-align: center; color: var(--suave); padding: 34px 18px; background: var(--card); border: 1px solid var(--linha); border-radius: var(--raio); }
.vazio b { display: block; color: var(--tinta); margin-bottom: 4px; }

/* ---------- Barra de ação fixa ---------- */
.rodape-acao {
  position: fixed; left: 0; right: 0; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 18;
  padding: 10px 16px; background: linear-gradient(to top, var(--fundo) 65%, transparent);
}
.rodape-acao > div { max-width: 760px; margin: 0 auto; display: flex; gap: 10px; }
.rodape-acao .btn-principal { flex: 1; }

/* ---------- Barra de abas ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 19; background: var(--card);
  border-top: 1px solid var(--linha); display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; background: none; border: none; font: inherit; font-size: .72rem; font-weight: 700; color: var(--suave);
  display: grid; justify-items: center; gap: 3px; padding: 10px 2px 9px; cursor: pointer; position: relative;
}
.tabbar button[aria-current="true"] { color: var(--tinta); }
.tabbar button[aria-current="true"]::after { content: ""; position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--indigo); }

/* ---------- Formulários ---------- */
label { display: grid; gap: 5px; font-size: .75rem; font-weight: 800; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; }
input, select, textarea {
  font: inherit; font-size: 16px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--tinta);
  background: #F4F4F7; border: 1.5px solid transparent; border-radius: 12px; padding: 12px 14px; min-height: 48px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--indigo); background: #fff; }
textarea { min-height: 84px; resize: vertical; }
.campos { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.campos .largo { grid-column: 1 / -1; }
.secao { font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--suave); margin: 20px 0 8px; }

dialog { border: none; border-radius: 24px 24px 0 0; padding: 0; width: min(680px, 100vw); max-width: 100vw; max-height: 94dvh; margin: auto auto 0; box-shadow: 0 -10px 40px rgb(13 13 43 / .25); }
@media (min-width: 700px) { dialog { border-radius: 24px; margin: auto; max-height: calc(100dvh - 40px); } }
dialog::backdrop { background: rgb(13 13 43 / .5); }
#dialogo-corpo { padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); }
#dialogo-corpo h2 { font-family: var(--fonte-titulo); margin: 0 0 14px; font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; }
.rodape-form { display: grid; gap: 10px; margin-top: 20px; }
.rodape-form .dois { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nota { background: var(--indigo-bg); color: #312A9E; padding: 12px 14px; border-radius: 14px; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }

.aviso { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--tinta-forte); color: #fff; padding: 13px 20px; border-radius: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: calc(100vw - 32px); font-weight: 700; }
.aviso.mostrar { opacity: 1; }
.aviso.ruim { background: var(--vermelho); }

/* ---------- Entrar ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--tinta-forte); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 24px; padding: 30px 24px; text-align: center; display: grid; gap: 14px; }
.login-card label { text-align: left; }
.login-logo { width: 190px; max-width: 70%; margin: 0 auto 4px; }

/* ---------- Barras das categorias ---------- */
.barras { padding: 16px 18px; display: grid; gap: 12px; }
.barra { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; font-size: .92rem; font-weight: 600; }
.barra .trilho { grid-column: 1 / -1; height: 7px; background: var(--chip); border-radius: 99px; overflow: hidden; }
.barra .trilho span { display: block; height: 100%; background: var(--indigo); border-radius: 99px; }
.barra b { font-weight: 800; }
