/* Rockwell Sabay — Design System v2
   Apple-style calmness with warm energy. Bubble cards. Big taps. Minimal words. */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Core palette */
  --ink:         #0B2545;
  --ink-2:       #13315C;
  --ink-soft:    #1E3A5F;
  --accent:      #E6A23C;
  --accent-2:    #F5B95C;
  --accent-ink:  #5A3A15;

  /* Surfaces */
  --bg:          #F5F2EC;
  --bg-tint:     #EFE9DE;
  --surface:     #FFFFFF;
  --surface-2:   #FAF8F3;
  --surface-3:   #F0EBE0;
  --line:        #E7E1D2;
  --line-2:      #D4CDB9;

  /* Text */
  --text:        #1A1F2C;
  --text-soft:   #3C4458;
  --muted:       #6B7280;
  --muted-2:     #9CA3AF;

  /* Semantic */
  --ok:          #0F8A5F;
  --ok-soft:     #2BA374;
  --warn:        #C2770B;
  --bad:         #C0392B;
  --info:        #2563EB;

  --ok-bg:       #E3F4EB;
  --warn-bg:     #FAEFD8;
  --bad-bg:      #FBE6E2;
  --info-bg:     #E3EBFB;

  /* Radii — rounder, bubble feel */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 100px;

  /* Shadows — soft and lived-in */
  --shadow-xs: 0 1px 2px rgba(11, 37, 69, 0.04);
  --shadow-sm: 0 2px 6px rgba(11, 37, 69, 0.06), 0 1px 2px rgba(11, 37, 69, 0.04);
  --shadow-md: 0 8px 24px rgba(11, 37, 69, 0.08), 0 2px 6px rgba(11, 37, 69, 0.04);
  --shadow-lg: 0 16px 40px rgba(11, 37, 69, 0.10), 0 4px 12px rgba(11, 37, 69, 0.06);
  --shadow-inner: inset 0 1px 2px rgba(11, 37, 69, 0.05);

  /* Animation */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'SF Pro Text', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { touch-action: manipulation; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
  text-rendering: optimizeLegibility;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: none; }
button { font-family: inherit; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.018em; color: var(--text); }
h1 { font-size: 30px; letter-spacing: -0.028em; line-height: 1.15; }
h2 { font-size: 22px; letter-spacing: -0.02em; }
h3 { font-size: 17px; }
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.02em; font-style: italic; color: var(--ink); }

/* ─────────────────────────────────────────────────────────────
   TOPBAR + BOTTOM NAV
   ───────────────────────────────────────────────────────────── */
.topbar {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; letter-spacing: -0.02em;
  box-shadow: var(--shadow-sm);
}
.brand-name { font-family: var(--font-display); font-style: italic; font-size: 22px; color: var(--ink); }

.topnav { display: flex; gap: 2px; margin-left: 16px; flex: 1; }
.topnav a {
  padding: 8px 14px; border-radius: var(--r-pill);
  color: var(--muted); font-weight: 500; font-size: 14px;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.topnav a:hover { color: var(--ink); background: rgba(11, 37, 69, 0.06); }
.topnav a.active { color: var(--ink); background: rgba(11, 37, 69, 0.08); }
.topnav a.admin-link { margin-left: auto; color: var(--accent-ink); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  font-size: 13px; color: var(--text-soft); font-weight: 500;
  padding: 7px 14px; border-radius: var(--r-pill);
  background: rgba(11, 37, 69, 0.06);
}
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--r-pill);
  color: var(--muted); background: transparent;
  border: none; cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.1s var(--ease);
}
.icon-btn:hover { background: rgba(11, 37, 69, 0.06); color: var(--ink); }
.icon-btn:active { transform: scale(0.92); }

/* Bottom nav — bigger, friendlier */
.bottomnav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.bottomnav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px; min-height: 54px;
  font-size: 11px; font-weight: 500; color: var(--muted-2);
  border-radius: var(--r-md);
  transition: color 0.18s var(--ease);
}
.bottomnav a:hover { text-decoration: none; }
.bottomnav a.active { color: var(--ink); }
.bottomnav a svg { width: 24px; height: 24px; stroke-width: 2.2; }
.bottomnav a:active { transform: scale(0.92); }

/* ─────────────────────────────────────────────────────────────
   MAIN + TYPE
   ───────────────────────────────────────────────────────────── */
