/* UaiCarro — coluna única estilo painel de instrumentos; barra de abas embaixo, formulários em tela cheia */
:root {
  --bg: #F1F4F7; --surface: #FFFFFF; --sunk: #E8EDF2; --ink: #15202B; --muted: #5A6874; --line: #DCE2E8;
  --brand: #C8102E; --accent: #1E4FD6; --accent-ink: #FFFFFF; --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --gas: #D9681A; --eta: #2B9550; --ok: #2B9550; --warn: #B7791F; --danger: #C2362B;
  --f-display: "Saira", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px; --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1216; --surface: #151C22; --sunk: #10171C; --ink: #E6EBEF; --muted: #94A1AC; --line: #25303A;
    --brand: #EF4A57; --accent: #7097FF; --accent-ink: #0D1216;
    --gas: #F0904A; --eta: #4FC27D; --ok: #4FC27D; --warn: #E2B04E; --danger: #F07468;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1216; --surface: #151C22; --sunk: #10171C; --ink: #E6EBEF; --muted: #94A1AC; --line: #25303A;
  --brand: #EF4A57; --accent: #7097FF; --accent-ink: #0D1216;
  --gas: #F0904A; --eta: #4FC27D; --ok: #4FC27D; --warn: #E2B04E; --danger: #F07468;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.45; min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
.num { font-family: var(--f-display); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.page { max-width: 720px; margin: 0 auto; width: 100%; }

/* ---------- barra superior ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 30; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); padding-block: 10px 8px; }
.top-row { display: flex; align-items: center; gap: 10px; }
.mark { width: 44px; height: auto; flex: none; display: block; }
.brand { font-family: var(--f-display); font-style: italic; font-weight: 800; font-size: 22px; letter-spacing: -.01em; line-height: 1; }
.brand .uai { color: var(--brand); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn { border: 0; background: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink); }
.icon-btn:active { background: var(--sunk); }
.icon-btn svg { width: 22px; height: 22px; }
.sync { display: flex; align-items: center; gap: 6px; border: 0; background: none; font-size: 12.5px; color: var(--muted); padding: 6px 8px; border-radius: 10px; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.sync.pending i { background: var(--warn); }
.sync.off i { background: var(--muted); }
.sync.err i { background: var(--danger); }
.sync.busy i { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.cars { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.cars::-webkit-scrollbar { display: none; }
.car-chip { text-decoration: none; color: var(--ink); flex: none; display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px 6px 10px; font-family: var(--f-display); font-weight: 600; font-size: 15px; }
.car-chip i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 25%, transparent); }
.car-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.car-chip.add { color: var(--muted); padding-left: 14px; }

/* ---------- conteúdo ---------- */
main { padding-block: 8px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 18px; }
h1 { font-family: var(--f-display); font-weight: 700; font-size: 26px; line-height: 1.15; margin: 0; text-wrap: balance; }
h2 { font-family: var(--f-display); font-weight: 600; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0; }
.panel { background: var(--surface); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.car-title { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.car-title .sub { font-size: 14px; color: var(--muted); }

.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 10px 12px; font-size: 14.5px; background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: var(--ink); border: 0; text-align: left; width: 100%; }
.alert b { color: var(--c); font-family: var(--f-display); font-weight: 700; }
.alert i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }

.hero { display: flex; flex-direction: column; gap: 2px; }
.hero .big { font-family: var(--f-display); font-size: clamp(56px, 17vw, 84px); font-weight: 700; line-height: .95; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero .big small { font-size: .3em; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.hero .sub { color: var(--muted); font-size: 15px; }

.fuels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fuel { background: var(--surface); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--c); min-width: 0; }
.fuel .lbl { font-family: var(--f-display); font-weight: 600; font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--c); }
.fuel .val { font-family: var(--f-display); font-size: 32px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fuel .val small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.fuel .meta { font-size: 13px; color: var(--muted); }
.insight { font-size: 14.5px; margin: 0; max-width: 65ch; }
.insight b { font-family: var(--f-display); font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 5px; vertical-align: -1px; }
.chart { width: 100%; min-width: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--f-display); font-size: 11px; fill: var(--muted); }
.chart-info { font-size: 14px; color: var(--muted); min-height: 1.45em; }
.chart-info b { color: var(--ink); font-family: var(--f-display); }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-family: var(--f-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.kv .total { color: var(--ink); font-weight: 600; border-top: 1px solid var(--line); padding-top: 8px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.split .v { font-family: var(--f-display); font-weight: 700; font-size: 24px; font-variant-numeric: tabular-nums; }
.split .l { font-size: 13px; color: var(--muted); }

.snap { display: flex; flex-direction: column; gap: 4px; }
.snap .main { font-family: var(--f-display); font-weight: 700; font-size: 20px; }
.snap .sub { font-size: 14px; color: var(--muted); }

.empty { text-align: left; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.empty p { margin: 0; color: var(--muted); max-width: 46ch; }

/* ---------- listas ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.month { font-family: var(--f-display); font-weight: 600; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 2px 6px; }
.month:first-child { padding-top: 0; }
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r); }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; padding: 12px 14px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.rows > li:first-child .row { border-top: 0; }
.row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); }
.row .t1 { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t2 { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .big { font-family: var(--f-display); font-weight: 700; font-size: 20px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .big small { font-size: 12px; color: var(--muted); font-weight: 600; }
.row .clip { display: inline-flex; vertical-align: -2px; margin-left: 4px; }
.row .clip svg { width: 13px; height: 13px; }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); white-space: nowrap; font-family: var(--f-body); }

/* ---------- botões ---------- */
.btn { text-decoration: none; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 16px; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { border: 0; background: var(--accent); color: var(--accent-ink); font-family: var(--f-display); font-style: italic; font-weight: 700; letter-spacing: .02em; font-size: 16px; padding: 12px 18px; }
.btn-danger { border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); background: none; }
.btn-danger.arm { background: var(--danger); color: var(--surface); border-color: var(--danger); }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; }
.linkish { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 4px 0; }

/* ---------- abas ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabs .page { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }

/* ---------- formulários ---------- */
.form-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); padding-block: 8px; }
.form-top .page { display: flex; align-items: center; gap: 8px; }
.form-top h1 { font-size: 20px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form { display: flex; flex-direction: column; gap: 18px; padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
.group { background: var(--surface); border-radius: var(--r); padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.group > h2 { grid-column: 1 / -1; }
.group .note { grid-column: 1 / -1; font-size: 13.5px; color: var(--muted); margin: -6px 0 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .flabel { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.opt { font-weight: 400; font-size: 12px; }
input, textarea, select { font: inherit; font-size: 17px; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 76px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
input.auto { color: var(--accent); }
.seg { display: grid; grid-template-columns: repeat(var(--n, 2), 1fr); gap: 8px; }
.seg input, .chips input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.seg label { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 8px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-family: var(--f-display); font-weight: 600; font-size: 14.5px; letter-spacing: .04em; color: var(--ink); text-transform: uppercase; text-align: center; }
.seg label i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.seg input:checked + label { border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 12%, transparent); color: var(--c, var(--accent)); }
.seg input:focus-visible + label, .chips input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 14.5px; cursor: pointer; }
.chips input:checked + label { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches label { width: 36px; height: 36px; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 25%, transparent); }
.swatches input:checked + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatches input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 15px; cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.calc { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.calc b { color: var(--ink); font-family: var(--f-display); }
.err { color: var(--danger); font-size: 14.5px; margin: 0; background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 10px 12px; border-radius: 10px; }
.form-actions { display: flex; flex-direction: column; gap: 10px; }

.photos { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; max-width: 100%; border-radius: 10px; overflow: hidden; background: var(--sunk); border: 0; padding: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 600; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--ink) 70%, transparent); color: var(--bg); font-size: 14px; line-height: 1; display: grid; place-items: center; }
.add-photo { border: 1.5px dashed var(--line); background: none; flex-direction: column; gap: 4px; cursor: pointer; }
.add-photo svg { width: 22px; height: 22px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding-block: 32px; }
.auth .page { max-width: 420px; display: flex; flex-direction: column; gap: 22px; }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.auth-brand .mark { width: 92px; }
.auth-brand .brand { font-size: 42px; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 16px; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.auth .switch { font-size: 15px; color: var(--muted); }

/* ---------- ajustes ---------- */
.settings-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.settings-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.settings-list li:first-child { border-top: 0; }
.settings-list .who { display: flex; flex-direction: column; min-width: 0; }
.settings-list .who span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.invite-code { font-family: var(--f-display); font-weight: 700; font-size: 30px; letter-spacing: .14em; user-select: all; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- avisos ---------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14.5px; max-width: calc(100% - 32px); z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--accent-soft); color: var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 14.5px; }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(5, 8, 11, .94); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.viewer .bar { display: flex; justify-content: flex-end; gap: 8px; padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px 12px; }
.viewer .bar button { background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 600; }
.viewer .img { flex: 1; display: grid; place-items: center; overflow: auto; padding: 8px; min-height: 0; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.splash { min-height: 100vh; display: grid; place-items: center; }
.splash svg { width: 96px; }

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .2s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
}
@media (prefers-reduced-motion: reduce) { .sync.busy i { animation: none; } }
@media (min-width: 560px) {
  .fuels { gap: 14px; }
  .group { grid-template-columns: 1fr 1fr 1fr; }
  .group .field.wide { grid-column: span 2; }
}
