:root {
  --ink: #17211c;
  --ink-soft: #5c6b62;
  --paper: #f3ecdf;
  --paper-2: #fffaf3;
  --line: #e4d8c6;
  --teal: #0e6b52;
  --deep: #10211c;
  --amber: #e6a11a;
  --coral: #b84332;
  --shadow: 0 24px 60px rgba(23, 33, 28, 0.12);
  --font: "Poppins", system-ui, sans-serif;
  --display: "Poppins", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  background: var(--paper);
  text-rendering: optimizeLegibility;
}
body.is-gate { background: #1c3344; }
body.is-app { background: #efe6d6; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
::selection { background: #f3d48a; color: var(--ink); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.booting {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  color: #f6f1e7;
  font-family: var(--display);
  font-size: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 18px;
}
.brand svg { width: 28px; height: 28px; display: block; }

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
}
.display {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(40px, 10vw, 60px);
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.display em { font-style: normal; font-weight: 600; color: var(--teal); }
.display-sm { font-size: clamp(36px, 8vw, 52px); }
.lede { color: var(--ink-soft); font-size: 16px; max-width: 38ch; }
.fine { color: #6d7b72; font-size: 12.5px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.btn, .text-btn, .choice, .bus-card, .chip {
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.btn:active, .choice:active, .bus-card:active, .chip:active { transform: scale(0.985); }
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 12px 16px;
  background: var(--teal);
  color: white;
  font-weight: 700;
}
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.warn { background: #f8e6df; color: #8a3328; }
.btn.ghost { background: transparent; color: var(--teal); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.text-btn { background: none; border: 0; padding: 8px 0; color: var(--teal); font-weight: 700; }

.gate { min-height: 100dvh; }
.gate-card { min-height: 100dvh; display: flex; flex-direction: column; }
.gate-sky {
  position: relative;
  min-height: 34vh;
  flex: 1;
  overflow: hidden;
  background:
    radial-gradient(90% 70% at 78% 8%, rgba(242, 201, 154, 0.95), transparent 46%),
    radial-gradient(60% 40% at 16% 28%, rgba(247, 226, 196, 0.45), transparent 42%),
    linear-gradient(#1a3040, #24362c 72%, #1a2b24);
}
.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.4px 1.4px at 18% 22%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 62% 16%, #fff, transparent),
    radial-gradient(1px 1px at 80% 32%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 40% 12%, rgba(255,255,255,.8), transparent),
    radial-gradient(1px 1px at 30% 38%, rgba(255,255,255,.7), transparent);
  animation: twinkle 4.5s ease-in-out infinite;
}
.moon {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  right: 12%;
  top: 16%;
  background: radial-gradient(circle at 35% 35%, #fff7e8, #f0c99a 62%, #e3ae62);
  box-shadow: 0 0 46px rgba(240, 201, 154, 0.55);
  animation: float 7s ease-in-out infinite;
}
.hill { position: absolute; bottom: 0; border-radius: 80% 80% 0 0; }
.hill-a { left: -12%; width: 72%; height: 90px; background: #17352c; }
.hill-b { right: -18%; width: 62%; height: 58px; background: #214538; }
.bus-stage { position: absolute; z-index: 1; left: 0; right: 0; bottom: 46px; height: 74px; }
.lane {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 8px;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.75) 0 16px, transparent 16px 30px);
}
.mini-bus { position: absolute; bottom: 12px; width: 98px; animation: drive 9s linear infinite; }
.roof-light {
  width: 12px;
  height: 7px;
  margin-left: 16px;
  border-radius: 4px 4px 2px 2px;
  background: #f0c36a;
  box-shadow: 0 0 14px #f0c36a;
  animation: glow 1.3s ease-in-out infinite;
}
.mini-body {
  height: 34px;
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 0 10px 0 12px;
  border-radius: 11px 16px 9px 9px;
  background: linear-gradient(#fffaf3, #f0e2cc);
  box-shadow: 0 10px 0 #0c1c16;
}
.mini-body i {
  width: 14px;
  height: 12px;
  border-radius: 3px;
  background: #1c3344;
  box-shadow: inset 0 -6px 0 #f0c36a;
}
.wheel {
  position: absolute;
  bottom: -5px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #d5dde2 0 3px, #101816 4px);
  animation: spin 0.7s linear infinite;
}
.wheel.left { left: 16px; }
.wheel.right { right: 16px; }
.gate-sheet {
  position: relative;
  z-index: 2;
  margin-top: -28px;
  padding: 22px 18px calc(28px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: #f6f0e6;
  display: grid;
  gap: 12px;
  align-content: start;
}
.choices { display: grid; gap: 10px; }
.choice {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 3px;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: white;
  box-shadow: 0 10px 28px rgba(23, 33, 28, 0.05);
}
.choice-kicker { color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.choice-title { font-family: var(--display); font-size: 28px; letter-spacing: -0.02em; line-height: 1.25; }
.choice-copy { color: var(--ink-soft); font-size: 14px; }
.choice-admin { background: var(--deep); color: #f6f1e7; border-color: var(--deep); }
.choice-admin .choice-kicker { color: #f0c36a; }
.choice-admin .choice-copy { color: #c9ddd4; }

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.login-card {
  width: min(460px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px 18px 18px;
  border-radius: 28px;
  background: white;
}
.role-parent { box-shadow: var(--shadow), inset 0 6px 0 var(--teal); }
.role-admin { box-shadow: var(--shadow), inset 0 6px 0 var(--amber); }
.or { text-align: center; color: var(--ink-soft); font-size: 13px; }
form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(14, 107, 82, 0.12); }
.pw { position: relative; }
.pw input { padding-right: 76px; }
.pw button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 700;
  padding: 8px;
}
.pw button:active { transform: translateY(-50%) scale(0.98); }
.form-error { min-height: 1.2em; color: var(--coral); font-size: 14px; font-weight: 600; }
.creds {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f6f1e6;
  font-size: 13px;
}
.creds strong { font-weight: 700; }

.shell-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 0 16px calc(112px + env(safe-area-inset-bottom));
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -16px 8px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(243, 236, 223, 0.9);
  backdrop-filter: blur(16px);
}
.topbar-row, .person, .meta, .split { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.top-actions .btn { min-height: 42px; padding: 8px 14px; }
.day { margin-top: 4px; color: var(--ink-soft); font-size: 13px; }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e5f4ee;
  color: var(--teal);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: #1fa87a;
  box-shadow: 0 0 0 0 rgba(31, 168, 122, 0.65);
  animation: pulse 1.6s ease-out infinite;
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--deep);
  color: #f6e7c2;
  font-size: 10px;
  font-weight: 600;
}

.hero { padding: 6px 0 2px; }
.kicker { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-weight: 600; font-size: 14px; }
.eta {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(56px, 16vw, 88px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 8px 0 6px;
}
.eta-sub { font-size: 18px; color: var(--ink-soft); }
.banner {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 2px 10px;
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 18px;
}
.banner i { grid-row: 1 / span 2; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: currentColor; }
.banner strong, .banner span { grid-column: 2; min-width: 0; }
.banner strong { font-size: 15px; }
.banner span { font-size: 14px; }
.parent-grid > *, .admin-grid > *, .stack, .banner { min-width: 0; }
.banner-enroute, .banner-safe, .banner-at-school, .banner-home { background: #e7f3ee; color: #0c3b2e; }
.banner-next, .banner-arriving { background: #fff1d2; color: #6a4a08; }
.banner-paused, .banner-ended, .banner-not-boarded { background: #fde8e4; color: #7a261c; }

.parent-grid, .admin-grid { display: grid; gap: 14px; }
.stack { display: grid; gap: 14px; }
.map-card, .panel, .stat, .bus-card {
  background: var(--paper-2);
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(23, 33, 28, 0.05);
}
.map-card, .panel { padding: 10px; }
.map-frame {
  height: 42vh;
  min-height: 280px;
  border-radius: 18px;
  overflow: hidden;
  background: #d7e4ea;
  position: relative;
  z-index: 0;
}
.map-frame .leaflet-container {
  width: 100%;
  height: 100%;
  background: #d7e4ea;
  font-family: var(--font);
}
.leaflet-container img { max-width: none; }
.bus-marker, .stop-marker { background: transparent; border: 0; }
.bus-badge {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #10211c;
  color: #fffaf3;
  border: 3px solid #e6a11a;
  box-shadow: 0 10px 22px rgba(16, 33, 28, 0.35);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.map-stop {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #0e6b52;
  box-shadow: 0 2px 8px rgba(16, 33, 28, 0.25);
}
.map-stop.home { background: #e6a11a; border-color: #fffaf3; }
.map-stop.school { background: #10211c; border-color: #fff; }
.map-stop.end { background: #2d6a9f; border-color: #fff; }
.stop-tip { font-family: var(--font); font-weight: 600; border: 0; border-radius: 8px; }
.home-btn { width: 100%; margin: 12px 0 4px; line-height: 1.25; }
.home-btn:disabled { opacity: 0.55; cursor: default; }
.map-caption, .meta { padding: 10px 6px 4px; color: var(--ink-soft); font-size: 12px; }
.geo { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.route-go { transition: stroke-dashoffset 0.12s linear; }
.stop-dot { fill: #fff; stroke: #6d8a7c; stroke-width: 0.55; }
.stop-dot.is-passed { fill: #0e6b52; stroke: #0e6b52; }
.stop-dot.is-home { fill: #e6a11a; stroke: #fffaf3; stroke-width: 0.75; }
.stop-dot.is-home.is-passed { fill: #0e6b52; stroke: #e6a11a; stroke-width: 0.9; }
.halo { fill: #e6a11a; }

.panel { padding: 16px; }
.panel .section-title { margin-top: 0; }
.section-title {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 18px 0 8px;
}
.rail { list-style: none; margin: 0; padding: 0; }
.rail-item { position: relative; padding: 0 0 18px 28px; }
.rail-item::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 14px;
  bottom: -4px;
  width: 2px;
  background: var(--line);
}
.rail-item:last-child::before { display: none; }
.rail-item.is-passed::before { background: var(--teal); }
.dot {
  position: absolute;
  left: 1px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  border: 2px solid #c9bfae;
}
.rail-item.is-passed .dot { background: var(--teal); border-color: var(--teal); }
.rail-item.is-home .dot { background: var(--amber); border-color: white; box-shadow: 0 0 0 4px rgba(230, 161, 26, 0.28); }
.rail-item strong { display: block; font-size: 15px; }
.rail-item em { font-style: normal; color: var(--ink-soft); font-size: 13px; }
.rail-item.is-next strong { color: var(--teal); }
.person h2, .driver-stop { font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; }
.person h2 { font-size: 26px; }
.person p, .quiet { color: var(--ink-soft); font-size: 14px; }
.call {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  text-decoration: none;
  font-weight: 600;
}
.alert { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.alert:first-child { border-top: 0; padding-top: 0; }
.alert p { color: var(--ink-soft); font-size: 14px; }
.alert.hot strong { color: #8a5a08; }
.alert.bad strong { color: var(--coral); }
.alert.warn strong { color: #8a5a08; }
.safety {
  padding: 14px;
  border-radius: 18px;
  background: #fff6e4;
  color: #5c4520;
  font-size: 14px;
}
.safety a { color: #0e6b52; font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stat { padding: 12px; }
.stat strong { display: block; font-family: var(--display); font-size: 32px; line-height: 1.1; font-weight: 600; }
.stat span { color: var(--ink-soft); font-size: 12px; }
.stat-alert strong { color: var(--coral); }
.fleet-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.fleet-list::-webkit-scrollbar { height: 0; }
.bus-card {
  min-width: 230px;
  scroll-snap-align: start;
  text-align: left;
  border: 1px solid transparent;
  padding: 14px;
}
.bus-card.is-selected { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14, 107, 82, 0.16); }
.stripe { height: 4px; border-radius: 99px; background: var(--route); margin-bottom: 10px; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #efe7d8;
  color: #5c5346;
}
.pill-en-route { background: #e5f4ee; color: #0e6b52; }
.pill-paused { background: #fff1d2; color: #6a4a08; }
.pill-done { background: #e7eef6; color: #24527e; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ctrl-main { grid-column: 1 / -1; }
.student {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.student:last-child { border-bottom: 0; }
.tag {
  border: 0;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  background: #f3ecdf;
  color: #5c5346;
}
.tag-ok { background: #e5f4ee; color: #0e6b52; }
.tag-bad { background: #fde8e4; color: #8a3328; }
.tag-home { background: #fff1d2; color: #6a4a08; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}
.office-note { font-size: 13px; color: var(--ink-soft); }

.driver-wrap { width: min(480px, 100%); margin: 8px auto 20px; }
.driver-caption { color: var(--ink-soft); font-size: 13px; margin-bottom: 8px; }
.driver-phone {
  background:
    radial-gradient(400px 180px at 80% 0%, rgba(240, 195, 106, 0.18), transparent 50%),
    var(--deep);
  color: #f6f1e7;
  border-radius: 32px;
  padding: 18px 16px 16px;
  box-shadow: 0 30px 80px rgba(12, 36, 32, 0.28);
  display: grid;
  gap: 12px;
}
.driver-phone .text-btn, .driver-phone .eyebrow { color: #f0c36a; }
.driver-kicker { letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; color: #f0c36a; font-weight: 600; }
.driver-stop { font-size: clamp(36px, 9vw, 48px); line-height: 1.2; }
.driver-phone .quiet { color: #c9ddd4; }
.bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.14); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f0c36a, #8ddec0); transition: width 0.12s linear; }
.driver-actions { display: grid; gap: 8px; }
.driver-phone .btn { background: #f0c36a; color: #1a1408; }
.driver-phone .btn.secondary { background: transparent; color: #f6f1e7; border-color: rgba(255,255,255,0.2); }
.driver-phone .btn.warn { background: transparent; color: #ffb1a6; border: 1px solid rgba(255, 177, 166, 0.4); }
.driver-phone .student { border-color: rgba(255,255,255,0.12); }
.driver-phone .map-frame { height: 220px; min-height: 180px; background: #d5ebe3; }

.dock {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 20px));
  display: flex;
  gap: 4px;
  padding: 6px;
  background: rgba(16, 33, 28, 0.94);
  color: #f6f1e7;
  border-radius: 999px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}
.dock a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 11px 0;
  border-radius: 999px;
}
.dock a.is-on { background: #f6f1e7; color: var(--deep); }

#live, #stops, #care, #fleet, #map, #students { scroll-margin-top: 78px; }

body.play .rise { animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
.shake { animation: shake 0.45s ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@keyframes drive {
  from { left: -30%; }
  to { left: 108%; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(8px); } }
@keyframes glow { 50% { filter: brightness(1.4); } }
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(31, 168, 122, 0); }
}
@keyframes twinkle { 50% { opacity: 0.55; } }

@media (hover: hover) {
  .choice:hover, .bus-card:hover { transform: translateY(-2px); }
}

@media (min-width: 720px) {
  .controls { grid-template-columns: repeat(4, 1fr); }
  .ctrl-main { grid-column: auto; }
  .depart-bar { grid-template-columns: 1fr 1fr 1fr; }
  .depart-bar .ctrl-main { grid-column: 1 / -1; }
}

@media (min-width: 980px) {
  body.is-gate { background: #c9b89a; }
  .gate { display: grid; place-items: center; padding: 28px; }
  .gate-card {
    width: min(1040px, 100%);
    min-height: 640px;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(28, 32, 24, 0.22);
  }
  .gate-sky { min-height: 100%; }
  .gate-sheet { margin: 0; border-radius: 0; padding: 42px 40px; align-content: center; }
  body.is-app { height: 100dvh; overflow: hidden; }
  .shell, .shell-inner { height: 100dvh; }
  .shell-inner {
    width: 100%;
    max-width: none;
    padding: 0 18px 14px;
    display: flex;
    flex-direction: column;
  }
  .parent-grid, .admin-grid {
    flex: 1;
    min-height: 0;
    align-items: stretch;
  }
  .parent-grid { grid-template-columns: minmax(0, 1fr) 400px; }
  .admin-grid { grid-template-columns: 340px minmax(0, 1fr); }
  .parent-grid > .stack:first-child,
  .admin-grid > .stack:last-child {
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }
  .admin-grid > .stack:last-child { display: flex; flex-direction: column; overflow: auto; grid-template-rows: none; }
  .admin-grid .map-card { height: auto; flex: none; }
  .parent-grid > .stack:last-child,
  .admin-grid > .fleet-list { min-height: 0; overflow: auto; }
  .map-card { min-height: 0; height: 100%; display: flex; flex-direction: column; }
  .parent-grid .map-frame { flex: 1; height: auto; min-height: 0; }
  .admin-grid .map-frame { height: calc(100dvh - 210px); min-height: 520px; flex: none; }
  .fleet-list { flex-direction: column; overflow: visible; }
  .bus-card { min-width: 0; }
  .sticky { position: sticky; top: 12px; }
  .dock { display: none; }
}

@media (max-width: 979px) {
  .desk { overflow-x: hidden; }
  .desk-main { padding: 0 12px calc(108px + env(safe-area-inset-bottom)); }
  .desk .topbar { padding: 12px; }
  .desk .topbar-row { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
  .desk .topbar-row > div:first-child { flex-wrap: wrap; }
  .desk .day { white-space: normal; }
  .desk .eta { font-size: 48px; }
  .desk .stats { margin: 12px 0; }
  .stat strong { font-size: 26px; }
  .now-bus { align-items: flex-start; flex-wrap: wrap; }
  .now-bus span { text-align: left; }
  .depart-bar .ctrl-main { white-space: normal; }
  .map-frame { height: 46vh; min-height: 240px; }
  .driver-wrap { width: auto; margin-left: -12px; margin-right: -12px; }
  .driver-phone { border-radius: 0 0 28px 28px; min-height: calc(100dvh - 120px); }
}

.desk { min-height: 100dvh; background: #f4efe6; }
.desk .topbar { margin: 0; padding: 12px 16px; background: #fff; border-bottom: 1px solid #e7dcc8; }
.desk .topbar-row > div:first-child { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.desk .day { margin: 0; white-space: nowrap; }
.desk .eta { font-size: 56px; line-height: 0.95; margin: 2px 0 4px; }
.desk .solid-hero { padding: 16px; }
.desk .panel { padding: 16px; }
.desk .section-title { margin: 0 0 10px; font-size: 22px; line-height: 1.15; }
.menu { display: none; }
.menu-mobile { display: flex; gap: 8px; overflow: auto; margin: 12px 0 0; padding: 0; }
.menu-mobile a, .menu-mobile button {
  flex: none;
  border: 0;
  background: #0e6b52;
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}
.desk-main { min-width: 0; }
.desk-grid { display: grid; gap: 12px; }
.pane-scroll .section-title { margin-top: 0; font-size: 22px; }
.solid-hero, .panel, .map-card, .bus-card { background: #fff; border: 1px solid #e4d3b8; box-shadow: none; }
.stat { background: #0e6b52; color: #fff; border-radius: 16px; }
.stat span { color: #d7efe4; }
.stat.stat-alert { background: #9a3412; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.facts div { min-height: 68px; display: flex; flex-direction: column; justify-content: center; background: #f4efe6; border-radius: 12px; padding: 10px 12px; min-width: 0; }
.facts dt { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #0e6b52; }
.facts dd { margin: 2px 0 0; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.depart-bar { position: sticky; bottom: 0; z-index: 2; margin-top: 12px; padding-top: 12px; background: #fff; border-top: 1px solid #e7dcc8; grid-template-columns: 1fr 1fr 1fr; }
.depart-bar .ctrl-main { grid-column: 1 / -1; border-radius: 14px; min-height: 52px; font-size: 16px; white-space: nowrap; }
.depart-bar .btn { border-radius: 12px; white-space: nowrap; min-height: 44px; padding: 10px 12px; }
.now-bus { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #e7dcc8; }
.now-bus strong { font-size: 22px; letter-spacing: -0.03em; }
.now-bus span { color: var(--ink-soft); font-size: 13px; font-weight: 600; text-align: right; }
.bell { position: relative; border: 0; background: #0e6b52; color: #fff; border-radius: 999px; min-height: 42px; padding: 8px 14px; font-weight: 700; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 99px; background: #e6a11a; color: #1a1408; font-size: 11px; }
.drawer-back { position: fixed; inset: 0; background: rgba(16, 33, 28, 0.45); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: #fff; z-index: 61; display: flex; flex-direction: column; padding: 18px 16px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drawer h2 { font-size: 22px; }
.drawer-list { overflow: auto; display: grid; gap: 10px; margin-top: 12px; }
.note-card { border-radius: 14px; padding: 12px; background: #f4efe6; }
.note-card strong { display: block; }
.note-card p { margin-top: 4px; font-size: 14px; }
.note-card time { display: block; margin-top: 6px; font-size: 12px; color: #6d7b72; }
.tone-hot { background: #fff1d2; }
.tone-warn { background: #fde8e4; }
.tone-ok { background: #e5f4ee; }
.topbar { background: #efe6d6; }

@media (min-width: 980px) {
  .desk { display: grid; grid-template-columns: 228px minmax(0, 1fr); height: 100dvh; background: #f4efe6; }
  .menu { display: flex; flex-direction: column; gap: 6px; background: #0e6b52; color: #fff; padding: 0 12px 16px; }
  .menu .brand { height: 64px; padding: 0 10px; align-items: center; }
  .menu-role { margin: 0 10px 10px; color: #d7efe4; font-size: 13px; }
  .menu nav { display: grid; gap: 4px; }
  .menu nav a, .menu nav button { display: flex; align-items: center; width: 100%; min-height: 44px; text-align: left; border: 0; background: transparent; color: #fff; border-radius: 12px; padding: 0 12px; font: inherit; font-weight: 600; font-size: 15px; text-decoration: none; }
  .menu nav a:hover, .menu nav button:hover { background: #0b5642; }
  .menu-out { margin-top: auto; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.4); border-radius: 999px; min-height: 44px; font-weight: 700; }
  .menu-mobile { display: none; }
  .desk .topbar { height: 64px; padding: 0 20px; display: flex; align-items: center; }
  .desk .topbar-row { width: 100%; }
  .desk-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #f4efe6; }
  .desk .stats { margin: 16px 16px 0; }
  .desk-grid { flex: 1; min-height: 0; margin: 0; padding: 16px; gap: 16px; align-items: stretch; grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); }
  .parent-desk { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); }
  .pane-scroll { min-height: 0; overflow: auto; padding: 0; gap: 12px; align-content: start; }
  .desk-grid .map-card { height: 100%; min-height: 0; margin: 0; padding: 8px; display: flex; flex-direction: column; border-radius: 20px; }
  .desk-grid .map-frame { flex: 1; height: auto; min-height: 0; border-radius: 14px; }
  .desk-grid .map-caption, .desk-grid .meta { padding: 8px 8px 2px; }
  .desk .dock { display: none; }
  .fleet-list { flex-direction: column; overflow: visible; }
  .desk .bus-card { min-width: 0; width: 100%; padding: 12px 14px; border-radius: 16px; }
  .desk .person h2 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
