/* RENGUI — App do Frete (visual 2.11: entrada minimalista em marinho, alvos de 44 px, só tema claro)
   Identidade: azul-marinho, dourado envelhecido e branco. Logo RG (o G é uma estrada),
   estrada em perspectiva como desenho de fundo. Letras: Manrope (textos) e Archivo (marca e números), servidas pelo próprio app.
   Uma coluna de celular, botões grandes, um assunto por tela. */
@font-face { font-family: "Archivo"; src: url("fonts/archivo-latin.woff2") format("woff2"); font-weight: 500 800; font-stretch: 100% 125%; font-style: normal; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("fonts/manrope-latin.woff2") format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; }
:root {
  --bg: #EEF2F7;
  --surface: #FFFFFF;
  --ink: #0E1726;
  --muted: #5B6577;
  --line: #CFD7E2;
  --sombra: 0 1px 2px rgba(11, 27, 51, .06), 0 4px 14px rgba(11, 27, 51, .05);
  --navy: #0B1B33;
  --navy-2: #1A3358;
  --navy-line: #2A4470;
  --ico-bg: #0B1B33;
  --card-navy: #0B1B33;
  --on-navy: #FFFFFF;
  --on-navy-muted: #C3CAD6;
  --gold: #B8954F;
  --gold-light: #D6BC85;
  --gold-text: #7A5E28;
  --on-gold: #0B1B33;
  --accent: #0B1B33;
  --accent-ink: #FFFFFF;
  --accent-soft: #E6EBF3;
  --positive: #1E6B4A;
  --warn-soft: #F6EEDC;
  --danger: #A12C23;
  --danger-ink: #FFFFFF;
  --danger-soft: #F5DCD8;
  --font-body: "Manrope", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Archivo", "Manrope", -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
html { touch-action: manipulation; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; font-weight: 500; line-height: 1.45; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, .big, .act, .item, .cat, .chip, .notabar { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* Topo (marinho, de ponta a ponta) */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--navy); }
.bar { position: sticky; top: 0; z-index: 5; background: var(--navy); color: var(--on-navy); border-bottom: 2px solid var(--gold); padding-top: env(safe-area-inset-top, 0px); }
.bar-in { max-width: 480px; margin: 0 auto; display: flex; align-items: center; gap: 6px; min-height: 58px; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
.bar #backBtn { margin-left: -8px; flex: none; }
.bar h1 { flex: 1; min-width: 0; margin: 0; text-align: left; font-size: 16px; font-weight: 800; line-height: 1.2; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.bar .right { margin-left: auto; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand svg { width: 28px; height: 28px; flex: none; }
.wordmark { font-family: var(--font-num); font-weight: 800; font-stretch: 125%; letter-spacing: .14em; text-transform: uppercase; line-height: 1; }
.bar .wordmark { font-size: 15px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--on-navy-muted); }
.bar.off { border-bottom-color: #E2B04A; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #6FCF97; }
.status.off::before { background: #E2B04A; }
.status.sending::before { background: var(--gold-light); }
.status.demo::before { background: #9AA6B8; }
.icon-btn { width: 46px; height: 46px; border: 1px solid transparent; background: transparent; border-radius: 12px; display: grid; place-items: center; color: var(--on-navy); }
.icon-btn.right { border-color: transparent; color: var(--gold-light); }
.icon-btn:hover { background: var(--navy-2); }
.icon-btn svg { width: 21px; height: 21px; }

.app {
  max-width: 480px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 18px 48px;
}
.stack { display: flex; flex-direction: column; gap: 10px; }
.banner { background: var(--warn-soft); border-radius: 14px; padding: 10px 12px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.banner.info { background: var(--accent-soft); }
/* Aviso de edição simultânea: a viagem ou o lançamento mudou no banco enquanto o formulário estava aberto. */
.banner.mudou { border: 1px solid var(--gold-text); font-weight: 700; line-height: 1.4; }
.banner.mudou p { margin: 0; }
.banner.mudou .link { padding-top: 0; }
.field :is(input, select, textarea).campo-atualizado { border-color: var(--gold-text); background: var(--warn-soft); }
.field :is(input, select, textarea).campo-conflito { border-color: var(--danger); background: var(--danger-soft); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 3px; gap: 3px; }
.tabs button { min-height: 46px; border: 0; border-radius: 11px; background: transparent; font-weight: 800; font-size: 14px; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.tabs button { position: relative; }
.tabs .badge { position: absolute; top: 4px; right: 8px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--gold); color: var(--on-gold); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
h2.sec .sec-n { color: var(--ink); font-family: var(--font-num); letter-spacing: 0; margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 800; font-size: 14px; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Cartões marinho com a estrada ao fundo */
.trip { position: relative; overflow: hidden; background: var(--card-navy); color: var(--on-navy); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.trip > .deco, .kpi > .deco { display: none; }
.trip > * { position: relative; }
.deco { position: absolute !important; inset: 0; pointer-events: none; }
.deco svg { position: absolute; right: -10px; bottom: 0; width: 72%; height: 100%; }
.eyebrow { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--on-navy-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { display: inline-block; font-size: 11px; letter-spacing: .1em; padding: 2px 8px; border-radius: 999px; background: var(--gold); color: var(--on-gold); font-weight: 800; }
.pill.done { background: transparent; color: var(--on-navy); box-shadow: inset 0 0 0 1px var(--on-navy-muted); display: inline-flex; align-items: center; gap: 4px; }
.pill.done svg { width: 11px; height: 11px; }
.pill.wait { background: transparent; color: var(--gold-light); box-shadow: inset 0 0 0 1px var(--gold-light); }
.route { font-family: var(--font-num); font-weight: 800; font-stretch: 105%; font-size: 17px; line-height: 1.1; margin: 0; text-transform: uppercase; text-wrap: balance; overflow-wrap: anywhere; }
.route .arrow { color: var(--gold); }
.route.small { font-size: 16px; }
.trip.compact { padding: 16px; gap: 8px; }
.sub { margin: 0; color: var(--muted); font-size: 16px; }
.trip .sub { color: var(--on-navy-muted); font-size: 13px; }
.cash { margin-top: 4px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .12); display: flex; flex-direction: column; gap: 2px; }
.cash span { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--on-navy-muted); }
.cash b { font-family: var(--font-num); font-size: 26px; line-height: 1.1; font-weight: 700; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.cash small { color: var(--on-navy-muted); font-size: 12px; }
.trip-links { display: flex; flex-wrap: wrap; gap: 0 20px; }
/* Comissão no cartão: só leitura para o motorista; para o gestor, abre a correção da viagem. */
.trip-com { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .12); color: var(--on-navy); }
button.trip-com { grid-template-columns: minmax(0, 1fr) auto 12px; cursor: pointer; }
.trip-com .tc-rot { display: block; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--on-navy-muted); }
.trip-com small { display: block; margin-top: 2px; color: var(--on-navy-muted); font-size: 12px; overflow-wrap: anywhere; }
.trip-com b { font-family: var(--font-num); font-size: 18px; line-height: 1.1; font-weight: 700; color: var(--on-navy); white-space: nowrap; font-variant-numeric: tabular-nums; }
.trip-com .chev { font-size: 22px; line-height: 1; color: var(--gold-light); }
button.trip-com:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
button.trip-com:active { opacity: .78; }
@media (hover: hover) { button.trip-com:hover b { color: var(--gold-light); } }
.cash.neg b { color: #F2A097; }
.link { background: none; border: 0; padding: 8px 0; min-height: 44px; display: inline-flex; align-items: center; color: var(--gold-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; align-self: flex-start; text-align: left; }
.trip .link { color: var(--gold-light); }
.link.danger { color: var(--danger); }

.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.act { min-height: 80px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sombra); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 10px 3px; text-align: center; font-size: 14px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; color: var(--ink); overflow-wrap: anywhere; }
.ico-c { width: 32px; height: 32px; border-radius: 50%; background: var(--ico-bg); color: var(--gold-light); display: grid; place-items: center; flex: none; }
.ico-c svg { width: 17px; height: 17px; }
.act:active { transform: scale(.98); }
.act.finish { grid-column: 1 / -1; min-height: 66px; flex-direction: row; align-items: center; justify-content: center; background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-size: 19px; }
.act.finish svg { width: 24px; height: 24px; }
.big { width: 100%; min-height: 52px; border-radius: 14px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 18px; text-align: center; }
.big svg { width: 21px; height: 21px; flex: none; }
.big.gold { background: var(--gold); color: var(--on-gold); }
.big.slim { min-height: 46px; font-size: 15px; border-radius: 12px; }
.trip .big.ghost { background: transparent; color: var(--on-navy); border-color: var(--navy-line); }
.trip .big.ghost svg { color: var(--gold-light); }
.big[disabled] { opacity: .5; }
select { appearance: auto; }
.big.ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.big.ghost svg { color: var(--gold-text); }
.big.danger { background: var(--danger); color: var(--danger-ink); }
.big:disabled { opacity: .6; cursor: default; }
label.big { cursor: pointer; }

h2.sec { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 8px 0 0; }
.totals { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--muted); }
.totals b { color: var(--ink); font-family: var(--font-num); }
.items { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--sombra); }
/* Cartão branco com o título dentro (Lançamentos) */
.bloco { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--sombra); }
.bloco-cab { padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 3px; }
.bloco-cab h2 { margin: 0; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.bloco .items { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.bloco .empty { padding: 0 14px 14px; font-size: 14px; }
.bloco-mais { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 12px 14px; border-top: 1px solid var(--line); text-align: center; font-weight: 800; font-size: 14px; color: var(--gold-text); cursor: pointer; }
.bloco-mais:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.bloco-dica { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
/* Incluir lançamento numa viagem fechada (gestor). */
.bloco-add { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.bloco-add button { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 48px; padding: 8px 4px; font-weight: 800; font-size: 13px; color: var(--gold-text); cursor: pointer; text-align: center; min-width: 0; }
.bloco-add button + button { border-left: 1px solid var(--line); }
.bloco-add svg { width: 15px; height: 15px; flex: none; }
.bloco-add button:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.bloco-add button:active { background: var(--accent-soft); }
@media (max-width: 360px) { .bloco-add svg { display: none; } }
.items li + li { border-top: 1px solid var(--line); }
.item { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px; min-height: 56px; }
.item.static { cursor: default; }
.item:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.item:not(.static):active, .notabar:active { background: var(--accent-soft); }
.big:active:not([disabled]) { filter: brightness(.94); }
/* Listas longas: o celular só desenha o que está aparecendo na tela. */
.items li { content-visibility: auto; contain-intrinsic-size: auto 72px; }
.item .ico { width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; color: var(--ink); }
.item .ico svg { width: 17px; height: 17px; }
.item .ico.cashico { background: var(--warn-soft); color: var(--gold-text); }
.item .ico.numico { background: var(--ico-bg); color: var(--gold-light); font-family: var(--font-num); font-weight: 800; font-size: 13px; }
.item .what { min-width: 0; font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.item .what small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.item .val { text-align: right; font-family: var(--font-num); font-size: 15px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item .val small { display: block; font-family: var(--font-body); font-weight: 700; font-size: 12.5px; color: var(--muted); }
.item .val small.adi { color: var(--gold-text); }
.item .val small.espera { color: var(--gold-text); }
.item .val small.ok { color: var(--positive); display: inline-flex; align-items: center; gap: 3px; justify-content: flex-end; }
.item .what small.ok { color: var(--positive); font-weight: 700; }
.item .val small.ok svg { width: 12px; height: 12px; }
.item .val.neg { color: var(--danger); }
.empty { color: var(--muted); padding: 16px; margin: 0; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; box-shadow: var(--sombra); }
.kpi.vazio b { color: var(--muted); }
.var { font-style: normal; font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 999px; margin-left: 6px; white-space: nowrap; vertical-align: 2px; }
.var.sobe { background: #DDF3E6; color: var(--positive); }
.var.desce { background: var(--danger-soft); color: var(--danger); }
.var.igual { background: var(--accent-soft); color: var(--muted); }
.kpi > * { position: relative; }
.kpi.wide { grid-column: 1 / -1; background: var(--card-navy); border-color: var(--card-navy); color: var(--on-navy); }
.kpi span { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 800; }
.kpi.wide span { color: var(--gold-light); }
.kpi b { font-family: var(--font-num); font-size: clamp(18px, 5vw, 22px); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kpi.wide b { font-size: clamp(22px, 7vw, 28px); }
.kpi small { color: var(--muted); font-size: 13px; }
.kpi.wide small { color: var(--on-navy-muted); }
.kpi small b { font-size: 14px; font-family: var(--font-body); font-weight: 800; color: var(--ink); }
.kpi.wide small b { color: var(--gold-light); font-size: 14px; }
.kpi small b.neg { color: var(--danger); }
.kpi.wide small b.neg { color: #F2A097; }

/* Formulários */
.form { display: flex; flex-direction: column; gap: 16px; }
.ftitle { font-family: var(--font-num); font-weight: 800; font-stretch: 105%; font-size: 21px; text-transform: uppercase; line-height: 1.05; margin: 0; color: var(--ink); }
.hint { color: var(--muted); font-size: 14px; margin: -8px 0 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 15px; }
.field small { font-weight: 500; color: var(--muted); font-size: 13px; }
.field input, .field textarea, .field select { width: 100%; min-height: 52px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px 14px; font-size: 19px; font-weight: 600; color: var(--ink); }
.field textarea { min-height: 84px; font-size: 16px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(184, 149, 79, .25); }
.field input.bad, .field textarea.bad, .field select.bad { border-color: var(--danger); background: var(--danger-soft); }
/* Erro de validação junto do campo */
.campo-erro { display: flex; align-items: flex-start; gap: 6px; margin: -10px 0 0; color: var(--danger); font-size: 14px; font-weight: 800; line-height: 1.3; }
.campo-erro::before { content: ""; flex: none; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--danger); }
.km-ultimo { margin-top: -10px; min-height: 44px; }
.pair > .km-ultimo { grid-column: 1 / -1; margin-top: -6px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
/* Rótulo, sub-rótulo e campo alinhados entre os dois lados (subgrid; sem ele, o campo alinha pelo pé). O erro ocupa a linha inteira. */
.pair > .field { display: grid; grid-template-rows: subgrid; grid-row: span 3; align-content: end; }
.pair > .field > small { grid-row: 2; }
.pair > .field > :is(input, select, span) { grid-row: 3; }
.pair > .campo-erro { grid-row: 4; grid-column: 1 / -1; margin-top: -6px; }
.pair input[type="date"] { padding-inline: 10px; font-size: 17px; }
.pair > * { min-width: 0; }
.live { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; font-size: 16px; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.live b { font-family: var(--font-num); font-size: 22px; color: var(--gold-text); }
.live small { display: block; font-size: 13px; color: var(--muted); }
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.seg legend { font-weight: 800; font-size: 15px; margin-bottom: 6px; padding: 0; }
.seg .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg .opts.opts3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg span small { display: block; font-weight: 600; font-size: 12px; color: var(--muted); margin-top: 2px; }
.seg label { position: relative; display: flex; }
.seg label > span { flex: 1; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 52px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); padding: 8px 10px; font-size: 15px; font-weight: 800; line-height: 1.15; }
.seg input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.seg input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.err { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 10px 14px; font-weight: 800; font-size: 16px; margin: 0; }
/* Confirmação em folha: sobe do pé da tela sobre um fundo escurecido. */
.folha { position: fixed; inset: 0; z-index: 25; display: flex; flex-direction: column; justify-content: flex-end; }
.folha-fundo { position: absolute; inset: 0; border: 0; padding: 0; background: rgba(11, 27, 51, .5); animation: fundo-entra .2s ease-out both; cursor: default; }
.folha-caixa { position: relative; width: 100%; max-width: 520px; margin: 0 auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px 20px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 -12px 40px rgba(0, 0, 0, .25); animation: folha-sobe .28s cubic-bezier(.2, .8, .2, 1) both; }
.folha-puxador { width: 40px; height: 4px; border-radius: 2px; background: var(--line); align-self: center; margin-bottom: 4px; }
.folha-caixa h2 { margin: 2px 0 0; font-size: 19px; font-weight: 800; line-height: 1.25; }
.folha-caixa p { margin: 0 0 4px; color: var(--muted); font-size: 15px; line-height: 1.4; }
@keyframes fundo-entra { from { opacity: 0; } }
@keyframes folha-sobe { from { transform: translateY(40px); opacity: 0; } }

.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat { min-height: 62px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--sombra); font-size: 15px; font-weight: 800; padding: 10px 14px; text-align: left; line-height: 1.15; color: var(--ink); }
.cat small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 3px; }
.cats.uma { grid-template-columns: 1fr; }
.cats.uma .cat { min-height: 56px; }
.cat[aria-current="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.cat:active { transform: scale(.98); }

/* Acerto e fechamento */
.acerto { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.acerto .row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 16px; font-size: 15px; align-items: baseline; }
.acerto .row + .row, .acerto .result + .row { border-top: 1px solid var(--line); }
.acerto .row b { font-family: var(--font-num); font-size: 17px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.acerto .row span small { display: block; color: var(--muted); font-size: 13px; }
.result { padding: 15px 16px; font-size: 16px; font-weight: 800; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.result b { font-family: var(--font-num); font-size: 26px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.result.pay { background: var(--card-navy); color: var(--on-navy); border-top: 2px solid var(--gold); }
.result.pay b { color: var(--gold-light); }
.result.owe { background: var(--warn-soft); }
.result.owe b { color: var(--gold-text); }
.result.zero { background: var(--bg); }
.result.good b { color: var(--positive); }
.grid-info { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.grid-info div { background: var(--surface); padding: 10px 12px; min-width: 0; }
.grid-info span { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.grid-info b { font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
/* Passos da viagem fechada: fechada → conferência → acerto */
.passos { list-style: none; margin: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sombra); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; counter-reset: passo; }
.passos li { position: relative; padding-top: 26px; min-width: 0; }
.passos li::before { content: ""; position: absolute; top: 8px; left: 0; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); box-sizing: border-box; }
.passos li::after { content: ""; position: absolute; top: 16px; left: 22px; right: -8px; height: 2px; background: var(--line); }
.passos li:last-child::after { display: none; }
.passos li.feito::before { background: var(--navy); border-color: var(--navy); box-shadow: inset 0 0 0 4px var(--navy), inset 0 0 0 6px #FFFFFF; }
.passos li.feito::after { background: var(--navy); }
.passos li.atual::before { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 149, 79, .25); animation: pulsa 1.6s ease-in-out infinite; }
.passos b { display: block; font-size: 13px; font-weight: 800; line-height: 1.2; }
.passos small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.passos li.atual small { color: var(--gold-text); font-weight: 700; }
.foot { color: var(--muted); font-size: 13px; text-align: center; margin-top: 8px; }
.perfil { display: flex; align-items: center; gap: 14px; background: var(--card-navy); color: var(--on-navy); border-radius: 16px; padding: 14px 16px; }
.perfil .avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--gold); color: var(--on-gold); display: grid; place-items: center; font-family: var(--font-num); font-size: 24px; font-weight: 800; }
.perfil b { display: block; font-size: 18px; font-weight: 800; line-height: 1.2; }
.perfil small { display: block; color: var(--on-navy-muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
button.gestao-link { cursor: pointer; }

/* Abertura do app (~1,3 s): a estrada do G se traça, o R se monta por dentro, o nome é "digitado"; depois o logo e o nome viajam até a marca da entrada.
   Tempos amarrados ao app.js (ESTRADA_MS = fim da estrada, ABERTURA_MS = fim do nome). O R e o nome animam só transform e
   opacidade (camadas próprias, fora da thread principal); só a estrada usa stroke-dashoffset, e o app não carrega nada pesado enquanto ela se desenha. */
#abertura { position: fixed; inset: 0; z-index: 60; background: #0B1B33; display: grid; place-items: center; transition: opacity .3s ease, background-color .4s ease; }
#abertura.sai { opacity: 0; pointer-events: none; }
#abertura.entrega { background-color: transparent; pointer-events: none; }
.ab-caixa { display: grid; justify-items: center; gap: 18px; }
.ab-logo { position: relative; width: 132px; height: 132px; transform-origin: 0 0; }
.ab-peca { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ab-nome-caixa { position: relative; font-size: 30px; color: #FFFFFF; transform-origin: 0 0; }
.ab-nome { white-space: nowrap; }
#abertura.entrega .ab-logo, #abertura.entrega .ab-nome-caixa { transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.ab-g { fill: none; stroke: #C9A55C; stroke-width: 27; stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: ab-traca .5s cubic-bezier(.4, 0, .2, 1) .05s forwards; }
@keyframes ab-traca { to { stroke-dashoffset: 0; } }
.ab-faixa { fill: none; stroke: #0B1B33; stroke-width: 3.5; stroke-dasharray: 11 9; }
/* Cada peça do R cresce a partir do ponto de onde nasce (em % da caixa 200×200 do logo): haste de baixo, bojo da haste, perna do bojo. */
.ab-haste, .ab-bojo, .ab-perna { fill: #FFFFFF; opacity: 0; will-change: transform, opacity; animation: ab-monta .22s cubic-bezier(.2, .8, .2, 1) forwards; }
.ab-haste { transform-origin: 36.5% 72%; transform: scaleY(0); animation-delay: .4s; }
.ab-bojo { transform-origin: 42.5% 42%; transform: scaleX(0); animation-delay: .5s; }
.ab-perna { transform-origin: 59.25% 55%; transform: scaleY(0); animation-delay: .6s; }
@keyframes ab-monta { from { opacity: 1; } to { opacity: 1; transform: none; } }
/* O nome: uma letra a cada 60 ms a partir de 0,76 s; o cursor dourado fica logo depois da última letra que apareceu e some no fim. */
.ab-nome > span { position: relative; display: inline-block; opacity: 0; will-change: transform, opacity; animation: ab-letra .12s ease-out calc(.76s + var(--i) * .06s) forwards; }
@keyframes ab-letra { from { opacity: 0; transform: translateY(.12em); } to { opacity: 1; transform: none; } }
.ab-nome > span::after { content: ""; position: absolute; left: 100%; top: .1em; width: 3px; height: .9em; margin-left: .04em; background: #C9A55C; opacity: 0; animation: ab-cursor .06s linear calc(.76s + var(--i) * .06s) forwards; }
.ab-nome > span:last-child::after { animation: ab-cursor-fim .4s linear 1.06s forwards; }
@keyframes ab-cursor { 0%, 99% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ab-cursor-fim { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
/* Enquanto a abertura está na tela, a entrada espera; na entrega, a marca da entrada fica escondida até o logo chegar. */
body.abrindo .entrada > * { animation: none; opacity: 0; }
body.entregando .e-topo { visibility: hidden; }

/* Entrada: marinho liso, marca, frase e formulário ao centro. Sem cartão, sem cenário. */
body.entrada-tela { background: #081427; }
/* A página tem o mesmo marinho da abertura enquanto ela está na tela: se o iPhone deixar alguma faixa fora da camada fixa
   (já aconteceu no pé da tela, no app instalado), ela não aparece clara. Vem depois da entrada: na abertura vale este. */
body.abrindo { background: #0B1B33; }
.e-cena { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(70% 90% at 50% 120%, rgba(38, 72, 122, .55), transparent 70%), #081427; }
body.entrada-tela .app { min-height: 100dvh; display: flex; flex-direction: column; gap: 0; padding-top: 0; padding-bottom: max(14px, env(safe-area-inset-bottom, 0px)); }
body.entrada-tela #view { flex: 1; display: flex; flex-direction: column; }
.entrada { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; color: #FFFFFF; padding-top: env(safe-area-inset-top, 0px); }
.entrada > * { animation: sobe .6s cubic-bezier(.2, .8, .2, 1) both; }
.entrada > .login { animation-delay: .1s; }
/* A marca chega pela entrega da abertura (sem o "sobe", a medida bate); a frase espera o nome passar. */
.entrada > .e-topo { animation: none; }
.entrada > .e-frase { animation-delay: .4s; }
/* Marca da entrada: logo em cima, nome embaixo, centrados (a abertura entrega o logo e o nome exatamente aqui). */
.e-topo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 14px; }
.e-topo .logo { width: 80px; height: 80px; }
.e-topo .wordmark { font-size: 24px; }
.e-frase { margin: 0 2px 10px; font-size: 16px; line-height: 1.35; color: rgba(255, 255, 255, .76); text-align: center; }
.login { display: flex; flex-direction: column; gap: 12px; }
.login .field { color: rgba(255, 255, 255, .84); font-size: 14px; font-weight: 600; }
.login .field small { color: rgba(255, 255, 255, .7); }
.login .field input { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .2); color: #FFFFFF; font-size: 18px; }
.login .field input::placeholder { color: rgba(255, 255, 255, .45); }
.login .field input:focus { border-color: var(--gold-light); box-shadow: 0 0 0 3px rgba(214, 188, 133, .3); }
.login .field input.bad { background: rgba(161, 44, 35, .35); border-color: #F2897E; }
.login .campo-erro { color: #FFC9C2; }
.login .campo-erro::before { background: #FFC9C2; }
.login .big.gold { min-height: 54px; font-size: 17px; margin-top: 2px; }
/* Usuário lembrado: entra só com a senha */
.e-quem { display: flex; align-items: center; gap: 12px; }
.e-quem .avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: var(--on-gold); display: grid; place-items: center; font-family: var(--font-num); font-size: 22px; font-weight: 800; }
.e-quem b { display: block; font-size: 18px; font-weight: 800; color: #FFFFFF; line-height: 1.2; }
.e-quem .link { color: var(--gold-light); padding: 4px 0; min-height: 44px; margin-block: -6px; font-size: 13.5px; }
.senha-caixa { position: relative; display: block; }
.senha-caixa input { padding-right: 56px; }
.olho { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 46px; height: 46px; border: 0; border-radius: 10px; background: transparent; color: rgba(255, 255, 255, .8); display: grid; place-items: center; }
.olho svg { width: 22px; height: 22px; }
.olho[aria-pressed="true"] { color: var(--gold-light); }
@keyframes sobe { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* Gestão no celular */
.hoje-dados { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .12); }
.hoje-dados div { min-width: 0; }
.hoje-dados span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--on-navy-muted); }
.hoje-dados b { display: block; font-size: 17px; font-weight: 700; color: var(--on-navy); overflow-wrap: anywhere; }
.hoje-dados b.neg { color: #F2A097; }
.hoje-dados .alerta b { color: #F2C66D; }
.hoje-dados .alerta span::after { content: " !"; color: #F2C66D; }
.linha-bts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.linha-bts .big { width: auto; flex: 1 1 140px; }
.contato { display: flex; gap: 8px; }
.contato .big { width: auto; flex: 1 1 110px; text-decoration: none; }
.contato.mini .big { min-height: 44px; font-size: 14px; padding: 8px 10px; }
.contato.mini .big svg { width: 18px; height: 18px; }
.banner .contato { align-self: stretch; }
.trip .contato .big { background: rgba(255, 255, 255, .08); color: var(--on-navy); border-color: var(--navy-line); }
.trip .contato .big svg { color: var(--gold-light); }
.gestao-link { text-decoration: none; justify-content: flex-start; text-align: left; gap: 12px; min-height: 64px; }
.gestao-link span { flex: 1; min-width: 0; }
.gestao-link span small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
.gestao-link svg:last-child { color: var(--muted); width: 18px; height: 18px; }
.mes-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 4px; }
.mes-cab b { font-family: var(--font-num); font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.mes-cab small { color: var(--muted); font-size: 13px; font-weight: 700; }
.aviso-app span { display: flex; align-items: flex-start; gap: 8px; }
.aviso-app svg { width: 20px; height: 20px; flex: none; color: var(--gold-text); margin-top: 1px; }
.aviso-app .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.aviso-app .big.slim { min-height: 44px; }
.fechar-bts { display: contents; }

/* Troca de tela e aviso: movimentos curtos, nunca no caminho do toque. */
::view-transition-old(root) { animation: 120ms ease-out both some-tela; }
::view-transition-new(root) { animation: 180ms cubic-bezier(.2, .8, .2, 1) both entra-tela; }
@keyframes some-tela { to { opacity: 0; } }
@keyframes entra-tela { from { opacity: 0; transform: translateY(6px); } }
.toast { position: fixed; left: 16px; right: 16px; width: fit-content; margin-inline: auto; top: calc(66px + env(safe-area-inset-top, 0px)); background: var(--navy); color: var(--on-navy); border: 1px solid var(--gold); padding: 12px 18px; border-radius: 14px; font-size: 16px; font-weight: 700; max-width: calc(100% - 32px); z-index: 20; text-align: center; pointer-events: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); animation: toast-entra .2s cubic-bezier(.2, .8, .2, 1) both; }
body.entrada-tela .toast { top: auto; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.toast.some { animation: toast-sai .2s ease-in both; }
@keyframes toast-entra { from { opacity: 0; transform: translateY(-10px); } }
@keyframes toast-sai { to { opacity: 0; transform: translateY(-10px); } }
/* Notas fiscais e arquivos */
.anx { background: var(--surface); border: 1.5px dashed var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.anx-head { display: flex; flex-direction: column; gap: 2px; }
.anx-head b { font-size: 16px; font-weight: 800; }
.anx-head small { color: var(--muted); font-size: 14px; font-weight: 500; }
.anx-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.anx-btns .big { position: relative; min-height: 52px; font-size: 15px; padding: 8px 10px; gap: 8px; border-radius: 14px; }
.anx-btns .big svg { width: 22px; height: 22px; }
.anx-btns.mini .big { min-height: 44px; font-size: 14px; border-radius: 12px; }
.anx-btns.mini .big svg { width: 19px; height: 19px; }
.vh-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.thumb .t-open { all: unset; box-sizing: border-box; cursor: pointer; display: block; width: 100%; height: 100%; }
.thumb .t-open:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.pend img { opacity: .75; }
.t-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; color: var(--gold-text); }
.t-file svg { width: 28px; height: 28px; }
.t-file b { font-size: 13px; color: var(--ink); }
.t-prep { display: grid; place-items: center; height: 100%; padding: 6px; font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; animation: pulsa 1.2s ease-in-out infinite; }
@keyframes pulsa { 50% { opacity: .45; } }
.t-tag { position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: var(--navy); color: var(--gold-light); padding: 2px 7px; border-radius: 999px; pointer-events: none; }
/* Tirar arquivo: alvo de 44 px, desenho pequeno (círculo de 30 px no canto). */
.t-rm { position: absolute; top: -2px; right: -2px; width: 44px; height: 44px; border: 0; padding: 0; background: transparent; color: #FFFFFF; display: grid; place-items: center; }
.t-rm svg { width: 14px; height: 14px; box-sizing: content-box; padding: 8px; border-radius: 50%; background: rgba(11, 27, 51, .84); }
.nf { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; white-space: nowrap; vertical-align: 1px; font-family: var(--font-body); }
.nf svg { width: 12px; height: 12px; }
.nf.ok { background: var(--accent-soft); color: var(--ink); }
.nf.no { background: var(--warn-soft); color: var(--gold-text); }
.notabar { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.notabar:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.notabar.falta { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.notabar b { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.notabar small { display: block; color: var(--ink); font-size: 14px; font-weight: 700; margin-top: 2px; }
.notabar .chev { font-size: 24px; line-height: 1; color: var(--gold-text); }
.nf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.nf-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.nf-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.nf-top .what { min-width: 0; font-weight: 800; line-height: 1.25; }
.nf-top .what small { display: block; font-weight: 500; color: var(--muted); font-size: 14px; }

/* Visualizador de nota (sempre escuro, como uma galeria de fotos) */
.viewer { position: fixed; inset: 0; z-index: 30; background: #050B16; color: #FFFFFF; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.v-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 16px; border-bottom: 1px solid #1A3358; }
.v-name { min-width: 0; font-weight: 800; font-size: 16px; overflow-wrap: anywhere; }
.v-name small { display: block; font-weight: 500; color: #C3CAD6; font-size: 13px; }
.v-top .icon-btn { color: #FFFFFF; flex: none; }
.v-body { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 12px; overscroll-behavior: contain; }
.v-body img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; background: #FFFFFF; }
.v-body.zoom { display: block; }
.v-body.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
.v-msg { color: #C3CAD6; text-align: center; padding: 20px; margin: 0; }
.v-file { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #D6BC85; }
.v-file svg { width: 64px; height: 64px; }
.v-file b { color: #FFFFFF; font-size: 22px; }
.v-file small { color: #C3CAD6; font-size: 15px; }
.v-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px 16px; border-top: 1px solid #1A3358; }
.v-actions .big { min-height: 54px; }
.v-actions .big.ghost { background: transparent; color: #FFFFFF; border-color: #2A4470; }
.v-actions .big.ghost svg { color: #D6BC85; }
.v-actions .full { grid-column: 1 / -1; }
.v-actions .link { justify-self: center; align-self: center; color: #F2A097; }
.v-ask { grid-column: 1 / -1; margin: 0; font-weight: 800; text-align: center; }
body.no-scroll { overflow: hidden; }

@media (prefers-reduced-motion: reduce) { .act:active, .cat:active { transform: none; } .t-prep, .entrada > *, .toast, .folha-fundo, .folha-caixa, .passos li.atual::before { animation: none; } .ab-g { animation: none; stroke-dashoffset: 0; } .ab-haste, .ab-bojo, .ab-perna, .ab-nome > span { animation: none; opacity: 1; transform: none; } .ab-nome > span::after { display: none; } ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }
/* Celulares de 360 px: rótulos curtos continuam numa linha só. */
@media (max-width: 374px) { .act { font-size: 13px; padding-inline: 2px; } .anx-btns.mini .big { font-size: 13px; padding-inline: 6px; } }
