/* ==========================================================================
   NST Carpool
   A classic travel aesthetic: navy ink on cool paper. Direction is
   colour-coded like an old departure board - green arrives, burgundy departs.
   Every clock time is set in mono so times align and scan down a column.
   Both themes are first-class; tokens below are the only place colour lives.
   ========================================================================== */

:root {
    --r-sm: 5px;
    --r-md: 9px;
    --r-lg: 13px;
    --r-xl: 16px;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

    --page: 1120px;
    --ease: cubic-bezier(0.4, 0.14, 0.3, 1);
}

/* ---------- Night: deep navy-charcoal ---------- */
:root,
:root[data-theme='dark'] {
    color-scheme: dark;

    --bg: #12151B;
    --surface: #191D25;
    --surface-2: #212630;
    --line: #2E343F;
    --line-soft: #232833;

    --text: #E8EAEE;
    --text-mid: #99A1AE;
    --text-dim: #6B7280;

    --accent: #6EA8DC;
    --accent-ink: #0E1319;
    --accent-wash: rgba(110, 168, 220, 0.10);
    --accent-edge: rgba(110, 168, 220, 0.32);
    --accent-quiet: #2C4560;

    --arrive: #56B39A;
    --depart: #E0736F;

    --glow: rgba(0, 0, 0, 0.45);
    --wash-1: rgba(110, 168, 220, 0.055);
    --wash-2: rgba(86, 179, 154, 0.04);
}

/* ---------- Day: cool paper and ink ---------- */
:root[data-theme='light'] {
    color-scheme: light;

    --bg: #F5F6F8;
    --surface: #FFFFFF;
    --surface-2: #EDEFF3;
    --line: #D8DCE3;
    --line-soft: #E4E7EC;

    --text: #171A1F;
    --text-mid: #545A66;
    --text-dim: #838A96;

    --accent: #1F4C7A;
    --accent-ink: #FFFFFF;
    --accent-wash: rgba(31, 76, 122, 0.08);
    --accent-edge: rgba(31, 76, 122, 0.28);
    --accent-quiet: #C3CEDC;

    --arrive: #2E6B5E;
    --depart: #8C2F39;

    --glow: rgba(23, 26, 31, 0.12);
    --wash-1: rgba(31, 76, 122, 0.045);
    --wash-2: rgba(46, 107, 94, 0.035);
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    transition: background 260ms var(--ease), color 260ms var(--ease);
}

/* One ambient wash: light raking in from the top corners. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(58rem 40rem at 6% -8%, var(--wash-1), transparent 62%),
        radial-gradient(48rem 36rem at 100% 4%, var(--wash-2), transparent 60%);
}

.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.view {
    display: none;
    position: relative;
    z-index: 1;
}

.view.active {
    display: block;
}

.hidden {
    display: none !important;
}

::selection {
    background: var(--accent);
    color: var(--accent-ink);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ============================ Brand ============================ */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: var(--text);
}

.brand-glyph {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    object-fit: contain;
    display: block;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 0.005em;
}

/* ============================ Type ============================ */
.eyebrow {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.lede {
    color: var(--text-mid);
    max-width: 48ch;
}

.section-title {
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: 0.005em;
}

.count {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-mid);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 9px;
}

/* ============================ Buttons ============================ */
.btn {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    padding: 12px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

.btn-block {
    width: 100%;
    padding: 14px 18px;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.08);
}

.btn-primary:disabled {
    background: var(--accent-quiet);
    color: var(--text-dim);
    cursor: default;
}

.btn-quiet {
    background: transparent;
    border-color: var(--line);
    color: var(--text-mid);
    padding: 9px 14px;
    font-size: 13px;
}

.btn-quiet:hover:not(:disabled) {
    border-color: var(--text-dim);
    color: var(--text);
}

.btn-quiet-danger:hover:not(:disabled) {
    border-color: var(--depart);
    color: var(--depart);
}

.btn-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--text-mid);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 160ms var(--ease), color 160ms var(--ease);
}

.btn-icon:hover {
    border-color: var(--text-dim);
    color: var(--text);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px;
}

.btn-link:disabled {
    color: var(--text-dim);
    cursor: default;
}