.main {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 100px;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head .subtitle { color: var(--muted); font-size: 15px; margin-top: 4px; line-height: 1.4; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 28px 0 12px;
}
.section-head h3 {
  font-size: 13px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.section-head a { font-size: 13px; color: var(--text-soft); font-weight: 500; }

/* ─────────────────────────────────────────────────────────────
   CARDS — bubble style, inviting, tactile
   ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.2s var(--ease), transform 0.1s var(--ease);
}
.card + .card { margin-top: 14px; }
a.card:hover { text-decoration: none; }

/* Bubble-style card for interactive list items */
.bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s var(--ease), transform 0.1s var(--ease), border-color 0.2s var(--ease);
  cursor: pointer;
}
.bubble:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-2);
  transform: translateY(-1px);
}
.bubble:active {
  transform: translateY(0) scale(0.995);
  box-shadow: var(--shadow-sm);
}
a.bubble:hover { text-decoration: none; color: inherit; }

/* ─────────────────────────────────────────────────────────────
   BUTTONS — big, friendly, tactile
   ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 12px 20px; border-radius: var(--r-pill);
  border: none; cursor: pointer;
  transition: transform 0.1s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease), opacity 0.15s var(--ease);
  white-space: nowrap;
  min-height: 44px; /* Apple touch target */
  letter-spacing: -0.005em;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--ink); color: #fff;
  box-shadow: 0 1px 2px rgba(11, 37, 69, 0.15);
}
.btn-primary:hover { background: var(--ink-2); }

.btn-accent {
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%);
  color: #2C1810;
  box-shadow: 0 1px 2px rgba(230, 162, 60, 0.25), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-accent:hover { background: var(--accent); }

.btn-secondary {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--ink); }

.btn-ghost {
  background: transparent; color: var(--muted);
}
.btn-ghost:hover { color: var(--ink); background: rgba(11, 37, 69, 0.05); }

.btn-danger {
  background: var(--bad); color: #fff;
}
.btn-danger:hover { background: #A02E24; }

.btn-sm { padding: 8px 14px; font-size: 13.5px; min-height: 36px; }
.btn-lg { padding: 16px 24px; font-size: 16px; min-height: 52px; }
.btn-block { width: 100%; }

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────────────────────
   MODE TOGGLE — the heart of the app
   ───────────────────────────────────────────────────────────── */
.mode-toggle {
  display: inline-flex;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px;
  gap: 2px;
  position: relative;
  box-shadow: var(--shadow-inner);
}
.mode-toggle [data-mode] {
  padding: 10px 22px;
  border-radius: var(--r-pill);
  font-size: 14px; font-weight: 600;
  color: var(--muted); background: transparent;
  border: none; cursor: pointer;
  transition: color 0.2s var(--ease);
  min-height: 40px;
  display: inline-flex; align-items: center; gap: 8px;
  letter-spacing: -0.005em;
}
.mode-toggle [data-mode] svg { width: 16px; height: 16px; stroke-width: 2; }
.mode-toggle [data-mode].active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.mode-toggle-lg [data-mode] { padding: 14px 28px; font-size: 15px; min-height: 48px; }
.mode-toggle-lg [data-mode] svg { width: 18px; height: 18px; }

/* Full-width segmented for mobile */
.mode-toggle-block { display: flex; width: 100%; }
.mode-toggle-block [data-mode] { flex: 1; justify-content: center; }

/* ─────────────────────────────────────────────────────────────
   FORMS
   ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-soft); margin-bottom: 7px;
  letter-spacing: 0.005em;
}
.form-input, .form-select, .form-textarea {
  width: 100%; font-family: inherit; font-size: 16px; /* 16 prevents iOS zoom */
  padding: 13px 14px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-md); color: var(--text);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  -webkit-appearance: none; appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11, 37, 69, 0.12);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ─────────────────────────────────────────────────────────────
   LISTING CARDS — bubble style
   ───────────────────────────────────────────────────────────── */
.listing-grid { display: grid; gap: 14px; }

.listing-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s var(--ease), transform 0.12s var(--ease), border-color 0.2s var(--ease);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.listing-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-2);
  transform: translateY(-1px);
  text-decoration: none;
}
.listing-card:active { transform: translateY(0) scale(0.995); }

