@font-face {
  font-family: 'Woodford Bourne PRO';
  src: url('/assets/woodford-bourne-regular.woff2') format('woff2');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

/* Tokens from the Inflight Design System (colors_and_type.css), as line-readiness uses them. */
:root {
  --gold: #B79B58;
  --gold-light: #CDBA82;
  --gold-dark: #9A8145;
  --gold-subtle: rgba(183, 155, 88, 0.08);
  --gold-glow: rgba(183, 155, 88, 0.15);
  --near-black: #0A0A0A;
  --charcoal: #1A1A1A;
  --dark-gray: #222222;
  --mid-gray: #575760;
  --gray: #888888;
  --light-gray: #E8E8E8;
  --off-white: #F5F4F1;
  --warm-white: #FAF9F7;
  --white: #FFFFFF;
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.12);
  --late: #B91C1C;
  --late-bg: #FEF2F2;
  --soon: #B45309;
  --soon-bg: #FEF3C7;
  --good: #166534;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-elevated: 0 12px 48px rgba(0, 0, 0, 0.12);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: 'Woodford Bourne PRO', Georgia, 'Times New Roman', serif;
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --topbar-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--dark-gray);
  background: var(--warm-white);
  overflow-wrap: anywhere;
}
h1, h2, h3, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
body.booting > * { visibility: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand svg { width: 28px; height: 28px; flex-shrink: 0; }
.brand-word { font-weight: 700; font-size: 13px; letter-spacing: 0.24em; text-transform: uppercase; }

.btn {
  min-height: 44px;
  padding: 10px 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--white);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.btn:hover:not(:disabled) { border-color: var(--gold-dark); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--near-black); }
.btn.primary:hover:not(:disabled) { background: var(--gold-dark); border-color: var(--gold-dark); color: var(--white); }
.btn.quiet { border-color: transparent; background: transparent; color: inherit; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.copy {
  min-height: 36px;
  padding: 6px 8px;
  margin: -6px -8px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--gold-dark);
  font-weight: 600;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.copy:active { background: var(--gold-subtle); }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-height: var(--topbar-h);
  padding: 8px 20px;
  background: var(--near-black);
  color: var(--white);
}
.topbar .brand { margin-right: auto; }
.topbar .btn { min-height: 36px; padding: 6px 14px; background: transparent; border-color: rgba(255, 255, 255, 0.24); color: var(--white); }
.topbar .btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-light); }
.topbar .btn.quiet { border-color: transparent; color: rgba(255, 255, 255, 0.72); }
@media (min-width: 721px) { .topbar { position: sticky; top: 0; z-index: 5; height: var(--topbar-h); flex-wrap: nowrap; } }
.sync { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync-status { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.sync-status .late-text { color: #FCA5A5; font-weight: 600; }
.who { display: flex; align-items: center; gap: 4px; font-size: 12px; color: rgba(255, 255, 255, 0.72); }

.tabs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; padding: 0 20px; border-bottom: 1px solid var(--border-strong); background: var(--white); }
.tabs { display: flex; gap: 4px; }
.training-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin: 6px 0;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-dark);
  text-decoration: none;
}
.training-link:hover { border-color: var(--gold-dark); }
.tabs button {
  min-height: 48px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-weight: 600;
  font-size: 13px;
  color: var(--mid-gray);
  cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--near-black); border-bottom-color: var(--gold); }
.count { display: inline-block; min-width: 1.7em; padding: 1px 7px; border-radius: var(--radius-full); background: var(--off-white); font-size: 11px; font-weight: 600; color: var(--mid-gray); text-align: center; }
.count:empty { display: none; }
.count.late { background: var(--late); color: var(--white); }
/* Credits waiting to be added pull the eye to their tab until there are none. */
.tabs button.has-pending { color: var(--late); animation: pending-flash 1.6s ease-in-out infinite; }
.tabs button.has-pending .count { background: var(--late); color: var(--white); }
@keyframes pending-flash {
  0%, 100% { color: var(--late); }
  50% { color: #F87171; }
}
.tabs button.has-pending .count { animation: pending-ring 1.6s ease-in-out infinite; }
@keyframes pending-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(185, 28, 28, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .tabs button.has-pending, .tabs button.has-pending .count { animation: none; }
}

main { padding: 16px 20px 40px; max-width: 1440px; margin: 0 auto; }
.empty { padding: 40px 0; text-align: center; color: var(--mid-gray); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--white);
  font-size: 12px;
  font-weight: 600;
  color: var(--dark-gray);
  cursor: pointer;
  touch-action: manipulation;
}
.chip:hover { border-color: var(--gold-dark); }
.chip-count { font-weight: 500; color: var(--gray); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--near-black); border-color: var(--near-black); color: var(--white); }
.chip[aria-pressed="true"] .chip-count { color: var(--gold-light); }
.search { flex: 0 1 280px; }
input[type="search"], input[type="email"], input[type="password"], textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--white);
  font-size: 16px;
}
input[type="search"] { border-radius: var(--radius-full); }
textarea { min-height: 96px; resize: vertical; }