.btn-link:not(:disabled):hover {
    text-decoration: underline;
}

/* ============================ Theme toggle ============================ */
.theme-toggle {
    position: relative;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--text-mid);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 160ms var(--ease), color 160ms var(--ease);
}

.theme-toggle:hover {
    border-color: var(--text-dim);
    color: var(--text);
}

.theme-toggle svg {
    position: absolute;
    transition: opacity 200ms var(--ease), transform 260ms var(--ease);
}

/* Show the destination, not the current state. */
:root[data-theme='dark'] .icon-sun,
:root[data-theme='light'] .icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

:root[data-theme='dark'] .icon-moon,
:root[data-theme='light'] .icon-sun {
    opacity: 0;
    transform: rotate(-90deg);
}

.auth-theme-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 5;
}

/* ============================ Fields ============================ */
.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 18px;
}

.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-mid);
    display: flex;
    align-items: center;
    gap: 8px;
}

.optional {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.field input,
.field select {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 13px 14px;
    width: 100%;
    transition: border-color 160ms var(--ease);
}

.field input.mono {
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
}

.field input::placeholder {
    color: var(--text-dim);
}

.field select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
        linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
    background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

input[type='datetime-local']::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.8;
    padding: 4px;
    border-radius: 4px;
    transition: opacity 160ms var(--ease), background 160ms var(--ease);
}

input[type='datetime-local']::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background: var(--accent-wash);
}

:root[data-theme='dark'] input[type='datetime-local']::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.6);
}

.field-hint {
    font-size: 12px;
    color: var(--text-dim);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.otp-field {
    font-family: var(--font-mono) !important;
    font-size: 25px !important;
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.3em;
    padding: 15px 14px 15px 24px !important;
}

.status-msg {
    font-size: 13px;
    font-weight: 500;
    min-height: 20px;
    margin-top: 12px;
    text-align: center;
}

.status-msg.neutral {
    color: var(--text-mid);
}

.status-msg.error {
    color: var(--depart);
}

.status-msg.success {
    color: var(--arrive);
}

/* ============================ Auth ============================ */
.auth-shell {
    position: relative;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
}

.auth-pitch {
    padding: 44px clamp(32px, 5vw, 72px);
    display: flex;
    flex-direction: column;
    gap: 26px;
    border-right: 1px solid var(--line-soft);
}

.pitch-headline {
    font-family: var(--font-display);
    font-size: clamp(46px, 6.4vw, 78px);
    line-height: 0.94;
    letter-spacing: -0.012em;
    margin-top: auto;
}

.pitch-headline em {
    font-style: italic;
    color: var(--accent);
}

.pitch-lede {
    color: var(--text-mid);
    font-size: 16px;
    max-width: 42ch;
}

/* Preview of the live rail, so the concept lands before sign-in. */
.pitch-rail {
    margin-top: 4px;
    padding: 22px 24px 18px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    max-width: 450px;
}

.pitch-rail-cap {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.prail {
    position: relative;
    height: 32px;
}

.prail-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--line);
}

.prail-band {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 25%;
    width: 50%;
    background: var(--accent-wash);
    border-left: 1px solid var(--accent-edge);
    border-right: 1px solid var(--accent-edge);
}

.prail-pin {
    position: absolute;
    top: 50%;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.prail-pin.is-near {
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line);
}

.prail-pin.is-match {
    background: var(--accent);
}

.prail-pin.is-you {
    width: 14px;
    height: 14px;
    background: var(--bg);
    box-shadow: inset 0 0 0 3px var(--text);
}

.prail-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
}

.pitch-foot {
    font-size: 13px;
    color: var(--text-dim);
    max-width: 42ch;
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px clamp(24px, 4vw, 56px);
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-step {
    display: none;
}

.auth-step.active {
    display: block;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 34px;
    letter-spacing: 0.005em;
    margin-top: 2px;
    line-height: 1.1;
}

.auth-sub {
    color: var(--text-mid);
    font-size: 14px;
    margin-bottom: 26px;
}

.auth-sub .mono {
    color: var(--text);
    font-size: 13px;
}

.step-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
}

.resend-row {
    text-align: center;
    margin-top: 14px;
}

