:root {
  --bg: #000;
  --card: #1c1c1e;
  --card2: #2c2c2e;
  --green: #2ee59d;
  --yellow: #ffd60a;
  --red: #ff453a;
  --text: #fff;
  --muted: #8e8e93;
  --dim: #636366;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Segoe UI", "Apple SD Gothic Neo", sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
.shell { display: grid; grid-template-columns: 88px 1fr; min-height: 100%; }
.sidenav { background: #0b0b0c; border-right: 1px solid #1f1f22; padding: 20px 10px; display: flex; flex-direction: column; gap: 8px; }
.brand { color: var(--green); font-weight: 800; line-height: 1.15; text-align: center; margin-bottom: 16px; }
.sidenav button, .bottomnav button {
  background: transparent; border: 0; color: var(--dim); display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px; border-radius: 12px; cursor: pointer; width: 100%;
}
.sidenav button.active, .bottomnav button.active { color: var(--green); }
.stage { display: flex; flex-direction: column; min-width: 0; max-width: 1100px; width: 100%; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 22px 8px; }
.car-name { font-size: 26px; font-weight: 800; }
.car-model { color: var(--muted); font-size: 13px; font-weight: 700; margin-left: 8px; }
.vid { color: var(--muted); font-size: 12px; }
.sync { color: var(--green); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.main { flex: 1; padding: 8px 18px 96px; overflow: auto; }
.row { display: grid; gap: 12px; }
.row-2 { grid-template-columns: 1fr 1fr; }
.card { background: var(--card); border-radius: 18px; padding: 16px; }
.h1 { font-size: 24px; font-weight: 800; margin: 4px 0 10px; }
.h2 { font-size: 18px; font-weight: 700; margin: 18px 0 10px; }
.muted { color: var(--muted); font-size: 12px; }
.dim { color: var(--dim); font-size: 11px; }
.green { color: var(--green); }
.yellow { color: var(--yellow); }
.red { color: var(--red); }
.big { font-size: 34px; font-weight: 800; line-height: 1; }
.mid { font-size: 22px; font-weight: 800; }
.pill { background: var(--card2); border-radius: 20px; padding: 6px 12px; font-size: 12px; }
.seg { display: flex; background: var(--card2); border-radius: 24px; padding: 4px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 20px; padding: 10px; cursor: pointer; font-weight: 700; }
.seg button.on { background: #fff; color: #000; }
.bar { height: 8px; background: #333; border-radius: 8px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--green); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.metrics b { display: block; font-size: 12px; }
.field { margin-top: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; background: var(--card2); border: 0; border-radius: 16px; padding: 14px 14px; }
.hint { color: var(--dim); font-size: 11px; margin-top: 4px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.btn { border: 0; border-radius: 20px; padding: 10px 16px; cursor: pointer; font-weight: 700; }
.btn-g { background: var(--green); color: #000; }
.btn-ghost { background: transparent; color: var(--green); }
.btn-d { background: transparent; color: var(--red); border: 1px solid #5a1d22; width: 100%; padding: 16px; border-radius: 16px; }
.notice { background: #1a2430; border-radius: 14px; padding: 12px; font-size: 12px; color: #c9d7e6; }
.toggle { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.toggle input { width: 44px; height: 26px; accent-color: var(--green); }
.tires { height: 220px; display: grid; grid-template-columns: 1fr 90px 1fr; align-items: center; justify-items: center; }
.car-body { width: 70px; height: 170px; border: 3px solid #3a3a3c; border-radius: 28px; position: relative; }
.car-body:before, .car-body:after { content: ""; position: absolute; left: 10px; right: 10px; height: 28px; border: 2px solid #3a3a3c; border-radius: 10px; }
.car-body:before { top: 16px; }
.car-body:after { bottom: 16px; }
.psi { font-size: 22px; font-weight: 800; }
#map { height: 320px; border-radius: 16px; overflow: hidden; }
.chart { width: 100%; height: 170px; }
.bottomnav { display: none; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #222; padding: 10px 16px; border-radius: 12px; z-index: 20; }
.hidden { display: none !important; }
.warn { color: #f0c674; font-size: 12px; }
.addr { font-size: 12px; color: var(--muted); margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.space { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidenav { display: none; }
  .bottomnav { display: flex; position: sticky; bottom: 0; background: #0b0b0c; padding: 6px 8px var(--safe-bottom); }
  .bottomnav button { width: auto; flex: 1; font-size: 11px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .main { padding-bottom: 18px; }
}