.match-score {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; letter-spacing: -0.02em;
  border: 2px solid;
  flex-shrink: 0;
  background: var(--bg);
}
.match-score.high { background: var(--ok-bg); color: var(--ok); border-color: #B8E5CC; }
.match-score.mid  { background: var(--warn-bg); color: var(--warn); border-color: #EFD7A8; }
.match-score.low  { background: var(--surface-3); color: var(--muted); border-color: var(--line-2); }

.listing-body { min-width: 0; }
.listing-body .route {
  font-size: 15.5px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  line-height: 1.3;
}
.listing-body .route .arrow { color: var(--muted-2); font-weight: 400; }
.listing-body .meta {
  font-size: 13.5px; color: var(--muted);
  display: flex; gap: 14px; margin-top: 5px; flex-wrap: wrap;
  align-items: center;
}
.listing-body .meta .sep { color: var(--line-2); }
.listing-body .chips {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}

/* Chips ========================================================= */
.chip {
  font-size: 11.5px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--info-bg); color: var(--info);
  letter-spacing: 0.005em;
  white-space: nowrap;
}
.chip.accent { background: #FBEDCE; color: var(--accent-ink); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.ghost { background: var(--surface-3); color: var(--text-soft); }
.chip.inline { display: inline-block; }

.listing-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: var(--muted-2);
  letter-spacing: 0.05em; font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────
   PILL / BADGE
   ───────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--r-pill);
  letter-spacing: 0.005em;
  white-space: nowrap;
}
.pill.ok     { background: var(--ok-bg);   color: var(--ok); }
.pill.warn   { background: var(--warn-bg); color: var(--warn); }
.pill.bad    { background: var(--bad-bg);  color: var(--bad); }
.pill.info   { background: var(--info-bg); color: var(--info); }
.pill.ghost  { background: var(--surface-3); color: var(--text-soft); }
.pill.live {
  background: var(--ok-bg); color: var(--ok);
  position: relative; padding-left: 18px;
}
.pill.live::before {
  content: ''; position: absolute; left: 8px; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  transform: translateY(-50%);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(15, 138, 95, 0.5); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(15, 138, 95, 0); }
}

/* ─────────────────────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────────────────────── */
.empty {
  text-align: center; padding: 48px 24px;
  color: var(--muted);
}
.empty .display { font-size: 36px; color: var(--ink); margin-bottom: 8px; }
.empty .empty-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; color: var(--muted);
}
.empty p { margin: 0 0 20px; font-size: 15px; }

/* ─────────────────────────────────────────────────────────────
   AUTH
   ───────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at top right, rgba(230, 162, 60, 0.10), transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(11, 37, 69, 0.06), transparent 50%),
    var(--bg);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 44px 36px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-card .brand { margin-bottom: 28px; font-size: 22px; }
.auth-card h1 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 36px; margin-bottom: 6px; letter-spacing: -0.02em; }
.auth-card .subtitle { color: var(--muted); font-size: 14.5px; margin-bottom: 28px; line-height: 1.45; }
.auth-error {
  background: var(--bad-bg); color: var(--bad); font-size: 13.5px;
  padding: 11px 14px; border-radius: var(--r-md); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.auth-demo-hint {
  margin-top: 24px; padding: 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px dashed var(--line-2);
  font-size: 12.5px; color: var(--muted); line-height: 1.6;
}
.auth-demo-hint strong { color: var(--ink); font-weight: 600; }
.auth-demo-hint code {
  background: var(--surface-3); padding: 1px 6px; border-radius: 4px;
  font-size: 11.5px; color: var(--text-soft);
}

/* ─────────────────────────────────────────────────────────────
   HERO / DASHBOARD
   ───────────────────────────────────────────────────────────── */