/* ============================ Topbar ============================ */
.topbar {
    border-bottom: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-inner {
    max-width: var(--page);
    margin: 0 auto;
    padding: 13px clamp(18px, 3vw, 32px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.identity-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

#user-usn {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#user-email {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================ Page ============================ */
.page {
    max-width: var(--page);
    margin: 0 auto;
    padding: clamp(28px, 4vw, 48px) clamp(18px, 3vw, 32px) 72px;
}

/* ============================ Pick a direction ============================ */
.pick-head {
    margin-bottom: 28px;
}

.pick-title {
    font-family: var(--font-display);
    font-size: clamp(34px, 4.4vw, 48px);
    letter-spacing: -0.005em;
    line-height: 1.06;
    margin: 8px 0 10px;
}

.pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
    gap: 16px;
    max-width: 740px;
}

.trip-card {
    position: relative;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-xl);
    padding: 26px 24px 24px;
    color: var(--text);
    font-family: var(--font-body);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 9px;
    transition: border-color 200ms var(--ease), transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

.trip-card:hover {
    border-color: var(--accent-edge);
    transform: translateY(-2px);
    box-shadow: 0 10px 26px -14px var(--glow);
}

.trip-tag {
    position: absolute;
    top: 22px;
    right: 22px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
}

.trip-tag-arrive {
    color: var(--arrive);
    border: 1px solid var(--arrive);
}

.trip-tag-depart {
    color: var(--depart);
    border: 1px solid var(--depart);
}

.trip-icon {
    color: var(--text-dim);
    margin-bottom: 3px;
}

.trip-card:hover .trip-icon {
    color: var(--accent);
}

.trip-name {
    font-family: var(--font-display);
    font-size: 24px;
    letter-spacing: 0.005em;
}

.trip-desc {
    font-size: 13.5px;
    color: var(--text-mid);
    max-width: 32ch;
}

.pick-foot {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 26px;
    font-size: 13px;
    color: var(--text-dim);
}

.pick-foot .mono {
    color: var(--text);
}

.dot-live {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--arrive);
    flex: 0 0 auto;
    animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ============================ Trip form ============================ */
.sheet {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-xl);
    padding: clamp(22px, 3vw, 34px);
    max-width: 560px;
    margin: 0 auto;
}

.sheet-title {
    font-family: var(--font-display);
    font-size: 29px;
    letter-spacing: 0.005em;
    margin-top: 2px;
    line-height: 1.12;
}

.sheet form {
    margin-top: 26px;
}

/* ============================ The rail (signature) ============================ */
.rail-card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-xl);
    padding: clamp(24px, 3vw, 34px);
    margin-bottom: 32px;
}

.rail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 36px;
}

.rail-time {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: clamp(38px, 6vw, 56px);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.035em;
    margin: 9px 0 7px;
}

.rail-meta {
    font-size: 14px;
    color: var(--text-mid);
}

.rail-meta .mono {
    color: var(--accent);
    font-size: 13px;
}

.rail-aside {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rail-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Small caps suffix so mono's full-width space doesn't gap open the time. */
.tsuffix {
    font-family: var(--font-body);
    font-size: 0.48em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-left: 0.3em;
    opacity: 0.7;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--text-mid);
}

.chip-live {
    color: var(--arrive);
    border-color: var(--arrive);
}

.rail {
    position: relative;
    height: 108px;
    margin-bottom: 4px;
}

/* Soft signal glow instead of a hard box - reads as reach, not a container. */
.rail-glow {
    position: absolute;
    top: 6px;
    height: 68px;
    background: radial-gradient(ellipse at center, var(--accent-wash) 0%, transparent 72%);
    pointer-events: none;
}

.rail-axis {
    position: absolute;
    top: 40px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--line);
}

.rail-tick {
    position: absolute;
    top: 36px;
    width: 1px;
    height: 9px;
    background: var(--line);
    transform: translateX(-50%);
}

/* Gate markers at the edges of what you are willing to wait out. */
.rail-gate {
    position: absolute;
    top: 26px;
    width: 1px;
    height: 29px;
    background: var(--accent-edge);
    transform: translateX(-50%);
}