.records {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
.records thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--white);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray);
  text-align: left;
  white-space: nowrap;
}
.records thead th:first-child { border-top-left-radius: 12px; }
.records thead th:last-child { border-top-right-radius: 12px; }
@media (min-width: 721px) { .records thead th { top: var(--topbar-h); } }
.records td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.records tbody tr.row { cursor: pointer; transition: background 0.15s var(--ease-out); }
.records tbody tr.row:hover { background: var(--warm-white); }
.records tbody tr.row.overdue { background: var(--late-bg); }
.records tbody tr.row.overdue td:first-child { box-shadow: inset 3px 0 0 var(--late); }
.records tfoot td { padding: 10px 12px; font-size: 12px; color: var(--mid-gray); }
.records .sub { display: block; margin-top: 2px; font-size: 12px; color: var(--gray); }
.records .nil { color: var(--light-gray); }
.c-index { width: 40px; color: var(--gray); font-size: 12px; white-space: nowrap; }
.c-student { min-width: 180px; }
.c-clock, .c-score, .c-next, .c-more { white-space: nowrap; }
.c-ride { min-width: 150px; }
.c-more { width: 48px; text-align: right; }
.name {
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--near-black);
  text-align: left;
  cursor: pointer;
}
.name:hover { color: var(--gold-dark); }

.section-head th { padding: 0; border-bottom: 1px solid var(--border); background: var(--off-white); text-align: left; }
.section-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  background: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--charcoal);
  cursor: pointer;
}
.section-hint { font-weight: 500; letter-spacing: 0.04em; text-transform: none; color: var(--gray); }
.chev { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; transition: transform 0.2s var(--ease-out); }
.section-toggle[aria-expanded="false"] .chev { transform: rotate(-90deg); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-stage-awaiting_outcome { background: var(--near-black); color: var(--gold-light); }
.pill-stage-offer_pending, .pill-credit-pending { background: var(--gold); color: var(--near-black); }
.pill-stage-offer_sent, .pill-credit-added { background: var(--gold-glow); color: var(--gold-dark); }
.pill-stage-survey_submitted { border-color: var(--gold); background: var(--white); color: var(--gold-dark); }
.pill-stage-review_sent { border-color: var(--charcoal); background: var(--white); color: var(--charcoal); }
.pill-stage-closed, .pill-credit-verified { background: var(--off-white); color: var(--mid-gray); }
.pill-stage-failed { background: var(--light-gray); color: var(--charcoal); }
.pill-credit-mismatch { background: var(--late-bg); color: var(--late); }
.pill-stage-not_review_eligible { border-color: var(--soon); background: var(--soon-bg); color: var(--soon); }

/* Survey score bands, from SCORE_BANDS in dashboard/lib/score.js. */
.score { font-weight: 700; }
.score-meets { color: var(--good); }
.score-close { color: var(--soon); }
.score-low { color: var(--late); }

.clock { font-weight: 600; color: var(--dark-gray); }
.clock.soon { color: var(--soon); }
.clock.late { color: var(--late); }
.clock.done { color: var(--good); }
.ledger-note { color: var(--late) !important; font-weight: 600; }

.more-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--mid-gray);
  cursor: pointer;
}
.more-btn svg { fill: currentColor; }
.more-btn:hover { border-color: var(--border-strong); color: var(--near-black); }
.menu {
  position: fixed;
  inset: auto;
  min-width: 200px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow-elevated);
}
.menu button {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.menu button:hover, .menu button:focus-visible { background: var(--off-white); }

/* iPad portrait and smaller laptops: drop the columns the drawer repeats. */
@media (max-width: 1100px) {
  .records .c-index, .records .h-0, .records .c-people, .records .h-3 { display: none; }
  .records thead th { white-space: normal; }
  .records th, .records td { padding-left: 8px; padding-right: 8px; }
  .c-student { min-width: 110px; }
  .c-ride { min-width: 90px; }
}

/* Phones: each row becomes a stacked block with the same pill and next action. */
@media (max-width: 720px) {
  main { padding: 12px 12px 32px; }
  .topbar { padding: 8px 12px; }
  .tabs-bar { padding: 0 12px; }
  .search { flex-basis: 100%; }
  .records, .records tbody, .records tfoot, .records tr, .records td, .records th { display: block; }
  .records { border: 0; background: none; }
  .records thead { display: none; }
  .records .section-head th { margin-top: 12px; border: 0; border-radius: var(--radius-md); }
  .records tbody tr.row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "student status" "ride clock" "ride score" "next more";
    gap: 8px 12px;
    margin-top: 8px;
    padding: 14px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--white);
  }
  .records td { padding: 0; border: 0; }
  .records .c-student { grid-area: student; min-width: 0; }
  .records .c-status { grid-area: status; text-align: right; }
  .records .c-ride, .records .c-credit { grid-area: ride; }
  .records .c-clock { grid-area: clock; text-align: right; }
  .records .c-score { grid-area: score; text-align: right; }
  .records .c-score .nil, .records .c-clock .nil { display: none; }
  .records .c-score .sub { display: inline; margin-left: 6px; }
  .records .c-next { grid-area: next; }
  .records .c-next .btn { width: 100%; min-height: 44px; }
  .records .c-next .nil { display: none; }
  .records .c-more { grid-area: more; width: auto; }
  .records .c-more .more-btn { width: 44px; height: 44px; border-color: var(--border-strong); }
  #credit-table tbody tr.row { grid-template-areas: "student student" "status status" "ride clock" "next next"; }
  #credit-table .c-status { text-align: left; }
  .records tfoot td { padding: 12px 4px; }
}

