/* Fleet2.1 — liquid glass design: frosted panels, soft mesh background, touch-first */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --green: #29c463;
  --green-dark: #1fad53;
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --red: #dc2626;
  --amber: #d97706;
  --pine-950: #081c10;
  --pine-900: #0c2617;
  --pine-700: #185030;
  --bg: #eef1ea;
  --card: rgba(255, 255, 255, 0.62);
  --card-strong: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-edge: rgba(8, 28, 16, 0.08);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 8px 28px -14px rgba(8, 28, 16, 0.28);
  --blur: 22px;
  --text: #16251d;
  --muted: #5f6d66;
  --line: rgba(8, 28, 16, 0.09);
  --accent: var(--green);
  --accent-dark: var(--green-dark);
  /* skinnable structure (each design under Portal → White Label reshapes these) */
  --r-card: 20px;
  --r-qa: 18px;
  --r-btn: 16px;
  --r-btn-sm: 13px;
  --r-input: 14px;
  --r-chip: 999px;
  --topbar-bg: rgba(255, 255, 255, 0.5);
  --input-bg: rgba(255, 255, 255, 0.6);
  --nav-bg: rgba(255, 255, 255, 0.6);
  --sheet-bg: rgba(255, 255, 255, 0.82);
  --side-bg: rgba(10, 30, 18, 0.78);
  --hero-bg: linear-gradient(135deg, rgba(8, 28, 16, 0.94), rgba(12, 38, 23, 0.92) 55%, rgba(24, 80, 48, 0.9));
  --logo-bg: linear-gradient(135deg, var(--pine-950), var(--pine-700));
  --mesh:
    radial-gradient(900px 520px at 88% -8%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(760px 480px at -12% 24%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    radial-gradient(680px 460px at 108% 78%, rgba(41, 196, 99, 0.16), transparent 70%),
    radial-gradient(520px 380px at 30% 108%, rgba(59, 130, 246, 0.10), transparent 70%),
    var(--bg);
}
body.mechanic { --accent: var(--blue); --accent-dark: var(--blue-dark); }
body.truck_boss { --accent: #ea8600; --accent-dark: #c46a00; }
body.fleet_manager { --accent: #7c3aed; --accent-dark: #6d28d9; }
body.safety_manager { --accent: #0d9488; --accent-dark: #0f766e; }
body.admin { --accent: #475569; --accent-dark: #334155; }

html, body { height: 100%; overflow-x: clip; }
body {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
}
/* ambient mesh, tinted by role accent */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background: var(--mesh);
}
button, a, .card.tap, .qa-item, .opt, .seg-btn { touch-action: manipulation; }

#app {
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
}
#screen { flex: 1; overflow-y: auto; padding-bottom: 96px; }

/* mono microlabel */
.microlabel, .lbl, .section > h2, .progress-label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- header ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--topbar-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.6);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.6);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-hi);
  /* keep the banner clear of the iPhone notch / Dynamic Island */
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
  display: flex; align-items: center; gap: 10px;
}
.topbar h1 { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; flex: 1; text-align: center; }
.topbar .spacer { width: 24px; }
.back-btn, .icon-btn {
  background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--text); display: flex; align-items: center; border-radius: 12px;
}
.back-btn:active, .icon-btn:active { background: rgba(8, 28, 16, 0.08); transform: scale(.94); }
.badge-dot {
  position: absolute; top: -1px; right: -1px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.ver {
  font-family: "IBM Plex Mono", monospace;
  font-size: 9.5px; color: var(--muted); font-weight: 600; letter-spacing: 0.06em;
  background: var(--card); border: 1px solid var(--glass-border); border-radius: 8px; padding: 2px 7px;
  backdrop-filter: blur(8px);
}

/* ---- hero ---- */
.hero {
  position: relative; overflow: hidden;
  background: var(--hero-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  color: #fff; padding: 24px 18px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.hero::after {
  content: ''; position: absolute; right: -70px; top: -70px;
  width: 200px; height: 200px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.hero::before {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.hero .hi {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px; letter-spacing: 0.13em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.hero .name { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.hero .role { font-size: 13px; color: rgba(255, 255, 255, 0.65); margin-top: 3px; font-weight: 600; }

/* ---- glass card ---- */
.section { padding: 18px 16px; }
.section > h2 { margin-bottom: 12px; }
.card {
  background: var(--card);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border: 1px solid var(--glass-border);
  outline: 1px solid var(--glass-edge);
  border-radius: var(--r-card);
  padding: 15px; margin-bottom: 10px;
  box-shadow: var(--glass-hi), var(--glass-shadow);
}
.card.tap { cursor: pointer; transition: transform .1s, background .12s; }
.card.tap:hover { background: var(--card-strong); }
.card.tap:active { transform: scale(.985); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }

/* ---- buttons: glassy with sheen ---- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border-radius: var(--r-btn); border: 1px solid transparent;
  font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, white), var(--accent) 45%, color-mix(in srgb, var(--accent) 88%, black));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 20px -8px color-mix(in srgb, var(--accent) 65%, transparent);
  transition: transform .1s, filter .12s;
}
body:not([class]) .btn:not(.secondary):not(.danger-outline):not(.blue), body[class=""] .btn:not(.secondary):not(.danger-outline):not(.blue) { color: var(--pine-950); }
.btn:active { transform: scale(.97); filter: brightness(.96); }
.btn.secondary {
  background: var(--card); color: var(--text);
  border: 1px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--glass-hi), 0 4px 14px -8px rgba(8, 28, 16, 0.25);
}
.btn.danger-outline {
  background: rgba(255, 255, 255, 0.55); color: var(--red);
  border: 1px solid color-mix(in srgb, var(--red) 35%, white);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--glass-hi);
}
.btn.blue {
  background: linear-gradient(180deg, #6da2f8, var(--blue) 45%, #2b6fe0); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 20px -8px rgba(59, 130, 246, 0.6);
}
.btn.sm { padding: 11px; font-size: 13.5px; border-radius: var(--r-btn-sm); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* quick access list */
.qa-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border: 1px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  border-radius: var(--r-qa);
  padding: 14px; margin-bottom: 8px; cursor: pointer;
  box-shadow: var(--glass-hi), 0 4px 16px -10px rgba(8, 28, 16, 0.22);
  transition: transform .1s, background .12s;
}
.qa-item:hover { background: var(--card-strong); }
.qa-item:active { transform: scale(.985); }
.qa-item .icon {
  width: 40px; height: 40px; border-radius: 13px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 20%, white), color-mix(in srgb, var(--accent) 10%, white));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: var(--accent-dark); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 18px;
}
.qa-item .t { font-size: 14px; font-weight: 700; }
.qa-item .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.qa-item .chev { margin-left: auto; color: rgba(8, 28, 16, 0.25); }

/* status chips — translucent */
.chip {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: var(--r-chip); white-space: nowrap;
  backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.chip.pending { background: rgba(253, 230, 175, 0.8); color: #92500e; }
.chip.in_progress, .chip.draft { background: rgba(191, 214, 252, 0.8); color: #1d4fb8; }
.chip.completed { background: rgba(190, 238, 209, 0.85); color: #0f7a3d; }
.chip.rejected, .chip.high, .chip.out_of_service, .chip.policy { background: rgba(252, 197, 197, 0.85); color: #a51f1f; }
.chip.medium, .chip.update { background: rgba(253, 230, 175, 0.8); color: #92500e; }
.chip.low, .chip.announcement { background: rgba(191, 214, 252, 0.8); color: #1d4fb8; }
.chip.repaired, .chip.awaiting { background: rgba(221, 209, 250, 0.85); color: #5b21b6; }
.chip.approved, .chip.in_service, .chip.training { background: rgba(190, 238, 209, 0.85); color: #0f7a3d; }

/* ---- wizard ---- */
.progress-wrap { padding: 14px 16px 0; }
.progress-label { display: block; margin-bottom: 6px; }
.progress-bar {
  height: 6px; border-radius: 3px; overflow: hidden;
  background: rgba(8, 28, 16, 0.1);
  box-shadow: inset 0 1px 2px rgba(8, 28, 16, 0.12);
}
.progress-bar > div {
  height: 100%; border-radius: 3px; transition: width .25s;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 75%, white), var(--accent));
}
.step-title { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 4px; }
.step-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.input, textarea.input, select.input {
  width: 100%; padding: 13px 14px; border-radius: var(--r-input);
  border: 1px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  font-size: 16px; font-family: inherit; color: var(--text);
  background: var(--input-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--glass-hi);
  transition: box-shadow .12s;
}
.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: var(--glass-hi), 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.input::placeholder { color: #93a09a; }
textarea.input { min-height: 84px; resize: vertical; }
.input-suffix { position: relative; }
.input-suffix .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
label.lbl { display: block; margin: 15px 0 7px; }

.opt {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1.5px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  border-radius: 16px;
  padding: 15px 14px; margin-bottom: 8px; cursor: pointer; font-size: 14.5px; font-weight: 700;
  box-shadow: var(--glass-hi);
  transition: transform .1s, border-color .12s;
}
.opt:active { transform: scale(.985); }
.opt .mark {
  margin-left: auto; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(8, 28, 16, 0.2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.opt.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, rgba(255,255,255,0.7)); }
.opt.sel .mark { background: var(--accent); border-color: var(--accent); }
.opt.sel.bad { border-color: var(--red); background: rgba(254, 234, 234, 0.8); }
.opt.sel.bad .mark { background: var(--red); border-color: var(--red); }

/* review table */
.review-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid rgba(8, 28, 16, 0.07); font-size: 13.5px;
}
.review-row:last-child { border-bottom: none; }
.review-row .k { color: var(--muted); font-weight: 500; }
.review-row .v { font-weight: 700; }
.v.ok { color: #0f7a3d; }
.v.bad { color: var(--red); }
.v.warn { color: var(--amber); }
.card > h2 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--muted);
}

/* success screen */
.success { text-align: center; padding: 60px 24px 24px; }
.success .big-check {
  width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, white), var(--accent));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 16px 44px -14px color-mix(in srgb, var(--accent) 70%, transparent);
}
body:not([class]) .success .big-check, body[class=""] .success .big-check { color: var(--pine-950); }
.success h2 { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 10px; }
.success p { color: var(--muted); font-size: 14px; line-height: 1.55; }

/* stats */
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat {
  flex: 1; min-width: 100px;
  background: var(--card);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border: 1px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  border-radius: 18px;
  padding: 15px 10px; text-align: center; cursor: pointer;
  box-shadow: var(--glass-hi), 0 4px 16px -10px rgba(8, 28, 16, 0.2);
  transition: transform .1s;
}
.stat:active { transform: scale(.97); }
.stat .n { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; }
.stat .l {
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-top: 4px;
}
.stat.pending .n { color: var(--amber); }
.stat.inprog .n { color: var(--blue); }
.stat.done .n { color: #0f7a3d; }

/* photos */
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-grid .ph { position: relative; }
.photo-grid img { width: 76px; height: 76px; object-fit: cover; border-radius: 14px; border: 1px solid var(--glass-border); display: block; }
.photo-grid .del {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--red); color: #fff; border: none; font-size: 12px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.add-photo {
  width: 76px; height: 76px; border: 1.5px dashed rgba(8, 28, 16, 0.25); border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; font-weight: 600; cursor: pointer;
  background: rgba(255, 255, 255, 0.4);
}
.add-photo:active { transform: scale(.95); }

/* messages */
.msg-list { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bubble {
  max-width: 78%; padding: 10px 13px; border-radius: 18px; font-size: 14px; line-height: 1.45;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.bubble.me {
  align-self: flex-end; color: #fff; border-bottom-right-radius: 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, white), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
body:not([class]) .bubble.me, body[class=""] .bubble.me { color: var(--pine-950); }
.bubble.them {
  align-self: flex-start; background: var(--card); border: 1px solid var(--glass-border);
  border-bottom-left-radius: 6px; box-shadow: var(--glass-hi);
}
.bubble .when { display: block; font-size: 10px; opacity: .65; margin-top: 3px; }
.composer {
  /* ride above the nav — which lifts by the safe-area inset on iPhones */
  position: fixed; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  width: calc(100% - 20px); max-width: 410px; padding: 8px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(var(--blur)) saturate(1.6);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.6);
  border: 1px solid var(--glass-border); border-radius: 22px;
  box-shadow: var(--glass-hi), var(--glass-shadow);
  display: flex; gap: 8px; align-items: center; z-index: 9;
}
.composer input { flex: 1; border-radius: 15px; }
.composer .btn { width: auto; padding: 12px 18px; }

/* training */
.video-card { display: flex; gap: 12px; align-items: center; }
.thumb {
  width: 92px; height: 60px; border-radius: 14px; flex-shrink: 0; position: relative;
  background: linear-gradient(135deg, var(--pine-700), var(--pine-950));
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.thumb .dur {
  position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,.7);
  color: #fff; font-family: "IBM Plex Mono", monospace; font-size: 9.5px; font-weight: 600; padding: 1px 5px; border-radius: 4px;
}
.tabs {
  display: flex; gap: 18px; padding: 0 16px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--glass-border);
}
.tabs .tab { padding: 13px 2px; font-size: 13.5px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; }
.tabs .tab.on { color: var(--accent-dark); border-color: var(--accent); }

/* ---- floating glass bottom nav ---- */
#nav {
  position: fixed; bottom: calc(10px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: calc(100% - 20px); max-width: 410px; z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.7);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.7);
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  box-shadow: var(--glass-hi), 0 12px 36px -12px rgba(8, 28, 16, 0.35);
  display: flex; padding: 7px 4px;
}
#nav button {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700; color: #7a877f; font-family: inherit;
  padding: 6px 0; border-radius: 18px;
  transition: transform .1s;
}
#nav button:active { transform: scale(.9); }
#nav button.on {
  color: var(--accent-dark);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* ---- sidebar (desktop) — dark glass ---- */
#sidebar {
  display: none;
  position: fixed; inset: 0 auto 0 0; width: 252px; z-index: 20;
  background: var(--side-bg);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  flex-direction: column;
}
.side-logo { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.side-logo .mark {
  width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--green) 80%, white), var(--green));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  color: var(--pine-950);
  display: flex; align-items: center; justify-content: center;
}
.side-logo b { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; display: block; }
.side-logo span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 8.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255,255,255,0.4); display: block; margin-top: 2px;
}
.side-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase;
  color: rgba(255,255,255,0.35); padding: 10px 22px 8px;
}
.side-nav { flex: 1; padding: 0 12px; }
.side-nav button {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: rgba(255,255,255,0.62); font-size: 13.5px; font-weight: 700;
  padding: 11px 12px; border-radius: 14px; margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.side-nav button:hover { color: #fff; background: rgba(255,255,255,0.09); }
.side-nav button.on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--green) 82%, white), var(--green));
  color: var(--pine-950);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
