/* Frota Monitor. Azul da placa Mercosul como cor da marca, tipografia de sinalização (Barlow),
   barra lateral escura e a planta baixa do carro como peça de assinatura. */
:root {
  color-scheme: light;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  --bg: #edf0f4;
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --surface-3: #e7ebf0;
  --zebra: #f8f9fb;
  --line: #dde2e8;
  --line-soft: #eaeef2;
  --ink: #0e1622;
  --ink-2: #455163;
  --ink-3: #5b6677;
  --brand: #1f4fa3;
  --brand-strong: #173d80;
  --brand-ink: #ffffff;
  --brand-soft: #e6edf9;
  --ok: #0b7650;
  --ok-fill: #15803d;
  --charge: #6d28d9;
  --charge-fill: #7c3aed;
  --charge-soft: #f0eafe;
  --on: #0369a1;
  --on-fill: #0284c7;
  --off: #4b5768;
  --off-fill: #64748b;
  --warn: #955800;
  --warn-fill: #b87700;
  --warn-soft: #fdf1da;
  --crit: #b42d26;
  --on-crit: #ffffff;
  --crit-soft: #fbe5e3;
  --series-1: #1f4fa3;
  --series-2: #d0581c;
  --series-3: #7c3aed;
  --glass: #1d2a3b;
  --tyre: #16191d;
  --tyre-plan: #1f2733;

  --side-bg: #0d1829;
  --side-line: #1d2b42;
  --side-ink: #a9b6c9;
  --side-ink-strong: #ffffff;
  --side-hover: #16243a;
  --side-active: #1a2d4b;
  --side-accent: #6f9cff;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --sh-1: 0 1px 2px rgb(14 22 34 / .05), 0 1px 3px rgb(14 22 34 / .04);
  --sh-2: 0 4px 16px rgb(14 22 34 / .08), 0 1px 3px rgb(14 22 34 / .05);
  --sh-pop: 0 24px 64px rgb(8 14 24 / .28);
  --side-w: 236px;
  --top-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #090e15;
    --surface: #111822;
    --surface-2: #161f2b;
    --surface-3: #1d2836;
    --zebra: #141c27;
    --line: #243042;
    --line-soft: #1b2533;
    --ink: #eef2f7;
    --ink-2: #abb6c5;
    --ink-3: #8794a8;
    --brand: #5b8cff;
    --brand-strong: #7da4ff;
    --brand-ink: #071023;
    --brand-soft: #16264a;
    --ok: #4ade80;
    --ok-fill: #4ade80;
    --charge: #a78bfa;
    --charge-fill: #a78bfa;
    --charge-soft: #2a1f4d;
    --on: #38bdf8;
    --on-fill: #38bdf8;
    --off: #94a3b8;
    --off-fill: #94a3b8;
    --warn: #f0a92a;
    --warn-fill: #f0a92a;
    --warn-soft: #33270f;
    --crit: #f2655d;
  --on-crit: #1c0504;
    --on-crit: #1c0504;
    --crit-soft: #3a1a19;
    --series-1: #5b8cff;
    --series-2: #ec8048;
    --series-3: #a78bfa;
    --glass: #0b121c;
    --tyre: #050608;
    --tyre-plan: #5d6b7f;
    --side-bg: #060a10;
    --side-line: #152033;
    --side-hover: #0f1828;
    --side-active: #132342;
    --sh-1: none;
    --sh-2: 0 4px 16px rgb(0 0 0 / .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090e15;
  --surface: #111822;
  --surface-2: #161f2b;
  --surface-3: #1d2836;
  --zebra: #141c27;
  --line: #243042;
  --line-soft: #1b2533;
  --ink: #eef2f7;
  --ink-2: #abb6c5;
  --ink-3: #8794a8;
  --brand: #5b8cff;
  --brand-strong: #7da4ff;
  --brand-ink: #071023;
  --brand-soft: #16264a;
  --ok: #4ade80;
  --ok-fill: #4ade80;
  --charge: #a78bfa;
  --charge-fill: #a78bfa;
  --charge-soft: #2a1f4d;
  --on: #38bdf8;
  --on-fill: #38bdf8;
  --off: #94a3b8;
  --off-fill: #94a3b8;
  --warn: #f0a92a;
  --warn-fill: #f0a92a;
  --warn-soft: #33270f;
  --crit: #f2655d;
  --on-crit: #1c0504;
  --crit-soft: #3a1a19;
  --series-1: #5b8cff;
  --series-2: #ec8048;
  --series-3: #a78bfa;
  --glass: #0b121c;
  --tyre: #050608;
  --tyre-plan: #5d6b7f;
  --side-bg: #060a10;
  --side-line: #152033;
  --side-hover: #0f1828;
  --side-active: #132342;
  --sh-1: none;
  --sh-2: 0 4px 16px rgb(0 0 0 / .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0;
  font: 15px/1.45 var(--font);
  background: var(--bg);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }
.secondary { color: var(--ink-2); }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Casca: barra lateral + coluna principal ---------- */
.shell { min-height: 100dvh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 1200;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--side-bg); color: var(--side-ink); border-right: 1px solid var(--side-line);
  padding: max(16px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.main-col { margin-left: var(--side-w); min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--side-ink-strong); padding: 4px 8px 18px; }
.brand-mark { width: 38px; height: 26px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: .2px; line-height: 1; }
.brand-name small { display: block; font-family: var(--font); font-weight: 500; font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--side-ink); margin-top: 3px; }
.side-label { font-size: 11px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: color-mix(in srgb, var(--side-ink) 70%, transparent); padding: 8px 10px 4px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--side-ink); font-weight: 500; font-size: 15px; border: 0; background: none; cursor: pointer; text-align: left;
  position: relative;
}
.side-nav a svg, .side-btn svg { width: 20px; height: 20px; flex: none; }
.side-nav a:hover, .side-btn:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.side-nav a[aria-current="page"] { background: var(--side-active); color: var(--side-ink-strong); font-weight: 600; }
.side-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-accent); }
.side-nav .count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--side-ink); background: var(--side-hover); border-radius: 999px; padding: 1px 8px; }
.side { overflow-y: auto; }
.side-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid var(--side-line); padding-top: 10px; }
.side-btn .hint { margin-left: auto; font-size: 12px; color: color-mix(in srgb, var(--side-ink) 80%, transparent); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 6px; border-radius: var(--r); background: var(--side-hover); }
.user-card .who { min-width: 0; flex: 1; }
.user-card .who b { display: block; color: var(--side-ink-strong); font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .who span { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-actions { display: flex; gap: 4px; padding: 6px 2px 0; }
.user-actions button { flex: 1; border: 1px solid var(--side-line); background: none; color: var(--side-ink); border-radius: var(--r-sm); padding: 6px 8px; font-size: 13px; cursor: pointer; }
.user-actions button:hover { color: var(--side-ink-strong); border-color: var(--side-ink); }
.scrim { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 1000; height: var(--top-h);
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: .1px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumb a { color: var(--ink-3); text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 22px; }
.crumb a:hover { color: var(--ink); }
.crumb .sep { color: var(--ink-3); }
#status { margin-left: auto; font-size: 13px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
#status:empty::before { display: none; }
#status.beat::before { animation: beat .9s ease-out; }
@keyframes beat { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } to { box-shadow: 0 0 0 9px transparent; } }
#status.error { color: var(--crit); }
#status.error::before { background: var(--crit); box-shadow: 0 0 0 3px color-mix(in srgb, var(--crit) 20%, transparent); }
.top-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap;
}
.top-btn svg { width: 18px; height: 18px; }
.top-btn:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
.top-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
#menu { display: none; }
main#app { padding: 24px 28px 56px; max-width: 1440px; }

@media (max-width: 899px) {
  .side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; width: min(300px, 86vw); }
  .shell.menu-open .side { transform: none; box-shadow: var(--sh-pop); }
  .shell.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 1100; background: rgb(4 8 14 / .5); }
  .main-col { margin-left: 0; }
  #menu { display: inline-flex; padding: 0; width: 38px; justify-content: center; border-radius: var(--r-sm); }
  .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); gap: 8px; }
  .topbar h1, .crumb a { font-size: 19px; }
  .crumb a.up { display: none; }
  .crumb .sep { display: none; }
  #status { font-size: 0; gap: 0; min-width: 44px; min-height: 44px; justify-content: center; cursor: help; }
  #status.error { font-size: 12px; white-space: normal; line-height: 1.2; text-align: right; }
  .top-btn .txt { display: none; }
  #privacy-top { width: 38px; padding: 0; justify-content: center; }
  main#app { padding: 14px 12px 40px; }
}

