/* ==========================================================================
   Pickup Bell — Design System
   Deep navy + soft gold + green accent, on a light, calm background.
   ========================================================================== */

:root {
  --navy-900: #0b1f3a;
  --navy-800: #122a4d;
  --navy-700: #1a3a68;
  --gold-500: #c9a227;
  --gold-100: #f7ecc9;
  --green-600: #1f8a5f;
  --green-100: #e3f5ec;
  --amber-600: #b9770e;
  --amber-100: #fbeed4;
  --slate-500: #64748b;
  --slate-100: #eef1f5;
  --red-600: #c0392b;
  --red-100: #fbe6e3;
  --bg: #f6f7fa;
  --surface: #ffffff;
  --border: #e3e7ee;
  --text: #172033;
  --text-muted: #5b6478;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(11, 31, 58, 0.06), 0 1px 1px rgba(11, 31, 58, 0.04);
  --shadow-md: 0 8px 24px rgba(11, 31, 58, 0.08);
  --shadow-lg: 0 16px 40px rgba(11, 31, 58, 0.14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
button { font-family: inherit; }
a { color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

/* ---------- App shell ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy-900);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topbar .brand-name { font-weight: 700; font-size: 15px; line-height: 1.1; }
.topbar .brand-role { font-size: 11.5px; color: var(--gold-100); opacity: 0.85; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:active { transform: scale(0.94); }

.text-btn {
  background: transparent;
  border: none;
  color: var(--gold-100);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
}

main.screen {
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 96px;
}
main.screen.wide { max-width: 1180px; }

/* ---------- Logo ---------- */
.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #ffffff;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.logo-hero {
  width: 132px;
  height: 132px;
  border-radius: 0;
  margin: 0 auto 16px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--navy-900); color: #fff; box-shadow: var(--shadow-md); }
.btn-gold { background: var(--gold-500); color: var(--navy-900); box-shadow: var(--shadow-md); }
.btn-green { background: var(--green-600); color: #fff; box-shadow: var(--shadow-md); }
.btn-outline { background: #fff; color: var(--navy-900); border: 1.5px solid var(--border); }
.btn-danger-outline { background: #fff; color: var(--red-600); border: 1.5px solid var(--red-100); }
.btn-sm { padding: 10px 14px; font-size: 13.5px; width: auto; border-radius: var(--radius-sm); }
.btn-block-row { display: flex; gap: 10px; }
.btn-block-row .btn { flex: 1; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card + .card { margin-top: 14px; }

/* ---------- Role switcher (login) ---------- */
.login-hero { text-align: center; padding: 28px 8px 12px; }
.login-hero h1 { font-size: 24px; color: var(--navy-900); }
.login-hero .tagline { color: var(--gold-500); font-weight: 700; font-size: 13px; margin-top: 4px; }
.login-hero .subtitle { color: var(--text-muted); font-size: 14.5px; margin-top: 10px; }
.login-hero .school-identity { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }

.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.role-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.role-card:active { transform: scale(0.97); }
.role-card .role-icon {
  width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.role-card.admin .role-icon { background: var(--navy-800); color: #fff; }
.role-card.teacher .role-icon { background: var(--green-100); color: var(--green-600); }
.role-card.parent .role-icon { background: var(--gold-100); color: var(--gold-500); }
.role-card.driver .role-icon { background: var(--slate-100); color: var(--navy-800); }
.role-card.staff .role-icon { background: var(--red-100); color: var(--red-600); }
.role-card .role-title { font-weight: 700; font-size: 14.5px; color: var(--navy-900); }
.role-card .role-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-waiting { background: var(--amber-100); color: var(--amber-600); }
.badge-sent { background: #dfeaff; color: #2557a8; }
.badge-hold { background: var(--slate-100); color: var(--slate-500); }
.badge-completed { background: var(--green-100); color: var(--green-600); }

/* ---------- Student / pickup card ---------- */
.pickup-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.pickup-card + .pickup-card { margin-top: 12px; }
.pickup-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pickup-card-head h3 { font-size: 16px; color: var(--navy-900); }
.pickup-card-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.pickup-card-time { font-size: 11.5px; color: var(--text-muted); margin-top: 8px; }
.pickup-card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; background: var(--slate-100); padding: 4px; border-radius: 12px; overflow-x: auto; }
.tab-btn {
  flex: 1;
  white-space: nowrap;
  background: transparent;
  border: none;
  padding: 9px 12px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.tab-btn.active { background: #fff; color: var(--navy-900); box-shadow: var(--shadow-sm); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.empty-state .empty-emoji { font-size: 34px; margin-bottom: 10px; }
.empty-state h4 { color: var(--navy-900); margin-bottom: 6px; }
.empty-state p { font-size: 13.5px; }

/* ---------- Toast / banners ---------- */
#toast-region {
  position: fixed;
  top: 12px;
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
  padding: 0 12px;
}
.toast {
  pointer-events: auto;
  max-width: 440px;
  width: 100%;
  background: var(--navy-900);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.2s ease;
}
.toast.success { background: var(--green-600); }
.toast.warn { background: var(--amber-600); }
.toast.error { background: var(--red-600); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.banner {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.banner-privacy { background: var(--slate-100); color: var(--text-muted); }
.banner-privacy strong { color: var(--navy-900); }
.banner-success { background: var(--green-100); color: var(--green-600); font-weight: 600; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  background: #fff;
  color: var(--text);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--navy-700); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,31,58,0.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100;
}
.modal {
  background: #fff; width: 100%; max-width: 480px;
  border-radius: 20px 20px 0 0;
  max-height: 88vh; overflow-y: auto;
  padding: 22px 20px 26px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s ease;
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 20px; }
}
@keyframes modal-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { font-size: 17px; color: var(--navy-900); }
.modal-head .icon-btn { background: var(--slate-100); border: 1px solid var(--border); color: var(--navy-900); }

/* ---------- Stat cards (admin) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(5, 1fr); } }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.stat-card .stat-value { font-size: 26px; font-weight: 800; color: var(--navy-900); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-card.accent-amber .stat-value { color: var(--amber-600); }
.stat-card.accent-blue .stat-value { color: #2557a8; }
.stat-card.accent-green .stat-value { color: var(--green-600); }
.stat-card.accent-slate .stat-value { color: var(--slate-500); }

/* ---------- Admin layout ---------- */
.admin-layout { display: flex; gap: 20px; align-items: flex-start; }
.admin-sidebar {
  width: 210px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px; box-shadow: var(--shadow-sm); position: sticky; top: 76px;
}
.admin-sidebar button {
  width: 100%; text-align: left; background: transparent; border: none; padding: 11px 12px;
  border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; gap: 8px; margin-bottom: 2px;
}
.admin-sidebar button.active { background: var(--navy-900); color: #fff; }
.admin-content { flex: 1; min-width: 0; }
.admin-mobile-tabs { display: none; }
@media (max-width: 880px) {
  .admin-layout { display: block; }
  .admin-sidebar { display: none; }
  .admin-mobile-tabs { display: flex; margin-bottom: 14px; }
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--bg);
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
.row-actions { display: flex; gap: 6px; }

.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.section-head h2 { font-size: 19px; color: var(--navy-900); }
.section-head p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Settings ---------- */
.settings-row {
  display: flex; justify-content: space-between; align-items: center; padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .settings-label { font-weight: 600; font-size: 14px; color: var(--navy-900); }
.settings-row .settings-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--slate-100); border-radius: 999px; cursor: pointer; transition: background 0.15s;
}
.switch .track::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; left: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.15s;
}
.switch input:checked + .track { background: var(--green-600); }
.switch input:checked + .track::after { transform: translateX(20px); }

.radius-options { display: flex; gap: 8px; }
.radius-chip {
  flex: 1; text-align: center; padding: 10px; border-radius: 10px; border: 1.5px solid var(--border);
  background: #fff; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--text-muted);
}
.radius-chip.active { border-color: var(--navy-900); background: var(--navy-900); color: #fff; }

/* ---------- Misc ---------- */
.muted { color: var(--text-muted); }
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff; animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-banner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 26px 14px; }
.status-banner .status-icon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.help-fab {
  position: fixed; bottom: 18px; right: 18px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--navy-900); color: #fff; border: none; box-shadow: var(--shadow-lg); font-size: 18px; font-weight: 700;
  cursor: pointer; z-index: 30;
}
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--slate-100); color: var(--text-muted); font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
