/* Trellis mockup design system — shared across all role mockups */

:root {
  --bg-0: #020617;
  --bg-1: #0b1220;
  --bg-2: #0f172a;
  --bg-3: #1e293b;
  --bg-elev: rgba(15, 23, 42, 0.7);
  --line: rgba(148, 163, 184, 0.10);
  --line-strong: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-mute: #64748b;
  --emerald: #34d399;
  --emerald-soft: rgba(52, 211, 153, 0.15);
  --sky: #38bdf8;
  --sky-soft: rgba(56, 189, 248, 0.15);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.18);
  --rose: #fb7185;
  --rose-soft: rgba(251, 113, 133, 0.15);
  --fuchsia: #e879f9;
  --shadow-emerald: 0 0 24px rgba(52, 211, 153, 0.45);
  --shadow-card: 0 8px 24px rgba(2, 6, 23, 0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(52, 211, 153, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(56, 189, 248, 0.05), transparent 60%),
    var(--bg-0);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.4;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* ===================== Brand ===================== */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--emerald), var(--sky));
  color: #04111a;
  box-shadow: 0 4px 14px rgba(52, 211, 153, 0.25);
}
.brand-mark.sm { width: 22px; height: 22px; border-radius: 7px; }
.brand-name { font-weight: 800; letter-spacing: -0.01em; font-size: 15px; }
.brand-name span { color: var(--emerald); }

/* ===================== Mobile phone frame ===================== */
.phone-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px calc(80px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 6px;
  background: rgba(11, 18, 32, 0.85);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(2, 6, 23, 0.6);
  z-index: 30;
}
.tabbar a, .tabbar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: all 0.15s;
}
.tabbar a.active, .tabbar button.active {
  background: var(--emerald-soft);
  color: var(--emerald);
}

/* ===================== Desktop sidebar layout ===================== */
.desktop-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: rgba(2, 6, 23, 0.6);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-nav a:hover { background: rgba(148, 163, 184, 0.06); color: var(--text); }
.sidebar-nav a.active {
  background: var(--emerald-soft);
  color: var(--emerald);
  font-weight: 600;
}
.sidebar-nav a svg { flex-shrink: 0; }
.sidebar-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 700;
  padding: 0 12px;
  margin-top: 10px;
}
.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.main {
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 1280px;
}
.main-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.main-head h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}
.main-head .subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin: 4px 0 0;
}

/* ===================== Cards ===================== */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  gap: 10px;
}
.card-head .title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card-head .title svg { color: var(--emerald); }
.card-body { padding: 4px 16px 16px; }

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg-3); }
.btn.primary {
  background: var(--emerald);
  color: #04111a;
  border-color: var(--emerald);
}
.btn.primary:hover { background: #6ee7b7; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.ghost:hover { background: rgba(148, 163, 184, 0.08); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 11px 18px; font-size: 14px; }
.btn.danger { background: var(--rose-soft); border-color: rgba(251, 113, 133, 0.3); color: var(--rose); }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); }

/* ===================== Badges / pills ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--bg-3);
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
}
.badge.emerald { background: var(--emerald-soft); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.3); }
.badge.sky { background: var(--sky-soft); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.3); }
.badge.amber { background: var(--amber-soft); color: #fcd34d; border-color: rgba(251, 191, 36, 0.3); }
.badge.rose { background: var(--rose-soft); color: var(--rose); border-color: rgba(251, 113, 133, 0.3); }
.badge.live::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  animation: breathe 1.4s ease-in-out infinite;
}
.badge.dot::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
@keyframes breathe {
  0%, 100% { opacity: 0.5; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ===================== Stats grid ===================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.stat-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  font-weight: 700;
  display: flex; align-items: center; gap: 6px;
}
.stat-card .value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 6px;
}
.stat-card .delta {
  font-size: 12px;
  margin-top: 4px;
  color: var(--text-dim);
}
.stat-card .delta.up { color: var(--emerald); }
.stat-card .delta.down { color: var(--rose); }

/* ===================== Lists / rows ===================== */
.row-list { display: flex; flex-direction: column; }
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: rgba(148, 163, 184, 0.04); }
.row .primary { font-size: 14px; font-weight: 600; color: var(--text); }
.row .secondary { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.row .right { text-align: right; }

/* Stop rows (route) */
.stop {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.stop:last-child { border-bottom: 0; }
.stop-seq {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 14px;
  background: var(--bg-3);
  color: var(--text-mute);
  border: 1px solid var(--line-strong);
}
.stop.done .stop-seq { background: var(--emerald-soft); color: var(--emerald); border-color: transparent; }
.stop.in-progress .stop-seq {
  background: var(--emerald);
  color: #04111a;
  border-color: transparent;
  box-shadow: var(--shadow-emerald);
  animation: nodePulse 2s ease-in-out infinite;
}
.stop.next .stop-seq { background: var(--sky-soft); color: var(--sky); border-color: rgba(56, 189, 248, 0.3); }
@keyframes nodePulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12); }
  50% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0.18); }
}