.hero {
  background:
    radial-gradient(circle at top right, rgba(230, 162, 60, 0.18), transparent 60%),
    linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #fff; border-radius: var(--r-xl);
  padding: 28px; margin-bottom: 20px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.hero h2 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 32px; letter-spacing: -0.02em; color: #fff; }
.hero .hero-sub { opacity: 0.8; margin: 4px 0 22px; font-size: 15px; line-height: 1.45; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 2px 8px rgba(230, 162, 60, 0.3);
}
.hero-actions .btn-primary:hover { background: var(--accent-2); }
.hero-actions .btn-secondary {
  background: rgba(255,255,255,0.12); color: #fff;
  border-color: rgba(255,255,255,0.2);
}
.hero-actions .btn-secondary:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.3); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.stat-card { padding: 18px 20px; }
.stat-card .label {
  font-size: 12px; color: var(--muted); font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.stat-card .value {
  font-size: 32px; font-weight: 600; letter-spacing: -0.025em;
  margin-top: 2px; color: var(--ink); line-height: 1;
}
.stat-card .sublabel { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ─────────────────────────────────────────────────────────────
   FILTERS
   ───────────────────────────────────────────────────────────── */
.filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 12px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.filter-chip {
  padding: 7px 14px; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid transparent;
  font-size: 13px; font-weight: 500; color: var(--text-soft);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.filter-chip:hover { background: var(--surface-2); border-color: var(--line); }
.filter-chip.active {
  background: var(--ink); color: #fff;
  border-color: var(--ink);
}

/* ─────────────────────────────────────────────────────────────
   TABS
   ───────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  margin-bottom: 18px;
  background: var(--surface-3);
  padding: 4px; border-radius: var(--r-pill);
  border: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 9px 16px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); border-radius: var(--r-pill);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
  white-space: nowrap;
}
.tabs a.active {
  color: var(--ink); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* ─────────────────────────────────────────────────────────────
   TRIP ROUTE (the from → to block)
   ───────────────────────────────────────────────────────────── */
.trip-route {
  display: flex; align-items: stretch; gap: 14px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px;
}
.trip-route .line {
  width: 2px; background: linear-gradient(to bottom, var(--ink) 0%, var(--accent) 100%);
  margin: 6px 0; position: relative; border-radius: 2px;
}
.trip-route .line::before, .trip-route .line::after {
  content: ''; position: absolute; left: -5px; width: 12px; height: 12px;
  border-radius: 50%;
}
.trip-route .line::before { top: -3px; background: var(--ink); }
.trip-route .line::after  { bottom: -3px; background: var(--accent); }
.trip-route .stops { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-height: 72px; }
.trip-route .stop .label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 600;
}
.trip-route .stop .value { font-size: 15.5px; font-weight: 600; color: var(--text); margin-top: 2px; }

/* ─────────────────────────────────────────────────────────────
   RIDER STATUS TIMELINE (driver's live trip view)
   ───────────────────────────────────────────────────────────── */
.rider-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px; align-items: center;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.rider-card.status-boarded { background: linear-gradient(to right, var(--ok-bg) 0%, var(--surface) 60%); border-color: #B8E5CC; }
.rider-card.status-dropped_off { background: var(--surface-3); opacity: 0.85; }
.rider-card.status-no_show { background: var(--bad-bg); border-color: #F0B9B0; }

.rider-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
  font-weight: 600; font-size: 15px;
  position: relative;
}
.rider-avatar.numbered { background: var(--ink); color: #fff; }
.rider-avatar .seq-num {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

.rider-card .rider-info { min-width: 0; }
.rider-card .rider-name { font-size: 15px; font-weight: 600; }
.rider-card .rider-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.rider-card .rider-timeline {
  font-size: 12px; color: var(--muted); margin-top: 5px;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.rider-card .rider-timeline span { display: inline-flex; align-items: center; gap: 4px; }

/* ─────────────────────────────────────────────────────────────
   QR
   ───────────────────────────────────────────────────────────── */
.qr-frame {
  background: #fff; padding: 24px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  max-width: 320px; margin: 0 auto;
}
.qr-frame svg, .qr-frame img, .qr-frame canvas { display: block; max-width: 100%; }
.qr-meta { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.qr-meta .countdown {
  font-family: ui-monospace, monospace; font-weight: 700; color: var(--ink);
  display: inline-block; min-width: 20px;
}

.scanner-frame {
  background: #000; border-radius: var(--r-lg); overflow: hidden;
  position: relative; aspect-ratio: 1; max-width: 360px; margin: 0 auto;
  box-shadow: var(--shadow-md);
}
.scanner-frame video { width: 100%; height: 100%; object-fit: cover; }
.scanner-overlay {
  position: absolute; inset: 12%; pointer-events: none;
  border-radius: var(--r-md);
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.4),
    inset 0 0 0 3px rgba(230, 162, 60, 0.9);
}
.scanner-overlay::before, .scanner-overlay::after,
.scanner-overlay span::before, .scanner-overlay span::after {
  content: ''; position: absolute; width: 20px; height: 20px;
  border-color: var(--accent); border-style: solid;
}
.scanner-overlay::before { top: -3px; left: -3px; border-width: 3px 0 0 3px; border-radius: 6px 0 0 0; }
.scanner-overlay::after  { top: -3px; right: -3px; border-width: 3px 3px 0 0; border-radius: 0 6px 0 0; }

/* ─────────────────────────────────────────────────────────────
   SEQUENCE LIST (drag reorder)
   ───────────────────────────────────────────────────────────── */
.seq-list { list-style: none; padding: 0; margin: 0; }
.seq-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  margin-bottom: 8px;
  transition: box-shadow 0.15s var(--ease), transform 0.1s var(--ease);
}
.seq-item:hover { cursor: grab; box-shadow: var(--shadow-sm); }
.seq-item.dragging { opacity: 0.4; cursor: grabbing; }
.seq-item .handle { color: var(--muted-2); }
.seq-item .num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}

/* ─────────────────────────────────────────────────────────────
   ADMIN
   ───────────────────────────────────────────────────────────── */
.admin-shell {
  display: grid; grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.admin-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 12px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.admin-sidebar .brand { margin-bottom: 28px; padding: 0 8px; }
.admin-sidebar .group-label {
  font-size: 10.5px; font-weight: 700; color: var(--muted-2);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 14px 10px 6px;
}
.admin-sidebar a {
  display: block; padding: 9px 12px; border-radius: var(--r-md);
  font-size: 13.5px; color: var(--text-soft); font-weight: 500;
  margin-bottom: 1px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.admin-sidebar a:hover { color: var(--ink); background: var(--bg-tint); text-decoration: none; }
.admin-sidebar a.active { color: var(--ink); background: var(--bg-tint); font-weight: 600; }
.admin-main { padding: 28px 32px 60px; max-width: none; }

.table {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.table th, .table td {
  padding: 12px 16px; text-align: left; font-size: 13.5px;
  border-bottom: 1px solid var(--line);
}
.table th {
  background: var(--surface-2); color: var(--muted);
  font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }
.table td.mono { font-family: ui-monospace, monospace; font-size: 12.5px; }

/* ─────────────────────────────────────────────────────────────
   UTILITIES
   ───────────────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ref-no {
  font-family: ui-monospace, monospace; font-size: 12.5px;
  color: var(--muted); letter-spacing: 0.05em;
  font-weight: 500;
}
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.flex-1 { flex: 1; }

.banner {
  background: var(--info-bg); color: var(--info);
  padding: 13px 16px; border-radius: var(--r-md);
  font-size: 13.5px; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner .banner-icon { flex-shrink: 0; font-weight: 700; }

/* ─────────────────────────────────────────────────────────────
   TOAST
   ───────────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed; bottom: 100px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1000; pointer-events: none;
  align-items: center;
}
.toast {
  background: rgba(11, 37, 69, 0.95);
  backdrop-filter: blur(20px);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease-out);
  max-width: 92vw;
}
.toast.toast-in { opacity: 1; transform: translateY(0); }
.toast.toast-out { opacity: 0; transform: translateY(-10px); }
.toast-bad { background: rgba(192, 57, 43, 0.95); }
.toast-warn { background: rgba(194, 119, 11, 0.95); }
.toast-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,0.2); font-size: 12px; font-weight: 700;
}

/* ─────────────────────────────────────────────────────────────
   BOTTOM SHEET
   ───────────────────────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 37, 69, 0.35);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.28s var(--ease);
}
.sheet-backdrop.in { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 201;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.32s var(--ease-out);
  max-height: 85vh;
  overflow-y: auto;
}
.sheet.in { transform: translateY(0); }
.sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--line-2);
  margin: 10px auto;
}
.sheet-body { padding: 8px 24px 28px; }

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .topnav { display: none; }
  .user-chip { display: none; }
  .bottomnav { display: flex; }
  .main { padding: 20px 16px 110px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  h1 { font-size: 26px; }
  .hero { padding: 24px; }
  .hero h2 { font-size: 28px; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .admin-main { padding: 20px 16px 60px; }
  .listing-card { grid-template-columns: auto 1fr; gap: 14px; }
  .listing-card > .btn { grid-column: 1 / -1; margin-top: 8px; }
  .rider-card { grid-template-columns: auto 1fr; }
  .rider-card > .pill { grid-column: 1 / -1; justify-self: start; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
