:root {
  --navy: #0b2540; --navy-2: #123a5c; --ink: #0f172a; --muted: #64748b; --line: #e5eaf0; --bg: #f4f7fa; --card: #fff;
  --green: #10b981; --amber: #f59e0b; --red: #ef4444; --blue: #3b82f6; --violet: #8b5cf6; --teal: #0ea5a4;
  --r: 14px; --shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; }
.muted { color: var(--muted); }

.shell { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.side { background: var(--navy); color: #cbd5e1; display: flex; flex-direction: column; padding: 14px; gap: 14px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.06); }
.brand img { width: 38px; height: 38px; border-radius: 10px; background: #fff; padding: 4px; }
.brand b { color: #fff; display: block; font-size: 15px; }
.brand small { color: #5eead4; font-size: 12px; }
#nav { display: grid; gap: 4px; }
#nav a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: #cbd5e1; text-decoration: none; font-weight: 500; }
#nav a span { width: 18px; text-align: center; }
#nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
#nav a.on { background: rgba(16,185,129,.16); color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.side-foot { margin-top: auto; font-size: 12px; color: #8aa0b6; padding: 8px 10px; }

.main { min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.top { height: 60px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 22px; background: #fff; border-bottom: 1px solid var(--line); }
.top h1 { font-size: 18px; margin: 0; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: #047857; background: #ecfdf5; padding: 4px 10px; border-radius: 99px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #e2e8f0; font-weight: 700; }
.menu { display: none; border: 0; background: none; font-size: 20px; cursor: pointer; }
.view { flex: 1; min-height: 0; overflow: auto; padding: 18px 22px; }

/* cards & tiles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-height: 0; display: flex; flex-direction: column; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); flex: none; }
.card-h h3 { margin: 0; font-size: 14px; }
.card-h p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.card-b { padding: 12px 16px; flex: 1; min-height: 0; overflow: auto; }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.tile { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; box-shadow: var(--shadow); }
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c); }
.tile .n { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .l { font-weight: 600; font-size: 13px; }
.tile .s { font-size: 12px; color: var(--muted); }

/* dashboard: one screen on desktop */
.dash { display: flex; flex-direction: column; gap: 14px; height: 100%; }
.dash-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.5fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 14px; }
.span-2r { grid-row: span 2; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: #d1fae5; color: #065f46; } .pill.go { background: #dbeafe; color: #1e40af; } .pill.wait { background: #fef3c7; color: #92400e; }
.pill.bad { background: #fee2e2; color: #991b1b; } .pill.off { background: #f1f5f9; color: #475569; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }

/* route map (schematic) */
.map { position: relative; height: 100%; min-height: 220px; border-radius: 10px; background:
  radial-gradient(circle at 20% 30%, #e6f4f1 0 18%, transparent 19%), radial-gradient(circle at 80% 70%, #eef2ff 0 16%, transparent 17%), #f8fafc;
  overflow: hidden; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map .site { position: absolute; transform: translate(-50%, -50%); background: var(--navy); color: #fff; font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 8px; white-space: nowrap; }
.map .bus { position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.85), 0 4px 10px rgba(0,0,0,.2); transition: left 1s linear, top 1s linear; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; margin-top: 8px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.bar { height: 8px; border-radius: 99px; background: #eef2f6; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.split { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 2px; background: #eef2f6; }
.row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f1f5f9; }
.row:last-child { border-bottom: 0; }
.row b { font-weight: 600; }
.grow { flex: 1; min-width: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.page { display: flex; flex-direction: column; height: 100%; }
.page .card { flex: 1; }

@media (max-width: 1100px), (max-height: 620px) {
  .dash { height: auto; }
  .dash-grid { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
  .dash-grid .card { min-height: 280px; }
  .span-2r { grid-row: auto; grid-column: 1 / -1; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu { display: block; }
  .dash-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #clock { display: none; }
}
.span-2r .card-b { display: flex; flex-direction: column; overflow: hidden; }
.span-2r .map { flex: 1; height: auto; }
td b { white-space: nowrap; }