/* ---------- Blocos ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.panel { padding: 18px 20px; min-width: 0; }
@media (max-width: 599px) { .panel { padding: 14px; } }
.ph { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.ph h2 { margin: 0; }
.ph .sub { font-size: 13px; color: var(--ink-3); flex-basis: 100%; margin-top: -4px; }
.ph .end { margin-left: auto; }
h2 { font-family: var(--font-display); font-size: 19px; font-weight: 700; margin: 0 0 10px; letter-spacing: .1px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--ink-2); }
.note { font-size: 13px; color: var(--ink-3); margin-top: 10px; }
.empty { padding: 28px; text-align: center; color: var(--ink-3); }
.stack { display: grid; gap: 16px; }
.grid2 { display: grid; gap: 16px; }
@media (min-width: 1100px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .grid2.eq { align-items: stretch; } }
.sec { display: grid; gap: 16px; scroll-margin-top: calc(var(--top-h) + 64px); }
.sec-title {
  display: flex; align-items: center; gap: 10px; margin: 18px 0 0;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.4px; color: var(--ink-3);
}
.sec-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.label { font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-3); }
.metric .value { font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.15; letter-spacing: -.1px; }
.metric .value small { font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--ink-2); margin-left: 3px; letter-spacing: 0; }
.metric .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
@media (min-width: 640px) { .kv { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Pílulas e estados */
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 999px; white-space: nowrap;
  font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