body.mechanic .side-nav button.on { background: linear-gradient(180deg, #6da2f8, var(--blue)); color: #fff; }
body.truck_boss .side-nav button.on { background: linear-gradient(180deg, #ffab3d, #ea8600); color: #fff; }
body.fleet_manager .side-nav button.on { background: linear-gradient(180deg, #a274f5, #7c3aed); color: #fff; }
body.safety_manager .side-nav button.on { background: linear-gradient(180deg, #34c3b5, #0d9488); color: #fff; }
body.admin .side-nav button.on { background: linear-gradient(180deg, #8d9db3, #64748b); color: #fff; }
.side-foot {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 14px 18px; display: flex; align-items: center; gap: 11px;
}
.side-foot .avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,0.14); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { display: block; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { display: block; font-size: 11px; color: rgba(255,255,255,0.45); }
.side-foot .ver { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.14); color: rgba(255,255,255,0.5); }

@media (min-width: 1024px) {
  #sidebar:not([hidden]) { display: flex; }
  #app { max-width: none; margin: 0; }
  /* the sidebar's width is only reserved while the sidebar is actually shown (not on login) */
  #sidebar:not([hidden]) + #app { margin-left: 252px; }
  #screen { max-width: 1280px; margin: 0 auto; width: 100%; padding: 0 8px 40px; }
  #nav { display: none !important; }
  .composer { left: auto; right: 24px; transform: none; width: 420px; bottom: 20px; }
  .hero { border-radius: 24px; margin: 18px 16px 0; border: 1px solid rgba(255, 255, 255, 0.16); }
  .hero .name { font-size: 30px; }
  .stat .n { font-size: 32px; }
  .stat { padding: 20px 12px; }
  .topbar h1 { font-size: 18px; }

  /* use the width: card & quick-access lists flow into two columns */
  .section:has(> .qa-item), .section:has(> .card.tap) {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; align-items: start;
  }
  .section:has(> .qa-item) > h2, .section:has(> .card.tap) > h2,
  .section:has(> .qa-item) > .row, .section:has(> .card.tap) > .row,
  .section:has(> .qa-item) > .btn, .section:has(> .card.tap) > .btn,
  .section:has(> .qa-item) > .btn-row, .section:has(> .card.tap) > .btn-row,
  .section:has(> .qa-item) > .muted, .section:has(> .card.tap) > .muted,
  .section:has(> .qa-item) > .stats, .section:has(> .card.tap) > .stats,
  .section:has(> .qa-item) > .err, .section:has(> .card.tap) > .err,
  .section:has(> .qa-item) > .empty, .section:has(> .card.tap) > .empty,
  .section:has(> .qa-item) > .card:not(.tap), .section:has(> .card.tap) > .card:not(.tap) {
    grid-column: 1 / -1;
  }
  .section:has(> .qa-item) > .qa-item, .section:has(> .card.tap) > .card { margin-bottom: 0; }

  /* wizard checklist: two columns of items */
  .section:has(.seg[data-key]) { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; align-items: start; }
  .section:has(.seg[data-key]) > .step-title, .section:has(.seg[data-key]) > .step-sub,
  .section:has(.seg[data-key]) > #nextBtn, .section:has(.seg[data-key]) > .btn { grid-column: 1 / -1; }
  .section:has(.seg[data-key]) > .card { margin-bottom: 0; }

  /* dialogs feel like modals, not bottom sheets, on desktop */
  .sheet { max-width: 520px; }
}

/* very wide screens: three columns */
@media (min-width: 1500px) {
  .section:has(> .qa-item), .section:has(> .card.tap) { grid-template-columns: repeat(3, 1fr); }
  .section:has(.seg[data-key]) { grid-template-columns: repeat(3, 1fr); }
}

/* training video player */
.video-el {
  width: 100%; max-height: 62dvh; border-radius: 18px; background: #000;
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); display: block;
}

/* work order cards: priority stripe (Gaiia-style board) */
.wo-card { border-left: 4px solid rgba(8, 28, 16, 0.15); }
.wo-card.p-high { border-left-color: var(--red); }
.wo-card.p-medium { border-left-color: var(--amber); }
.wo-card.p-low { border-left-color: var(--blue); }

/* dispatch board */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 14px; -webkit-overflow-scrolling: touch; }
.bcol { min-width: 250px; flex: 1; }
.bdrop {
  min-height: 140px; border-radius: 16px; padding: 8px;
  background: rgba(8, 28, 16, 0.05);
  border: 1.5px dashed transparent;
  transition: border-color .12s, background .12s;
}
.bdrop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
:root[data-theme="dark"] .bdrop { background: rgba(255, 255, 255, 0.05); }
:root[data-theme="dark"] .wo-card { border-left-color: rgba(255, 255, 255, 0.18); }
:root[data-theme="dark"] .wo-card.p-high { border-left-color: var(--red); }
:root[data-theme="dark"] .wo-card.p-medium { border-left-color: var(--amber); }
:root[data-theme="dark"] .wo-card.p-low { border-left-color: var(--blue); }

/* ================= DARK MODE ================= */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1712;
  --card: rgba(24, 40, 30, 0.6);
  --card-strong: rgba(32, 52, 40, 0.8);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-edge: rgba(0, 0, 0, 0.35);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 28px -14px rgba(0, 0, 0, 0.6);
  --text: #e6efe9;
  --muted: #91a199;
  --line: rgba(255, 255, 255, 0.1);
  --topbar-bg: rgba(15, 26, 20, 0.6);
  --nav-bg: rgba(18, 30, 23, 0.7);
  --sheet-bg: rgba(22, 36, 28, 0.94);
  --input-bg: rgba(0, 0, 0, 0.3);
  --mesh:
    radial-gradient(900px 520px at 88% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(760px 480px at -12% 24%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(680px 460px at 108% 78%, rgba(41, 196, 99, 0.08), transparent 70%),
    var(--bg);
}
:root[data-theme="dark"] body { background: var(--bg); }
:root[data-theme="dark"] #nav button { color: #7e8f86; }
:root[data-theme="dark"] .composer { background: rgba(22, 36, 28, 0.8); }
:root[data-theme="dark"] .input::placeholder { color: #6d7d74; }
:root[data-theme="dark"] .seg-btn { background: rgba(255, 255, 255, 0.06); }
:root[data-theme="dark"] .add-photo { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.25); }
:root[data-theme="dark"] .btn.danger-outline { background: rgba(0, 0, 0, 0.25); color: #f87171; }
:root[data-theme="dark"] .review-row { border-bottom-color: rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .v.ok { color: #4ade80; }
:root[data-theme="dark"] .v.bad { color: #f87171; }
:root[data-theme="dark"] .v.warn { color: #fbbf24; }
:root[data-theme="dark"] .stat.done .n { color: #4ade80; }
:root[data-theme="dark"] .timeline::before { background: rgba(255, 255, 255, 0.14); }
:root[data-theme="dark"] .tl-item::before { background: #1c2f24; }
:root[data-theme="dark"] .switch { background: rgba(255, 255, 255, 0.18); }
:root[data-theme="dark"] .progress-bar { background: rgba(255, 255, 255, 0.12); }
:root[data-theme="dark"] .tabs { background: rgba(18, 30, 23, 0.6); }
:root[data-theme="dark"] .err { background: rgba(127, 29, 29, 0.4); color: #fecaca; border-color: rgba(255, 255, 255, 0.12); }
:root[data-theme="dark"] .qa-item .icon {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 30%, #14231b), color-mix(in srgb, var(--accent) 14%, #14231b));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: color-mix(in srgb, var(--accent) 70%, white);
}
:root[data-theme="dark"] .opt.sel { background: color-mix(in srgb, var(--accent) 20%, rgba(0,0,0,0.3)); }
:root[data-theme="dark"] .opt.sel.bad { background: rgba(127, 29, 29, 0.35); }
:root[data-theme="dark"] .role-card svg { color: color-mix(in srgb, var(--green) 75%, white); }
:root[data-theme="dark"] .chip.draft, :root[data-theme="dark"] .chip.in_progress { background: rgba(59, 110, 220, 0.35); color: #a8c4f5; }
:root[data-theme="dark"] .chip.completed, :root[data-theme="dark"] .chip.approved, :root[data-theme="dark"] .chip.in_service, :root[data-theme="dark"] .chip.training { background: rgba(22, 101, 52, 0.45); color: #9ee6b8; }
:root[data-theme="dark"] .chip.pending, :root[data-theme="dark"] .chip.medium, :root[data-theme="dark"] .chip.update { background: rgba(146, 80, 14, 0.4); color: #fcd58a; }
:root[data-theme="dark"] .chip.rejected, :root[data-theme="dark"] .chip.high, :root[data-theme="dark"] .chip.out_of_service, :root[data-theme="dark"] .chip.policy { background: rgba(153, 27, 27, 0.45); color: #fda4a4; }
:root[data-theme="dark"] .chip.repaired, :root[data-theme="dark"] .chip.awaiting { background: rgba(91, 33, 182, 0.4); color: #cdb6f7; }

/* login */
.login-wrap {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 28px calc(28px + env(safe-area-inset-bottom, 0px));
  max-width: 430px; margin: 0 auto;
}
/* when everything fits the screen (login), there is nothing to scroll — so don't */
#screen:has(> .login-wrap) { padding: 0 !important; overflow-y: auto; }
.logo { text-align: center; margin-bottom: 30px; }
.logo .mark {
  width: 78px; height: 78px; margin: 0 auto 16px; border-radius: 24px;
  background: var(--logo-bg);
  display: flex; align-items: center; justify-content: center; color: var(--green);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 20px 48px -16px rgba(8, 28, 16, 0.55);
}
.logo h1 { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; }
.logo p {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-top: 7px;
}
.err {
  background: rgba(252, 208, 208, 0.75); color: #a51f1f;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px; padding: 11px 14px; font-size: 13px; font-weight: 600; margin-bottom: 12px;
}

/* toast */
#toast {
  position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: rgba(8, 28, 16, 0.85); color: #fff; font-size: 13px; font-weight: 700;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 11px 18px; border-radius: 999px; z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 12px 32px -8px rgba(8, 28, 16, 0.5);
  max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; }

.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 40px 20px; }
.footer-credit { text-align: center; font-size: 11px; color: var(--muted); padding: 6px 0 14px; }
.footer-credit a { color: var(--muted); }

/* timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: rgba(8, 28, 16, 0.12); border-radius: 1px;
}
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item::before {
  content: ''; position: absolute; left: -21px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent);
  box-shadow: 0 2px 6px rgba(8, 28, 16, 0.2);
}
.tl-item.red::before { border-color: var(--red); }
.tl-item.amber::before { border-color: var(--amber); }
.tl-item.gray::before { border-color: rgba(8, 28, 16, 0.25); }

/* toggle switch */
.switch {
  width: 50px; height: 30px; border-radius: 15px; border: none; cursor: pointer;
  background: rgba(8, 28, 16, 0.2); position: relative; transition: background .15s; flex-shrink: 0;
  box-shadow: inset 0 1px 3px rgba(8, 28, 16, 0.2);
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff;
  transition: left .15s; box-shadow: 0 2px 5px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.9);
}
.switch.on { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, white), var(--accent)); }
.switch.on::after { left: 23px; }

/* role picker (login) */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--card);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  border: 1px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  border-radius: 20px;
  padding: 20px 10px; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 700; color: var(--text);
  box-shadow: var(--glass-hi), 0 6px 20px -12px rgba(8, 28, 16, 0.3);
  transition: transform .1s, background .12s;
}
.role-card:hover { background: var(--card-strong); }
.role-card:active { transform: scale(.95); }
.role-card svg { color: var(--green-dark); }

/* segmented pass/defect/na + roll call — big touch targets */
.seg { display: flex; gap: 6px; }
.seg-btn {
  flex: 1; padding: 12px 4px; border-radius: 13px;
  border: 1px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--muted); cursor: pointer; transition: all .1s;
  box-shadow: var(--glass-hi);
}
.seg-btn:active { transform: scale(.95); }
.seg-btn.on.pass { background: rgba(190, 238, 209, 0.9); border-color: #0f7a3d; color: #0f7a3d; }
.seg-btn.on.defect { background: rgba(252, 197, 197, 0.9); border-color: var(--red); color: #a51f1f; }
.seg-btn.on.na { background: rgba(222, 227, 222, 0.9); border-color: #75817a; color: #4b554f; }
.seg-btn.on.warn2 { background: rgba(253, 230, 175, 0.9); border-color: var(--amber); color: #92500e; }

/* help sheet + onboarding sheet */
.sheet-overlay {
  /* above the admin edit bar (95) and toast (90) — the "Unhide?" sheet was stuck behind them */
  position: fixed; inset: 0; z-index: 120;
  background: rgba(8, 28, 16, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 430px;
  background: var(--sheet-bg);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  border: 1px solid var(--glass-border);
  border-radius: 26px 26px 0 0; padding: 20px 18px calc(28px + env(safe-area-inset-bottom));
  /* fill the screen when content needs it — header & buttons stay pinned, only the middle scrolls */
  max-height: calc(100dvh - 10px - env(safe-area-inset-top, 0px));
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--glass-hi), 0 -12px 48px -12px rgba(8, 28, 16, 0.4);
  animation: sheet-up .25s cubic-bezier(.2,.8,.3,1);
}
.sheet > * { flex-shrink: 0; min-width: 0; }
/* the sheet's scroll area becomes the one flexible region: it takes ALL the leftover height */
.sheet > div[style*="overflow-y:auto"], .sheet > div[style*="overflow-y: auto"] {
  flex: 1 1 auto; min-height: 0; max-height: none !important; overflow-x: hidden;
}
/* slim, quiet scrollbars inside sheets */
.sheet ::-webkit-scrollbar, .sheet::-webkit-scrollbar { width: 5px; }
.sheet ::-webkit-scrollbar-thumb, .sheet::-webkit-scrollbar-thumb { background: rgba(8, 28, 16, 0.28); border-radius: 3px; }
:root[data-theme="dark"] .sheet ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); }
@keyframes sheet-up { from { transform: translateY(50px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 1024px) {
  .sheet-overlay { align-items: center; }
  .sheet { border-radius: 26px; max-height: calc(100dvh - 48px); }
}
.onboard-step {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid rgba(8, 28, 16, 0.07);
}
.onboard-step:last-of-type { border-bottom: none; }
.onboard-step .num {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 75%, white), var(--accent));
  color: #fff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}

/* ================= SPLASH: dump truck unloading on the paver ================= */
#splash {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background:
    radial-gradient(800px 500px at 80% -10%, rgba(41, 196, 99, 0.2), transparent 70%),
    radial-gradient(700px 500px at 10% 110%, rgba(24, 80, 48, 0.55), transparent 70%),
    linear-gradient(160deg, #0a2013, #0c2617 60%, #113a24);
  transition: opacity .45s;
}
#splash.done { opacity: 0; pointer-events: none; }
#splash .sp-name { color: #fff; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
#splash .sp-tag {
  font-family: "IBM Plex Mono", monospace; font-size: 9.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: rgba(255,255,255,0.45); margin-bottom: 10px;
}
#splash svg { width: min(440px, 94vw); height: auto; }
.sp-dots { display: flex; gap: 7px; margin-top: 14px; }
.sp-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  animation: sp-dot 1.1s ease-in-out infinite;
}
.sp-dots span:nth-child(2) { animation-delay: .18s; }
.sp-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes sp-dot { 0%, 100% { opacity: .25; transform: scale(.8); } 45% { opacity: 1; transform: scale(1.15); } }

/* truck backs in */
#spTruck { animation: sp-truck 1.15s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes sp-truck { from { transform: translateX(-300px); } to { transform: translateX(0); } }
/* bed tilts up */
#spBed {
  transform-box: fill-box; transform-origin: 96% 100%;
  animation: sp-bed 2.6s ease-in-out forwards;
}
@keyframes sp-bed { 0%, 46% { transform: rotate(0deg); } 72%, 100% { transform: rotate(24deg); } }
/* asphalt pours */
#spLoad circle { opacity: 0; animation: sp-pour .62s linear infinite; }
#spLoad circle:nth-child(1) { animation-delay: 1.45s; }
#spLoad circle:nth-child(2) { animation-delay: 1.58s; }
#spLoad circle:nth-child(3) { animation-delay: 1.72s; }
#spLoad circle:nth-child(4) { animation-delay: 1.86s; }
#spLoad circle:nth-child(5) { animation-delay: 2.02s; }
#spLoad circle:nth-child(6) { animation-delay: 2.18s; }
@keyframes sp-pour {
  0% { opacity: 0; transform: translate(0, 0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-14px, 52px); }
}
/* hopper pile grows */
#spPile { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); animation: sp-pile 1.5s 1.55s ease-out forwards; }
@keyframes sp-pile { to { transform: scaleY(1); } }
/* exhaust puffs */
#spSmoke circle { opacity: 0; animation: sp-smoke 1.6s ease-out infinite; }
#spSmoke circle:nth-child(2) { animation-delay: .55s; }
#spSmoke circle:nth-child(3) { animation-delay: 1.05s; }
@keyframes sp-smoke {
  0% { opacity: 0; transform: translate(0, 0) scale(.6); }
  20% { opacity: .5; }
  100% { opacity: 0; transform: translate(6px, -26px) scale(1.5); }
}
/* fresh mat shimmer behind paver */
#spMat { opacity: 0; animation: sp-mat 1s 2s forwards; }
@keyframes sp-mat { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #spTruck, #spBed, #spLoad circle, #spPile, #spSmoke circle, #spMat { animation-duration: .01s !important; animation-delay: 0s !important; }
}

/* ================= ADMIN UI EDITOR ================= */
#uiBar {
  position: fixed; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  width: calc(100% - 20px); max-width: 480px; z-index: 95;
  display: flex; gap: 8px; align-items: center; padding: 10px;
  background: rgba(8, 28, 16, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 22px; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 14px 40px -10px rgba(0, 0, 0, 0.55);
}
#uiBar .input {
  flex: 1; min-width: 0; padding: 9px 10px; font-size: 13px;
  background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.25); color: #fff;
}
#uiBar option { color: #16251d; }
body.ui-edit #nav { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
.ui-ghost { outline: 2px dashed var(--red) !important; outline-offset: 1px; opacity: 0.45 !important; }
body.ui-edit #screen :is(button, .btn, .qa-item, .card, .stat, .chip, h2, label, .opt, .seg-btn, .tab, .muted, input, select, textarea):hover,
body.ui-edit #nav button:hover {
  outline: 2px solid var(--blue); outline-offset: 1px; cursor: crosshair;
}

/* ================= v2.0.2: chat, disclaimer, schedule ================= */
.beta-note {
  margin: 0 0 16px; padding: 10px 14px; border-radius: 14px;
  background: rgba(253, 230, 175, 0.5); border: 1px solid rgba(230, 180, 60, 0.4);
  color: #7a5b0f; font-size: 12.5px; line-height: 1.5; text-align: center;
}
:root[data-theme="dark"] .beta-note { background: rgba(230, 180, 60, 0.14); color: #e8c46a; border-color: rgba(230, 180, 60, 0.28); }

.sys-line {
  text-align: center; font-size: 11.5px; color: var(--muted);
  margin: 10px auto; max-width: 82%; line-height: 1.5;
  padding: 6px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--muted) 8%, transparent);
}
.sys-line .when-inline { display: block; font-size: 9.5px; opacity: 0.65; margin-top: 2px; }
.bubble[data-mine] { cursor: pointer; }

/* ================= v2.1.1: compact interval fold-outs ================= */
.iv-fold { margin-bottom: 10px; }
.iv-fold > summary {
  cursor: pointer; font-weight: 700; font-size: 13.5px; list-style: none;
  padding: 13px 15px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  backdrop-filter: blur(var(--blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.5);
  box-shadow: var(--glass-hi), var(--glass-shadow);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  transition: transform .1s;
}
.iv-fold > summary:active { transform: scale(.985); }
.iv-fold > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; flex-shrink: 0; }
.iv-fold[open] > summary::before { transform: rotate(90deg); }
.iv-fold > summary::-webkit-details-marker { display: none; }
.iv-fold > summary .grow { flex: 1; }
.iv-fold.sub { margin: 0 0 8px; }
.iv-fold.sub > summary { font-size: 12.5px; padding: 11px 13px; border-radius: 14px; box-shadow: var(--glass-hi); }

/* ================= v1.0.36: feel & flow ================= */
/* slim loading bar — quiet feedback whenever the app is talking to the server */
#loadbar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 300;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
#loadbar.on { opacity: 1; animation: loadslide 1s linear infinite; }
@keyframes loadslide { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* hover lift (the page-enter glide lives in the v1.0.43 motion block — real navigations only) */
@media (prefers-reduced-motion: no-preference) {
  .qa-item, .card.tap { transition: transform .12s ease, background .12s ease; }
  .qa-item:hover, .card.tap:hover { transform: translateY(-1px); }
}

/* desktop: comfortable reading width for content, full width for boards */
@media (min-width: 1024px) {
  #screen > .section { max-width: 940px; margin-inline: auto; }
  #screen > .section:has(.board) { max-width: none; }
  #screen > .hero { max-width: 940px; margin-inline: auto; }
  #screen > .tabs, #screen > .progress-wrap, #screen > details.iv-fold { max-width: 940px; margin-inline: auto; }
  .msg-list { max-width: 820px; margin-inline: auto; width: 100%; }
  /* chat composer sits centered under the conversation, not parked in a corner */
  .composer { left: calc(50% + 126px); right: auto; transform: translateX(-50%); width: min(700px, calc(100vw - 320px)); bottom: 22px; }
  #sidebar[hidden] ~ #app .composer { left: 50%; }
}

/* ---- v1.0.36 audit fixes ---- */
/* #screen becomes the real scroller (was: the document scrolled, so chat scroll-to-bottom never worked) */
#app { height: 100dvh; }
#screen { min-height: 0; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
/* toasts must beat sheets (z 120) — validation messages were invisible under open sheets */
#toast { z-index: 130; }
/* honest touch targets for icon buttons, photo-delete and tabs */
.back-btn, .icon-btn { min-width: 40px; min-height: 40px; justify-content: center; }
.photo-grid .ph .del { width: 28px; height: 28px; }
.tabs .tab { padding: 13px 10px; }
/* no sticky hover tint on touch screens */
@media (hover: none) {
  .card.tap:hover, .qa-item:hover { transform: none; }
}

/* version stamp on the loading screen */
.sp-ver {
  position: absolute; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0;
  text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.45);
}

/* ================= v1.0.40: iPhone bottom bar ================= */
/* the nav rides lower — near the bottom edge like a native tab bar (still clear of the home indicator) */
#nav { bottom: calc(6px + env(safe-area-inset-bottom, 0px) / 2); }
#screen { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px) / 2); }
.composer { bottom: calc(80px + env(safe-area-inset-bottom, 0px) / 2); }
#toast { bottom: calc(88px + env(safe-area-inset-bottom, 0px) / 2); }
/* ground fade under the nav — content melts out instead of floating loose in the bottom strip */
@media (max-width: 1023px) {
  #app:has(#nav:not([hidden]))::after {
    content: ''; position: fixed; left: 0; right: 0; bottom: 0;
    height: calc(86px + env(safe-area-inset-bottom, 0px) / 2);
    background: linear-gradient(to top, var(--bg) 22%, color-mix(in srgb, var(--bg) 62%, transparent) 58%, transparent);
    z-index: 9; pointer-events: none;
  }
  .composer { z-index: 11; }
}

/* ================= v1.0.41: scheduling, milestones, module health ================= */
body.scheduler { --accent: #4f46e5; --accent-dark: #4338ca; }
body.scheduler .side-nav button.on { background: linear-gradient(180deg, #818cf8, #4f46e5); color: #fff; }

/* scheduling board */
.sched-datebar {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 10px; margin-bottom: 12px;
}
.drop-zone {
  min-height: 44px; border: 1.5px dashed var(--line); border-radius: 12px;
  padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  transition: border-color .15s, background .15s;
}
.drop-zone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drv-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card-strong); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 12px; font: inherit; font-size: 12.5px; cursor: grab;
  color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.drv-chip:active { cursor: grabbing; transform: scale(.97); }
.drv-chip b { font-weight: 700; }
.drv-chip span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.drv-chip .warn2 { color: #b45309; }
.sched-mine { outline: 2px solid var(--accent); outline-offset: -1px; }

/* dealership milestone rail on the truck profile */
.mile-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px;
  margin-bottom: 12px; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.mile-card {
  flex: 0 0 auto; min-width: 96px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px; font: inherit; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
}
.mile-card .mi { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.mile-card .mi span { font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.mile-card .ev { font-size: 10px; color: var(--muted); font-weight: 600; }
.mile-card .jobs { font-size: 10px; color: var(--muted); }
.mile-card.due { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.mile-card.soon { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.mile-card:active { transform: scale(.97); }

/* module health */
.mod-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.mod-dot.ok { background: #22b45f; box-shadow: 0 0 0 3px rgba(34, 180, 95, .18); }
.mod-dot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .18); animation: modPulse 1.4s infinite; }
.mod-dot.off { background: #9aa3ad; box-shadow: 0 0 0 3px rgba(154, 163, 173, .18); }
@keyframes modPulse { 50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, .08); } }

/* advanced feature access role picker */
.fa-roles .chip { border: none; font: inherit; font-size: 11px; font-weight: 700; padding: 6px 12px; }

/* ================= v1.0.42: email sign-in ================= */
.code-input {
  font-size: 26px; font-weight: 800; letter-spacing: 10px; text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}
.linklike {
  background: none; border: none; padding: 4px 6px; font: inherit; font-size: 13px;
  font-weight: 700; color: var(--accent-dark, var(--accent)); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  border-radius: 8px;
}
.linklike:disabled { opacity: .5; cursor: default; }
.login-wrap .linklike { color: color-mix(in srgb, #fff 75%, var(--accent)); }
.login-links {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px;
}

/* ================= v1.0.43: motion system — alive, springy, never in the way ================= */
:root {
  --spring: cubic-bezier(.34, 1.45, .64, 1);      /* slight overshoot — things settle with a bounce */
  --glide: cubic-bezier(.22, 1, .36, 1);          /* fast start, soft landing */
}

@media (prefers-reduced-motion: no-preference) {
  /* pages breathe in on real navigation (route() adds .enter, removes it after the run) */
  #screen.enter > * { animation: pageIn .3s var(--glide) both; }
  #screen.enter > *:nth-child(2) { animation-delay: .04s; }
  #screen.enter > *:nth-child(3) { animation-delay: .08s; }
  #screen.enter > *:nth-child(4) { animation-delay: .12s; }
  #screen.enter > *:nth-child(n+5) { animation-delay: .15s; }
  @keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

  /* springy press-and-release everywhere — release bounces back instead of snapping */
  .btn { transition: transform .18s var(--spring), filter .15s, box-shadow .2s; }
  .btn:active { transition-duration: .06s; transform: scale(.96); filter: brightness(.95); }
  .card.tap, .qa-item, .opt, .stat, .role-card, .mile-card, .drv-chip {
    transition: transform .2s var(--spring), background .12s, border-color .15s, box-shadow .2s;
  }
  .card.tap:active, .qa-item:active { transition-duration: .06s; transform: scale(.982); }
  .opt:active, .stat:active, .mile-card:active { transition-duration: .06s; }
  .role-card:active, .drv-chip:active { transition-duration: .06s; }
  .back-btn, .icon-btn { transition: transform .18s var(--spring), background .15s; }
  .back-btn:active, .icon-btn:active { transition-duration: .06s; }
  .seg-btn { transition: transform .18s var(--spring), background .12s, color .12s, box-shadow .15s; }
  .seg-btn:active { transition-duration: .06s; }
  .seg-btn.on { animation: segPop .25s var(--spring); }
  @keyframes segPop { 45% { transform: scale(1.05); } }

  /* bottom nav: the icon pops when you switch tabs */
  #nav button { transition: transform .18s var(--spring), color .15s; }
  #nav button.just-on svg { animation: navPop .32s var(--spring); }
  @keyframes navPop { 40% { transform: scale(1.28) translateY(-2px); } }

  /* switches glide, badges pop, folds unfurl */
  .switch { transition: background .22s; }
  .switch::after { transition: left .22s var(--spring); }
  .badge-dot { animation: popIn .3s var(--spring) both; }
  @keyframes popIn { from { transform: scale(0); } to { transform: scale(1); } }
  .iv-fold[open] > *:not(summary) { animation: foldIn .24s var(--glide); }
  details[open] > .mt8 { animation: foldIn .22s var(--glide); }
  @keyframes foldIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

  /* toast rises with a small spring instead of just fading */
  #toast { transform: translateY(10px) scale(.96); transition: opacity .22s, transform .3s var(--spring); }
  #toast.show { transform: none; }

  /* sheets land with the same spring the rest of the app uses */
  .sheet { animation: sheet-up .32s var(--spring); }

  /* inputs acknowledge focus */
  .input { transition: border-color .15s, box-shadow .18s, background .15s; }
  .input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

  /* chips used as toggles (advanced features roles) give feedback too */
  .fa-roles .chip { transition: transform .18s var(--spring), background .15s, color .15s; cursor: pointer; }
  .fa-roles .chip:active { transform: scale(.9); transition-duration: .06s; }
}

/* ============================================================================
   v1.0.45 — DESIGN SKINS (Portal → White Label → App Design)
   Each skin reshapes the token layer; the accent color and role tints flow
   through every one of them. data-skin is set on <html> by applyBranding().
   ============================================================================ */

/* ---------- picker ---------- */
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.skin-tile {
  background: none; border: 2px solid var(--line); border-radius: 14px;
  padding: 8px; cursor: pointer; font-family: inherit; color: var(--text);
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  transition: border-color .15s, transform .18s var(--spring, ease);
}
.skin-tile:active { transform: scale(.96); }
.skin-tile.sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.skin-prev {
  width: 100%; height: 64px; border-radius: 9px; position: relative; overflow: hidden;
  border: 1px solid rgba(0,0,0,.12); margin-bottom: 6px; display: block;
}
.skin-prev .skin-chrome { position: absolute; inset: 0 0 auto 0; height: 14px; display: block; }
.skin-prev .skin-card {
  position: absolute; left: 8px; right: 8px; top: 22px; height: 20px; border-radius: 5px;
  box-shadow: 0 1px 2px rgba(0,0,0,.18); display: block;
}
.skin-prev .skin-card i { position: absolute; left: 5px; top: 5px; width: 10px; height: 10px; border-radius: 3px; display: block; }
.skin-prev .skin-card.sm { top: 47px; height: 12px; opacity: .75; }
.skin-name { font-size: 12.5px; font-weight: 800; }
.skin-tag { font-size: 10px; color: var(--muted); font-weight: 600; }

/* ============================ LIQUID GLASS ============================ */
html[data-skin="glass"] {
  --bg: #e7ecf4;
  --pine-950: #0b1220; --pine-900: #111b2e; --pine-700: #23406b;
  --card: rgba(255, 255, 255, 0.4); --card-strong: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(255, 255, 255, 0.85); --glass-edge: rgba(16, 24, 40, 0.06);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.92), inset 0 -1px 0 rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 16px 44px -18px rgba(16, 24, 40, 0.35);
  --blur: 34px;
  --text: #101826; --muted: #5b6b80; --line: rgba(16, 24, 40, 0.08);
  --r-card: 24px; --r-qa: 20px; --r-btn: 18px; --r-btn-sm: 14px; --r-input: 16px;
  --topbar-bg: rgba(255, 255, 255, 0.34);
  --nav-bg: rgba(255, 255, 255, 0.42);
  --sheet-bg: rgba(255, 255, 255, 0.68);
  --input-bg: rgba(255, 255, 255, 0.46);
  --side-bg: rgba(13, 20, 34, 0.66);
  --hero-bg: linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, #0b1220), color-mix(in srgb, var(--accent) 16%, #131e33) 58%, color-mix(in srgb, var(--accent) 34%, #16233c));
  --logo-bg: linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, #0b1220), color-mix(in srgb, var(--accent) 15%, #16233c));
  --mesh:
    radial-gradient(980px 560px at 90% -10%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 68%),
    radial-gradient(820px 520px at -14% 22%, rgba(124, 58, 237, 0.15), transparent 70%),
    radial-gradient(720px 500px at 110% 76%, rgba(34, 211, 238, 0.17), transparent 70%),
    radial-gradient(560px 420px at 26% 110%, rgba(244, 114, 182, 0.13), transparent 70%),
    var(--bg);
}
html[data-skin="glass"][data-theme="dark"] {
  --bg: #0a0f18;
  --card: rgba(30, 42, 60, 0.42); --card-strong: rgba(40, 54, 76, 0.6);
  --glass-border: rgba(255, 255, 255, 0.14); --glass-edge: rgba(0, 0, 0, 0.4);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 18px 48px -18px rgba(0, 0, 0, 0.7);
  --text: #e8eef7; --muted: #8fa0b5; --line: rgba(255, 255, 255, 0.09);
  --topbar-bg: rgba(13, 19, 30, 0.55);
  --nav-bg: rgba(17, 24, 38, 0.6);
  --sheet-bg: rgba(20, 28, 44, 0.92);
  --input-bg: rgba(0, 0, 0, 0.28);
  --mesh:
    radial-gradient(980px 560px at 90% -10%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 68%),
    radial-gradient(820px 520px at -14% 22%, rgba(124, 58, 237, 0.12), transparent 70%),
    radial-gradient(720px 500px at 110% 76%, rgba(34, 211, 238, 0.1), transparent 70%),
    var(--bg);
}
html[data-skin="glass"] .btn:not(.secondary):not(.danger-outline) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 10px 26px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}

/* ============================ HORIZON ============================ */
html[data-skin="horizon"] {
  --bg: #f7f1ea;
  --pine-950: #16152e; --pine-900: #1b1a3a; --pine-700: #4a2555;
  --card: rgba(255, 252, 248, 0.78); --card-strong: rgba(255, 255, 255, 0.94);
  --glass-border: rgba(255, 255, 255, 0.88); --glass-edge: rgba(60, 35, 70, 0.07);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 20px 46px -20px rgba(74, 37, 85, 0.32);
  --blur: 18px;
  --text: #241d2e; --muted: #74687c; --line: rgba(60, 35, 70, 0.1);
  --r-card: 22px; --r-qa: 20px; --r-btn: 18px; --r-btn-sm: 14px; --r-input: 15px;
  --topbar-bg: rgba(252, 246, 240, 0.6);
  --nav-bg: rgba(255, 252, 248, 0.66);
  --sheet-bg: rgba(255, 251, 246, 0.92);
  --input-bg: rgba(255, 255, 255, 0.75);
  --side-bg: rgba(23, 21, 48, 0.86);
  --hero-bg: linear-gradient(140deg, #1b1a3a, #40224e 40%, #8f3d3c 74%, #ce7440);
  --logo-bg: linear-gradient(140deg, #1b1a3a, #4a2555 55%, #b3543f);
  --mesh:
    radial-gradient(900px 540px at 88% -8%, rgba(224, 133, 74, 0.2), transparent 68%),
    radial-gradient(780px 500px at -12% 26%, rgba(74, 37, 85, 0.12), transparent 70%),
    radial-gradient(680px 480px at 106% 80%, rgba(216, 111, 98, 0.15), transparent 70%),
    var(--bg);
}
html[data-skin="horizon"][data-theme="dark"] {
  --bg: #141122;
  --card: rgba(36, 30, 58, 0.62); --card-strong: rgba(46, 39, 72, 0.8);
  --glass-border: rgba(255, 255, 255, 0.11); --glass-edge: rgba(0, 0, 0, 0.4);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 20px 46px -20px rgba(0, 0, 0, 0.7);
  --text: #ece6f2; --muted: #a396b0; --line: rgba(255, 255, 255, 0.09);
  --topbar-bg: rgba(24, 20, 42, 0.6);
  --nav-bg: rgba(28, 24, 50, 0.68);
  --sheet-bg: rgba(32, 27, 56, 0.94);
  --input-bg: rgba(0, 0, 0, 0.3);
  --mesh:
    radial-gradient(900px 540px at 88% -8%, rgba(206, 116, 64, 0.16), transparent 68%),
    radial-gradient(780px 500px at -12% 26%, rgba(124, 58, 237, 0.1), transparent 70%),
    var(--bg);
}
html[data-skin="horizon"] .hero::after, html[data-skin="horizon"] .hero::before { border-color: rgba(255, 210, 170, 0.25); }

/* ============================ ONYX (committed dark) ============================ */
html[data-skin="onyx"] {
  --r-card: 14px; --r-qa: 13px; --r-btn: 12px; --r-btn-sm: 10px; --r-input: 11px; --r-chip: 7px;
}
html[data-skin="onyx"][data-theme="dark"] {
  --bg: #0a0c0e;
  --pine-950: #08090b; --pine-900: #101317; --pine-700: #232a33;
  --card: linear-gradient(180deg, #16191d, #101317); --card-strong: #1b2025;
  --glass-border: rgba(255, 255, 255, 0.07); --glass-edge: rgba(0, 0, 0, 0.5);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 10px 30px -16px rgba(0, 0, 0, 0.8);
  --blur: 16px;
  --text: #e9ebee; --muted: #8b939c; --line: rgba(255, 255, 255, 0.07);
  --topbar-bg: rgba(10, 12, 14, 0.72);
  --nav-bg: rgba(14, 17, 20, 0.82);
  --sheet-bg: #14171b;
  --input-bg: rgba(255, 255, 255, 0.045);
  --side-bg: rgba(9, 11, 13, 0.92);
  --hero-bg: linear-gradient(135deg, #0c0e11, #171b21 55%, #20262e);
  --logo-bg: linear-gradient(135deg, #171b21, #262d36);
  --mesh:
    radial-gradient(900px 520px at 88% -8%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%),
    radial-gradient(700px 480px at -10% 80%, rgba(255, 255, 255, 0.025), transparent 70%),
    var(--bg);
}
html[data-skin="onyx"] .hero { border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
html[data-skin="onyx"] .btn:not(.secondary):not(.danger-outline) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 0 20px -5px color-mix(in srgb, var(--accent) 65%, transparent);
}
html[data-skin="onyx"] #nav button.on {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 16px -3px color-mix(in srgb, var(--accent) 50%, transparent);
}
html[data-skin="onyx"] .stat .n { text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 40%, transparent); }

/* ============================ ROUTE 70 (retro) ============================ */
html[data-skin="retro"] {
  --ink: #2c1d0e;
  --ink-sh: rgba(44, 29, 14, 0.85);
  --bg: #f3e9d3;
  --pine-950: #241708; --pine-900: #3a2412; --pine-700: #7c3a1d;
  --card: #fdf6e6; --card-strong: #fffbf0;
  --glass-border: var(--ink); --glass-edge: transparent;
  --glass-hi: inset 0 0 0 transparent;
  --glass-shadow: 4px 4px 0 var(--ink-sh);
  --blur: 0px;
  --text: #2c1d0e; --muted: #7a6248; --line: rgba(44, 29, 14, 0.18);
  --r-card: 10px; --r-qa: 9px; --r-btn: 9px; --r-btn-sm: 8px; --r-input: 8px; --r-chip: 6px;
  --topbar-bg: #f7eeda;
  --nav-bg: #fdf6e6;
  --sheet-bg: #f9f1df;
  --input-bg: #fffdf6;
  --side-bg: #241708;
  --hero-bg: linear-gradient(180deg, #3a2412, #58301a 62%, #7c3a1d);
  --logo-bg: linear-gradient(180deg, #3a2412, #7c3a1d);
  --mesh: linear-gradient(180deg, rgba(216, 111, 43, 0.13), transparent 34%), var(--bg);
}
html[data-skin="retro"][data-theme="dark"] {
  --ink: #c9b48e;
  --ink-sh: rgba(0, 0, 0, 0.65);
  --bg: #1d130a;
  --card: #2a1c10; --card-strong: #342310;
  --glass-border: rgba(201, 180, 142, 0.55);
  --glass-shadow: 4px 4px 0 var(--ink-sh);
  --text: #f0e4cd; --muted: #b39877; --line: rgba(201, 180, 142, 0.22);
  --topbar-bg: #241708;
  --nav-bg: #2a1c10;
  --sheet-bg: #2a1c10;
  --input-bg: rgba(0, 0, 0, 0.3);
  --mesh: linear-gradient(180deg, rgba(216, 111, 43, 0.1), transparent 34%), var(--bg);
}
html[data-skin="retro"] .card, html[data-skin="retro"] .qa-item, html[data-skin="retro"] .opt,
html[data-skin="retro"] .input, html[data-skin="retro"] textarea.input, html[data-skin="retro"] select.input,
html[data-skin="retro"] .sheet { border-width: 2px; }
html[data-skin="retro"] .btn { border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink-sh); }
html[data-skin="retro"] .btn:active { box-shadow: 1px 1px 0 var(--ink-sh); }
html[data-skin="retro"] .topbar { border-bottom: 2px solid var(--ink); box-shadow: none; }
html[data-skin="retro"] #nav { border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink-sh); }
html[data-skin="retro"] .chip { box-shadow: none; backdrop-filter: none; border: 1.5px solid currentColor; }
html[data-skin="retro"] .topbar h1, html[data-skin="retro"] .step-title, html[data-skin="retro"] .hero .name,
html[data-skin="retro"] .logo h1, html[data-skin="retro"] .skin-name {
  font-family: "IBM Plex Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.05em;
}
html[data-skin="retro"] .hero .name { font-size: 21px; }
html[data-skin="retro"] .hero { border-bottom: 3px solid var(--accent); }

/* ============================ CLARITY (paper) ============================ */
html[data-skin="paper"] {
  --bg: #f6f7f6;
  --pine-950: #1c2420; --pine-900: #243029; --pine-700: #3c4f45;
  --card: #ffffff; --card-strong: #f6f8f6;
  --glass-border: #e4e7e4; --glass-edge: transparent;
  --glass-hi: inset 0 0 0 transparent;
  --glass-shadow: 0 1px 3px rgba(20, 28, 24, 0.07);
  --blur: 0px;
  --text: #1a201c; --muted: #5c6862; --line: #e8ebe8;
  --r-card: 12px; --r-qa: 11px; --r-btn: 11px; --r-btn-sm: 9px; --r-input: 10px;
  --topbar-bg: rgba(255, 255, 255, 0.95);
  --nav-bg: rgba(255, 255, 255, 0.97);
  --sheet-bg: #ffffff;
  --input-bg: #ffffff;
  --side-bg: #243029;
  --hero-bg: linear-gradient(0deg, #243029, #243029);
  --logo-bg: linear-gradient(0deg, #243029, #2c3a32);
  --mesh: linear-gradient(0deg, var(--bg), var(--bg));
}
html[data-skin="paper"][data-theme="dark"] {
  --bg: #141715;
  --card: #1d221f; --card-strong: #242a26;
  --glass-border: #2c332f;
  --glass-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --text: #e8ece9; --muted: #97a29b; --line: #262c28;
  --topbar-bg: rgba(20, 23, 21, 0.97);
  --nav-bg: rgba(26, 30, 27, 0.97);
  --sheet-bg: #1d221f;
  --input-bg: #171b18;
  --mesh: linear-gradient(0deg, var(--bg), var(--bg));
}
html[data-skin="paper"] .btn:not(.secondary):not(.danger-outline):not(.blue) {
  background: var(--accent-dark); color: #fff; box-shadow: none;
}
html[data-skin="paper"] .qa-item .icon {
  background: color-mix(in srgb, var(--accent) 13%, var(--card-strong)); box-shadow: none;
}
html[data-skin="paper"] .topbar { box-shadow: none; border-bottom: 1px solid var(--glass-border); }
html[data-skin="paper"] #nav { box-shadow: 0 10px 26px -14px rgba(20, 28, 24, 0.35); }
html[data-skin="paper"] .chip { backdrop-filter: none; box-shadow: none; }

/* ============================ IMPACT (bold) ============================ */
html[data-skin="bold"] {
  --ink: #101418;
  --bg: #ffffff;
  --pine-950: #0c0f12; --pine-900: #101418; --pine-700: #2a3138;
  --card: #ffffff; --card-strong: #f2f5f7;
  --glass-border: var(--ink); --glass-edge: transparent;
  --glass-hi: inset 0 0 0 transparent;
  --glass-shadow: 0 2px 0 rgba(16, 20, 24, 0.9);
  --blur: 0px;
  --text: #0c0f12; --muted: #414b55; --line: #d6dbe0;
  --r-card: 12px; --r-qa: 11px; --r-btn: 12px; --r-btn-sm: 10px; --r-input: 10px; --r-chip: 8px;
  --topbar-bg: #ffffff;
  --nav-bg: #ffffff;
  --sheet-bg: #ffffff;
  --input-bg: #ffffff;
  --side-bg: #101418;
  --hero-bg: linear-gradient(0deg, #101418, #101418);
  --logo-bg: linear-gradient(0deg, #101418, #1b2026);
  --mesh: linear-gradient(0deg, var(--bg), var(--bg));
}
html[data-skin="bold"][data-theme="dark"] {
  --ink: #e8edf2;
  --bg: #0d1013;
  --card: #14181c; --card-strong: #1b2025;
  --glass-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
  --text: #f2f5f7; --muted: #9aa5af; --line: #2a3138;
  --topbar-bg: #0d1013;
  --nav-bg: #14181c;
  --sheet-bg: #14181c;
  --input-bg: #0f1215;
  --mesh: linear-gradient(0deg, var(--bg), var(--bg));
}
html[data-skin="bold"] .card, html[data-skin="bold"] .qa-item { border: 2px solid var(--ink); }
html[data-skin="bold"] .btn:not(.secondary):not(.danger-outline):not(.blue) {
  background: var(--accent-dark); color: #fff; border: 2px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink); font-weight: 800;
}
html[data-skin="bold"] .btn.secondary { border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
html[data-skin="bold"] .btn:active { box-shadow: 0 1px 0 var(--ink); }
html[data-skin="bold"] .input, html[data-skin="bold"] textarea.input, html[data-skin="bold"] select.input { border: 2px solid var(--ink); }
html[data-skin="bold"] .topbar { border-bottom: 2px solid var(--ink); box-shadow: none; }
html[data-skin="bold"] #nav { border: 2px solid var(--ink); box-shadow: 0 4px 0 rgba(16, 20, 24, 0.55); }
html[data-skin="bold"] .chip { border: 1.5px solid currentColor; box-shadow: none; backdrop-filter: none; }
html[data-skin="bold"] .qa-item .t, html[data-skin="bold"] .topbar h1 { font-weight: 800; }
html[data-skin="bold"] .section > h2 { color: var(--text); }
html[data-skin="bold"] .hero { border-bottom: 4px solid var(--accent); }

/* ============================================================================
   v1.0.46 — COMMAND CENTER desktop layout (White Label → Laptop/desktop layout)
   Big screens use every pixel: grouped sidebar menu, full-width content,
   3-4 column lists, slim banner hero. 'classic' keeps the centered column.
   Phones are untouched — everything here lives behind the desktop breakpoint.
   ============================================================================ */
@media (min-width: 1024px) {
  /* --- grouped sidebar: the whole app, mapped --- */
  html[data-layout="command"] #sidebar { width: 272px; }
  html[data-layout="command"] #sidebar:not([hidden]) + #app { margin-left: 272px; }
  html[data-layout="command"] .side-nav { overflow-y: auto; padding-bottom: 12px; scrollbar-width: thin; }
  html[data-layout="command"] .side-nav::-webkit-scrollbar { width: 5px; }
  html[data-layout="command"] .side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 3px; }
  html[data-layout="command"] .side-label { padding: 14px 12px 5px; }
  html[data-layout="command"] .side-nav button { padding: 8px 12px; font-size: 13px; margin-bottom: 1px; gap: 10px; }

  /* --- the page fills the screen --- */
  html[data-layout="command"] #screen { max-width: none; padding: 0 28px 60px; }
  html[data-layout="command"] #screen > .section { max-width: none; margin-inline: 0; }
  /* pure form / reading sections keep a readable width, anchored left where the eye starts */
  html[data-layout="command"] #screen > .section:not(:has(> .qa-item)):not(:has(> .card.tap)):not(:has(.board)):not(:has(.timeline)):not(:has(.drop-zone)):not(:has(.mile-strip)):not(:has(.asg-grid)):not(:has(.rc-grid)) {
    max-width: 880px;
  }
  /* truck profiles & timelines: wide but still readable */
  html[data-layout="command"] #screen > .section:has(.timeline) { max-width: 1020px; }

  /* --- lists spread into columns --- */
  html[data-layout="command"] .section:has(> .qa-item),
  html[data-layout="command"] .section:has(> .card.tap) {
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  }

  /* --- hero becomes a slim, wide banner --- */
  html[data-layout="command"] .hero { display: flex; align-items: center; gap: 18px; padding: 20px 26px; margin: 18px 0 0; border-radius: 20px; }
  html[data-layout="command"] .hero .name { font-size: 26px; margin-top: 0; }
  html[data-layout="command"] .hero .role { margin-top: 2px; margin-left: auto; padding-right: 26px; }

  /* --- desktop-app touches --- */
  html[data-layout="command"] .topbar { padding-left: 22px; padding-right: 22px; }
  html[data-layout="command"] .topbar h1 { text-align: left; font-size: 20px; }
  html[data-layout="command"] .stats { gap: 12px; }
  html[data-layout="command"] .stat { min-width: 150px; }
  html[data-layout="command"] .msg-list { max-width: 920px; }
}
@media (min-width: 1600px) {
  html[data-layout="command"] .section:has(> .qa-item),
  html[data-layout="command"] .section:has(> .card.tap) {
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  }
  html[data-layout="command"] #screen { padding: 0 40px 60px; }
}

/* ================= v1.0.47: assignment & roll-call tiles ================= */
.asg-grid, .rc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px;
}
.asg-tile {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
  background: var(--card); border: 1px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  border-radius: var(--r-qa); padding: 10px 12px; cursor: pointer;
  font-family: inherit; color: var(--text);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  box-shadow: var(--glass-hi), 0 3px 12px -8px rgba(8, 28, 16, 0.2);
  transition: transform .18s var(--spring, ease), background .12s;
}
.asg-tile:active { transform: scale(.96); }
.asg-tile .nm { font-size: 12.5px; font-weight: 800; }
.asg-tile .nm i { font-style: normal; color: var(--amber); }
.asg-tile .un { font-size: 12px; font-weight: 700; color: var(--accent-dark); }
.asg-tile .jb { font-size: 10.5px; color: var(--muted); font-weight: 600; min-height: 13px; }
.asg-tile.none { opacity: .78; }
.asg-tile.none .un { color: var(--muted); font-weight: 600; }

.rc-tile {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1.5px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  border-radius: var(--r-qa); padding: 9px 10px 9px 12px; cursor: pointer;
  box-shadow: var(--glass-hi), 0 3px 12px -8px rgba(8, 28, 16, 0.2);
  transition: transform .18s var(--spring, ease), background .15s, border-color .15s;
}
.rc-tile:active { transform: scale(.97); }
.rc-tile .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rc-tile .nm { font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-tile .nm em { font-style: normal; font-size: 9px; font-weight: 800; color: #0f7a3d; }
.rc-tile .un { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.rc-tile.present { background: color-mix(in srgb, #22b45f 20%, var(--card-strong)); border-color: #22b45f; }
.rc-tile.late { background: color-mix(in srgb, #f59e0b 22%, var(--card-strong)); border-color: #d97706; }
.rc-tile.absent { background: color-mix(in srgb, #dc2626 18%, var(--card-strong)); border-color: #dc2626; }
.rc-acts { display: flex; gap: 5px; flex-shrink: 0; }
.rc-a {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card-strong); cursor: pointer; font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  transition: transform .15s var(--spring, ease), background .12s, color .12s;
}
.rc-a:active { transform: scale(.85); }
.rc-a.late.on { background: #d97706; border-color: #d97706; color: #fff; }
.rc-a.absent.on { background: #dc2626; border-color: #dc2626; color: #fff; }

/* on desktop grids, the tile blocks span the full section width */
@media (min-width: 1024px) {
  .section > .asg-grid, .section > .rc-grid { grid-column: 1 / -1; }
}

/* ================= v1.0.49: driver safety + server task manager ================= */
.score-ring {
  width: 104px; height: 104px; border-radius: 50%; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 6px solid var(--line); background: var(--card-strong);
}
.score-ring b { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.score-ring span { font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--muted); margin-top: 2px; }
.score-ring.completed { border-color: #22b45f; }
.score-ring.in_progress { border-color: var(--blue); }
.score-ring.pending { border-color: #d97706; }
.score-ring.rejected { border-color: var(--red); }

.drv-score {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
  background: var(--card); border: 1.5px solid var(--glass-border); outline: 1px solid var(--glass-edge);
  border-radius: var(--r-qa); padding: 10px 12px; cursor: pointer;
  font-family: inherit; color: var(--text);
  box-shadow: var(--glass-hi), 0 3px 12px -8px rgba(8, 28, 16, 0.2);
  transition: transform .18s var(--spring, ease), background .15s, border-color .15s;
}
.drv-score:active { transform: scale(.96); }
.drv-score .nm { font-size: 12.5px; font-weight: 800; }
.drv-score .sc { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.drv-score .sc i { font-style: normal; font-size: 11px; font-weight: 800; margin-left: 5px; opacity: .7; }
.drv-score .mi { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.drv-score.completed { border-color: #22b45f; background: color-mix(in srgb, #22b45f 12%, var(--card-strong)); }
.drv-score.in_progress { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 10%, var(--card-strong)); }
.drv-score.pending { border-color: #d97706; background: color-mix(in srgb, #f59e0b 14%, var(--card-strong)); }
.drv-score.rejected { border-color: var(--red); background: color-mix(in srgb, #dc2626 12%, var(--card-strong)); }
.drv-score.none { opacity: .65; }

.spark { width: 100%; height: 24px; display: block; margin-top: 4px; }

/* live tracking bar — always visible while a trip is recording */
#trackbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom, 0px) / 2);
  z-index: 40; display: flex; align-items: center; gap: 8px;
  background: rgba(8, 28, 16, 0.9); color: #fff; border-radius: 999px;
  padding: 9px 16px; font-size: 12.5px; font-weight: 700; cursor: pointer;
  backdrop-filter: blur(12px); box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .5);
}
#trackbar .dot { width: 8px; height: 8px; border-radius: 50%; background: #ff5252; animation: trackPulse 1.6s infinite; }
#trackbar b { background: rgba(255,255,255,.16); border-radius: 999px; padding: 3px 10px; margin-left: 4px; }
@keyframes trackPulse { 50% { opacity: .3; } }
@media (min-width: 1024px) { #trackbar { bottom: 24px; } }

/* ================= v1.0.50: iPhone app feel ================= */
/* no rubber-band bounce revealing the void behind the app, no accidental pull-to-refresh */
html, body { overscroll-behavior: none; }
#screen { overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }

/* long-pressing a button or card must not select its label or pop the copy callout —
   that is the single biggest "this is a website" tell. Real content stays copyable. */
.btn, .btn *, .seg-btn, .chip, .qa-item .t, .qa-item .s, .qa-item .icon, .chev,
#nav, #nav *, .topbar h1, .back-btn, .icon-btn, .tabs, .tab, .hero, .hero *,
.rc-tile, .rc-tile *, .asg-tile, .asg-tile *, .drv-score, .drv-score *, .drv-chip, .drv-chip *,
.mile-card, .mile-card *, .skin-tile, .skin-tile *, .stat, .stat *, .role-card, .role-card *,
.side-nav, .side-nav *, .side-label, .switch, .opt, .opt *, .lbl, .microlabel, .progress-label,
.rc-a, #trackbar, .mod-dot, .step-title, .step-sub, .section > h2, .card > h2 {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
input, textarea, select { -webkit-user-select: text; user-select: text; }

/* a scrolled-out sheet must never drag the page behind it */
.sheet, .sheet > div[style*="overflow-y"] { overscroll-behavior: contain; }
.sheet-overlay { overscroll-behavior: contain; }
.msg-list, .board, .mile-strip { overscroll-behavior-x: contain; }

/* iOS zooms the whole page when a focused input's text is under 16px — never allow that.
   Desktop keeps its compact fields; phones get zoom-proof ones. */
@media (max-width: 1023px) {
  .input, textarea.input, select.input { font-size: 16px !important; }
}

/* horizontal rails glide with momentum */
.mile-strip, .skin-grid, .tabs { -webkit-overflow-scrolling: touch; }

/* dragging images (logos, photos) ghosts them around like a browser — stop that,
   but leave taps and pinch-zoom in the photo viewer alone */
.qa-item img, .hero img, #nav img, .side-logo img { -webkit-user-drag: none; }

/* ================= v1.0.51 ================= */

/* iPhone: the banner must ALWAYS clear the clock / Dynamic Island. Installed apps sometimes
   read a zero safe-area inset on a cold start, so standalone iOS gets a guaranteed minimum. */
html.ios-pwa .topbar { padding-top: max(calc(16px + env(safe-area-inset-top, 0px)), 58px); }
html.ios-pwa #splash { padding-top: env(safe-area-inset-top, 0px); }

/* ---- pull-to-refresh + loading strip: the dump truck drives right → left ---- */
#ptr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 290;
  height: calc(76px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--topbar-bg);
  backdrop-filter: blur(var(--blur)) saturate(1.6);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.6);
  border-bottom: 1px solid var(--glass-border);
  transform: translateY(-102%);
  transition: transform .28s cubic-bezier(.32, .72, .28, 1.08);
  pointer-events: none; overflow: hidden;
}
#ptr.pulling { transition: none; transform: translateY(calc(-102% + var(--pull, 0px))); }
#ptr.show { transform: translateY(0); }
.pt-road {
  position: absolute; left: 0; right: 0; bottom: 13px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--line) 0 22px, transparent 22px 40px);
  opacity: .9;
}
#ptr.loading .pt-road { animation: pt-road .5s linear infinite; }
@keyframes pt-road { from { transform: translateX(0); } to { transform: translateX(40px); } }
.pt-lane {
  position: absolute; bottom: 6px; left: 50%; width: 86px; height: 36px;
  transform: translateX(-50%);
}
.pt-svg { width: 86px; height: 36px; display: block; }
/* pulling: the truck waits mid-strip and the wheels roll with the finger */
#ptr.pulling .pt-wheel { transform: rotate(calc(var(--pull, 0px) * 3.4deg)); }
#ptr.ready .pt-body { animation: pt-rev .18s linear infinite; }
@keyframes pt-rev { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1px); } }
/* loading: drive across the screen, right → left, wheels spinning */
#ptr.loading .pt-lane { animation: pt-drive 1.9s linear infinite; }
@keyframes pt-drive {
  from { transform: translateX(56vw); }
  to { transform: translateX(calc(-50vw - 100px)); }
}
#ptr.loading .pt-wheel { animation: pt-spin .42s linear infinite; }
@keyframes pt-spin { to { transform: rotate(360deg); } }
.pt-txt {
  position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 0; right: 0;
  text-align: center; font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
}
@media (prefers-reduced-motion: reduce) {
  #ptr.loading .pt-lane, #ptr.loading .pt-wheel, #ptr.loading .pt-road, #ptr.ready .pt-body { animation: none; }
}

/* ---- App Map ---- */
.map-wrap { overflow: hidden; }
.map-line {
  fill: none; stroke: var(--line); stroke-width: 1.6;
  transition: stroke .25s, stroke-width .25s, opacity .25s;
}
.map-line.hub { opacity: .45; stroke-dasharray: 3 6; }
.map-line.lit { stroke: var(--accent); stroke-width: 2.6; opacity: 1; stroke-dasharray: none; }
.map-hub circle {
  fill: var(--pine-900, #0c2617); stroke: var(--accent); stroke-width: 2;
}
.map-hub-name {
  fill: #fff; font-size: 19px; font-weight: 800; text-anchor: middle;
  font-family: 'Manrope', sans-serif; letter-spacing: -0.01em;
}
.map-hub-sub {
  fill: rgba(255, 255, 255, 0.6); font-size: 9.5px; text-anchor: middle;
  font-family: 'IBM Plex Mono', monospace; letter-spacing: .04em;
}
.map-node { cursor: pointer; }
.map-node circle {
  fill: var(--card-strong); stroke: var(--tint); stroke-width: 2;
  transition: stroke-width .2s, r .2s;
}
.map-node:hover circle { stroke-width: 3.5; }
.map-node.sel circle { fill: color-mix(in srgb, var(--tint) 14%, var(--card-strong)); stroke-width: 4; }
.map-ic { font-size: 24px; text-anchor: middle; }
.map-nm {
  font-size: 10.5px; font-weight: 700; text-anchor: middle;
  fill: var(--text); font-family: 'Manrope', sans-serif;
}


/* API rows inside a module's detail card */
.api-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: baseline;
  border-top: 1px solid var(--line); padding: 9px 0;
}
.api-verb {
  font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 7px; letter-spacing: .04em;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-dark, var(--accent));
}
.api-verb.post { background: rgba(59, 130, 246, 0.14); color: #2563eb; }
.api-verb.put { background: rgba(217, 119, 6, 0.14); color: #b45309; }
.api-verb.delete { background: rgba(220, 38, 38, 0.12); color: #dc2626; }
:root[data-theme="dark"] .api-verb.post { color: #7fb3ff; }
:root[data-theme="dark"] .api-verb.put { color: #ffc46b; }
:root[data-theme="dark"] .api-verb.delete { color: #ff8f8f; }
.api-path {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600;
  word-break: break-all;
}
.api-who { font-size: 10px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.api-what { grid-column: 1 / -1; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ---- Capacity Planner ---- */
.cap-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.cap-row input[type="range"] { flex: 1; accent-color: var(--accent); min-height: 28px; }
.cap-val {
  font-family: 'IBM Plex Mono', monospace; font-size: 15px; min-width: 58px; text-align: right;
  font-variant-numeric: tabular-nums;
}
