/* ============================================================
   School Runs - shared design system (clean)
   Used by every app/auth page. Landing page keeps its own inline CSS.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #111714;
  --ink-soft: #6B746F;
  --ink-mute: #A1A8A3;
  --bg: #FAFAF9;
  --bg-alt: #F4F4F2;
  --card: #FFFFFF;
  --border: #E9E9E6;
  --border-soft: #F0F0EE;

  --brand: #16A66B;
  --brand-deep: #0F8A57;
  --brand-tint: #EEF6F1;
  --brand-soft: #DCEAE2;

  --coral: #E07856;
  --coral-tint: #F7EBE5;
  --amber: #C99A4E;
  --amber-tint: #F5EFE2;
  --sky: #5A8AA0;
  --sky-tint: #E8EFF2;
  --plum: #8A6FA8;
  --red: #C2543F;
  --red-tint: #F7E9E5;

  --shadow-sm: 0 1px 2px rgba(17, 23, 20, 0.03);
  --shadow-md: 0 1px 2px rgba(17, 23, 20, 0.04), 0 4px 12px -6px rgba(17, 23, 20, 0.06);
  --shadow-lg: 0 1px 3px rgba(17, 23, 20, 0.04), 0 10px 24px -10px rgba(17, 23, 20, 0.10);
  --shadow-float: 0 2px 6px rgba(17, 23, 20, 0.05), 0 18px 40px -16px rgba(17, 23, 20, 0.14);

  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;

  --sidebar-w: 248px;
}

html { scroll-behavior: smooth; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh; /* dvh excludes mobile browser chrome, avoiding phantom scroll */
}
a { color: inherit; }