.rail-gate::before,
.rail-gate::after {
    content: '';
    position: absolute;
    left: -2px;
    width: 5px;
    height: 1px;
    background: var(--accent-edge);
}

.rail-gate::before {
    top: 0;
}

.rail-gate::after {
    bottom: 0;
}

/* Dimension callout, borrowed from a drafting sheet. */
.rail-dim {
    position: absolute;
    top: 72px;
    height: 1px;
    background: var(--accent-edge);
}

.rail-dim::before,
.rail-dim::after {
    content: '';
    position: absolute;
    top: -3px;
    width: 1px;
    height: 7px;
    background: var(--accent-edge);
}

.rail-dim::before {
    left: 0;
}

.rail-dim::after {
    right: 0;
}

.rail-dim-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    padding: 0 9px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    white-space: nowrap;
}

.rail-pin {
    position: absolute;
    top: 40px;
    transform: translate(-50%, -50%);
}

.pin-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--line);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-mid);
    overflow: hidden;
    cursor: default;
}

.pin-dot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rail-pin.is-match .pin-dot {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
    color: var(--text);
}

.rail-pin.is-near {
    opacity: 0.4;
}

.rail-pin.is-near .pin-dot {
    border-style: dashed;
}

.rail-pin.is-you {
    z-index: 3;
}

/* Your aircraft, nosing forward along the time axis. */
.pin-plane {
    display: block;
    color: var(--accent);
    filter: drop-shadow(0 2px 7px var(--glow));
}

.pin-plane svg {
    display: block;
}

.pin-label {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text);
    white-space: nowrap;
}

.rail-scale {
    position: absolute;
    top: 88px;
    left: 0;
    right: 0;
    height: 14px;
}

.rail-scale span {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    white-space: nowrap;
}

.rail-scale span.at-start {
    left: 0;
}

.rail-scale span.at-mid {
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-mid);
}

.rail-scale span.at-end {
    right: 0;
}

/* Tear line, like the stub on a ticket. */
.rail-legend {
    font-size: 13.5px;
    color: var(--text-mid);
    border-top: 1px dashed var(--line);
    padding-top: 18px;
    margin-top: 18px;
}

.rail-legend strong {
    color: var(--text);
    font-weight: 600;
}

/* ============================ Columns ============================ */
.columns {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line-soft);
}

.section-head-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================ Match cards ============================ */
.match {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    padding: 20px;
    transition: border-color 200ms var(--ease);
}

.match:hover {
    border-color: var(--accent-edge);
}

.match-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.match-who {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.match-name {
    font-family: var(--font-display);
    font-size: 21px;
    letter-spacing: 0.005em;
    line-height: 1.2;
}

.match-sub {
    font-size: 12.5px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.match-sub .mono {
    color: var(--text-mid);
    font-size: 11.5px;
}

.match-when {
    text-align: right;
    flex: 0 0 auto;
}

.match-time {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 19px;
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.match-gap {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--accent);
    text-transform: uppercase;
    margin-top: 5px;
}

.match-note {
    font-size: 13.5px;
    color: var(--text-mid);
    line-height: 1.5;
    border-left: 2px solid var(--accent-quiet);
    padding-left: 13px;
    margin: 16px 0 18px;
}

.match-sent {
    font-size: 12.5px;
    color: var(--arrive);
    border-top: 1px dashed var(--line);
    padding-top: 14px;
    margin-top: 4px;
}

/* ============================ Board rows ============================ */
.board-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-left: 2px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px 15px;
}

.board-row.to-hostel {
    border-left-color: var(--arrive);
}

.board-row.to-airport {
    border-left-color: var(--depart);
}

.board-row.is-you {
    background: var(--surface-2);
}

.board-face {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-mid);
    overflow: hidden;
}

.board-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.board-body {
    min-width: 0;
    flex: 1;
}

.board-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 7px;
}

.board-dir {
    font-size: 11.5px;
    color: var(--text-dim);
}

.board-when {
    text-align: right;
    flex: 0 0 auto;
}

.board-time {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.board-date {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-dim);
}

.tag-you {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--accent-edge);
    border-radius: 3px;
    padding: 0 5px;
    flex: 0 0 auto;
}

