/* Brand typeface, served from this site (and bundled in the Android app) so it is the same everywhere, offline too.
   Plus Jakarta Sans, SIL Open Font License 1.1 (fonts/OFL.txt). */
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(fonts/plus-jakarta-sans-latin-ext.woff2) format("woff2-variations"), url(fonts/plus-jakarta-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url(fonts/plus-jakarta-sans-latin.woff2) format("woff2-variations"), url(fonts/plus-jakarta-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Manake Fleet operations palette */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f6f1e7, #161b17);
  --surface: light-dark(#fffdf8, #1f261f);
  --surface-2: light-dark(#efe8d8, #2a342a);
  --fg: light-dark(#1f2a24, #f1ece0);
  --muted: light-dark(#5a6157, #b3b8a8);
  --line: light-dark(#ddd3c0, #343d33);
  --accent: light-dark(#1d4a38, #8fd1ae);
  --accent-fg: light-dark(#fff, #0f2419);
  --accent-soft: light-dark(#e3ecdf, #26402f);
  --rail: light-dark(#163a2c, #101a14);
  --rail-fg: #f1ece0;
  --rail-muted: #b8c9bb;
  --rail-active: #2d5a47;
  --ok: light-dark(#1d6b4a, #8fd1ae);
  --ok-soft: light-dark(#e1efe4, #223d2e);
  --info: light-dark(#2a5f8f, #9cc7ea);
  --info-soft: light-dark(#e3edf5, #243a4d);
  --warn: light-dark(#8a5a00, #f0c46a);
  --warn-soft: light-dark(#fbefd0, #433118);
  --crit: light-dark(#a23a1f, #f2a38c);
  --crit-soft: light-dark(#f8e3da, #4b2a22);
  --road: light-dark(#d9cfba, #3a4436);
  --land: light-dark(#f2ecdd, #1f261f);
  --plate: #ffe7ae;
  --plate-fg: #352609;
  --phone: #1d2a22;
  --shadow: 0 1px 0 #1f2a2414, 0 6px 16px #1f2a2410;
  --f-display: "Barlow Semi Condensed", "Segoe UI", Roboto, Arial, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 14px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 16px; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; letter-spacing: .01em; }
h1 { font-size: 30px; font-weight: 700; line-height: 1.1; }
h2 { font-size: 19px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }

.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 20px; max-width: 1360px; margin: 0 auto; align-items: start; }
.rail { background: var(--rail); color: var(--rail-fg); border-radius: 14px; padding: 18px 12px; position: sticky; top: calc(16px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand b { font-family: var(--f-display); font-size: 20px; display: block; line-height: 1; }
.brand span { font-size: 11.5px; color: var(--rail-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--rail-fg); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--rail-active); }
.nav a[aria-current="page"] { background: var(--rail-active); box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; background: var(--crit); color: #fff; font-size: 11px; font-weight: 600; border-radius: 99px; padding: 1px 7px; font-family: var(--f-mono); }
.nav .sep { height: 1px; background: var(--rail-active); margin: 8px 6px; }
.rail-foot { font-size: 12px; color: var(--rail-muted); padding: 0 8px; display: flex; flex-direction: column; gap: 8px; }
.rail-foot button { background: transparent; border: 1px solid var(--rail-active); color: var(--rail-fg); border-radius: 8px; padding: 6px 10px; cursor: pointer; text-align: left; }
.rail-foot button:hover { background: var(--rail-active); }

main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.demo-note { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.demo-note b { background: var(--warn-soft); color: var(--warn); border-radius: 4px; padding: 1px 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.page-head { display: flex; gap: 14px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.page-head > div { min-width: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2e { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-decoration: none; color: var(--fg); display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--accent); }
.tile .val { font-family: var(--f-display); font-size: 32px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tile .val small { font-size: 16px; color: var(--muted); font-weight: 500; }
.tile .sub { font-size: 12.5px; color: var(--muted); }
.tile.t-crit .val { color: var(--crit); } .tile.t-warn .val { color: var(--warn); } .tile.t-ok .val { color: var(--ok); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 500; text-decoration: none; color: var(--fg); white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--crit); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.p-ok { background: var(--ok-soft); color: var(--ok); } .p-warn { background: var(--warn-soft); color: var(--warn); }
.p-crit { background: var(--crit-soft); color: var(--crit); } .p-info { background: var(--info-soft); color: var(--info); }
.p-mute { background: var(--surface-2); color: var(--muted); }
.plate { font-family: var(--f-mono); background: var(--plate); color: var(--plate-fg); border: 1px solid rgba(0,0,0,.25); border-radius: 4px; padding: 0 6px; font-size: 12px; white-space: nowrap; letter-spacing: .04em; }
.fleet { font-family: var(--f-display); font-weight: 700; font-size: 15px; letter-spacing: .03em; white-space: nowrap; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }

.tbl-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; } td.num { font-family: var(--f-mono); font-size: 13px; }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; }
.b-ok { background: var(--ok); } .b-info { background: var(--info); } .b-warn { background: var(--warn); } .b-crit { background: var(--crit); } .b-acc { background: var(--accent); }

.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--fg); }
.li:last-child { border-bottom: 0; }
a.li:hover .li-t { color: var(--accent); }
.li-body { min-width: 0; flex: 1; }
.li-t { font-weight: 500; }
.li-m { font-size: 12.5px; color: var(--muted); }
.sev { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }

.dept-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 88px; gap: 12px; align-items: center; padding: 6px 0; }
.dept-row .bar { height: 14px; border-radius: 4px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; }
textarea { width: 100%; resize: vertical; }
.form { display: grid; gap: 12px; }
.form .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field input, .field select { width: 100%; }
.hint { font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--fg); border-color: var(--accent); }
.tabs .n { font-family: var(--f-mono); font-size: 12px; background: var(--surface-2); border-radius: 99px; padding: 0 6px; margin-left: 4px; }

.trip { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; }
.trip:last-child { border-bottom: 0; }
.trip-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.trip-p { font-weight: 600; font-size: 15px; }
.trip-meta { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.trip .actions { justify-content: flex-end; }

.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.col { background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.col-h { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px; }
.job { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.job .actions { margin-top: 2px; }

.gauge { display: flex; gap: 16px; align-items: center; }
.tank { width: 64px; height: 120px; border: 2px solid var(--line); border-radius: 10px; position: relative; overflow: hidden; flex: none; background: var(--surface-2); }
.tank i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); opacity: .85; }

.map-wrap { overflow-x: auto; }
.map { width: 100%; min-width: 620px; height: auto; display: block; border-radius: 10px; background: var(--land); }
.map text { font-family: var(--f-body); fill: var(--muted); font-size: 14px; }
.map .vlabel { font-family: var(--f-display); font-weight: 700; font-size: 14px; fill: var(--fg); }
.map .veh { cursor: pointer; transition: transform 1.8s linear; }
@media (prefers-reduced-motion: reduce) { .map .veh { transition: none; } }

.drv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.phone { width: 340px; max-width: 100%; background: var(--phone); border-radius: 36px; padding: 12px; margin: 0 auto; }
.screen { background: var(--bg); border-radius: 26px; overflow: hidden; height: 620px; display: flex; flex-direction: column; }
.sbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px 6px; font-size: 12px; font-family: var(--f-mono); }
.net { border: 0; border-radius: 99px; padding: 2px 9px; font-size: 11.5px; cursor: pointer; font-family: var(--f-body); font-weight: 600; }
.net.on { background: var(--ok-soft); color: var(--ok); } .net.off { background: var(--warn-soft); color: var(--warn); }
.appbar { background: var(--rail); color: var(--rail-fg); padding: 12px 16px; }
.appbar b { font-family: var(--f-display); font-size: 18px; display: block; }
.appbar span { font-size: 12px; color: var(--rail-muted); }
.pbody { padding: 14px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.pbtn { width: 100%; padding: 12px; border-radius: 10px; border: 0; font-weight: 600; cursor: pointer; background: var(--accent); color: var(--accent-fg); font-size: 15px; }
.pbtn.sec { background: var(--surface); color: var(--fg); border: 1px solid var(--line); }
.pbtn:disabled { opacity: .45; cursor: not-allowed; }
.chk { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 10px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.seg button.on-ok { background: var(--ok); color: #fff; } .seg button.on-bad { background: var(--crit); color: #fff; }
.big-odo { font-size: 22px; padding: 10px; text-align: center; font-family: var(--f-mono); width: 100%; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); }
.steps b { color: var(--fg); }

.overlay { position: fixed; inset: 0; background: rgba(20,26,20,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: min(540px, 100%); max-height: calc(100% - 32px); overflow-y: auto; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }
#toasts { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(380px, calc(100% - 32px)); }
.toast { background: var(--rail); color: var(--rail-fg); padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 13.5px; border-left: 4px solid var(--accent); }
.toast.warn { border-left-color: var(--warn); }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.empty { color: var(--muted); padding: 16px 0; text-align: center; }

@media (max-width: 1080px) { .grid-2, .drv-layout { grid-template-columns: minmax(0, 1fr); } .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; padding: 12px; gap: 10px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); }
  .nav .sep, .rail-foot p { display: none; }
  .rail-foot { flex-direction: row; }
  .grid-2e { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  h1 { font-size: 25px; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .form .row { grid-template-columns: minmax(0, 1fr); }
  .dept-row { grid-template-columns: 110px minmax(0, 1fr); } .dept-row .muted { grid-column: 2; }
  .trip { grid-template-columns: minmax(0, 1fr); } .trip .actions { justify-content: flex-start; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
}

/* Platform additions */
.auth { min-height: calc(100vh - 32px); display: grid; place-items: center; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 18px; }
.auth-card .brand { padding: 0; color: var(--fg); }
.auth-card .brand span { color: var(--muted); }
.err { background: var(--crit-soft); color: var(--crit); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.rail-user { font-size: 12.5px; color: var(--rail-fg); padding: 0 8px; }
.rail-user span { display: block; color: var(--rail-muted); }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.field textarea { width: 100%; }
.check-row { display: flex; gap: 8px; align-items: center; }
.json { font-family: var(--f-mono); font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-width: 46ch; }
.mobile-wrap { max-width: 520px; display: flex; flex-direction: column; gap: 14px; }
.seg label { display: block; position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-b { display: block; padding: 6px 12px; cursor: pointer; font-size: 12.5px; font-weight: 600; background: var(--surface); }
.seg input:focus-visible + .seg-b { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg input[value="ok"]:checked + .seg-b { background: var(--ok); color: var(--surface); }
.seg input[value="bad"]:checked + .seg-b { background: var(--crit); color: var(--surface); }
/* Operations workspace */
body { margin: 0; }
.app { max-width: 1520px; gap: clamp(16px, 2.5vw, 34px); }
.rail { border-radius: 20px; padding: 20px 14px; }
.nav a { min-height: 40px; }
.page-head { align-items: center; padding: 8px 0 16px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(28px, 4vw, 44px); letter-spacing: -.025em; }
.page-head p { margin-top: 7px; }
.page-head .btn { min-height: 42px; }
.tiles { gap: 12px; }
.tile { box-shadow: none; }
.tile .val { font-size: clamp(24px, 3vw, 36px); }
.dispatch-tabs { overflow-x: auto; flex-wrap: nowrap; }
.dispatch-tabs button { flex: none; min-height: 44px; }
.trip { padding: 18px 4px; }
.trip-p { font-size: 17px; }
.trip .actions .btn { min-height: 38px; }
.trip-window { font-weight: 600; color: var(--fg); }
.mobile-wrap { width: 100%; max-width: 640px; }
.pcard[data-current="true"] { border-inline-start: 4px solid var(--accent); }
.inspection-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.inspection-heading output { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pcard .chk { min-height: 50px; gap: 12px; }
.pcard .seg { flex: none; }
.pcard .seg-b { display: grid; place-items: center; min-height: 44px; min-width: 52px; }
.pcard .pbtn { min-height: 46px; }
[data-save-feedback] { margin: 0; color: var(--crit); }
[data-save-feedback]:empty { display: none; }
.connection-status { max-width: 1520px; margin: 0 auto 12px; padding: 10px 14px; border-radius: 10px; color: var(--warn); background: var(--warn-soft); }
@media (max-width: 860px) {
  .rail { border-radius: 14px; padding: 12px; }
  .rail-foot { align-items: center; justify-content: space-between; }
  .page-head { padding-top: 0; }
}
@media (max-width: 560px) {
  .app { gap: 14px; }
  .page-head .actions, .page-head .actions .primary { width: 100%; }
  .trip .actions .btn { min-height: 44px; }
  .pcard .seg-b { min-width: 48px; padding: 6px; }
}
.driver-trip-title { font: 600 16px/1.35 var(--f-body); }
.driver-vehicle { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Bundled Android screens */
.android-app {
  --mobile-panel: var(--surface);
  --mobile-line: var(--line);
  --mobile-heading: var(--rail);
  background: var(--bg);
  color: var(--fg);
  padding: 0;
}
.android-app .app { display: block; }
.android-app .rail {
  position: static;
  background: var(--mobile-heading);
  border-radius: 0;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
}
.android-app .nav { flex-direction: row; overflow-x: auto; }
.android-app .nav a { flex: none; }
.android-app .rail-foot { flex-direction: row; align-items: center; justify-content: space-between; }
.android-app .auth-card > .brand {
  padding: calc(15px + env(safe-area-inset-top, 0px)) 16px 15px;
  background: var(--mobile-heading);
  color: white;
}
.android-app .auth-card > .brand span { color: var(--rail-muted); }
.android-app .auth { min-height: auto; display: block; }
.android-app .auth-card {
  width: min(100%, 540px);
  margin: auto;
  padding: 0 0 20px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  gap: 14px;
}
.android-app .auth-card > :not(.brand) { margin-inline: 16px; }
.android-app .mobile-login-fields,
.android-app .mobile-check-panel .inspection-form,
.android-app .driver-trip-list .pcard {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--mobile-line);
  border-radius: 14px;
  background: var(--mobile-panel);
}
.android-app .mobile-login-fields input { min-height: 44px; }
.android-app .mobile-login-fields > .btn { min-height: 44px; }
.android-app main {
  width: min(100%, 640px);
  margin: auto;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.android-app h1 { font: 700 24px/1.25 var(--f-body); letter-spacing: -.025em; }
.android-app .page-head { border: 0; }
.android-app .mobile-offline {
  margin-block: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
}
.android-app .mobile-check-panel:not([hidden]) { display: grid; gap: 14px; }
.android-app .mobile-back { justify-self: start; min-height: 44px; }
.android-app .driver-trip-title { font-size: 17px; }
.android-app .driver-vehicle {
  border-top: 1px solid var(--mobile-line);
  padding-top: 10px;
}
.android-app .inspection-form progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}
.android-app .inspection-form .chk { min-height: 51px; border-bottom: 1px solid var(--mobile-line); }
.android-app .inspection-form .seg { flex: none; }
.android-app .inspection-form .seg-b {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
}
.android-app .pbtn { min-height: 44px; }


/* Shared responsive workspace */
body { min-height: 100vh; }
.nav a[aria-current="page"] { box-shadow: inset 3px 0 0 #e3ae3f; }
.brand-mark { border-radius: 11px; }
.card, .tile, .pcard { box-shadow: var(--shadow); }
.tile:hover, .tile:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.btn.primary, .pbtn { font-weight: 650; }
.dispatch-tabs button[aria-selected="true"] { color: var(--accent); font-weight: 650; }
.overview-header {
  padding: clamp(19px, 3vw, 34px);
  color: var(--rail-fg);
  background: var(--rail);
  border-radius: 17px;
  border: 0;
}
.overview-header p { color: var(--rail-muted); }
.overview-header .btn { color: #2a1d06; background: #e3ae3f; border-color: #e3ae3f; }
.overview-header .btn:hover { background: #efc063; border-color: #efc063; }
.auth-entry { width: min(920px, 100%); display: grid; grid-template-columns: 1.05fr 1fr; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); }
.auth-entry .auth-card { width: 100%; border-radius: 0; box-shadow: none; padding: clamp(20px, 4vw, 40px); }
.auth-intro {
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: space-between;
  gap: 36px;
  padding: clamp(24px, 5vw, 48px);
  color: var(--rail-fg);
  background: #163a2c;
}
.auth-intro .brand { padding: 0; }
.auth-intro h1 { font-size: clamp(32px, 4.4vw, 56px); line-height: .99; }
.auth-intro p { color: var(--rail-muted); margin: 12px 0 0; }
.auth-intro .btn { color: #2a1d06; background: #e3ae3f; border-color: #e3ae3f; }
.auth-form-fields { display: grid; gap: 13px; }
.auth-form-fields .btn { justify-content: center; min-height: 44px; }
.auth-entry + .auth-card { box-shadow: none; }
.demo-exit { color: var(--rail-fg); padding: 7px 10px; }
@media (max-width: 660px) {
  .auth-entry { grid-template-columns: 1fr; width: min(460px, 100%); }
  .auth-intro { gap: 18px; }
  .auth-intro h1 { font-size: 33px; }
  .overview-header { border-radius: 12px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 #e3ae3f; }
}

/* ==========================================================================
   Fleet design layer: flat blue sidebar, card dashboard, app bar and bottom tabs.
   Patterns follow established fleet-management software; names, logos and imagery are our own.
   Declared last so it overrides the earlier palette and layout rules.
   ========================================================================== */
:root {
  --bg: light-dark(#f3f5f7, #12161c);
  --surface: light-dark(#ffffff, #1b222c);
  --surface-2: light-dark(#f0f3f6, #242d39);
  --fg: light-dark(#212b36, #e8edf3);
  --muted: light-dark(#5f6b7a, #9aa7b8);
  --line: light-dark(#e2e7ec, #2f3947);
  --accent: light-dark(#1b6ec2, #6fb1f0);
  --accent-fg: light-dark(#ffffff, #0a1a2b);
  --accent-soft: light-dark(#e6f0fa, #1d3552);
  --rail: light-dark(#044a87, #0b2f52);
  --rail-fg: #ffffff;
  --rail-muted: #b8d2ee;
  --rail-active: light-dark(#0a5ba6, #123f6d);
  --ok: light-dark(#17825a, #5fd3a1);
  --ok-soft: light-dark(#dff5ec, #153a2b);
  --info: light-dark(#1b6ec2, #8cc2f5);
  --info-soft: light-dark(#e3eefb, #1d3552);
  --warn: light-dark(#b86412, #f2b369);
  --warn-soft: light-dark(#fdeedb, #3d2a12);
  --crit: light-dark(#d03a34, #f59a95);
  --crit-soft: light-dark(#fbe5e4, #442120);
  --road: light-dark(#d5dbe3, #3a4452);
  --land: light-dark(#eef1f5, #1b222c);
  --chart-a: light-dark(#fcc419, #f5be1f);
  --chart-b: light-dark(#3a8fdc, #5aa6ea);
  --shadow: 0 1px 2px #1018280d;
  --phone: #17212d;
  --f-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
body { font-size: 14px; padding: 0; }
h1, h2, h3 { letter-spacing: 0; }

/* Flush blue sidebar */
.app { grid-template-columns: 248px minmax(0, 1fr); gap: 0; max-width: none; align-items: stretch; min-height: 100vh; }
.rail { border-radius: 0; padding: 0; gap: 0; top: 0; height: 100vh; overflow-y: auto; align-self: start; }
.brand { padding: 16px 20px; border-bottom: 1px solid #ffffff1f; }
.brand-mark { background: #ffffff29; color: #fff; border-radius: 6px; }
.brand b { font-size: 17px; font-weight: 600; }
.nav { gap: 0; padding: 8px 0; }
.nav a { min-height: 46px; padding: 0 20px; gap: 14px; border-radius: 0; font-size: 15px; font-weight: 500; }
.nav a:hover { background: #ffffff14; }
.nav a[aria-current="page"] { background: var(--rail-active); box-shadow: none; }
.nav svg { width: 20px; height: 20px; opacity: 1; }
.nav .badge { background: #e8453c; }
.rail-foot { margin-top: auto; padding: 16px 20px; border-top: 1px solid #ffffff1f; }
.rail-user { padding: 0; }
main, #main { padding: 24px 28px 40px; min-width: 0; }

/* Page header, cards */
.page-head { padding: 0 0 18px; border: 0; }
.page-head h1 { font-size: 24px; font-weight: 600; }
.page-head p { font-size: 14px; }
.overview-header { background: none; color: var(--fg); padding: 0 0 18px; border-radius: 0; }
.overview-header p { color: var(--muted); }
.overview-header .btn { color: var(--fg); background: var(--surface); border-color: var(--line); }
.overview-header .btn:hover { background: var(--surface-2); border-color: var(--line); }
.card, .tile, .pcard { border-radius: 6px; box-shadow: var(--shadow); }
.card { padding: 18px 20px; }
.card-head h2 { font-size: 16px; font-weight: 600; }
.card-link { color: var(--accent); font-size: 13px; font-weight: 500; text-decoration: none; }
.card-link:hover { text-decoration: underline; }
.btn, .btn.primary, .pbtn, input, select, textarea { border-radius: 4px; }

/* Dashboard grid */
.dash { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.dash .span-2 { grid-column: span 2; }
.dash > .span-2 > .card { height: 100%; }
.status-list a { display: flex; justify-content: space-between; align-items: center; padding: 14px 2px; border-top: 1px solid var(--line); color: var(--fg); text-decoration: none; font-size: 15px; }
.status-list a:first-child { border-top: 0; }
.status-list a:hover { background: var(--surface-2); }
.count { min-width: 28px; height: 24px; padding: 0 9px; border-radius: 99px; color: #fff; font-weight: 600; font-size: 13px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.c-ok { background: #25b87a; } .c-info { background: #1b6ec2; } .c-warn { background: #e8912d; } .c-crit { background: #d9423b; }
.kpi2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: center; align-items: center; min-height: 148px; }
.kpi2 a { text-decoration: none; color: inherit; display: block; }
.kpi2 b { display: block; font-size: 44px; font-weight: 400; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi2 span { display: block; color: var(--muted); font-size: 14.5px; margin-top: 6px; }
.k-crit { color: #e0443d; } .k-info { color: #1b6ec2; } .k-warn { color: #e8912d; } .k-ok { color: #1faa6b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .k-info { color: #6fb1f0; } }
@media (max-width: 1180px) { .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash .span-2 { grid-column: 1 / -1; } }
@media (max-width: 860px) {
  .app { display: block; }
  .rail { height: auto; position: static; }
  .nav { flex-direction: row; overflow-x: auto; padding: 0; }
  .nav a { white-space: nowrap; min-height: 44px; padding: 0 14px; }
  main, #main { padding: 16px; }
  .dash { grid-template-columns: 1fr; } .dash .span-2 { grid-column: auto; }
}

/* ---------- Android app: blue app bar, bottom tabs ---------- */
:is(.android-app, body.bottom-nav) { background: var(--bg); }
:is(.android-app, body.bottom-nav) .app { display: block; min-height: 100vh; padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
:is(.android-app, body.bottom-nav) .rail { display: contents; }
:is(.android-app, body.bottom-nav) .brand { position: sticky; top: 0; z-index: 30; background: var(--rail); color: #fff; min-height: 56px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 96px 8px 16px; border: 0; margin: 0; }
:is(.android-app, body.bottom-nav) .brand span { font-size: 12px; }
:is(.android-app, body.bottom-nav) .rail-foot { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); right: 8px; z-index: 31; border: 0; padding: 0; margin: 0; flex-direction: row; }
:is(.android-app, body.bottom-nav) .rail-user { display: none; }
:is(.android-app, body.bottom-nav) .rail-foot button { background: transparent; border: 0; color: #fff; font-weight: 600; padding: 10px 12px; min-height: 40px; }
:is(.android-app, body.bottom-nav) .nav { position: fixed; inset: auto 0 0 0; z-index: 40; flex-direction: row; overflow-x: auto; justify-content: space-around; gap: 0; padding: 0 0 env(safe-area-inset-bottom, 0px);
  background: var(--surface); border-top: 1px solid var(--line); }
:is(.android-app, body.bottom-nav) .nav a { flex: 1 0 72px; flex-direction: column; justify-content: center; gap: 3px; min-height: 58px; padding: 6px 4px; font-size: 11.5px; font-weight: 500;
  color: var(--muted); background: transparent; box-shadow: none; }
:is(.android-app, body.bottom-nav) .nav a:hover { background: transparent; }
:is(.android-app, body.bottom-nav) .nav a[aria-current="page"] { color: var(--accent); background: transparent; box-shadow: none; }
:is(.android-app, body.bottom-nav) .nav svg { width: 24px; height: 24px; }
:is(.android-app, body.bottom-nav) main, :is(.android-app, body.bottom-nav) #main { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
:is(.android-app, body.bottom-nav) .page-head h1 { font-size: 22px; }

/* ---------- Pre-trip inspection: one item per screen ---------- */
.android-app .mobile-check-panel:not([hidden]) { position: fixed; inset: 0; z-index: 80; display: block; background: var(--rail); overflow: hidden; }
.android-app .mobile-check-panel .inspection-form { height: 100%; display: flex; flex-direction: column; gap: 0; padding: 0; border: 0; border-radius: 0; background: var(--rail); color: #fff; }
.mc-bar { display: flex; align-items: center; gap: 4px; padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px 4px; min-height: 60px; flex: none; }
.mc-back { background: transparent; border: 0; color: #fff; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; }
.mc-back svg { width: 26px; height: 26px; }
.mc-title { flex: 1; min-width: 0; }
.android-app .mc-title h1 { font: 600 18px/1.2 var(--f-body); letter-spacing: 0; color: #fff; margin: 0; outline: none; }
.mc-title span { display: block; font-size: 13px; color: var(--rail-muted); }
.mc-title output { color: inherit; }
.mc-act { background: transparent; border: 0; color: #fff; font: 600 14px var(--f-body); text-transform: uppercase; letter-spacing: .06em; padding: 12px 10px; min-height: 44px; cursor: pointer; }
.mc-act:disabled { opacity: .5; }
.mc-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.mc-body .mobile-offline { margin: 0; }
.android-app .inspection-form .chk { display: none; border: 0; min-height: 0; padding: 0; }
.android-app .inspection-form[data-view="step"] .chk[data-current] { display: flex; flex-direction: column; align-items: center; text-align: center; flex: 1;
  background: var(--surface); color: var(--fg); border-radius: 6px; padding: 18px 16px 20px; min-height: 52vh; gap: 10px; }
.req { background: var(--crit-soft); color: var(--crit); font-size: 14px; font-weight: 600; padding: 4px 12px; border-radius: 6px; }
.chk-t { font-size: 28px; font-weight: 400; line-height: 1.2; margin-top: 6px; }
.chk-k { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pf { margin-top: auto; width: 100%; display: flex; justify-content: space-between; align-items: flex-start; padding: 0 8px; }
.pf label { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; position: relative; }
.pf input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pf-b { width: 64px; height: 64px; border-radius: 6px; background: var(--surface-2); color: #8696a6; box-shadow: 0 1px 3px #10182829; display: grid; place-items: center; }
.pf-b svg { width: 32px; height: 32px; }
.pf-l { font-size: 20px; color: var(--muted); }
.pf input:focus-visible + .pf-b { outline: 3px solid var(--accent); outline-offset: 2px; }
.pf-pass input:checked + .pf-b { background: #25b87a; color: #fff; }
.pf-fail input:checked + .pf-b { background: #d9423b; color: #fff; }
.pf input:checked ~ .pf-l { color: var(--fg); font-weight: 600; }
.chk-s, .chk-open { display: none; }
.android-app .inspection-form .field { color: #fff; }
.android-app .inspection-form .field label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--rail-muted); }
.android-app .inspection-form .field textarea { background: var(--surface); color: var(--fg); border: 0; min-height: 64px; width: 100%; padding: 10px; }
.android-app .inspection-form[data-view="step"]:not([data-cur-bad="1"]) .field { display: none; }
/* List view */
.android-app .inspection-form[data-view="list"] .chk { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; background: var(--surface); color: var(--fg);
  padding: 12px 14px; min-height: 52px; border-bottom: 1px solid var(--line); text-align: left; }
.android-app .inspection-form[data-view="list"] .chk:first-of-type { border-radius: 6px 6px 0 0; } 
.android-app .inspection-form[data-view="list"] .req, .android-app .inspection-form[data-view="list"] .chk-k, .android-app .inspection-form[data-view="list"] .pf { display: none; }
.android-app .inspection-form[data-view="list"] .chk-t { font-size: 16px; margin: 0; grid-column: 1; }
.android-app .inspection-form[data-view="list"] .chk-s { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.android-app .inspection-form[data-view="list"] .chk[data-state="ok"] .chk-s { color: var(--ok); } .android-app .inspection-form[data-view="list"] .chk[data-state="ok"] .chk-s::after { content: "Pass"; }
.android-app .inspection-form[data-view="list"] .chk[data-state="bad"] .chk-s { color: var(--crit); } .android-app .inspection-form[data-view="list"] .chk[data-state="bad"] .chk-s::after { content: "Fail"; }
.android-app .inspection-form[data-view="list"] .chk:not([data-state]) .chk-s::after { content: "Not checked"; }
.android-app .inspection-form[data-view="list"] .chk-open { display: block; background: transparent; border: 0; font-size: 24px; color: var(--muted); min-width: 44px; min-height: 44px; cursor: pointer; }
/* Footer */
.mc-foot { flex: none; order: 9; padding: 0 0 env(safe-area-inset-bottom, 0px); }
.android-app .inspection-form [data-save-feedback] { order: 8; margin: 0; padding: 8px 16px; background: var(--crit); color: #fff; font-size: 13px; }
.android-app .inspection-form [data-save-feedback]:empty { display: none; }
.mc-foot progress { display: block; width: 100%; height: 4px; border: 0; background: #ffffff2e; accent-color: #25c97f; }
.mc-foot progress::-webkit-progress-bar { background: #ffffff2e; } .mc-foot progress::-webkit-progress-value { background: #25c97f; }
.mc-nav { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; }
.mc-nav button { background: transparent; border: 0; color: #fff; font: 600 14px var(--f-body); text-transform: uppercase; letter-spacing: .1em; padding: 14px 12px; min-height: 48px; cursor: pointer; }
.mc-nav button:disabled { opacity: .4; }
.mc-nav output { color: #fff; font-size: 15px; }

/* ---------- Vehicle page: hero with KPI tiles ---------- */
.crumbs { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.crumbs .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vhero { display: grid; grid-template-columns: 200px minmax(0, 1fr) minmax(300px, 420px); gap: 28px; align-items: center; padding: 22px 24px; border-radius: 12px; margin-bottom: 20px; }
.vh-art { aspect-ratio: 4 / 3; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.vh-art svg { width: 70%; height: 70%; }
.vh-main h1 { font-size: 30px; font-weight: 700; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vh-sub { color: var(--muted); margin: 4px 0 14px; }
.vh-driver { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.vh-driver small, .vh-facts small, .kpi-mini .kl { display: block; color: var(--muted); font-size: 12.5px; }
.vh-driver b { font-size: 15px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-weight: 600; font-size: 14px; flex: none; }
.vh-facts { display: flex; gap: 28px; flex-wrap: wrap; }
.vh-facts b { font-size: 15px; font-weight: 600; }
.vh-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi-mini { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); display: grid; gap: 4px; }
.kpi-mini b { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 8px; }
.kpi-mini small { font-size: 13px; color: var(--muted); font-weight: 400; }
.ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; margin-bottom: 2px; }
.ico svg { width: 20px; height: 20px; }
.ico-green { background: #25b87a; } .ico-blue { background: #2f7fd6; } .ico-orange { background: #f0a020; } .ico-purple { background: #7a3fe0; }
@media (max-width: 1180px) { .vhero { grid-template-columns: 160px minmax(0, 1fr); } .vh-kpis { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px) { .vhero { grid-template-columns: 1fr; } .vh-art { max-width: 200px; } .vh-kpis { grid-template-columns: 1fr 1fr; } }

/* ==========================================================================
   Brand theme: the same near-black, white and orange as the public page.
   Declared last so it overrides the earlier blue palette everywhere.
   ========================================================================== */
:root {
  --bg: light-dark(#f6f6f4, #0f1012);
  --surface: light-dark(#ffffff, #18191c);
  --surface-2: light-dark(#f0f0ed, #222327);
  --fg: light-dark(#0c0d10, #f1f1ef);
  --muted: light-dark(#565b63, #a3a6ad);
  --line: light-dark(#e7e7e4, #2c2d32);
  --accent: light-dark(#d9430a, #ff7a45);
  --accent-fg: light-dark(#ffffff, #1a0a02);
  --accent-soft: light-dark(#fff0ea, #3a1f14);
  --brand: #ff4f12;
  --rail: #0b0b0d;
  --rail-fg: #f4f4f2;
  --rail-muted: #9a9ca3;
  --rail-active: #1c1d21;
  --info: light-dark(#2a5f8f, #8cc2f5);
  --phone: #0b0b0d;
  --f-display: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3 { letter-spacing: -.02em; }
.page-head h1 { font-weight: 800; letter-spacing: -.03em; }
.card, .tile, .pcard, .kpi-mini { border-radius: 8px; }
.btn, .btn.primary, .pbtn, input, select, textarea { border-radius: 8px; }
.brand-mark { background: var(--brand); color: #fff; }
.nav a[aria-current="page"] { background: var(--rail-active); box-shadow: inset 3px 0 0 var(--brand); }
.nav a[aria-current="page"] svg { color: var(--brand); }
.nav .badge { background: var(--brand); }
.k-info { color: var(--fg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .k-info { color: var(--fg); } }
.vh-art { background: var(--accent-soft); color: var(--brand); }
.avatar { background: var(--rail); color: #fff; }
.ico-blue { background: #0c0d10; }
.android-app .nav a[aria-current="page"], body.bottom-nav .nav a[aria-current="page"] { color: var(--accent); box-shadow: none; background: transparent; }
.mc-bar, .android-app .mobile-check-panel:not([hidden]) { background: var(--rail); }

/* ---------- Sign-in: split screen like the public page ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 32px; box-shadow: none; gap: 14px; }
.auth-card h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.auth-sub { color: var(--muted); margin: -6px 0 4px; font-size: 14.5px; }
.auth-form-fields .btn.primary { min-height: 46px; font-size: 15px; font-weight: 700; box-shadow: 0 8px 20px #ff4f122e; }
.auth-form-fields input { min-height: 44px; }
.auth-card a { color: var(--accent); font-weight: 600; }
.auth.auth-split { display: block; padding: 0; }
.auth-split .auth-entry { width: 100%; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-radius: 0; box-shadow: none; overflow: visible; }
.auth-split .auth-intro { background: #0b0b0d; color: #fff; padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; border: 0; position: relative; }
.auth-split .auth-intro::after { content: ""; position: absolute; left: clamp(28px, 5vw, 64px); right: clamp(28px, 5vw, 64px); bottom: 112px; height: 2px; background: var(--brand); opacity: .9; }
.auth-split .auth-intro .brand { padding: 0; }
.auth-split .auth-intro .brand b { font-size: 18px; font-weight: 700; }
.auth-split .auth-intro .brand span { color: var(--rail-muted); }
.auth-split .intro-body h1 { font-size: clamp(34px, 4.2vw, 58px); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; max-width: 12em; }
.auth-split .intro-body p { margin: 18px 0 0; color: #c9cad0; font-size: 17px; line-height: 1.6; max-width: 30em; }
.intro-facts { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 10px; color: #dcdde1; font-size: 14.5px; }
.intro-facts li { padding-left: 22px; position: relative; }
.intro-facts li::before { content: ""; position: absolute; left: 0; top: .6em; width: 10px; height: 2px; background: var(--brand); }
.intro-foot { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.auth-split .btn.ghost-light { background: transparent; color: #fff; border: 1px solid #ffffff59; }
.auth-split .btn.ghost-light:hover { background: #ffffff14; }
.intro-link { color: #c9cad0; text-decoration: none; font-size: 14px; }
.intro-link:hover { color: #fff; text-decoration: underline; }
.auth-split .auth-entry .auth-card { width: 100%; max-width: none; border: 0; border-radius: 0; background: var(--surface); padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; }
.auth-split .auth-entry .auth-card > * { width: min(400px, 100%); }
@media (max-width: 860px) {
  .auth-split .auth-entry { grid-template-columns: 1fr; min-height: 0; }
  .auth-split .auth-intro { padding: 24px 20px 28px; gap: 18px; }
  .auth-split .auth-intro::after, .auth-split .intro-facts, .auth-split .intro-body p { display: none; }
  .auth-split .intro-body h1 { font-size: 28px; }
  .auth-split .auth-entry .auth-card { padding: 28px 20px 40px; align-items: stretch; }
  .auth-split .auth-entry .auth-card > * { width: 100%; }
}
.android-app .auth { padding: 0; background: var(--bg); }
.android-app .auth-card > .brand { background: var(--rail); }
.auth-split .auth-intro .brand { border: 0; }
.auth-form-fields .field label { font-size: 13px; font-weight: 600; color: var(--fg); }
.auth-form-fields input { border: 1px solid #d6d6d2; background: var(--surface); }
.auth-form-fields input:focus { outline: 3px solid #ff4f1240; border-color: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-form-fields input { border-color: #3a3b41; } }

.auth-split .intro-art { width: min(440px, 80%); color: #3a3b41; margin: auto 0; align-self: flex-start; }
@media (max-width: 860px) { .auth-split .intro-art { display: none; } }

/* Sign-in is a single centred card: no side panel. */
.auth-card .brand { padding: 0 0 6px; border: 0; }
.auth-card .brand b { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.auth-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 13.5px; }
.auth-links a { font-weight: 600; text-decoration: none; text-align: center; padding: 10px 6px; min-height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; line-height: 1.2; }
.auth-links a:hover { border-color: var(--accent); }
.auth-card .small.muted { line-height: 1.5; }
.auth-card .small.muted a { display: inline-block; padding: 6px 0; text-decoration: underline; }
/* On phone-width browsers the in-app top bar must not restyle the sign-in card's own brand header. */
body.bottom-nav:not(.android-app) .auth-card .brand { position: static; background: transparent; color: var(--fg); min-height: 0; padding: 0 0 6px; margin: 0; }
body.bottom-nav:not(.android-app) .auth-card .brand span { color: var(--muted); }
body.bottom-nav:not(.android-app) .auth { padding: 16px; align-items: start; }

/* Logo mark: the M fills its orange tile. */
.brand-mark svg { width: 100%; height: 100%; padding: 6px; }

/* ---------- Licences ---------- */
.plan { font-weight: 700; margin-bottom: 4px; }
.lim-full { color: var(--crit); font-weight: 600; }
.act-col { white-space: nowrap; }
.lic-log { margin-top: 10px; display: grid; gap: 4px; }
.licence-strip { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-weight: 600; font-size: 14px; }

.welcome { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok); border-radius: 8px; padding: 10px 12px; font-weight: 600; font-size: 14px; margin: 0 0 4px; }

.no-options { color: var(--crit); }

/* ---------- Drivers ---------- */
.name-link { color: var(--fg); text-decoration: none; } .name-link:hover b { color: var(--accent); }
.row-removed { opacity: .6; }
.big-initials { font-size: 54px; font-weight: 800; letter-spacing: -.02em; }
.check-row { display: inline-flex; align-items: center; gap: 8px; margin-right: 14px; font-size: 13.5px; color: var(--muted); cursor: pointer; }

/* ---------- Read-only organisation view ---------- */
.modal.modal-wide { width: min(860px, 100%); }
.view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; margin: 12px 0 4px; }
.view-grid h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.view-grid .kv { grid-template-columns: 120px minmax(0, 1fr); }
.form-h { font-size: 14px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 720px) { .view-grid { grid-template-columns: 1fr; } }

/* reports */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.report-grid .card { margin: 0; }
#print-area { display: none; }
@media print {
  body.printing #root, body.printing #modal-root, body.printing .toast, body.printing #toasts { display: none !important; }
  body.printing #print-area { display: block; color: #000; background: #fff; font: 11px/1.4 Arial, sans-serif; }
  body.printing #print-area h1 { font-size: 18px; margin: 0 0 4px; }
  body.printing #print-area table { width: 100%; border-collapse: collapse; margin-top: 10px; }
  body.printing #print-area th, body.printing #print-area td { border: 1px solid #bbb; padding: 3px 5px; text-align: left; }
  body.printing #print-area thead { display: table-header-group; }
  body.printing #print-area tr { page-break-inside: avoid; }
  @page { size: landscape; margin: 12mm; }
}

/* app update banner (Android) */
#update-banner { position: fixed; left: 8px; right: 8px; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: #111; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.3); font-size: 14px; }
#update-banner span { flex: 1 1 180px; }

/* Fuel: the issues table gets the room, the tank card sits beside it */
.fuel-layout { grid-template-columns: minmax(0, 1fr) 330px; }
.fuel-table td, .fuel-table th { white-space: nowrap; }
.fuel-table td .muted.small { white-space: nowrap; }
@media (max-width: 1180px) { .fuel-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Driver app: bell, More tab, Home, bottom sheets ---------- */
.bell-btn { display: none; position: relative; width: 40px; height: 40px; border-radius: 12px; background: #1f1f24; border: 0; color: #fff; place-items: center; cursor: pointer; }
.bell-btn svg { width: 22px; height: 22px; margin: auto; }
.bell-btn i { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--brand); color: #fff; font: 700 10px/17px var(--f-body); text-align: center; padding: 0 4px; font-style: normal; border: 2px solid #0b0b0d; box-sizing: content-box; }
.bell-btn i[hidden] { display: none; }
:is(.android-app, body.bottom-nav) .rail-foot { top: calc(8px + env(safe-area-inset-top, 0px)); right: 12px; }
:is(.android-app, body.bottom-nav) .rail-foot .bell-btn { display: grid; }
:is(.android-app, body.bottom-nav) .rail-foot .signout-btn { display: none; }
:is(.android-app, body.bottom-nav) .brand { padding-right: 70px; }
.more-tab { background: transparent; border: 0; font-family: inherit; cursor: pointer; }
:is(.android-app, body.bottom-nav) .nav .more-tab { flex: 1 0 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 58px; padding: 6px 4px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
:is(.android-app, body.bottom-nav) .nav .more-tab[aria-current="page"] { color: var(--accent); }
:is(.android-app, body.bottom-nav) .nav .more-tab svg { width: 24px; height: 24px; }
:is(.android-app, body.bottom-nav) .nav a, :is(.android-app, body.bottom-nav) .nav .more-tab { position: relative; }
:is(.android-app, body.bottom-nav) .nav [aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 50%; width: 28px; margin-left: -14px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }

/* soft round icons */
.mh-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.mh-ico svg { width: 20px; height: 20px; }
/* one icon colour everywhere: the brand orange on a soft tint */
.mh-ico, .mh-ico.ico-green, .mh-ico.ico-blue, .mh-ico.ico-orange, .mh-ico.ico-purple, .mh-ico.ico-grey, .mh-ico.ico-red { background: var(--accent-soft); color: var(--accent); }
.mh-big { width: 64px; height: 64px; border-radius: 50%; margin: 6px auto 4px; } .mh-big svg { width: 34px; height: 34px; }

/* Home */
.mh { display: flex; flex-direction: column; gap: 0; max-width: 560px; }
.mh-hello h1 { font-size: 24px; letter-spacing: -.02em; } .mh-hello p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.mh-h { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 18px 2px 8px; display: flex; justify-content: space-between; align-items: center; }
.mh-link { background: none; border: 0; color: var(--accent); font: 600 12.5px var(--f-body); text-transform: none; letter-spacing: 0; cursor: pointer; padding: 4px 2px; text-decoration: none; margin-left: auto; }
.mh-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.mh-hero { background: #0b0b0d; color: #fff; border-radius: 18px; padding: 16px; margin-top: 12px; position: relative; overflow: hidden; }
.mh-hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: var(--brand); opacity: .16; pointer-events: none; }
.mh-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: #ffffff1f; }
.mh-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mh-hero h2 { font-size: 18px; margin: 10px 0 2px; letter-spacing: -.01em; color: #fff; } .mh-hero p { color: #b4b4bd; font-size: 12.5px; margin: 0; }
.mh-route { display: flex; gap: 10px; margin-top: 12px; font-size: 12.5px; color: #d7d7de; flex-wrap: wrap; }
.mh-actions { display: flex; gap: 10px; margin-top: 14px; position: relative; z-index: 1; } .mh-actions .btn { flex: 1; min-height: 44px; justify-content: center; text-decoration: none; }
.mh-actions .btn.ghost { background: #ffffff1a; color: #fff; border: 0; } .mh-actions .btn svg { width: 18px; height: 18px; margin-right: 6px; }
.mh-quiet h2 { font-size: 17px; }
.mh-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mh-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; display: flex; gap: 11px; align-items: center; min-width: 0; }
.mh-stat b { font-size: 19px; letter-spacing: -.02em; display: block; line-height: 1.1; } .mh-stat span:not(.mh-ico) { font-size: 11.5px; color: var(--muted); }
.mh-veh { padding: 14px; } .mh-vtop { display: flex; justify-content: space-between; align-items: flex-start; } .mh-veh h3 { font-size: 16px; margin: 8px 0 0; }
.mh-line { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 10px; } .mh-line b { color: var(--fg); text-align: right; }
.mh-meter { height: 7px; background: var(--surface-2); border-radius: 5px; overflow: hidden; margin-top: 6px; } .mh-meter i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.mh-meter i.b-warn { background: var(--warn); } .mh-meter i.b-crit { background: var(--crit); }
.mh-qas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mh-qa { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 4px 10px; text-align: center; font-size: 11px; font-weight: 600; box-shadow: var(--shadow); color: var(--fg); text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.mh-li, .mh-mrow, .mh-nt { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; font: inherit; color: var(--fg); text-decoration: none; cursor: pointer; }
.mh-li:last-child, .mh-mrow:last-child, .mh-nt:last-child { border-bottom: 0; }
div.mh-li, div.mh-nt, div.mh-mrow { cursor: default; }
.mh-li-t { display: flex; flex-direction: column; min-width: 0; flex: 1; } .mh-li-t b { font-size: 13.5px; font-weight: 600; line-height: 1.25; } .mh-li-t small { font-size: 12px; color: var(--muted); margin-top: 1px; }
.mh-li-r { text-align: right; flex: none; font-size: 12px; color: var(--muted); } .mh-li-r b { color: var(--fg); font-size: 13px; }
.mh-seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; margin: 4px 0 14px; max-width: 560px; }
.mh-seg button { flex: 1; border: 0; background: none; font: 700 13px var(--f-body); padding: 10px; border-radius: 10px; color: var(--muted); cursor: pointer; }
.mh-seg button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px #0002; }
.mh-form { padding: 14px; display: flex; flex-direction: column; gap: 10px; } .mh-fixed { min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); } .mh-fixed small { margin-left: auto; color: var(--muted); }
.mh-kv { margin: 0 0 10px; } .mh-kv dd { text-align: right; font-weight: 600; }
.bio-block { display: none; text-align: center; } .bio-block h2 { font-size: 18px; margin: 0 0 14px; } .bio-block .pbtn { margin-top: 10px; }
.bio-btn { width: 112px; height: 112px; border-radius: 50%; border: 2px solid var(--line); background: radial-gradient(circle, #ff4f1233, transparent 70%); color: var(--brand); display: grid; place-items: center; margin: 4px auto 6px; cursor: pointer; }
.bio-btn svg { width: 58px; height: 58px; stroke-width: 1.5; }
#login-form.bio-mode .bio-block { display: block; }
#login-form.bio-mode h1, #login-form.bio-mode .auth-sub, #login-form.bio-mode .auth-form-fields, #login-form.bio-mode > .small, #login-form.bio-mode .auth-links, #login-form.bio-mode .welcome { display: none; }

/* bottom sheets: on a phone every dialog slides up from the bottom */
.mh-switch { margin-left: auto; width: 46px; height: 27px; border-radius: 14px; border: 0; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.mh-switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px #0004; }
.mh-switch[aria-checked="true"] { background: var(--brand); } .mh-switch[aria-checked="true"]::after { transform: translateX(19px); }
.mh-sep { height: 1px; background: var(--line); margin: 6px 18px; } .mh-danger, .mh-danger b { color: var(--crit); }
.mh-mrow .go { margin-left: auto; color: var(--muted); font-style: normal; font-size: 18px; }
.mh-nt time { margin-left: auto; font-size: 11px; color: var(--muted); flex: none; } .mh-nt.un { background: var(--accent-soft); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; } .sheet-head h2 { font-size: 18px; margin: 0; }
.sheet-x { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 14px; }
.sheet-body { display: flex; flex-direction: column; gap: 6px; } .sheet-flush { margin: 0 -20px -8px; } .sheet-flush > p { margin: 0; }
.sheet-center { align-items: stretch; text-align: center; gap: 10px; } .sheet-center h3 { font-size: 18px; margin: 6px 0 0; }
:is(.android-app, body.bottom-nav) .overlay { place-items: end center; padding: 0; background: rgba(0,0,0,.55); }
:is(.android-app, body.bottom-nav) .modal.sheet { width: 100%; max-width: none; border-radius: 22px 22px 0 0; max-height: 88vh; padding: 14px 20px calc(18px + env(safe-area-inset-bottom, 0px)); animation: sheet-up .22s ease-out; box-shadow: 0 -10px 30px #0006; position: relative; gap: 12px; }
:is(.android-app, body.bottom-nav) .modal.sheet::before { content: ""; width: 42px; height: 4px; border-radius: 3px; background: var(--line); margin: -4px auto 0; flex: none; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { :is(.android-app, body.bottom-nav) .modal.sheet { animation: none; } }
:is(.android-app, body.bottom-nav) .modal.sheet .modal-foot { position: static; padding-top: 8px; }
:is(.android-app, body.bottom-nav) .modal.sheet .modal-foot .btn { flex: 1; min-height: 46px; }
.modal.odo-sheet input[type="number"] { font: 700 32px var(--f-mono); text-align: center; height: 68px; letter-spacing: .06em; }

.mh-svg { width: 20px; height: 20px; flex: none; }
.mh-actions .btn .mh-svg { margin-right: 6px; }
.mh-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* the page behind a dialog or sheet must not scroll */
body.modal-open { overflow: hidden; }
.overlay { overscroll-behavior: contain; }
.modal { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* The top bar and the bell are both fixed (the bar used to be "sticky", which lags the fixed bell while scrolling and makes the toolbar shake). */
:is(.android-app, body.bottom-nav) { --bar-h: calc(56px + env(safe-area-inset-top, 0px)); overscroll-behavior-y: none; }
html:has(body.bottom-nav), html:has(body.android-app) { overscroll-behavior-y: none; }
:is(.android-app, body.bottom-nav) .app { padding-top: var(--bar-h); }
:is(.android-app, body.bottom-nav) .brand { position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); min-height: 0; box-sizing: border-box; transform: translateZ(0); will-change: transform; }
:is(.android-app, body.bottom-nav) .rail-foot { transform: translateZ(0); will-change: transform; }

/* app lock */
#app-lock { position: fixed; inset: 0; z-index: 300; background: #0b0b0d; color: #fff; display: grid; place-items: center; padding: 24px; }
#app-lock .lock-card { width: min(360px, 100%); text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
#app-lock .brand-mark { margin: 0 auto 4px; } #app-lock h1 { font-size: 22px; color: #fff; margin: 6px 0 0; } #app-lock p { color: #a9a9b3; margin: 0 0 6px; }
#app-lock .bio-btn { margin: 8px auto; border-color: #ffffff22; }
#app-lock .pbtn.sec { background: #1b1b20; color: #fff; border-color: #2c2c33; }

/* Phone shell: the document does not scroll. The top bar and the tab bar are ordinary flex rows, and only #main scrolls.
   (Fixed or sticky bars over a scrolling page flicker in the Android WebView.) */
html.phone-shell, html.phone-shell body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.phone-shell body { padding: 0; }
html.phone-shell .app { position: fixed; inset: 0; display: flex; flex-direction: column; padding: 0; min-height: 0; }
html.phone-shell .brand { position: static; flex: none; transform: none; will-change: auto; top: auto; left: auto; right: auto; }
html.phone-shell .rail-foot { transform: none; will-change: auto; }
html.phone-shell #main { order: 2; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
html.phone-shell .nav { order: 3; position: static; flex: none; inset: auto; width: 100%; padding-bottom: env(safe-area-inset-bottom, 0px); }
html.phone-shell .brand { order: 1; }
html.phone-shell .licence-strip { margin: 0 0 12px; }

:is(.android-app, body.bottom-nav) .modal.sheet { max-height: 88dvh; }
:is(.android-app, body.bottom-nav) .modal.sheet textarea { min-height: 96px; }

/* Home card in the brand orange (the black card with a brown glow read as off-brand) */
.mh-hero { background: linear-gradient(135deg, #ff4f12 0%, #d9430a 100%); color: #fff; box-shadow: 0 10px 24px #ff4f1233; }
.mh-hero::after { background: #fff; opacity: .1; }
.mh-hero h2 { color: #fff; } .mh-hero p { color: #ffffffd9; } .mh-route { color: #fffffff0; }
.mh-chip { background: #ffffff2e; color: #fff; }
.mh-actions .btn.primary { background: #fff; color: #0c0d10; border: 0; box-shadow: none; }
.mh-actions .btn.ghost { background: #ffffff2e; color: #fff; }
.mh-quiet { background: var(--surface); color: var(--fg); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mh-quiet::after { background: var(--brand); opacity: .08; }
.mh-quiet h2 { color: var(--fg); } .mh-quiet p { color: var(--muted); } .mh-quiet .mh-chip { background: var(--accent-soft); color: var(--accent); }
.mh-quiet .mh-actions .btn.ghost { background: var(--accent); color: #fff; }

/* Phone toolbar on white, like the rest of the app surface */
:is(.android-app, body.bottom-nav) .brand { background: var(--surface); color: var(--fg); border-bottom: 1px solid var(--line); }
:is(.android-app, body.bottom-nav) .brand b { color: var(--fg); }
:is(.android-app, body.bottom-nav) .brand span { color: var(--muted); }
:is(.android-app, body.bottom-nav) .rail-foot .bell-btn { background: var(--surface-2); color: var(--fg); padding: 0; min-height: 40px; }
:is(.android-app, body.bottom-nav) .bell-btn i { border-color: var(--surface); }
.bell-btn i { top: -5px; right: -5px; min-width: 16px; height: 16px; line-height: 16px; font-size: 9.5px; }

/* Home card: white with an orange accent instead of a solid orange block */
.mh-hero { background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-left: 4px solid var(--brand); box-shadow: var(--shadow); }
.mh-hero::after { background: var(--brand); opacity: .06; }
.mh-hero h2 { color: var(--fg); } .mh-hero p { color: var(--muted); } .mh-route { color: var(--fg); }
.mh-chip { background: var(--accent-soft); color: var(--accent); }
.mh-actions .btn.primary { background: var(--accent); color: #fff; }
.mh-actions .btn.ghost { background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); }
.mh-quiet { border-left-color: var(--line); }
.mh-quiet .mh-actions .btn.ghost { background: var(--surface); color: var(--accent); border: 1px solid var(--line); }
.mh-hero { border-left: 1px solid var(--line); }

/* ---------- Android app sign-in ---------- */
.ml { min-height: 100vh; background: var(--surface); color: var(--fg); padding: calc(22px + env(safe-area-inset-top, 0px)) 24px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; }
html.phone-shell .ml { position: fixed; inset: 0; overflow-y: auto; max-width: none; }
.ml section { display: flex; flex-direction: column; flex: 1; }
.ml section[hidden] { display: none; }
.ml-logo { display: flex; align-items: center; gap: 10px; }
.ml-logo .brand-mark { width: 40px; height: 40px; border-radius: 11px; }
.ml-logo b { font-size: 17px; display: block; line-height: 1.1; letter-spacing: -.01em; font-family: var(--f-body); } .ml-logo span { color: var(--muted); font-size: 12px; }
.ml h1 { font: 800 30px/1.1 var(--f-body); letter-spacing: -.03em; margin: 44px 0 0; color: var(--fg); }
.ml-sub { color: var(--muted); font-size: 14.5px; line-height: 1.45; margin: 8px 0 24px; }
.ml-f { display: block; margin-bottom: 14px; } .ml-f > span:first-child { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.ml-in { height: 52px; border: 1.5px solid var(--line); border-radius: 14px; display: flex; align-items: center; gap: 10px; padding: 0 6px 0 14px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.ml-in:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px #ff4f1218; }
.ml-in.err { border-color: var(--crit); }
.ml-in .mh-svg { color: var(--muted); width: 20px; height: 20px; flex: none; }
.ml-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 500 15.5px var(--f-body); color: var(--fg); height: 100%; padding: 0; box-shadow: none; }
.ml-eye { width: 40px; height: 40px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; border-radius: 10px; cursor: pointer; } .ml-eye.on { color: var(--accent); }
.ml-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 22px; font-size: 14px; }
.ml-switch { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; cursor: pointer; margin: 0; flex: none; transition: background .15s; }
.ml-switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0004; transition: transform .15s; }
.ml-switch:checked { background: var(--brand); } .ml-switch:checked::after { transform: translateX(18px); }
.ml-btn { width: 100%; height: 54px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font: 700 15.5px var(--f-body); display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; box-shadow: 0 10px 22px #d9430a33; }
.ml-btn:disabled { opacity: .5; box-shadow: none; }
.ml-btn[aria-busy="true"] { opacity: 1; } .ml-btn[aria-busy="true"]::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #ffffff55; border-top-color: #fff; animation: ml-spin .8s linear infinite; }
@keyframes ml-spin { to { transform: rotate(360deg); } }
.ml-btn.ml-sec { background: var(--surface); color: var(--fg); border: 1.5px solid var(--line); box-shadow: none; margin-top: 10px; }
.ml-link { background: none; border: 0; color: var(--accent); font: 700 13.5px var(--f-body); padding: 12px; margin: 8px auto 0; cursor: pointer; display: block; }
.ml-link.ml-quiet { color: var(--muted); font-weight: 600; margin: 0 auto; } .ml-link.ml-inline { display: inline; padding: 4px; margin: 0; }
.ml-foot { margin: auto 0 0; padding-top: 18px; text-align: center; font-size: 12.5px; color: var(--muted); }
.ml-err { display: flex; gap: 10px; align-items: flex-start; background: var(--crit-soft); color: var(--crit); border-radius: 12px; padding: 11px 13px; font-size: 13px; margin: -8px 0 14px; }
.ml-err[hidden] { display: none; } .ml-err .mh-svg { width: 18px; height: 18px; }
.ml .mobile-offline { display: flex; background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 11px 13px; font-size: 13px; margin: -8px 0 14px; }
.ml .mobile-offline[hidden] { display: none; }
.ml-code { display: flex; gap: 9px; margin-bottom: 16px; } .ml-code[hidden] { display: none; }
.ml-code input { flex: 1; min-width: 0; height: 58px; border: 1.5px solid var(--line); border-radius: 14px; text-align: center; font: 700 24px var(--f-body); color: var(--fg); background: var(--surface); padding: 0; }
.ml-code input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px #ff4f1218; }
#ml-rec-wrap { margin-bottom: 16px; }
.ml-center { text-align: center; } .ml-center h1 { font-size: 26px; margin-top: 10px; } .ml-center .ml-sub { margin: 6px 0 0; }
.ml-av { width: 76px; height: 76px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font: 800 26px var(--f-body); margin: 46px auto 4px; }
.ml-bio { width: 120px; height: 120px; border-radius: 50%; margin: 30px auto 26px; display: grid; place-items: center; background: radial-gradient(circle, #ff4f1222 0, #ff4f120a 55%, transparent 70%); border: 1.5px solid #ffd9c9; color: var(--brand); cursor: pointer; }
.ml-bio .mh-svg { width: 60px; height: 60px; stroke-width: 1.5; }
/* app lock, light like the sign-in */
#app-lock { background: var(--surface); color: var(--fg); }
#app-lock h1 { color: var(--fg); font: 800 24px var(--f-body); } #app-lock p { color: var(--muted); }
.ml-mark-big .brand-mark { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 10px; } .ml-mark-big .brand-mark svg { width: 34px; height: 34px; }

/* Organisations table (platform console) */
.org-lic { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.org-acts { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
details.row-menu { position: relative; display: inline-block; }
details.row-menu > summary { list-style: none; cursor: pointer; min-width: 36px; text-align: center; }
details.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 180px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px #0002; padding: 6px; display: flex; flex-direction: column; }
.row-menu-list button { background: none; border: 0; text-align: left; padding: 10px 12px; border-radius: 8px; font: 500 14px var(--f-body); color: var(--fg); cursor: pointer; }
.row-menu-list button:hover { background: var(--surface-2); } .row-menu-list button.danger { color: var(--crit); }

/* Responsive tables: on narrow screens every row becomes a card, with each value labelled by its column heading. */
@media (max-width: 760px) {
  .tbl-wrap { margin: 0; padding: 0; overflow: visible; }
  table.rt, table.rt tbody, table.rt tr, table.rt td { display: block; width: 100%; }
  table.rt thead { display: none; }
  table.rt tr { border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin: 0 0 10px; background: var(--surface); box-shadow: var(--shadow); }
  table.rt td { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); text-align: right; white-space: normal; min-width: 0; }
  table.rt td:last-child { border-bottom: 0; }
  table.rt td > * { min-width: 0; }
  table.rt td::before { content: attr(data-label); flex: none; max-width: 42%; text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
  table.rt td:not([data-label])::before, table.rt td[data-label=""]::before { content: none; }
  table.rt td:not([data-label]), table.rt td[data-label=""] { justify-content: flex-end; }
  table.rt td[colspan] { display: block; text-align: center; }
  table.rt td.r, table.rt td.num { text-align: right; }
  .fuel-table td, .fuel-table th, .fuel-table td .muted.small { white-space: normal; }
  .act-col .actions, .org-acts { flex-wrap: wrap; justify-content: flex-end; }
  .row-menu-list { right: 0; }
}
@media (max-width: 760px) {
  /* label above the value: cells often hold several lines, which squash when placed side by side */
  table.rt td { display: block; text-align: left; }
  table.rt td::before { display: block; max-width: none; margin-bottom: 4px; padding: 0; }
  table.rt td.r, table.rt td.num { text-align: left; }
  table.rt td.act-col, table.rt td:not([data-label]), table.rt td[data-label=""] { text-align: right; }
}
.row-menu-list { position: fixed; }

/* Phones: tables read as lists. The first column is the item's title; the other values follow as short "Label value" pairs. */
@media (max-width: 760px) {
  table.rt { border-collapse: collapse; }
  table.rt tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 13px 2px; margin: 0; background: transparent; }
  table.rt tr:last-child { border-bottom: 0; }
  table.rt td { display: inline; width: auto; padding: 0; border: 0; font-size: 13px; text-align: left; color: var(--fg); }
  table.rt td::before { display: inline; content: attr(data-label); font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); margin: 0 5px 0 0; padding: 0; max-width: none; }
  table.rt td:first-child { flex: 1 1 100%; font-size: 15px; font-weight: 700; }
  table.rt td:first-child::before { content: none; }
  table.rt td:first-child .small, table.rt td:first-child .muted { font-weight: 400; }
  table.rt td > div { display: inline; margin-left: 4px; }
  table.rt td > div:first-child { margin-left: 0; }
  table.rt .bar { display: none; }
  table.rt td.act-col, table.rt td:not([data-label]):not(:first-child), table.rt td[data-label=""]:not(:first-child) { flex: 1 1 100%; text-align: right; }
  table.rt td.act-col > div, table.rt td.act-col .actions, table.rt td.act-col .org-acts { display: inline-flex; }
  table.rt td[colspan] { flex: 1 1 100%; text-align: center; }
  table.rt tr[data-href] { cursor: pointer; padding-right: 22px; position: relative; }
  table.rt tr[data-href]::after { content: "›"; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; }
  .card:has(> .tbl-wrap table.rt), .card:has(table.rt) { padding-top: 6px; padding-bottom: 6px; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters input, .filters select { width: 100%; max-width: none; }
}
@media (max-width: 760px) {
  /* Line 1: title, the second column, and any status pill on the right. Line 2: the rest, small and muted. */
  table.rt td:first-child { flex: 0 1 auto; order: 0; }
  table.rt td:nth-child(2) { order: 1; }
  table.rt td:nth-child(2)::before { content: none; }
  table.rt td:has(.pill):not(:first-child):not(:nth-child(2)) { order: 2; margin-left: auto; }
  table.rt td:has(.pill):not(:first-child):not(:nth-child(2))::before { content: none; }
  table.rt tr::before { content: ""; order: 3; flex-basis: 100%; height: 0; }
  table.rt td:nth-child(n+3):not(:has(.pill)) { order: 4; font-size: 12.5px; color: var(--muted); }
  table.rt td:nth-child(n+3):not(:has(.pill))::before { font-size: 12.5px; color: var(--muted); opacity: .75; }
  table.rt td:nth-child(n+3) .num, table.rt td.num:nth-child(n+3) { font-family: var(--f-body); }
  table.rt td.act-col { order: 5; }
}
@media (max-width: 760px) { table.rt td > div, table.rt td > div:first-child { margin-left: 6px; } }

/* Phones, final list style: no cards. Each row shows only its name, its second value and its status, plus one short
   line underneath. Tapping opens the item (rows that have a page) or unfolds the remaining details (rows that do not). */
@media (max-width: 760px) {
  .card:has(table.rt) { background: transparent; border: 0; box-shadow: none; padding: 0; border-radius: 0; }
  .card:has(table.rt) > .card-head { padding: 0 2px; }
  .tbl-wrap:has(table.rt) { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -16px; padding: 0 16px; }
  table.rt tr { padding: 12px 24px 12px 0; gap: 3px 10px; }
  table.rt td:nth-child(n+3):not(:has(.pill)) { display: none; }
  table.rt td:nth-child(3):not(:has(.pill)) { display: block; order: 4; flex: 1 1 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--muted); }
  table.rt td:nth-child(3):not(:has(.pill))::before { content: none; }
  table.rt td:nth-child(3) > div { display: inline; }
  table.rt td:has(.pill):not(:first-child):not(:nth-child(2)) > :not(.pill) { display: none; }
  table.rt td.act-col { display: none; }
  /* unfolded row */
  table.rt tr.open td:nth-child(n+4):not(:has(.pill)), table.rt tr.open td.act-col { display: block; flex: 1 1 100%; white-space: normal; font-size: 13px; color: var(--fg); }
  table.rt tr.open td:nth-child(n+4)::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 0 2px; }
  table.rt tr.open td:has(.pill) > :not(.pill) { display: inline; }
  table.rt tr:not([data-href]):has(td:nth-child(4))::after { content: "⌄"; position: absolute; right: 2px; top: 14px; color: var(--muted); font-size: 16px; transition: transform .15s; }
  table.rt tr:not([data-href]) { position: relative; cursor: pointer; }
  table.rt tr.open:not([data-href])::after { transform: rotate(180deg); }
  table.rt tr[data-href]::after { top: 50%; }
}
@media (max-width: 760px) {
  /* only the last status-like column sits on the first line; other badges are details */
  table.rt td:has(.pill):not(:first-child):not(:nth-child(2)) { display: none; }
  table.rt td:has(.pill):not(:first-child):not(:nth-child(2)):not(:has(~ td .pill)) { display: inline; order: 2; margin-left: auto; }
  table.rt tr.open td:has(.pill):not(:first-child):not(:nth-child(2)):has(~ td .pill) { display: block; order: 5; flex: 1 1 100%; margin: 0; }
  table.rt tr.open td:has(.pill):has(~ td .pill)::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 0 2px; }
  /* rows whose name links to a page open that page */
  table.rt tr:has(td:first-child a[href^="#"])::after { content: "›"; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; }
  table.rt tr:has(td:first-child a[href^="#"]) { position: relative; cursor: pointer; }
  table.rt td:first-child a.name-link { color: inherit; text-decoration: none; }
}

/* Toolbar title (phones): the logo and name only on the dashboard; elsewhere the screen's title, and a back arrow on detail pages */
.brand .bar-title, .brand .bar-back { display: none; }
:is(.android-app, body.bottom-nav) .brand.titled > .brand-mark, :is(.android-app, body.bottom-nav) .brand.titled > div { display: none; }
:is(.android-app, body.bottom-nav) .brand.titled .bar-title { display: block; margin: 0; font: 700 20px/1.2 var(--f-body); letter-spacing: -.02em; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
:is(.android-app, body.bottom-nav) .brand.titled.has-back .bar-back { display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px; border: 0; background: none; color: var(--fg); cursor: pointer; flex: none; }
:is(.android-app, body.bottom-nav) .brand.titled.has-back .bar-back svg { width: 24px; height: 24px; }
/* the title now lives in the toolbar, so the page itself starts with its actions */
:is(.android-app, body.bottom-nav) .page-head h1, :is(.android-app, body.bottom-nav) .page-head > div > p { display: none; }
:is(.android-app, body.bottom-nav) .page-head { padding: 0 0 14px; border: 0; }
:is(.android-app, body.bottom-nav) .page-head:not(:has(.actions)) { display: none; }
:is(.android-app, body.bottom-nav) .page-head .actions { width: 100%; }
:is(.android-app, body.bottom-nav) .page-head .actions .btn { flex: 1; justify-content: center; min-height: 48px; }
:is(.android-app, body.bottom-nav) .crumbs > .small { display: none; }

/* Drop-down picker sheet (phones) */
.picker { position: fixed; inset: 0; z-index: 90; }
.picker-dim { position: absolute; inset: 0; background: rgba(0,0,0,.5); animation: picker-fade .15s ease-out; }
.picker-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 75vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 30px #0006; animation: sheet-up .2s ease-out; }
.picker-grab { width: 42px; height: 4px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; flex: none; }
.picker-sheet h3 { font: 700 17px var(--f-body); margin: 0; padding: 2px 20px 10px; color: var(--fg); }
.picker-list { overflow-y: auto; overscroll-behavior: contain; }
.picker-list button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 12px 20px; border: 0; border-top: 1px solid var(--line); background: none; font: 500 15.5px var(--f-body); color: var(--fg); text-align: left; cursor: pointer; }
.picker-list button svg { width: 20px; height: 20px; color: var(--accent); visibility: hidden; flex: none; }
.picker-list button[aria-selected="true"] { color: var(--accent); font-weight: 700; } .picker-list button[aria-selected="true"] svg { visibility: visible; }
.picker-list button:disabled { color: var(--muted); }
@keyframes picker-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .picker-sheet, .picker-dim { animation: none; } }