/* ===================== Avatar ===================== */
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  color: #04111a;
}
.avatar.lg { width: 64px; height: 64px; font-size: 18px; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.a0 { background: linear-gradient(135deg, #fbbf24, #f97316); }
.avatar.a1 { background: linear-gradient(135deg, var(--sky), #818cf8); }
.avatar.a2 { background: linear-gradient(135deg, var(--emerald), #14b8a6); }
.avatar.a3 { background: linear-gradient(135deg, var(--fuchsia), #f472b6); }
.avatar.a4 { background: linear-gradient(135deg, #f472b6, #ef4444); color: white; }

/* ===================== Tables ===================== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead {
  background: rgba(2, 6, 23, 0.6);
}
.table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(148, 163, 184, 0.03); }
.table .num { font-variant-numeric: tabular-nums; }

/* ===================== Map common ===================== */
.map-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.map-wrap svg { width: 100%; height: 100%; display: block; }
.map-bg { fill: #0a1325; }
.map-park { fill: rgba(52, 211, 153, 0.08); }
.map-water { fill: rgba(56, 189, 248, 0.08); }
.map-road-major { stroke: #1f2a44; stroke-width: 6; fill: none; stroke-linecap: round; }
.map-road-major-line { stroke: #2a3a5e; stroke-width: 4; fill: none; stroke-linecap: round; }
.map-road-minor { stroke: #182238; stroke-width: 2.5; fill: none; stroke-linecap: round; }
.map-route-bg { stroke: rgba(52, 211, 153, 0.20); stroke-width: 5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.map-route {
  stroke: var(--emerald);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(52, 211, 153, 0.7));
  stroke-dasharray: 8 6;
  animation: dash 1.4s linear infinite;
}
@keyframes dash { to { stroke-dashoffset: -28; } }
.map-pin {
  filter: drop-shadow(0 0 4px rgba(2, 6, 23, 0.6));
}
.pin-done circle { fill: rgba(52, 211, 153, 0.4); }
.pin-done .num { fill: var(--emerald); }
.pin-active circle { fill: var(--emerald); }
.pin-active .num { fill: #04111a; }
.pin-active .halo {
  fill: var(--emerald);
  opacity: 0.3;
  animation: halo 2s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes halo {
  0%, 100% { transform: scale(0.7); opacity: 0.4; }
  50% { transform: scale(1.3); opacity: 0.05; }
}
.pin-upcoming circle { fill: rgba(148, 163, 184, 0.3); }
.pin-upcoming .num { fill: var(--text-dim); }

/* ===================== Sparkline ===================== */
.spark { width: 100%; height: 36px; display: block; }
.spark path.line { fill: none; stroke: var(--emerald); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark path.fill { fill: url(#sparkGrad); opacity: 0.4; }

/* ===================== Misc ===================== */
.divider { height: 1px; background: var(--line); margin: 8px 0; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.numeric { font-variant-numeric: tabular-nums; }
.flex-row { display: flex; align-items: center; gap: 10px; }
.flex-col { display: flex; flex-direction: column; gap: 6px; }
.grow { flex: 1; min-width: 0; }
.center { display: grid; place-items: center; }
.text-emerald { color: var(--emerald); }
.text-sky { color: var(--sky); }
.text-amber { color: var(--amber); }
.text-rose { color: var(--rose); }
.text-mute { color: var(--text-mute); }
.text-dim { color: var(--text-dim); }
.f-bold { font-weight: 700; }
.f-semibold { font-weight: 600; }
.f-small { font-size: 12px; }
.f-xs { font-size: 11px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }

/* ===================== Footer ===================== */
.footer-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
  font-size: 11px;
  color: var(--text-mute);
}

/* ===================== Section nav (in-page tabs) ===================== */
.seg {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px;
}
.seg button {
  padding: 7px 14px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.seg button.active {
  background: var(--bg-3);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04);
}

/* ===================== Screen swap ===================== */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; gap: 18px; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===================== Form ===================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.field input, .field textarea, .field select {
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}
.field .hint { font-size: 11px; color: var(--text-mute); }
