/* Cabin Noir web. Dark by default, follows the system light setting. System fonts, 44 px touch targets, no text under 12 px. */
:root {
  --bg: #0b0b0d; --card: #17171a; --card2: #212126; --line: #2b2b31; --text: #f4f4f6; --muted: #9a9aa3;
  --accent: #f5c518; --accent-ink: #1a1400; --red: #ff453a; --orange: #ff9f0a; --green: #30d158; --blue: #64a8ff;
  --radius: 18px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f2f2f7; --card: #ffffff; --card2: #ececf1; --line: #dcdce2; --text: #111114; --muted: #6a6a74; --accent-ink: #1a1400; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; } .gap { display: grid; gap: 12px; } .gap-s { display: grid; gap: 6px; }

/* shell */
.shell { max-width: 520px; margin: 0 auto;   /* a phone-width column, centred: wider windows are not stretched */
  padding: calc(12px + var(--safe-t)) 16px calc(var(--tabs-h, calc(72px + var(--safe-b))) + 24px); }   /* --tabs-h: measured height of the bottom bar (app.js) */
.topbar { display: flex; align-items: center; gap: 10px; padding: 6px 0 14px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; padding: 8px 12px calc(8px + var(--safe-b)); background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.tabs-in { display: flex; gap: 4px; width: 100%; max-width: 520px; background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 4px; }
.tab { flex: 1; min-height: 48px; display: grid; place-items: center; gap: 1px; border: 0; background: none; border-radius: 22px; color: var(--muted); font-size: 12px; text-decoration: none; }
.tab svg { width: 22px; height: 22px; } .tab.on { background: var(--bg); color: var(--accent); font-weight: 600; }

/* surfaces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.pad0 { padding: 0; overflow: hidden; }
.sec-title { margin: 22px 4px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.list > * + * { border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; width: 100%; background: none; border: 0; text-align: left; }
.item .ic { width: 22px; height: 22px; color: var(--accent); flex: none; }
.item .sub { color: var(--muted); font-size: 13px; }
.item:hover { background: var(--card2); }

/* controls */
.btn { min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--card2); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--text); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { background: var(--red); color: #fff; border-color: transparent; }
.btn.ghost { background: none; } .btn.block { width: 100%; } .btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; position: relative; }
.icon-btn svg { width: 22px; height: 22px; }
.field { display: grid; gap: 6px; } .field label { font-size: 13px; color: var(--muted); font-weight: 600; }
input[type=text], input[type=tel], input[type=number], input[type=search], select, textarea { min-height: 48px; width: 100%; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; padding: 8px 16px; }
.switch input { appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--card2); border: 1px solid var(--line); position: relative; flex: none; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 25px; height: 25px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.switch input:checked { background: var(--green); border-color: var(--green); } .switch input:checked::after { transform: translateX(20px); }
.check { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; border-radius: 14px; background: var(--card2); }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* status */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--card2); }
.pill.red { background: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); }
.pill.orange { background: color-mix(in srgb, var(--orange) 22%, transparent); color: var(--orange); }
.pill.green { background: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); }
.pill.grey { color: var(--muted); }
.verdict { border-radius: 24px; padding: 20px; border: 1px solid var(--line); background: var(--card); }
.verdict.critical { background: color-mix(in srgb, var(--red) 16%, var(--card)); border-color: var(--red); }
.verdict.warning { background: color-mix(in srgb, var(--orange) 16%, var(--card)); border-color: var(--orange); }
.verdict.safe, .verdict.ok { border-color: color-mix(in srgb, var(--green) 50%, var(--line)); }
.verdict .kicker { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.verdict.critical .kicker { color: var(--red); } .verdict.warning .kicker { color: var(--orange); } .verdict.ok .kicker, .verdict.safe .kicker { color: var(--green); } .verdict.unknown .kicker { color: var(--muted); }
.banner { padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--orange) 18%, var(--card)); border: 1px solid var(--orange); font-size: 14px; }
.banner.red { background: color-mix(in srgb, var(--red) 18%, var(--card)); border-color: var(--red); }
.chips { display: flex; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 700; }
.chip svg { width: 20px; height: 20px; } .chip.hot { border-color: var(--red); color: var(--red); } .chip.items svg { color: var(--accent); }
.seats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.seat { border-radius: 14px; border: 1px dashed var(--line); padding: 10px 6px; text-align: center; font-size: 12px; color: var(--muted); min-height: 64px; display: grid; place-items: center; }
.seat.occ { border-style: solid; border-color: var(--red); color: var(--text); background: color-mix(in srgb, var(--red) 14%, transparent); font-weight: 700; }
.seat.pet { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); }
.seat.front { grid-column: span 3; } .seat.rear { grid-column: span 2; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.tile .v { font-size: 20px; font-weight: 700; } .tile.orange .v { color: var(--orange); } .tile.red .v { color: var(--red); } .tile.green .v { color: var(--green); }
.steps { display: grid; gap: 10px; } .step { display: flex; gap: 12px; align-items: flex-start; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: var(--line); flex: none; } .dot.done { background: var(--green); } .dot.skipped { background: var(--orange); } .dot.failed { background: var(--red); }
.progress { height: 8px; border-radius: 4px; background: var(--card2); overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--accent); }
.map { height: 320px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--card2); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.bars i { flex: 1; min-width: 2px; background: var(--red); border-radius: 2px 2px 0 0; opacity: .85; }
.bars i.zero { background: var(--line); }
.timeline { display: grid; gap: 0; } .timeline > div { display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* overlays */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .scrim { align-items: center; } }
.sheet { width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; background: var(--card); border-radius: 26px 26px 0 0; padding: 20px 18px calc(22px + var(--safe-b)); border: 1px solid var(--line); }
@media (min-width: 700px) { .sheet { border-radius: 26px; } }
.toasts { position: fixed; left: 0; right: 0; top: calc(10px + var(--safe-t)); z-index: 60; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; max-width: 92vw; padding: 12px 16px; border-radius: 16px; background: var(--card2); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.err { border-color: var(--red); } .toast.ok { border-color: var(--green); }
.video { width: 100%; border-radius: 16px; background: #000; aspect-ratio: 4/3; object-fit: cover; }
/* Video mẫu: the box follows the clip's own shape so the seat zones drawn on top line up with the picture. */
.video-wrap { position: relative; }
.video-wrap .video { display: block; aspect-ratio: auto; object-fit: contain; min-height: 120px; }
.video-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; border-radius: 16px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .box { width: 100%; max-width: 400px; }
.logo-big { width: 72px; height: 72px; border-radius: 18px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.leaflet-container { isolation: isolate; z-index: 0; }
.btn svg, .item svg, a.btn svg { width: 20px; height: 20px; flex: none; }
.noprint { }
@media print {
  .tabs, .topbar, .noprint, .banner, .toasts { display: none !important; }
  :root { --bg: #fff; --card: #fff; --card2: #f3f3f3; --line: #ccc; --text: #111; --muted: #555; }
  body { background: #fff !important; color: #111 !important; }
  .card, .tile { break-inside: avoid; box-shadow: none !important; }
  .shell { padding-bottom: 0 !important; }
}
.item.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
h3 svg, h2 svg, .card.row svg { width: 20px; height: 20px; flex: none; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.seg button.on { background: var(--accent); color: var(--accent-ink, #1a1400); }
.dot-red { width: 9px; height: 9px; border-radius: 50%; background: var(--red); display: inline-block; }
.banner.orange { border-color: var(--orange); }
.bell-wrap { position: relative; margin-left: 8px; }
.bell-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.bell-panel { position: absolute; right: 0; top: 52px; z-index: 70; width: min(390px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 16px 48px rgba(0,0,0,.45); }
.bell-list { display: grid; }
.bell-item { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 12px 14px; background: none; border: 0; border-top: 1px solid var(--line); color: inherit; min-height: 56px; }
.bell-item.new { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.bell-item > .grow { display: grid; gap: 2px; }
.bell-ic { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--card2); }
.bell-ic svg { width: 18px; height: 18px; }
.bell-ic.red { color: var(--red); } .bell-ic.orange { color: var(--orange); }
.bell-t { font-weight: 700; } .bell-d { color: var(--muted); font-size: 14px; } .bell-m { color: var(--muted); font-size: 12px; }
.bell-empty { padding: 22px 14px; color: var(--muted); text-align: center; }
@media print { .bell-wrap { display: none !important; } }

/* ---- History redesign: Apple-style materials (translucent, blurred, hairline edges), grouped lists, 44 px targets */
.glass { background: color-mix(in srgb, var(--card) 72%, transparent); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); border: 1px solid color-mix(in srgb, var(--text) 9%, transparent); }
@supports (corner-shape: squircle) { .glass, .icard, .hero { corner-shape: squircle; } }
.hist h1 { margin-bottom: 0; }
.hero { padding: 16px 18px; border-radius: 24px; }
.kicker2 { font-size: 13px; color: var(--muted); font-weight: 600; }
.pmenu { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--card2); align-items: center; }
.pmenu button { min-width: 40px; min-height: 32px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-weight: 700; }
.pmenu button.on { background: var(--card); color: var(--text); }
.pmenu::after { content: "ngày"; font-size: 12px; color: var(--muted); padding: 0 8px 0 4px; }
.headline { font-size: 22px; font-weight: 700; line-height: 1.2; margin: 6px 0 14px; }
.headline .red { color: var(--red); }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; height: 92px; align-items: end; }
.sday { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-height: 44px; background: none; border: 0; padding: 0; color: inherit; }
.sbar { display: block; width: 100%; max-width: 36px; min-height: 8px; border-radius: 9px; transition: height .3s ease; }
.sday.sel .sbar { outline: 2px solid var(--accent); outline-offset: 2px; }
.slab { white-space: nowrap; overflow: visible; font-size: 11px; color: var(--muted); }
.covline { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 14px; flex-wrap: wrap; }
.covline svg { width: 18px; height: 18px; color: var(--green); }
.seg.glass { position: sticky; top: 8px; z-index: 30; border-radius: 999px; }
.nudge { display: flex; align-items: center; gap: 10px; text-align: left; width: 100%; padding: 12px 14px; min-height: 48px; border-radius: 16px; color: inherit; border: 1px solid color-mix(in srgb, var(--orange) 55%, transparent); background: color-mix(in srgb, var(--orange) 12%, transparent); font-size: 14px; }
.nudge svg { width: 20px; height: 20px; flex: none; color: var(--orange); }
.chip2 { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 600; font-size: 14px; }
.chip2.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #1a1400); }
.cards { display: grid; gap: 10px; }
.icard { display: block; padding: 14px 16px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: inherit; }
.icard.red { box-shadow: inset 4px 0 0 var(--red); } .icard.orange { box-shadow: inset 4px 0 0 var(--orange); } .icard.green { box-shadow: inset 4px 0 0 var(--green); }
.ititle { font-size: 16px; } .isub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.steps2 { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 2px; font-size: 12px; color: var(--muted); }
.st { display: inline-flex; align-items: center; gap: 6px; }
.st i { width: 9px; height: 9px; border-radius: 50%; background: var(--card2); border: 1px solid var(--line); }
.st.done i { background: var(--accent); border-color: var(--accent); } .st.ok i { background: var(--green); border-color: var(--green); } .st.pending i { background: transparent; border-color: var(--orange); }
.tag { display: inline-flex; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--card2); color: var(--muted); }
.tag.red { background: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); } .tag.orange { background: color-mix(in srgb, var(--orange) 22%, transparent); color: var(--orange); }
.empty { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px; border-radius: 20px; color: var(--muted); }
.empty svg { width: 22px; height: 22px; }
.foot2 { font-size: 12px; color: var(--muted); padding: 0 4px; }
.seal { display: inline-flex; align-items: center; gap: 6px; } .seal svg { width: 16px; height: 16px; } .seal.ok svg { color: var(--green); } .seal.bad { color: var(--red); }
.cov { padding: 16px 18px; border-radius: 24px; }
.covnum { font-size: 38px; font-weight: 700; line-height: 1.1; margin: 4px 0 10px; }
.covbar { position: relative; height: 10px; border-radius: 5px; background: var(--green); overflow: hidden; }
.covbar i { position: absolute; top: 0; bottom: 0; background: var(--orange); } .covbar i.device_offline { background: #6e6e78; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; } .legend .g { background: var(--green); } .legend .o { background: var(--orange); } .legend .n { background: #6e6e78; }
.dtitle { font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 4px 6px; }
.group { border-radius: 20px; overflow: hidden; }
.arow { display: flex; gap: 12px; align-items: center; padding: 12px 14px; min-height: 56px; border-top: 1px solid var(--line); }
.arow:first-child { border-top: 0; }
.aic { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--card2); }
.aic svg { width: 18px; height: 18px; } .aic.orange { color: var(--orange); }
.at { font-weight: 600; } .as { font-size: 13px; color: var(--muted); }
details.more { border-radius: 20px; padding: 0 16px; margin-top: 8px; }
details.more summary { min-height: 52px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
details.more[open] { padding-bottom: 12px; }
.actionbar { position: sticky; bottom: calc(var(--tabs-h, calc(72px + var(--safe-b))) + 8px); z-index: 25; display: flex; gap: 10px; padding: 8px; border-radius: 28px; margin-top: 8px; }
.btn.icon-only { width: 48px; padding: 0; flex: none; }
.btn.icon-only svg { width: 20px; height: 20px; }
@media (prefers-reduced-motion: reduce) { .sbar { transition: none; } }
@media print { .actionbar, .seg { display: none !important; } }

/* Vehicle photo (or neutral drawing when we have no photo of the model) */
.car-stage { display: grid; place-items: center; height: 150px; margin: 4px 0 -6px; }
.car-stage .carpic { max-width: 100%; max-height: 150px; object-fit: contain; filter: drop-shadow(0 12px 18px rgba(0,0,0,.45)); transition: filter .3s, opacity .3s; }
.car-stage.stale .carpic { filter: grayscale(.8); opacity: .65; }
.carpic.generic, .carthumb.generic { display: grid; place-items: center; color: var(--muted); }
.carpic.generic { width: 180px; height: 120px; border-radius: 24px; background: rgba(255,255,255,.05); }
.carpic.generic .ic { width: 72px; height: 72px; stroke-width: 1.2; }
.carthumb { width: 64px; height: 40px; object-fit: contain; flex: none; }
.carthumb.generic { border-radius: 10px; background: rgba(255,255,255,.06); }
.carthumb.generic .ic { width: 26px; height: 26px; }
.nowrap { white-space: nowrap; flex: none; }
.row.top { align-items: flex-start; gap: 12px; }
.toasts { top: calc(64px + var(--safe-t)); }
.actions3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.actions3 .btn { min-width: 0; padding-left: 8px; padding-right: 8px; justify-content: center; }
/* Odd tile count: the last tile takes the full row instead of leaving a hole */
.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles > .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
/* Action list: same width, icon + text aligned left */
.card .acts { display: grid; gap: 8px; }
.card .acts > .btn { width: 100%; justify-content: flex-start; gap: 10px; }
.btn .ic { width: 18px; height: 18px; flex: none; }
/* A setting with a long explanation: text on top, the control full width below it */
.switch.stack { flex-wrap: wrap; }
.switch.stack > div:first-child { flex: 1 1 100%; }
.switch.stack > select { flex: 1 1 100%; width: 100%; margin-top: 8px; }
details.more summary { list-style: none; justify-content: space-between; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 12px; transition: transform .2s; flex: none; }
details.more[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.switch .sub { color: var(--muted); font-size: 13px; font-weight: 400; }
.covline.good .ic { color: var(--green); } .covline.warn .ic { color: var(--orange); } .covline.bad .ic { color: var(--red); }
.topbar .brand { white-space: nowrap; flex: none; }
.topbar .carsel { min-height: 44px; min-width: 0; flex: 0 1 220px; max-width: 220px; }
@media (max-width: 430px) { .topbar:has(.carsel) .brand-name { display: none; } .topbar .carsel { flex: 1 1 auto; max-width: none; } }

/* ---------- Phone frame (desktop preview, see js/frame.js) ---------- */
html.framed, html.framed body { height: 100%; overflow: hidden; }
html.framed body { background: radial-gradient(120% 90% at 50% 0%, #26262b 0%, #101012 55%, #08080a 100%); }
.stage { position: fixed; inset: 0; overflow: hidden; }
.device {
  --s: 1; position: absolute; left: 50%; top: 50%; width: 417px; height: 876px; box-sizing: border-box; padding: 12px; border-radius: 68px;
  background: linear-gradient(145deg, #2c2c30, #141416 40%, #1d1d20);
  box-shadow: 0 0 0 1.5px #4a4a50, 0 0 0 4px #0b0b0c, 0 40px 90px rgba(0,0,0,.65), inset 0 0 0 2px #050505, inset 0 0 0 4px #2a2a2e;
  transform: translate(-50%, -50%) scale(var(--s)); transform-origin: center;
}
.device .side { position: absolute; width: 4px; border-radius: 2px; background: linear-gradient(90deg, #3a3a3f, #222225); }
.device .side.act { left: -5px; top: 150px; height: 34px; }
.device .side.up { left: -5px; top: 210px; height: 62px; }
.device .side.down { left: -5px; top: 286px; height: 62px; }
.device .side.power { right: -5px; top: 238px; height: 98px; }
.device-screen {
  --safe-t: 50px; --safe-b: 20px;
  position: relative; width: 100%; height: 100%; border-radius: 56px; overflow: hidden; background: var(--bg);
  transform: translateZ(0);                 /* fixed-position UI (tab bar, toasts, sheets) stays inside the screen */
}
.device-screen > #app { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.device-screen > #app::-webkit-scrollbar { display: none; }
.island { position: absolute; top: 11px; left: 50%; transform: translateX(-50%); width: 124px; height: 36px; border-radius: 20px; background: #000; z-index: 90; pointer-events: none; }
.sb {
  position: absolute; top: 0; left: 0; right: 0; height: 50px; z-index: 89; pointer-events: none; display: flex; align-items: center; justify-content: space-between;
  padding: 2px 30px 0 44px; color: var(--text); font: 600 16px/1 -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif; letter-spacing: -.01em;
  background: linear-gradient(var(--bg) 55%, color-mix(in srgb, var(--bg) 0%, transparent));
}
.sb-icons { display: flex; align-items: center; gap: 5px; }
.sb-icons .ic { width: 17px; height: 17px; stroke-width: 2.4; }
.sb-icons .ic:last-child { width: 25px; height: 25px; stroke-width: 1.8; }
.home-ind { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); width: 134px; height: 5px; border-radius: 3px; background: var(--text); opacity: .85; z-index: 90; pointer-events: none; }
html.framed .login { min-height: 100%; }
html.framed .sheet { max-height: 86%; }
.frame-toggle {
  position: absolute; right: 18px; bottom: 18px; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #d9d9de; font: 500 13px/1 -apple-system, BlinkMacSystemFont, sans-serif; cursor: pointer;
}
.frame-toggle:hover { background: rgba(255,255,255,.12); }
.frame-toggle .ic { width: 16px; height: 16px; }
.frame-toggle.floating { position: fixed; z-index: 100; bottom: calc(96px + var(--safe-b)); background: var(--card); color: var(--text); border-color: var(--line); }
@media (max-width: 459px) { .frame-toggle.floating { display: none; } }
.seg.glass { top: calc(8px + var(--safe-t)); }
html.framed .bell-panel { width: 361px; max-height: 600px; }
.tester-note { margin: 0; padding: 10px 12px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text); font-size: 13px; line-height: 1.45; }
.tester-note[hidden] { display: none; }

/* iPhone-style notification banner (in-page alerts and pushes received while the page is open) */
.banners { position: fixed; left: 0; right: 0; top: calc(8px + var(--safe-t)); z-index: 95; display: grid; justify-items: center; gap: 8px; padding: 0 10px; pointer-events: none; }
.banner-n {
  pointer-events: auto; cursor: pointer; width: min(100%, 420px); display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border-radius: 22px;
  background: color-mix(in srgb, var(--card2) 82%, transparent); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent); box-shadow: 0 12px 34px rgba(0,0,0,.45); color: var(--text);
  animation: banner-in .35s cubic-bezier(.2,.9,.3,1.2);
}
.banner-n.urgent { border-color: color-mix(in srgb, var(--red) 70%, transparent); }
.banner-n.out { animation: banner-out .25s ease forwards; }
.banner-n > img { width: 38px; height: 38px; border-radius: 9px; flex: none; }
.banner-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.banner-t { font-weight: 700; font-size: 15px; margin-top: 1px; }
.banner-b { font-size: 14px; color: color-mix(in srgb, var(--text) 85%, transparent); line-height: 1.35; }
.banner-x { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.banner-x .ic { width: 16px; height: 16px; }
@keyframes banner-in { from { transform: translateY(-120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes banner-out { to { transform: translateY(-120%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .banner-n, .banner-n.out { animation: none; } }

/* ---------- In-car device page (device/index.html) ---------- */
.dev-page { min-height: 100vh; }
.devwrap { max-width: 1040px; margin: 0 auto; padding: 18px 16px 48px; display: grid; gap: 16px; }
.devhead { display: flex; align-items: center; gap: 12px; padding: 4px 2px; }
.devhead img { border-radius: 8px; }
.devcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.devcol { display: grid; gap: 14px; max-width: 520px; width: 100%; }
.devcols .devcol { max-width: none; }
.dev-page .devwrap > .devcol { margin: 0 auto; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.seatsel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seatcell { display: grid; gap: 4px; padding: 8px; border: 1px dashed var(--line); border-radius: 12px; }
.seatcell select { width: 100%; }
.tog { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.tog[aria-pressed="true"], .tog.on { background: color-mix(in srgb, var(--accent) 18%, var(--card)); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.devlog { display: grid; gap: 4px; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); max-height: 220px; overflow: auto; }
.devlog > div { display: flex; gap: 8px; } .devlog > div > span { color: var(--text); flex: none; } .devlog .bad { color: var(--red); }
.switch input[type="range"] { width: 130px; }

.stepno { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.stepno.ok { background: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); border-color: transparent; }
.stepno .ic { width: 15px; height: 15px; }
.setup .item.done { color: var(--muted); }

/* Side panels beside the phone: guide (left) and what this screen does + live state (right) */
.side-panel { display: none; position: absolute; top: 32px; bottom: 32px; width: var(--pw, 300px); overflow: auto; scrollbar-width: none; flex-direction: column; gap: 12px; color: #d9d9de; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif; }
.side-panel::-webkit-scrollbar { display: none; }
.stage.with-panels .side-panel { display: flex; }
.side-panel.left { right: calc(50% + var(--dw, 420px) / 2 + 28px); }
.side-panel.right { left: calc(50% + var(--dw, 420px) / 2 + 28px); }
.side-panel .pcard { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 14px 16px; display: grid; gap: 8px; }
.side-panel h3 { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #9a9aa3; font-weight: 600; }
.side-panel h4 { margin: 0; font-size: 16px; color: #fff; }
.side-panel p { margin: 0; color: #b9b9c1; font-size: 13px; }
.side-panel ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: #c9c9d0; font-size: 13px; }
.side-panel .gstep { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.side-panel .gno { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.08); color: #bdbdc5; }
.side-panel .gstep.done .gno { background: rgba(48,209,88,.2); color: #30d158; }
.side-panel .gstep.now .gno { background: #f5c518; color: #111; }
.side-panel .gstep .gt { color: #fff; font-weight: 600; font-size: 14px; }
.side-panel .gstep.done .gt { color: #9a9aa3; font-weight: 500; }
.side-panel .gbtn { margin-top: 6px; justify-self: start; padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(245,197,24,.55); background: rgba(245,197,24,.12); color: #f5c518; font: 600 13px/1 inherit; cursor: pointer; text-decoration: none; display: inline-block; }
.side-panel .gbtn:hover { background: rgba(245,197,24,.22); }
.side-panel .kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; } .side-panel .kv b { color: #fff; font-weight: 600; text-align: right; }
.side-panel .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #8e8e93; }
.side-panel .dot.on { background: #30d158; } .side-panel .dot.warn { background: #ff9f0a; } .side-panel .dot.bad { background: #ff453a; }
.side-panel code { background: rgba(255,255,255,.1); padding: 1px 6px; border-radius: 6px; font-size: 12px; color: #fff; }
.devwrap .row.wrap > .btn { flex: 1 1 130px; white-space: normal; text-align: center; }
.devhead .pill { white-space: normal; text-align: center; max-width: 45%; }

/* Text always wraps inside its box. Nothing is cut with "…", and a long word, name or address cannot push the page sideways. */
body, .card, .item, .tile, .banner, .sheet, .check, label, h1, h2, h3, p, summary, .btn, .pill, .tag, .sub, .small, .covline, .step { overflow-wrap: anywhere; }
.row > *, .item > *, .switch > *, .tiles > *, .check > *, .gap > *, .acts > *, .actions3 > *, .step > * { min-width: 0; }
.btn { text-align: center; height: auto; line-height: 1.3; padding-top: 10px; padding-bottom: 10px; }
.btn.icon-only { padding: 0; height: 48px; }
.btn svg, .item .ic, .pill svg { flex: none; }
html.framed .topbar:has(.carsel) .brand-name { display: none; }   /* the phone frame is narrow whatever the window width: the media query only sees the window */
.topbar .carsel { flex: 1 1 0; }
/* Alert card and alert photos on the incident page */
.alert-card,.alert-photo{width:100%;height:auto;border-radius:12px;display:block;background:#111}