/* ============================ Empty states ============================ */
.empty {
    border: 1px dashed var(--line);
    border-radius: var(--r-lg);
    padding: 30px 24px;
    text-align: center;
}

.empty-title {
    font-family: var(--font-display);
    font-size: 20px;
    margin-bottom: 4px;
}

.empty-text {
    font-size: 13px;
    color: var(--text-dim);
    max-width: 36ch;
    margin: 0 auto;
}

.empty-text .mono {
    color: var(--text-mid);
}

/* ============================ Motion ============================ */
.rotating svg {
    animation: spin 600ms var(--ease);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.rail-pin {
    animation: settle 420ms var(--ease) both;
}

@keyframes settle {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }
}

.rail-glow,
.rail-dim,
.rail-gate {
    animation: fade-in 420ms var(--ease) both;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================ Responsive ============================ */
@media (max-width: 960px) {
    .auth-shell {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .auth-pitch {
        border-right: none;
        border-bottom: 1px solid var(--line-soft);
        gap: 20px;
        padding: 30px clamp(20px, 5vw, 40px) 34px;
    }

    .pitch-headline {
        margin-top: 6px;
        font-size: clamp(40px, 9vw, 56px);
    }

    .pitch-rail {
        max-width: none;
    }

    .columns {
        grid-template-columns: 1fr;
        gap: 34px;
    }
}

@media (max-width: 560px) {
    .auth-pitch {
        gap: 16px;
        padding-top: 26px;
    }

    /* Below the fold on a phone; the rail reappears on the live board. */
    .pitch-rail,
    .pitch-foot {
        display: none;
    }

    .auth-panel {
        padding: 28px 20px 48px;
    }

    .field-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .identity-text {
        display: none;
    }

    /* Chip tucks up beside the eyebrow; the two actions split the width. */
    .rail-card {
        position: relative;
    }

    .rail-aside {
        width: 100%;
    }

    .rail-aside .chip {
        position: absolute;
        top: 22px;
        right: 22px;
    }

    .rail-controls {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .rail-head {
        margin-bottom: 30px;
    }

    .match-top {
        flex-direction: column;
        gap: 12px;
    }

    .match-when {
        text-align: left;
        display: flex;
        align-items: baseline;
        gap: 10px;
    }

    .match-gap {
        margin-top: 0;
    }
}


/* Fraunces carries weight where Instrument Serif was used at 400. */
.brand-name,
.section-title,
.pitch-headline,
.auth-title,
.pick-title,
.sheet-title,
.trip-name,
.match-name,
.empty-title {
    font-weight: 700;
}

.pitch-headline {
    font-weight: 800;
    letter-spacing: -0.015em;
}

/* ==========================================================================
   Board layout
   The two-column split left an empty half whenever there were no matches,
   while the board itself ran as one tall single-file list. Sections now stack
   full width and each list flows into as many columns as will fit.
   ========================================================================== */
.columns {
    display: flex;
    flex-direction: column;
    gap: 34px;
    /* The old grid rule set align-items:start, which in a column flex box
       shrinks each section to its content width instead of the full page. */
    align-items: stretch;
}

.col-main .stack,
.board-day-rows {
    display: grid;
    gap: 10px;
}

.col-main .stack {
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}

.board-day-rows {
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}

.board-day + .board-day {
    margin-top: 20px;
}

.board-day-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.board-day-name {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.board-day-count {
    font-size: 10.5px;
    color: var(--text-dim);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 7px;
}

/* The rule fills the space left of the count, tying the group together. */
.board-day-head::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line-soft);
}

.board-row {
    padding: 11px 13px;
}

.board-when {
    text-align: right;
}

@media (max-width: 640px) {
    .board-day-rows,
    .col-main .stack {
        grid-template-columns: 1fr;
    }

    .rail-time {
        font-size: clamp(34px, 11vw, 46px);
    }

    .page {
        padding-left: 14px;
        padding-right: 14px;
    }

    .rail-card,
    .sheet {
        padding: 20px 16px;
    }

    .topbar-inner {
        padding-left: 14px;
        padding-right: 14px;
    }

    .pick-grid {
        grid-template-columns: 1fr;
    }

    .section-head {
        flex-wrap: wrap;
    }
}