dialog {
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog::backdrop { background: rgba(10, 10, 10, 0.62); }
dialog.drawer { margin: 0 0 0 auto; width: min(520px, 100vw); height: 100dvh; max-height: 100dvh; border-radius: 0; }
.dialog-body { display: grid; gap: 16px; padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; color: var(--near-black); }
.dialog-close { flex-shrink: 0; min-width: 44px; min-height: 44px; border: 0; border-radius: var(--radius-full); background: var(--off-white); font-size: 22px; line-height: 1; cursor: pointer; }
.dialog-section { display: grid; gap: 10px; }
.dialog-section h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: var(--gray); }
.preview { max-height: 38dvh; overflow: auto; padding: 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--warm-white); font-size: 14px; white-space: pre-wrap; }
.meta { font-size: 13px; color: var(--mid-gray); }
.confirm-line { font-size: 13px; color: var(--mid-gray); }
.error { color: var(--late); font-weight: 600; }
.error:empty { display: none; }
.hint { font-size: 13px; color: var(--mid-gray); }
.field { display: grid; gap: 6px; font-weight: 600; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.muted { color: var(--mid-gray); }
.good { color: var(--good); }
.late-text { color: var(--late); }

.status { display: grid; gap: 4px; }
.line.warn { color: var(--soon); font-weight: 600; }
.badge { display: inline-block; padding: 1px 8px; border-radius: var(--radius-full); background: var(--off-white); font-size: 12px; font-weight: 600; }
.badge.soon { background: var(--soon-bg); color: var(--soon); }
.badge.late { background: var(--late-bg); color: var(--late); }
.facts { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.facts div { display: grid; grid-template-columns: 8rem 1fr; gap: 8px; align-items: baseline; }
.facts dt { font-size: 12px; color: var(--gray); }
.proofs { display: flex; flex-wrap: wrap; gap: 8px; }
.proof img { display: block; width: 120px; height: 80px; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border-strong); }
.credit-list { display: grid; gap: 8px; }
.credit-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.timeline { display: grid; gap: 12px; }
.timeline li { display: grid; gap: 2px; padding-left: 12px; border-left: 2px solid var(--gold-glow); }
.timeline time { font-size: 12px; color: var(--gray); }
.answers { display: grid; gap: 12px; }
.answers dt { font-size: 13px; font-weight: 600; color: var(--mid-gray); }
.answers dd { white-space: pre-wrap; }

.confirm-dialog { width: min(460px, calc(100vw - 24px)); }
.confirm { gap: 12px; padding: 28px 28px 22px; }
.confirm h2 { font-family: var(--font-display); font-weight: 500; font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; color: var(--near-black); }
.confirm-body { color: var(--mid-gray); line-height: 1.6; }
.confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.heads-up h2 { font-family: var(--font); font-weight: 700; font-size: 26px; letter-spacing: 0.04em; color: var(--late); }
.heads-up .eyebrow { color: var(--late); }
.heads-up .eyebrow::before { content: ''; width: 24px; height: 1px; background: var(--late); }


.eyebrow { display: inline-flex; align-items: center; gap: 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.32em; text-transform: uppercase; color: var(--gold-dark); }
.confirm .eyebrow::before { content: ''; width: 24px; height: 1px; background: var(--gold); }

.toasts {
  position: fixed;
  inset: auto auto max(16px, env(safe-area-inset-bottom)) 50%;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(480px, calc(100vw - 32px));
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  overflow: visible;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast { padding: 12px 16px; border-radius: 10px; background: var(--near-black); color: var(--white); font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); }
.toast.bad { background: var(--late); }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; display: grid; gap: 18px; padding: 32px clamp(20px, 5vw, 36px); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--white); }
.login-card .brand { padding-bottom: 18px; border-bottom: 1px solid var(--border-strong); color: var(--near-black); }
.login-card h1 { font-family: var(--font-display); font-weight: 500; font-size: 30px; color: var(--near-black); }
.login-form { display: grid; gap: 14px; }
.login-form .btn { width: 100%; }
.denied { font-size: 17px; font-weight: 600; color: var(--near-black); }
.fatal { padding: 48px 16px; text-align: center; color: var(--mid-gray); }