/* Beta announcement bar (top of every page) */
.beta-bar { background: var(--brand); color: #fff; text-align: center; font-size: 13.5px; font-weight: 500; padding: 9px 18px; line-height: 1.45; }
.beta-bar b { font-weight: 700; }
.beta-bar a { color: #fff; font-weight: 700; text-decoration: underline; }
.beta-bar a:hover { opacity: .85; }
.font-display { font-family: "Space Grotesk", sans-serif; letter-spacing: -0.02em; }

/* Brand logomark - "The Run" S-road, drops into any .logo / .sb-logo tile */
.brand-mark { width: 58%; height: 58%; color: var(--brand); }
.auth-aside .brand-mark { color: #fff; }

/* ============ Accessibility ============ */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 5000; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 10px 0; font-weight: 600; font-size: 14px; text-decoration: none; }
.skip-link:focus { left: 0; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* Compact inline filter bar (e.g. "Your routes") */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-bar select { width: auto; min-width: 0; padding: 7px 30px 7px 12px; font-size: 13px; background-position: right 10px center; }
/* Multi-select dropdown (e.g. days of the week) styled to match .filter-bar select */
.ms { position: relative; }
.ms-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 13px; font-weight: 500; font-family: inherit; border: 1.5px solid var(--border); border-radius: var(--r-sm); background: var(--bg-alt); color: var(--ink); cursor: pointer; transition: all .16s; }
.ms-btn:hover { border-color: var(--ink-mute); }
.ms.open .ms-btn { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px var(--brand-tint); }
/* Render the days-dropdown caret as the exact same SVG chevron the <select>s use, so
   every dropdown across the app shows an identical arrow (not a filled ▾ triangle). */
.ms-caret { display: inline-block; width: 12px; height: 8px; flex-shrink: 0; font-size: 0; margin-left: auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236B746F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5L6 6.5L11 1.5'/%3E%3C/svg%3E") no-repeat center; }
.ms-panel { display: none; position: absolute; top: calc(100% + 5px); left: 0; z-index: 50; background: #fff; border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: var(--shadow-md); padding: 6px; min-width: 150px; }
.ms.open .ms-panel { display: block; }
.ms-opt { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; white-space: nowrap; }
.ms-opt:hover { background: var(--bg-alt); }
/* Greyed-out (no matching route) day options: dim the whole label, not just the box */
.ms-opt:has(input:disabled) { color: var(--ink-mute); opacity: .5; cursor: default; }
.ms-opt:has(input:disabled):hover { background: none; }

/* ============ App shell (logged-in pages) ============ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: calc(100vh - var(--beta-h, 0px)); min-height: calc(100dvh - var(--beta-h, 0px)); }

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: calc(100vh - var(--beta-h, 0px)); height: calc(100dvh - var(--beta-h, 0px)); overflow-y: auto;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 14px;
}
.sb-brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px 18px; text-decoration: none; }
.sb-logo { width: 36px; height: 36px; background: var(--ink); border-radius: 10px; display: grid; place-items: center; font-size: 16px; }
.sb-brand h1 { font-family: "Space Grotesk", sans-serif; font-size: 16px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.sb-brand p { font-size: 11px; color: var(--ink-soft); line-height: 1.3; }

.school-switch {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 12px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer; width: 100%;
  font-family: inherit; text-align: left; transition: border-color .15s;
}
.school-switch:hover { border-color: var(--ink-mute); }
.school-switch .ss-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-tint); color: var(--brand-deep); display: grid; place-items: center; font-size: 14px; flex-shrink: 0; }
.school-switch .ss-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-mute); font-weight: 700; }
.school-switch .ss-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.school-switch .ss-caret { margin-left: auto; color: var(--ink-mute); font-size: 12px; }

.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-mute); font-weight: 700; padding: 10px 11px 5px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500; font-family: inherit; color: var(--ink-soft);
  text-decoration: none; transition: all .15s; margin-bottom: 1px;
}
.nav-link .ico { font-size: 16px; width: 20px; text-align: center; }
.nav-link:hover { background: var(--bg-alt); color: var(--ink); }
.nav-link.active { background: var(--ink); color: #fff; font-weight: 600; }
.nav-link .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 7px; }
.nav-link.active .count { background: rgba(255,255,255,.2); }
.nav-link .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); display: inline-block; margin-left: 6px; vertical-align: middle; }

.sb-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.sb-user { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--r-sm); text-decoration: none; }
.sb-user:hover { background: var(--bg-alt); }
.sb-user .name { font-size: 13px; font-weight: 600; line-height: 1.15; }
.sb-user .role { display: block; font-size: 11px; color: var(--ink-soft); line-height: 1.2; }

.main { min-width: 0; }
.topbar {
  display: none; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--card);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.topbar .sb-logo { width: 32px; height: 32px; }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--border); background: var(--card); border-radius: var(--r-sm); display: grid; place-items: center; cursor: pointer; font-size: 16px; color: var(--ink-soft); }
.icon-btn:hover { border-color: var(--ink-mute); color: var(--ink); }

.page { max-width: 1100px; margin: 0; padding: 28px 28px 72px; }
.page-wide { max-width: 1280px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h2 { font-family: "Space Grotesk", sans-serif; font-size: 32px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; }
.page-header .sub { font-size: 14px; color: var(--ink-soft); margin-top: 3px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.breadcrumb { font-size: 13px; color: var(--ink-mute); margin-bottom: 14px; display: flex; gap: 6px; align-items: center; }
.breadcrumb a { text-decoration: none; color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--ink); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: 1px solid transparent; text-decoration: none;
  transition: all .16s ease; white-space: nowrap;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-accent { background: var(--brand); color: #fff; }
.btn-accent:hover { background: var(--brand-deep); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--ink-mute); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--bg-alt); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #A8442F; border-color: #A8442F; }
/* Borderless trigger for the most destructive action (the modal confirms in red). */
.btn-ghost.danger { color: var(--red); }
.btn-ghost.danger:hover { background: var(--red-tint); color: var(--red); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .arrow { transition: transform .2s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ============ Cards ============ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card-pad { padding: 22px; }
.card-hover { transition: all .16s ease; }
.card-hover:hover { border-color: var(--ink-mute); box-shadow: var(--shadow-md); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.card-head .sub { font-size: 13px; color: var(--ink-soft); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-split { grid-template-columns: 1.3fr 1fr; align-items: start; }
.grid-aside { grid-template-columns: 280px 1fr; align-items: start; }

/* ============ Stats ============ */
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; }
.stat .label { font-size: 12px; color: var(--ink-soft); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .value { font-family: "Space Grotesk", sans-serif; font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.stat .delta { font-size: 12px; margin-top: 2px; color: var(--ink-mute); }
.stat .delta.up { color: var(--brand-deep); }

/* ============ Forms ============ */
.field { margin-bottom: 18px; }
.field.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
label .opt { color: var(--ink-mute); font-weight: 500; }
.hint { font-size: 12px; color: var(--ink-mute); margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=time], input[type=date], input[type=search], input[type=number], select, textarea {
  width: 100%; padding: 12px 13px; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; font-family: inherit; font-weight: 500; background: var(--bg-alt); color: var(--ink); transition: all .16s; appearance: none;
}
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236B746F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5L6 6.5L11 1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-mute); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px var(--brand-tint); }
.input-wrap { position: relative; }
.input-wrap .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); opacity: .65; font-size: 15px; pointer-events: none; }
.input-wrap input, .input-wrap select { padding-left: 40px; }

/* Phone input with a fixed +353 country prefix, so users know to enter an Irish number. */
.phone-group { display: flex; align-items: stretch; }
.phone-group .phone-prefix { display: flex; align-items: center; padding: 0 13px; background: var(--bg-alt); border: 1.5px solid var(--border); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.phone-group input { border-top-left-radius: 0; border-bottom-left-radius: 0; flex: 1; min-width: 0; }
.phone-group input:focus + .phone-prefix, .phone-group:focus-within .phone-prefix { border-color: var(--brand); }

.checkrow { display: flex; gap: 11px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-alt); cursor: pointer; margin-bottom: 10px; }
.checkrow:hover { border-color: var(--ink-mute); }
.checkrow input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex-shrink: 0; }
.checkrow .ct { font-size: 13px; }
.checkrow .ct b { font-weight: 600; }
.checkrow .ct span { color: var(--ink-soft); display: block; font-size: 12px; }

/* Segmented toggle */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--bg-alt); border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 4px; }
.seg button { padding: 10px 8px; border: none; background: transparent; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-soft); font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 7px; transition: all .15s; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* Day picker */
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days button { width: 42px; height: 42px; border: 1.5px solid var(--border); background: var(--bg-alt); border-radius: var(--r-sm); font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-soft); cursor: pointer; transition: all .15s; }
.days button:hover { border-color: var(--ink-mute); }
.days button.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ============ Badges, tags, pills ============ */
.badge { display: inline-flex !important; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .01em; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--brand-tint); color: var(--brand-deep); }
.badge-amber { background: var(--amber-tint); color: #8A6A2E; }
.badge-red { background: var(--red-tint); color: var(--red); }
.badge-blue { background: var(--sky-tint); color: #3D6275; }
.badge-grey { background: var(--bg-alt); color: var(--ink-soft); }
.badge-coral { background: var(--coral-tint); color: #A8543A; }
.badge.plain::before { display: none; }

.tag { font-size: 11px; padding: 4px 9px; border-radius: 999px; background: var(--bg-alt); color: var(--ink-soft); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.tag.car { background: var(--amber-tint); color: #8A6A2E; }
.tag.walk { background: var(--sky-tint); color: #3D6275; }
.tag.cycle { background: var(--brand-tint); color: var(--brand-deep); }
.tag.public { background: #EDE8F2; color: #6A4F86; }
.tag.offering { background: var(--brand-tint); color: var(--brand-deep); }
.tag.seeking { background: var(--coral-tint); color: #A8543A; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
/* Keep a card's pills on a single line (scrolls horizontally if they overflow). */
.tags.nowrap { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tags.nowrap::-webkit-scrollbar { display: none; }
.tags.nowrap .tag { flex: 0 0 auto; }

/* ============ Avatar ============ */
.avatar { border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; position: relative; width: 44px; height: 44px; font-size: 15px; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; border-radius: 10px; }

/* Mode tile - colour-coded icon anchor for your own route rows (mirrors the avatar). */
.mode-tile { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.mode-tile.car { background: var(--amber-tint); }
.mode-tile.walk { background: var(--sky-tint); }
.mode-tile.cycle { background: var(--brand-tint); }
.mode-tile.public { background: #EDE8F2; }
.avatar.lg { width: 60px; height: 60px; font-size: 21px; border-radius: 16px; }
.avatar .vdot { position: absolute; bottom: -2px; right: -2px; width: 16px; height: 16px; background: var(--brand); border: 2.5px solid #fff; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 8px; }

/* ============ Route / parent card ============ */
.r-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; transition: all .16s; }
.r-card.is-paused { background: var(--bg-alt); border-style: dashed; }
.r-card.is-paused .r-route, .r-card.is-paused .tags { opacity: .5; }
.r-card.click { cursor: pointer; }
.r-card.click:hover { border-color: var(--ink-mute); box-shadow: var(--shadow-md); }
.r-top { display: flex; gap: 13px; align-items: flex-start; }
.r-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.r-meta { font-size: 13px; color: var(--ink-soft); margin-top: 1px; }
.r-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }
.r-route { font-size: 13px; display: flex; align-items: center; gap: 7px; color: var(--ink-soft); }
.r-route b { color: var(--ink); font-weight: 600; }
.r-route .arrow { color: var(--coral); }

/* ============ Table ============ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-mute); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.table td { padding: 13px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.table tr:last-child td { border-bottom: none; }
table.table tbody tr:hover { background: var(--bg-alt); }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .name { font-weight: 600; }
.cell-user .sub { font-size: 12px; color: var(--ink-soft); }

/* ============ Tabs ============ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; }
.tabs a, .tabs button { padding: 11px 14px; font-size: 14px; font-weight: 600; color: var(--ink-soft); text-decoration: none; border: none; background: none; cursor: pointer; font-family: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs a.active, .tabs button.active { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count { font-size: 11px; background: var(--bg-alt); border-radius: 999px; padding: 1px 7px; margin-left: 5px; }

.pill-tabs { display: inline-flex; gap: 4px; background: var(--bg-alt); padding: 4px; border-radius: 999px; }
.pill-tabs button { padding: 7px 14px; border: none; background: none; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-soft); cursor: pointer; font-family: inherit; transition: all .15s; }
.pill-tabs button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* Inline text link (brand-coloured, semibold). Replaces repeated inline styles. */
.link { color: var(--brand-deep); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Chat message bubbles (thread view). */
.msg { padding: 10px 13px; max-width: 75%; font-size: 13.5px; }
.msg-own { align-self: flex-end; margin-left: auto; background: var(--ink); color: #fff; border-radius: 14px 14px 4px 14px; }
.msg-other { align-self: flex-start; background: var(--bg-alt); border-radius: 14px 14px 14px 4px; }

/* Danger-zone card (account deletion etc.). */
.card-danger { background: var(--red-tint); border-color: #EBC9C0; }

/* Centred brand lockup in the public footer. */
.site-foot .site-brand { justify-content: center; margin-bottom: 14px; }

/* Collapsible card header (<details><summary class="conn-summary">) - clickable, with
   a caret that flips when open. Shared by the connections page and the dashboard. */
.conn-summary { cursor: pointer; list-style: none; }
.conn-summary::-webkit-details-marker { display: none; }
.conn-summary::after { content: "▸"; color: var(--ink-mute); font-size: 12px; margin-left: 8px; }
details[open] .conn-summary::after { content: "▾"; }

/* ============ Empty state ============ */
.empty { text-align: center; padding: 52px 20px; color: var(--ink-soft); }
/* Compact empty state for use inside a card (vs the full-page default above). */
.empty.sm { padding: 24px 16px; }
.empty .illo { width: 76px; height: 76px; margin: 0 auto 16px; background: var(--bg-alt); border-radius: 50%; display: grid; place-items: center; font-size: 32px; }
.empty h4 { font-family: "Space Grotesk", sans-serif; font-size: 17px; color: var(--ink); font-weight: 700; margin-bottom: 6px; }
.empty p { font-size: 14px; max-width: 38ch; margin: 0 auto 18px; }

/* Full-page error states (404/500/403/400). */
.error-page { min-height: 60vh; display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.error-box { max-width: 460px; text-align: center; }
.error-box .error-emoji { font-size: 46px; margin-bottom: 10px; }
.error-box h1 { font-size: 28px; color: var(--ink); margin: 0 0 8px; }
.error-box p { font-size: 15px; line-height: 1.6; max-width: 42ch; margin: 0 auto 22px; }

/* ============ Notice / alert ============ */
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); font-size: 13.5px; line-height: 1.5; border: 1px solid; }
/* Auto-dismissing flash messages collapse smoothly so content above settles up. */
.flash-msg { overflow: hidden; transition: max-height .4s ease, opacity .3s ease, margin .4s ease, padding .4s ease, transform .4s ease; }
.notice .ni { font-size: 18px; flex-shrink: 0; line-height: 1.3; }
.notice b { font-weight: 700; }
.notice-info { background: var(--sky-tint); border-color: #CFE0E8; color: #34525F; }
.notice-warn { background: var(--amber-tint); border-color: #EAD9B6; color: #7A5E26; }
.notice-green { background: var(--brand-tint); border-color: var(--brand-soft); color: #0C5E3D; }
.notice-red { background: var(--red-tint); border-color: #EBC9C0; color: #8A382A; }

/* ============ Auth / centered layouts ============ */
.auth { min-height: calc(100vh - var(--beta-h, 0px)); min-height: calc(100dvh - var(--beta-h, 0px)); display: grid; grid-template-columns: 1fr; }
.auth-aside { display: none; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
/* On phones, sit the card near the top rather than floating in the middle. */
@media (max-width: 700px) { .auth-main { align-items: flex-start; padding-top: 24px; } }
.auth-card { width: 100%; max-width: 430px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 30px 28px; }
.auth-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 26px; text-decoration: none; }
.auth-brand .sb-logo { width: 40px; height: 40px; background: var(--ink); border-radius: 11px; display: grid; place-items: center; font-size: 18px; }
.auth-brand h1 { font-family: "Space Grotesk", sans-serif; font-size: 19px; font-weight: 700; letter-spacing: -.03em; }
.auth-title { font-family: "Space Grotesk", sans-serif; font-size: 30px; font-weight: 700; letter-spacing: -.04em; line-height: 1.05; text-align: center; }
.auth-sub { text-align: center; color: var(--ink-soft); font-size: 14px; margin: 6px 0 24px; }
.auth-foot { text-align: center; font-size: 13.5px; color: var(--ink-soft); margin-top: 20px; }
.auth-foot a { color: var(--brand-deep); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-mute); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }

/* The auth pages are a single centered card on the light background, in keeping
   with the rest of the app (no dark split-screen aside). */

/* ============ Steps indicator ============ */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 26px; }
.steps .step { display: flex; align-items: center; gap: 9px; flex: 1; }
.steps .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--bg-alt); color: var(--ink-mute); border: 1.5px solid var(--border); flex-shrink: 0; }
.steps .step.done .dot { background: var(--brand); color: #fff; border-color: var(--brand); }
.steps .step.active .dot { background: var(--ink); color: #fff; border-color: var(--ink); }
.steps .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.steps .step.active .lbl, .steps .step.done .lbl { color: var(--ink); }
.steps .bar { height: 1.5px; background: var(--border); flex: 1; margin: 0 10px; }
.steps .step.done + .step .bar, .steps .bar.done { background: var(--brand); }

/* ============ Modal ============ */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17,23,20,.45); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.modal-backdrop.show { display: flex; }
.modal { background: #fff; border-radius: var(--r-lg); max-width: 460px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-float); animation: pop .2s ease; }
.modal.lg { max-width: 600px; }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.close-x { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 17px; color: var(--ink-soft); display: grid; place-items: center; transition: all .15s; }
.close-x:hover { color: var(--ink); transform: rotate(90deg); }

/* ============ Misc utilities ============ */
.stack { display: flex; flex-direction: column; }
.stack-2 > * + * { margin-top: 8px; }
.stack-3 > * + * { margin-top: 12px; }
.stack-4 > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--ink-soft); }
.mute2 { color: var(--ink-mute); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.b { font-weight: 600; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex1 { flex: 1; } .grow { flex: 1; }
.hide { display: none; }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-mute); font-weight: 700; margin-bottom: 12px; }
.divider-line { height: 1px; background: var(--border); margin: 20px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-soft); }
.kv .v { font-weight: 600; text-align: right; }
.locked { color: var(--ink-mute); font-style: italic; display: inline-flex; align-items: center; gap: 5px; }

/* ============ Public / marketing pages ============ */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(250,250,249,.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.site-header-inner { max-width: 1320px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 14px; }
.site-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); }
.site-brand b { font-size: 17px; letter-spacing: -.02em; }
.site-brand-text { display: flex; flex-direction: column; line-height: 1.12; text-align: left; align-items: flex-start; }
.site-brand-sub { font-size: 11px; font-weight: 500; color: var(--ink-soft); }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.site-nav a { padding: 9px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink-soft); text-decoration: none; transition: all .15s; }
.site-nav a:hover { color: var(--ink); background: var(--bg-alt); }
.site-nav a.active { color: var(--ink); font-weight: 600; }
.site-nav a.cta { background: var(--ink); color: #fff; font-weight: 600; padding: 9px 18px; margin-left: 8px; }
.site-nav a.cta:hover { background: var(--brand-deep); }

.prose-hero { text-align: center; max-width: 720px; margin: 0 auto; padding: 56px 24px 8px; }
.prose-hero .eyebrow { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--brand-deep); background: var(--brand-tint); padding: 5px 12px; border-radius: 999px; margin-bottom: 16px; }
.prose-hero h1 { font-family: "Space Grotesk", sans-serif; font-size: clamp(32px, 5vw, 46px); font-weight: 700; letter-spacing: -.04em; line-height: 1.05; }
.prose-hero p { font-size: 18px; color: var(--ink-soft); margin-top: 14px; }
.prose { max-width: 760px; margin: 0 auto; padding: 20px 24px 64px; }
.prose h2 { font-family: "Space Grotesk", sans-serif; font-size: 23px; letter-spacing: -.02em; margin: 28px 0 8px; }
.prose p { color: var(--ink-soft); margin-bottom: 10px; }

.site-foot { border-top: 1px solid var(--border); background: var(--bg-alt); }
.site-foot-inner { max-width: 1320px; margin: 0 auto; padding: 28px 24px; text-align: center; }
.site-foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin-bottom: 12px; }
.site-foot-links a { font-size: 14px; color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.site-foot-links a:hover { color: var(--ink); }
.site-foot-note { font-size: 13px; color: var(--ink-mute); }

/* "Free to use" pill - reused wherever we state the no-money policy */
.free-banner { display: inline-flex; align-items: center; gap: 8px; background: var(--brand-tint); color: var(--brand-deep); border: 1px solid var(--brand-soft); padding: 8px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600; }

/* Numbered how-it-works steps */
.steps-list { display: grid; gap: 14px; margin-top: 8px; }
.step-item { display: flex; gap: 16px; align-items: flex-start; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 22px; }
.step-item .num { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-family: "Space Grotesk", sans-serif; }
.step-item h3 { font-size: 16px; margin-bottom: 3px; }
.step-item p { font-size: 14px; color: var(--ink-soft); margin: 0; }

/* Weekly driving rota */
.rota { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rota-day { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 6px; text-align: center; background: var(--card); }
.rota-day .rd-day { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-mute); display: block; margin-bottom: 9px; }
.rota-day .avatar { margin: 0 auto 7px; }
.rota-day .rd-who { font-size: 12px; font-weight: 600; display: block; }
.rota-day.off { background: var(--bg-alt); }
.rota-day.off .rd-none { font-size: 12px; color: var(--ink-mute); display: grid; place-items: center; height: 100%; min-height: 56px; }
.rota-day.you { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
@media (max-width: 560px) { .rota { grid-template-columns: repeat(3, 1fr); } }

/* "Grow your school network" card (invite + notify) */
.net-card { background: linear-gradient(180deg, var(--brand-tint), var(--card)); border: 1px solid var(--brand-soft); border-radius: var(--r-lg); padding: 22px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ============ Responsive ============ */
/* Mobile nav drawer: hidden on desktop, shown as an off-canvas panel <=860px */
.nav-backdrop { display: none; }
.sb-close { display: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  /* Sidebar becomes a slide-in drawer toggled by .app.nav-open */
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 300;
    width: 290px; max-width: 86vw; height: 100%;
    box-shadow: var(--shadow-float);
    transform: translateX(-100%); transition: transform .26s ease;
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 250;
    background: rgba(17, 23, 20, .42);
    opacity: 0; pointer-events: none; transition: opacity .26s ease;
  }
  .app.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  .sb-close { display: inline-flex; align-items: center; justify-content: center; line-height: 1; position: absolute; top: 14px; right: 14px; z-index: 2; }
  /* Keep the user + log-out footer just under the nav, not pinned below the fold. */
  .sb-foot { margin-top: 24px; }
  .topbar { display: flex; }
  .page { padding: 20px 16px 60px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-4.keep-2, .grid-3.keep-2 { grid-template-columns: 1fr 1fr; }
  .grid-split, .grid-aside { grid-template-columns: 1fr; }
  .field.row2 { grid-template-columns: 1fr; }
  .page-header { gap: 12px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .card-head { flex-wrap: wrap; }
  .card-head .row { flex-wrap: wrap; }
  /* marketing header: keep Log in + Sign up, hide the section links */
  .site-header-inner { padding: 12px 16px; gap: 10px; }
  .site-nav { gap: 4px; }
  .site-nav a.mk { display: none; }
  .site-nav a { padding: 8px 11px; font-size: 13px; }
  .site-nav a.cta { padding: 9px 16px; margin-left: 4px; }
  .rota { grid-template-columns: repeat(3, 1fr); }

  /* Step indicator: keep on one line without overflowing */
  .steps .step { min-width: 0; }
  .steps .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .steps .bar { margin: 0 6px; }
}

/* Phone-width refinements for the marketing / legal / onboarding additions */
@media (max-width: 600px) {
  .beta-bar { font-size: 12.5px; padding: 8px 14px; }
  .prose-hero { padding: 38px 18px 4px; }
  .prose { padding: 16px 18px 56px; }
  .prose h2 { font-size: 20px; margin: 22px 0 8px; }
  .step-item { padding: 16px 16px; gap: 13px; }
  .step-item .num { width: 32px; height: 32px; }
  .net-card { padding: 18px; }
  .site-foot-inner { padding: 24px 18px; }
  .site-foot-links { gap: 6px 14px; }
}