button.chip { cursor: pointer; }
button.chip:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
button.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
button.chip[aria-pressed="true"] .count { color: inherit; opacity: .7; }
.chip .count { color: var(--ink-3); font-weight: 500; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c, var(--ink-3)); }
.dot.hollow { background: transparent; box-shadow: inset 0 0 0 2px var(--ink-3); }
.state { --c: var(--off-fill); }
.state.driving { --c: var(--ok-fill); }
.state.on { --c: var(--on-fill); }
.state.charging { --c: var(--charge-fill); }
.state .st-ico { width: 14px; height: 14px; flex: none; color: var(--c); }
.state.no-signal .st-ico { color: var(--ink-3); }
.state.no-signal.long .st-ico { color: var(--warn); }
.state.no-signal { color: var(--ink-2); border-style: dashed; }
.state.no-signal.long { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.state.no-signal.long .dot.hollow { box-shadow: inset 0 0 0 2px var(--warn); }
.state[data-tip] { cursor: help; }
.chip.flat { border: 0; background: none; padding: 0; height: auto; font-weight: 500; color: var(--ink-2); gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.pill.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pill.soon { background: var(--warn-soft); color: var(--warn); }
.pill.overdue { background: var(--crit-soft); color: var(--crit); }
.svc { --c: var(--ok); }
.svc.soon { --c: var(--warn-fill); }
.svc.overdue { --c: var(--crit); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; cursor: help; }
.badge.critical { background: var(--crit); color: var(--on-crit); }
.badge.warning { background: var(--warn-fill); color: #2a1a00; }

.battery { display: inline-flex; align-items: center; gap: 7px; }
.battery .bar { position: relative; width: 30px; height: 13px; border-radius: 3px; box-shadow: inset 0 0 0 1.5px var(--ink-3); padding: 2px; }
.battery .bar::after { content: ""; position: absolute; right: -3px; top: 4px; width: 2px; height: 5px; border-radius: 0 1px 1px 0; background: var(--ink-3); }
.battery .fill { display: block; height: 100%; border-radius: 1.5px; background: var(--ok); }
.battery.low .fill { background: var(--warn-fill); }
.battery.critical .fill { background: var(--crit); }

.alerts { display: grid; gap: 6px; }
.alert { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid transparent; }
.alert.warning { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn-fill) 35%, transparent); }
.alert.critical { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.alert .sym { flex: none; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 800; margin-top: 1px; }
.alert.warning .sym { background: var(--warn-fill); color: #2a1a00; }
.alert.critical .sym { background: var(--crit); color: var(--on-crit); }

/* Placa Mercosul */
.plate {
  display: inline-flex; flex-direction: column; border: 1.5px solid #1b1f26; border-radius: 5px; overflow: hidden;
  background: #fff; color: #111; vertical-align: middle; line-height: 1; flex: none;
}
.plate::before { content: "BRASIL"; background: #1f4fa3; color: #fff; font: 700 7px/1 var(--font); letter-spacing: 1.2px; text-align: center; padding: 2px 0 1.5px; }
.plate span { padding: 3px 8px 3px; font: 700 16px/1 var(--font-display); letter-spacing: 1.6px; }
.plate.sm { border-width: 1px; border-top: 3px solid #1f4fa3; border-radius: 3px; }
.plate.sm::before { display: none; }
.plate.sm span { font-size: 12px; padding: 2px 5px; letter-spacing: 1.2px; }

/* Pessoa: foto ou iniciais. O modo privacidade borra fotos. */
.avatar {
  --size: 36px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; overflow: hidden; display: grid; place-items: center;
  font: 700 calc(var(--size) * .38)/1 var(--font-display); letter-spacing: .3px; color: #fff; background: var(--av, #5a6b84);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { --size: 52px; }
.avatar.xl { --size: 88px; }
.avatar.sm { --size: 26px; }
.avatar.none { background: var(--surface-3); color: var(--ink-3); }
.avatar.none svg { width: 55%; height: 55%; }
:root[data-privacy] .person-photo img { filter: blur(7px) saturate(.6); transform: scale(1.15); }
:root[data-privacy] .pii { filter: blur(5px); user-select: none; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .who { min-width: 0; }
.person .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .who span { display: block; font-size: 12px; color: var(--ink-3); }
.person.empty-driver .who b { color: var(--ink-3); font-weight: 500; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.danger { color: var(--crit); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; height: 46px; font-size: 15px; }
.btn.link { border: 0; background: none; padding: 0 2px; height: auto; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }
.btn.link.danger { color: var(--crit); }
.btn[disabled] { opacity: .6; cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { color: var(--brand); border-color: var(--brand); }
.icon-btn svg { width: 18px; height: 18px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ⓘ e dica flutuante */
.info {
  display: inline-grid; place-items: center; width: 17px; height: 17px; padding: 0; border-radius: 50%; border: 1.3px solid currentColor;
  background: none; color: var(--ink-3); font: 700 11px/1 Georgia, serif; font-style: italic; cursor: help; vertical-align: 1px; flex: none;
  text-transform: none; letter-spacing: 0;
}
.info:hover, .info:focus-visible { color: var(--brand); }
#tip {
  position: fixed; z-index: 3000; pointer-events: none; max-width: min(320px, calc(100vw - 16px));
  background: var(--ink); color: var(--surface); font-size: 13px; line-height: 1.4; padding: 8px 11px; border-radius: var(--r-sm);
  white-space: pre-line; box-shadow: var(--sh-2); display: none;
}

/* ---------- Tabela única ---------- */
.tbl-wrap { overflow: auto; max-height: var(--tbl-h, 440px); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; table-layout: fixed; }
.tbl th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.tbl th .th { display: inline-flex; align-items: center; gap: 6px; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl td.wrap { white-space: normal; min-width: 220px; }
.tbl tbody tr:nth-child(even) td { background: var(--zebra); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.tbl .n { text-align: right; white-space: nowrap; font-family: var(--font-display); font-size: 15px; font-weight: 500; }
.tbl th.n { font-family: var(--font); font-size: 13px; }
.tbl th.n .th { justify-content: flex-end; }
.tbl td.bad { color: var(--crit); font-weight: 700; }
.tbl td.warn { color: var(--warn); font-weight: 700; }
.tbl td.good { color: var(--ok); font-weight: 600; }
.tbl td.strong { font-weight: 600; }
.tbl tr.sub td { color: var(--ink-2); font-size: 13px; }
.tbl tr.sub td:first-child { padding-left: 30px; }
.tbl td.empty-row { text-align: center; color: var(--ink-3); padding: 22px; }
.tbl td.act { width: 1%; white-space: nowrap; text-align: right; }
.tbl .dim { color: var(--ink-3); font-family: var(--font); font-size: 12px; font-weight: 400; margin-left: 4px; }
.tbl a { text-decoration: none; font-weight: 600; }
.tbl a:hover { text-decoration: underline; }

/* ---------- Frota ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 100%; padding: 1px; }
.chips::-webkit-scrollbar { display: none; }
.field-search, .field-select {
  height: 38px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); padding: 0 12px;
}
.field-search { flex: 1 1 0; min-width: 0; padding-left: 36px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237f8b9c' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 12px 50% no-repeat; }
.field-select { flex: none; max-width: 48%; padding: 0 8px; }

/* Mapa */
.car-marker { width: 30px; height: 30px; display: grid; place-items: center; position: relative; }
.car-marker svg { transition: transform .6s ease; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .5)); }
.car-marker.focus::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid var(--brand); animation: ping 1.2s ease-out 3; }
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.map-label { background: var(--surface); color: var(--ink); border: 1px solid var(--line); font: 600 12px var(--font); box-shadow: var(--sh-1); padding: 2px 7px; border-radius: 6px; }
.map-label::before { display: none; }
.leaflet-container { background: var(--surface-2); font: inherit; }
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.72) contrast(1.08) saturate(.7); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .leaflet-tile-pane { filter: brightness(.72) contrast(1.08) saturate(.7); } }

/* ---------- Detalhe do carro ---------- */
.detail { display: grid; gap: 16px; }
.hero-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-soft); padding-top: 18px; gap: 16px; }
.hero-metrics .metric + .metric { border-left: 1px solid var(--line-soft); padding-left: 16px; }
.hero-metrics .value { font-size: 38px; font-weight: 700; line-height: 1; margin-top: 6px; }
.hero-metrics .value small { font-size: 15px; }
.hero-metrics .bar { height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.hero-metrics .bar span { display: block; height: 100%; background: var(--c, var(--ok)); border-radius: 3px; }
.tabbar {
  position: sticky; top: var(--top-h); z-index: 900; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -2px; padding: 4px; border-radius: var(--r); background: var(--surface-3); border: 1px solid var(--line);
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar a {
  flex: none; padding: 8px 14px; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap;
}
.tabbar a:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.tabbar a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
@media (max-width: 899px) { .tabbar { top: calc(var(--top-h) + env(safe-area-inset-top)); } }

/* Planta baixa dos pneus */
.tyre-plan { display: grid; justify-items: center; }
.tyre-plan svg { width: 100%; max-width: 400px; height: auto; display: block; }
.tyre-plan .body { fill: var(--surface-2); stroke: var(--ink-3); stroke-width: 1.4; }
.tyre-plan .glass { fill: var(--surface-3); stroke: var(--ink-3); stroke-width: 1; }
.tyre-plan .detail-line { fill: none; stroke: var(--ink-3); stroke-width: 1; opacity: .7; }
.tyre-plan .lamp { fill: var(--ink-3); opacity: .55; }
.tyre-plan .grid { stroke: var(--line-soft); stroke-width: 1; }
.tyre-plan .tyre { fill: var(--tyre-plan); }
.tyre-plan .tyre.alert { fill: var(--warn-fill); }
.tyre-plan .tyre.none { fill: none; stroke: var(--ink-3); stroke-dasharray: 3 3; }
.tyre-plan .halo { fill: var(--warn-fill); opacity: .22; }
.tyre-plan .leader { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; }
.tyre-plan .pos { font: 600 10.5px var(--font); letter-spacing: 1px; text-transform: uppercase; fill: var(--ink-3); }
.tyre-plan .psi { font: 700 30px var(--font-display); fill: var(--ink); }
.tyre-plan .psi.alert { fill: var(--warn); }
.tyre-plan .unit { font: 500 13px var(--font); fill: var(--ink-2); }
.tyre-plan .temp { font: 500 13px var(--font); fill: var(--ink-2); }
.tyre-plan .front { font: 600 10px var(--font); letter-spacing: 2px; fill: var(--ink-3); }
.tyre-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); justify-content: center; }
.tyre-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tyre-legend i { width: 10px; height: 16px; border-radius: 3px; background: var(--tyre-plan); display: inline-block; }
.tyre-legend i.alert { background: var(--warn-fill); }

/* Revisões */
.svc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.svc-head .target { font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.countdown { display: flex; gap: 28px; flex-wrap: wrap; margin: 14px 0 12px; }
.countdown .value { font-size: 32px; font-weight: 700; }
.progress { position: relative; height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.progress .done { height: 100%; border-radius: 5px; background: var(--c); }
.progress-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.timeline { display: grid; margin-top: 16px; }
.tl-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); align-items: center; }
.tl-row .what { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.tl-row .sub { font-size: 12px; color: var(--ink-3); }
.tl-row .when { text-align: right; font-weight: 600; white-space: nowrap; }
.tl-row .when .sub { font-weight: 400; }
details.more { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
details.more summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.more summary::before { content: "+"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 13px; line-height: 1; }
details.more[open] summary::before { content: "–"; }
details.more summary::-webkit-details-marker { display: none; }

/* Motoristas (no carro) */
.driver-now { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.driver-now .person { flex: 1 1 220px; }
.driver-now .kv { flex: 2 1 320px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 160px) 1fr 112px; gap: 12px; align-items: center; font-size: 14px; white-space: nowrap; }
.bar-row > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.bar-row .track { height: 12px; background: var(--surface-3); border-radius: 0 4px 4px 0; overflow: hidden; }
.bar-row .fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.bar-row .val { text-align: right; font-family: var(--font-display); font-weight: 600; }
@media (max-width: 599px) { .bar-row { grid-template-columns: minmax(0, 110px) 1fr 92px; gap: 8px; } }

/* Gráficos */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font: 12px var(--font); fill: var(--ink-3); }
.chart .gridline { stroke: var(--line-soft); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: color-mix(in srgb, var(--ink) 6%, transparent); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .key.line { height: 3px; width: 16px; vertical-align: 3px; border-radius: 2px; }

/* ---------- Formulários e janelas ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.input, .form input:not([type="radio"]):not([type="checkbox"]):not([type="file"]):not([type="color"]), .form select, .form textarea {
  height: 42px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); padding: 0 12px; width: 100%; font-weight: 400; font-size: 15px; color: var(--ink);
}
.form textarea { height: auto; padding: 10px 12px; min-height: 84px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.form input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.form .full { grid-column: 1 / -1; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 479px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.form-error { color: var(--crit); font-size: 14px; font-weight: 500; }
.form-error:empty { display: none; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.color-field { display: flex; align-items: center; gap: 10px; height: 42px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 10px; background: var(--surface); }
.color-field input[type="color"] { width: 28px; height: 28px; border: 0; padding: 0; background: none; cursor: pointer; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line); border-radius: 6px; }
.color-field code { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }

/* Campo de foto: prévia + botões próprios. */
.photo-field { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 14px; align-items: center; }
.photo-field .preview { width: 132px; aspect-ratio: 16 / 10; border-radius: var(--r); border: 1px dashed var(--line); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.photo-field .preview.round { width: 88px; aspect-ratio: 1; border-radius: 50%; }
.photo-field .preview img, .photo-field .preview svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-field .preview svg { object-fit: contain; }
.photo-field .ctl { display: grid; gap: 6px; justify-items: start; }
.photo-field .ctl .hint { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.photo-field input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-field:has(.round) { grid-template-columns: 88px minmax(0, 1fr); }

dialog.sheet {
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  background: var(--surface); color: var(--ink); box-shadow: var(--sh-pop);
}
dialog.sheet.narrow { width: min(440px, calc(100vw - 24px)); }
dialog.sheet::backdrop { background: rgb(6 10 18 / .55); backdrop-filter: blur(2px); }
dialog.sheet form { margin: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.sheet-head h2 { margin: 0; }
.sheet-body { padding: 8px 20px 20px; }
.sheet-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
fieldset { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; display: grid; gap: 12px; }
legend { font-family: var(--font-display); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ink-3); padding: 0; margin-bottom: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.gallery label { position: relative; display: grid; gap: 4px; justify-items: center; padding: 8px 6px 6px; border: 1.5px solid var(--line); border-radius: var(--r); cursor: pointer; font-size: 12px; font-weight: 500; text-align: center; color: var(--ink-2); }
.gallery label:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.gallery label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); font-weight: 700; }
.gallery input { position: absolute; opacity: 0; pointer-events: none; }
.gallery img, .gallery svg { width: 100%; aspect-ratio: 614 / 320; object-fit: contain; }
.gallery label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Entrar e convite ---------- */
.auth {
  position: fixed; inset: 0; z-index: 2500; overflow: auto; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr);
  background: var(--bg);
}
.auth-art {
  position: relative; overflow: hidden; color: #dfe7f4; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    linear-gradient(var(--side-line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--side-line) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--side-bg);
}
.auth-art .brand { padding: 0; }
.auth-art .blueprint { position: absolute; right: -70px; top: 12%; width: min(600px, 80%); opacity: .9; pointer-events: none; }
.auth-art .blueprint .b-body { fill: none; stroke: #6f9cff; stroke-width: 1.4; }
.auth-art .blueprint .b-fine { fill: none; stroke: #6f9cff; stroke-width: .9; opacity: .55; }
.auth-art .blueprint .b-tyre { fill: #6f9cff; opacity: .9; }
.auth-art .blueprint .b-dim { stroke: #6f9cff; stroke-width: .8; opacity: .55; }
.auth-art .blueprint text { font: 600 11px var(--font); letter-spacing: 1.5px; fill: #8fb1ff; }
.auth-art .blueprint .b-psi { font: 700 22px var(--font-display); letter-spacing: 0; fill: #fff; }
.auth-art h2 { font-family: var(--font-display); font-size: 44px; line-height: 1.02; font-weight: 700; color: #fff; margin: 0; max-width: 12ch; letter-spacing: -.4px; position: relative; }
.auth-art p { max-width: 38ch; color: #a9b6c9; font-size: 16px; position: relative; margin: 14px 0 0; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 22px; }
.auth-card h1 { font-family: var(--font-display); font-size: 32px; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.auth-card .lead { color: var(--ink-2); margin: 6px 0 0; }
.pw { position: relative; }
.pw input { padding-right: 76px !important; }
.pw button { position: absolute; right: 6px; top: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.auth-foot { font-size: 13px; color: var(--ink-3); }
.auth-mobile-brand { display: none; }
@media (max-width: 899px) {
  .auth { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .auth-art { display: none; }
  .auth-mobile-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
  .auth-mobile-brand .brand-name small { color: var(--ink-3); }
  .auth-form { place-items: start center; padding: max(28px, env(safe-area-inset-top)) 20px 32px; }
}

/* ---------- Gestão ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; text-decoration: none; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--brand); }
pre.json { margin: 0; padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font: 12.5px/1.5 var(--font-mono); overflow: auto; max-height: 520px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-family: var(--font-mono); font-size: 13px !important; }
.back-m { display: none; text-decoration: none; font-size: 18px; }
@media (max-width: 899px) { .back-m { display: inline-grid; } }

/* Estado vazio com próximo passo */
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 40px 24px; text-align: center; color: var(--ink-2); }
.empty-state svg { width: 40px; height: 40px; color: var(--ink-3); }
.empty-state b { font-size: 16px; color: var(--ink); }
.person .who b a { text-decoration: none; }
.person .who b a:hover { text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 599px) { .form.link-form { grid-template-columns: minmax(0, 1fr) !important; } }

/* Alvos de toque: 44 px em tela de toque; o ⓘ ganha área invisível maior. */
@media (pointer: coarse) {
  .btn, .icon-btn, .chip, .top-btn, .tabbar a, .side-nav a, .side-btn, .user-actions button, .secnav button { min-height: 44px; }
  .icon-btn, .top-btn#menu, #privacy-top { min-width: 44px; }
  .btn.link { min-height: 44px; padding: 0 6px; }
  .field-search, .field-select, .form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]), .form select { min-height: 44px; font-size: 16px; }
}
.info { position: relative; }
.info::before { content: ""; position: absolute; inset: -10px; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 4000; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: var(--r-sm); box-shadow: var(--sh-2); font-weight: 600; }
.skip:focus { top: 8px; }

/* Esqueleto de carregamento */
.skeleton { display: grid; gap: 14px; }
.skeleton i { display: block; height: 120px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton i:first-child { height: 220px; }
@keyframes shimmer { to { background-position: -300% 0; } }

/* Confirmação e aviso flutuante */
dialog.confirm { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; width: min(420px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); box-shadow: var(--sh-pop); }
dialog.confirm::backdrop { background: rgb(6 10 18 / .55); }
dialog.confirm h2 { margin: 0 0 8px; }
dialog.confirm p { margin: 0 0 20px; color: var(--ink-2); }
dialog.confirm .actions { justify-content: flex-end; }
.btn.danger-fill { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.danger-fill:hover { background: #b91c1c; border-color: #b91c1c; }
#toast { position: fixed; z-index: 3500; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(460px, calc(100vw - 24px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--ink); color: var(--surface); box-shadow: var(--sh-pop); font-size: 14px; }
.toast.error { background: var(--crit-soft); color: var(--crit); border: 1px solid color-mix(in srgb, var(--crit) 40%, transparent); }
.toast span { flex: 1; }
.toast button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 6px; }

/* Cor do carro: amostras + outra cor */
.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatches label { position: relative; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .2); }
.swatches label::before { content: ""; position: absolute; inset: -7px; }
.swatches input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatches label:has(input:checked) { outline: 2px solid var(--ink); outline-offset: 3px; }
.swatches label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 3px; }
.swatches .other { background: conic-gradient(#dc2626, #f59e0b, #16a34a, #0ea5e9, #7c3aed, #dc2626); }
.photo-field.drag .preview { border-color: var(--brand); background: var(--brand-soft); }

/* Barra de dados dentro da célula */
.tbl td.cell-bar { background-image: linear-gradient(var(--series-1), var(--series-1)); background-repeat: no-repeat; background-position: right 14px bottom 6px; background-size: calc((100% - 28px) * var(--p, 0)) 3px; }
/* Tabela larga no celular: primeira coluna fixa e sombra indicando mais colunas. */
.tbl-wrap.more { box-shadow: inset -14px 0 12px -12px rgb(0 0 0 / .25); }
@media (max-width: 639px) {
  .tbl th:first-child, .tbl td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); }
  .tbl tbody tr:nth-child(even) td:first-child { background: var(--zebra); }
  .tbl th:first-child { z-index: 3; background: var(--surface-2); }
  .tbl .hide-sm { display: none; }
}

/* Marcador no mapa com anel na cor do estado */
.car-marker .ring { position: absolute; inset: 1px; border-radius: 50%; border: 3px solid var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); }
.car-marker.no-signal { opacity: .6; }
.car-marker.no-signal .ring { border-style: dashed; border-color: #64748b; background: none; }
#status.stale { color: var(--warn); }
#status.stale::before { background: var(--warn-fill); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn-fill) 22%, transparent); }
button#status { border: 0; background: none; cursor: pointer; font: inherit; padding: 6px; }
#app:focus, .crumb h1:focus { outline: none; }

.chip .st-ico { width: 15px; height: 15px; flex: none; color: var(--ink-3); }
.chip.door-open { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.chip.door-open .st-ico { color: var(--warn); }
@media (max-width: 599px) { .kv[style*="repeat(3"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* Faixa "Agora" do carro: o que chega ao vivo, separado do cadastro e do histórico. */
.live { margin: 0 -24px -22px; padding: 16px 24px 20px; background: var(--surface-2); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg); display: grid; gap: 14px; }
.live .hero-metrics { border-top: 0; padding-top: 0; }
.live .chips-row { margin: 0; }
.live-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-sub { font-size: 13px; color: var(--ink-2); }
.live-tag { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; border-radius: 999px; font: 700 12px var(--font); letter-spacing: 1px; text-transform: uppercase; color: var(--ok); background: color-mix(in srgb, var(--ok-fill) 14%, transparent); }
.live-tag i, .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok-fill); display: inline-block; flex: none; animation: beat 1s ease-out; }
.live-tag.off { color: var(--ink-2); background: var(--surface-3); }
.live-tag.off i { background: none; box-shadow: inset 0 0 0 2px var(--ink-3); animation: none; }
.live-tag.sm { height: 20px; font-size: 10.5px; padding: 0 8px; vertical-align: 3px; margin-left: 4px; }
.hero-metrics .bar { display: block; }
@media (max-width: 899px) { .live { margin: 0 -16px -16px; padding: 14px 16px 16px; } }
.tabbar a .live-dot { margin-right: 7px; vertical-align: 1px; animation: none; }
.tab-sep { align-self: center; flex: none; padding: 0 6px 0 12px; margin-left: 4px; border-left: 1px solid var(--line); font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-3); }

/* Pneus centrados na altura do cartão */
.panel.tyres { display: flex; flex-direction: column; }
.panel.tyres .tyre-plan { flex: 1; align-content: center; }

/* Quem rodou (Rodagem por semana e mês) */
.avatar.xs { --size: 24px; box-shadow: 0 0 0 2px var(--surface); font-size: 9.5px; }
.tbl tbody tr:nth-child(even) .avatar.xs { box-shadow: 0 0 0 2px var(--zebra); }
.avatar.xs.more { background: var(--surface-3); color: var(--ink-2); }
.ride { display: flex; align-items: center; gap: 10px; min-width: 0; border-radius: var(--r-sm); cursor: help; }
.ride-faces { display: inline-flex; flex: none; }
.ride-faces .avatar + .avatar { margin-left: -8px; }
.ride-main { display: grid; gap: 5px; min-width: 0; flex: 1; }
.ride-names { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ride-names.none { color: var(--ink-3); font-weight: 500; }
.ride-bar { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; }
.ride-bar .seg { flex-basis: 0; min-width: 4px; background: var(--seg, var(--ink-3)); }
.ride-bar .seg.none { background: repeating-linear-gradient(135deg, var(--surface-3) 0 3px, color-mix(in srgb, var(--ink-3) 55%, transparent) 3px 5px); }
.ride-names .rn { display: inline-flex; align-items: center; gap: 5px; }
.ride-names .rn + .rn { margin-left: 10px; }
.ride-names .rn i { width: 8px; height: 8px; border-radius: 2px; background: var(--seg); flex: none; }
.ride-names .rn i.none { background: repeating-linear-gradient(135deg, var(--surface-3) 0 2px, var(--ink-3) 2px 3.5px); }
.ride-names .rn:has(i.none) { color: var(--ink-3); font-weight: 500; }
@media (max-width: 639px) { .tbl-wrap { scroll-padding-left: 150px; } }

.empty-first { max-width: 560px; margin: 24px auto; padding: 32px 28px; display: grid; justify-items: center; gap: 10px; text-align: center; }
.empty-first svg { width: 44px; height: 44px; color: var(--ink-3); }
.empty-first h2 { margin: 0; font-size: 22px; }
.empty-first p { margin: 0 0 6px; color: var(--ink-2); }

.tabbar.more::after {
  content: "›"; position: sticky; right: 0; flex: none; display: grid; place-items: center; width: 24px; margin-left: -24px;
  font-size: 22px; font-weight: 700; color: var(--ink-2); background: linear-gradient(90deg, transparent, var(--surface-3) 55%); pointer-events: none;
}
.synth { margin: -2px 0 10px; }
.synth-n { font: 700 28px/1.1 var(--font-display); }
.synth-n small { font: 500 14px var(--font); color: var(--ink-2); }
.synth-d { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.rodagem-kv .metric .value { font-size: 18px; }
.rodagem-kv .metric.main .value { font-size: 28px; }
details.more.data { margin-top: 10px; padding-top: 10px; }
.chart .hit.active { fill: color-mix(in srgb, var(--brand) 14%, transparent); }
svg.chart[data-chart]:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 4px; }
/* Financeiro */
.tbc { color: var(--warn); font-weight: 600; font-style: italic; }
.floor { white-space: nowrap; }
.value .info { vertical-align: 4px; margin-left: 4px; }
.pill.overdue, .pill.soon, .pill.ok { white-space: nowrap; }
.chip.flat-chip { height: 26px; font-weight: 500; background: var(--surface-2); }
.fin-reasons { margin-top: 12px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn-fill) 35%, transparent); font-size: 13px; }
.fin-reasons b { color: var(--warn); }
.fin-reasons ul { margin: 4px 0 0; padding-left: 18px; }
.fin-bar { height: 12px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.fin-bar span { display: block; height: 100%; border-radius: 6px; background: var(--ok-fill); }
.fin-bar-labels { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.fin-payback-n .value { font: 700 30px var(--font-display); }
.fin-payback .sub { margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.fin-mini { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.fin-mini .fin-bar { margin: 0; height: 8px; }
.fin-mini span:last-child { font-size: 13px; color: var(--ink-2); }
.brl-in { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding-left: 12px; }
.brl-in > span { color: var(--ink-3); font-weight: 500; }
.form .brl-in input:not([type]) { border: 0 !important; box-shadow: none !important; padding-left: 8px; }
.brl-in:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.owner-pays { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 14px; margin-top: 8px; }
.pill.fin { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* Leitura que não é de agora: valores esmaecidos (texto secundário, contraste ≥ 4,5:1), barras e ícones sem cor. */
.stale .value, .stale .tyre-plan .psi { color: var(--ink-3); font-weight: 500; }
.stale .tyre-plan .psi { fill: var(--ink-3); }
.stale .tyre-plan .tyre:not(.alert), .stale .tyre-plan .temp { opacity: .7; }
.stale .bar, .stale .soc-bar, .stale .battery .bar, .stale .st-ico, .stale .chip .st-ico { filter: grayscale(1); opacity: .75; }
.chip.state.old { color: var(--ink-2); border-style: dashed; }
.chip.state.old .st-ico { color: var(--ink-3); }
/* Faixa sem leitura recente: fundo listrado, números menores e sem cor, e a nota datada no lugar dos chips. */
.live.stale { background: repeating-linear-gradient(135deg, var(--surface-2) 0 10px, var(--surface-3) 10px 11px); }
.live.stale .hero-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.live.stale .hero-metrics .value { font-size: 28px; font-weight: 600; }
.stale-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.stale-note .chip.state { color: var(--warn); border-color: color-mix(in srgb, var(--warn-fill) 45%, transparent); background: var(--warn-soft); }
@media (max-width: 599px) {
  .live.stale .hero-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live.stale .hero-metrics .value { font-size: 24px; }
}

/* ---------- Redesenho v4: gestão primeiro ---------- */
.sep { color: var(--ink-3); margin: 0 6px; }
.launch-top { height: 36px; }
.fab { display: none; }
@media (max-width: 899px) {
  .launch-top { display: none; }
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 1050; right: 16px; bottom: max(16px, env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink); box-shadow: var(--sh-pop); cursor: pointer;
  }
  .fab svg { width: 26px; height: 26px; }
  main#app { padding-bottom: 96px; }
}

/* Menu Lançar: lista de ações grandes; no celular sobe da base da tela. */
dialog.launch { width: min(440px, calc(100vw - 24px)); }
dialog.launch::backdrop { background: rgb(6 10 18 / .45); }
.launch-list { display: grid; padding: 8px; }
.launch-list button {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; border: 0; border-radius: var(--r-sm);
  background: none; text-align: left; cursor: pointer; color: var(--ink);
}
.launch-list button:hover, .launch-list button:focus-visible { background: var(--surface-2); }
.launch-list svg { width: 22px; height: 22px; flex: none; color: var(--brand); }
.launch-list b { display: block; font-weight: 600; }
.launch-list small { display: block; color: var(--ink-3); font-size: 13px; }
@media (max-width: 599px) {
  dialog.launch, dialog.sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92dvh; }
}

/* Pendências: a cor da borda é a gravidade; o botão da ação fica na linha. */
.todos { list-style: none; margin: 0; padding: 0; display: grid; }
.todo {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center;
  padding: 12px 14px; border-left: 3px solid var(--ink-3); border-bottom: 1px solid var(--line-soft);
}
.todo:last-child { border-bottom: 0; }
.todo.crit { border-left-color: var(--crit); }
.todo.warn { border-left-color: var(--warn-fill); }
.todo-title { font-weight: 600; }
.todo.crit .todo-title { color: var(--crit); }
.todo-meta { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.todo-meta a { color: var(--ink-2); font-weight: 600; text-decoration: none; }
.todo-meta a:hover { text-decoration: underline; }
.todo-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.todo-empty { color: var(--ink-3); margin: 4px 0; }
@media (max-width: 639px) {
  .todo { grid-template-columns: minmax(0, 1fr); }
  .todo-act { justify-content: flex-start; }
}
.home { display: grid; gap: 14px; }
.fleet-line { margin: 0; color: var(--ink-2); font-size: 14px; }
.fleet-line a { color: inherit; }
.ph .chips { flex: 0 1 auto; }

/* Fatos e indicadores: uma faixa com divisórias, sem um cartão por número. */
.facts, .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fact, .kpi { padding: 16px 20px; min-width: 0; }
.fact + .fact, .kpi + .kpi { border-left: 1px solid var(--line-soft); }
.fact .value, .kpi .value { font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.2; margin-top: 4px; }
.kpi .value { font-size: 26px; font-weight: 700; }
.fact .value.sm { font-family: var(--font); font-size: 15px; font-weight: 500; }
.fact .value .dot { vertical-align: 3px; }
.fact .sub, .kpi .sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.fact .sub .pill { margin-left: 4px; }
.kpi .label .info { margin-left: 4px; }
.kpi.neg .value, .kpi.hot .value { color: var(--crit); }
.value.svc.overdue { color: var(--crit); }
.value.svc.soon { color: var(--warn); }
.bad { color: var(--crit); }
@media (max-width: 1099px) {
  .facts, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact:nth-child(3), .kpi:nth-child(3) { border-left: 0; }
  .fact:nth-child(n+3), .kpi:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 479px) {
  .facts, .kpis { grid-template-columns: minmax(0, 1fr); }
  .fact + .fact, .kpi + .kpi { border-left: 0; border-top: 1px solid var(--line-soft); }
}

/* Cabeçalho do carro e do motorista: sem cartão, foto pequena, ações à direita. */
.car-head { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.car-head .art img, .car-head .art svg { width: 100%; display: block; }
.car-head .art img.photo { aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--r); }
.car-head .art .avatar.xl { --size: 88px; }
.car-head .name-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.car-head .name { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.05; margin: 0; }
.car-head .model { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.car-head .line { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; }
.car-head .line .person .avatar { --size: 26px; }
.car-head .actions { align-self: start; }
.btn.icon-only { width: 38px; padding: 0; }
@media (max-width: 899px) {
  .car-head { grid-template-columns: 88px minmax(0, 1fr); gap: 12px; }
  .car-head .actions { grid-column: 1 / -1; }
  .car-head .actions .btn.primary { display: none; }
  .car-head .name { font-size: 24px; }
  .car-head .art .avatar.xl { --size: 72px; }
}

/* Abas e segmentado */
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-sm); background: var(--surface-3); border: 1px solid var(--line); flex: none; }
.seg a { padding: 6px 14px; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.seg a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.fleet .toolbar .chips { flex: 1 1 100%; }
.map-full { height: calc(100dvh - var(--top-h) - 170px); min-height: 360px; border-radius: var(--r-lg); border: 1px solid var(--line); z-index: 0; }
@media (pointer: coarse) { .seg a { min-height: 44px; display: inline-flex; align-items: center; } }

/* Tabela de carros */
.car-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.car-cell .icon { flex: none; width: 18px; display: grid; place-items: center; }
.car-cell > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.car-cell .sub { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.sm-only { display: none; }
@media (max-width: 639px) { .sm-only { display: inline; } }
.badge.info { background: var(--ink-3); color: var(--surface); }
.tbl td.act .btn + .btn { margin-left: 10px; }
.tbl tr.stale .battery { color: var(--ink-3); }

/* Contrato na ficha do motorista */
.contract { display: grid; gap: 10px; padding-top: 4px; }
.contract + .contract { border-top: 1px solid var(--line); padding-top: 16px; }
.contract-head { display: flex; gap: 10px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.contract-head .facts { display: block; font-size: 15px; }
.contract-sit { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.contract-nums { display: flex; gap: 6px 20px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.contract-nums b { color: var(--ink); font-family: var(--font-display); font-size: 16px; }

/* Escolha em botões (categoria da despesa) */
.choice { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.choice label { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 14px; color: var(--ink); cursor: pointer; }
.choice input:checked + span { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.choice input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (pointer: coarse) { .choice span { height: 44px; } }

/* Telemetria: a faixa ao vivo vira um cartão próprio */
.card.live { margin: 0; padding: 18px 20px; border-radius: var(--r-lg); }
@media (max-width: 899px) { .live .hero-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .live .hero-metrics .metric:nth-child(3) { border-left: 0; padding-left: 0; } .live .hero-metrics .value { font-size: 28px; } }
.detail { display: grid; gap: 16px; }
.detail h3.sec-title { margin: 8px 0 0; }
/* Escolha de motorista em lista: um toque escolhe. */
.pick { display: grid; gap: 4px; max-height: 300px; overflow: auto; margin-top: 2px; }
.pick label { position: relative; }
.pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pick label > span { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); font-weight: 500; color: var(--ink); cursor: pointer; min-height: 44px; }
.pick label > span small { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.pick input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
