/* TR4CK design system.
 *
 * Mobile is the real target -- this is used from a phone in a parked car --
 * so everything is sized for a thumb first and widened at 760px for desktop.
 *
 * Three typefaces, each with one job:
 *   Racing Sans One  every piece of display type -- titles, nav, labels,
 *                    buttons, table headings -- and always uppercase
 *   Orbitron         anything that is a number on a timer
 *   Inter            body text, notes, form fields
 * All three are served from /fonts so the app still looks right with no signal,
 * which matters for a PWA that gets opened in a moving car.
 */

/* ------------------------------- fonts --------------------------------- */

@font-face {
  font-family: 'Racing Sans One';
  src: url('/fonts/racing-sans-one.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Orbitron';
  src: url('/fonts/orbitron.woff2') format('woff2');
  font-weight: 500 900;          /* variable font, one file covers the range */
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

/* ------------------------------- tokens -------------------------------- */

:root {
  --green:      #00843D;
  --green-dark: #006B31;
  --green-soft: #E6F2EB;
  --red:        #BD202E;
  --red-dark:   #9C1A26;
  --red-soft:   #FBEAEB;

  /* Daytime is amber and nighttime is blue, picked at the same depth as the
   * green and red so the four read as one set rather than four borrowed
   * colours. Green stays the colour of a total. */
  --amber:      #D99400;
  --amber-dark: #A87300;
  --amber-soft: #FFF3DC;
  --blue:       #0B5FA5;
  --blue-dark:  #08497F;
  --blue-soft:  #E3EFFA;

  --ink:    #141414;
  --paper:  #FFFFFF;
  --bg:     #F2F2F2;
  --muted:  #58595B;
  --line:   #E2E2E2;
  --line-strong: #C9C9C9;

  /* LCD readout */
  --lcd-bg:    #0D0D0D;
  --lcd-green: #39FF6A;
  --lcd-amber: #FFC93F;
  --lcd-blue:  #55C2FF;
  --lcd-red:   #FF4D5C;
  --lcd-dim:   #7A7A7A;

  --font-title: 'Racing Sans One', 'Arial Narrow', system-ui, sans-serif;
  /* Same face as the titles -- one display type throughout, always
   * uppercase, because Racing Sans One's lowercase reads as a different
   * voice than its caps. */
  --font-label: var(--font-title);
  --font-timer: 'Orbitron', ui-monospace, 'Courier New', monospace;
  --font-body:  'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* One checker tile is two squares across and two down, so an element
   * exactly one tile tall shows a real two-row flag rather than a single
   * line of squares. */
  --check-tile: 22px;

  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 1px 3px rgba(0, 0, 0, .10), 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .22);

  --tap: 48px;                   /* minimum comfortable touch target */
}

/* ------------------------------- base ---------------------------------- */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  /* Stops the whole page rubber-banding on iOS while a lap is running. */
  overscroll-behavior-y: none;
}

[hidden] { display: none !important; }

h1, h2, h3 {
  font-family: var(--font-title);
  text-transform: uppercase;
  font-weight: 400;
  letter-spacing: .02em;
  line-height: 1.1;
  margin: 0;
}
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }

a { color: var(--green-dark); }

/* The small uppercase label used for nav, table headers and stat captions. */
.label {
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--muted);
}

.muted { color: var(--muted); }
.center { text-align: center; }

/* --------------------------- checkered flag ----------------------------- */

/* Two offset rows of squares. Height is exactly one tile so both rows show;
 * half a tile would read as a line of dots, which is not a flag. */
.checkers {
  height: var(--check-tile);
  background-image: repeating-conic-gradient(
    var(--ink) 0% 25%, var(--paper) 0% 50%);
  background-size: var(--check-tile) var(--check-tile);
  flex: none;
}
.checkers--thin { --check-tile: 16px; }
.checkers--thick { --check-tile: 28px; }

/* ------------------------------- shell --------------------------------- */

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.appbar {
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: env(safe-area-inset-top);
}

.appbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* The app name is always the mark, never set in a typeface -- no web font
 * draws the 4 with the flat-topped A shape the logo uses. */
/* Tagline beside the mark rather than under it -- the plate is a wide shape,
 * and stacking a line of text below made the lockup bottom-heavy. */
.brand { display: flex; flex-direction: row; align-items: center; gap: 9px; text-decoration: none; }
.brand-mark { display: block; height: 40px; width: auto; flex: none; }
.brand-tag {
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 8px;
  line-height: 1.35;
  letter-spacing: .1em;
  color: var(--muted);
  /* One line, never wrapped: left to itself it breaks after the "4" and
   * strands it on a line of its own. */
  white-space: nowrap;
}
@media (min-width: 760px) {
  .brand-mark { height: 46px; }
  .brand-tag { font-size: 9.5px; }
}

.appbar-actions { display: flex; align-items: center; gap: 8px; }

.view {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px calc(96px + env(safe-area-inset-bottom));
  outline: none;
}

.view-head { margin-bottom: 14px; }
.view-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------------------------- navigation -------------------------------- */

/* Phones get a thumb-reachable bar at the bottom; desktop moves the same
 * links up into the header. */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px 10px;
  min-height: var(--tap);
  text-decoration: none;
  color: var(--muted);
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .04em;
  border-top: 3px solid transparent;
  margin-top: -1px;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a[aria-current='page'] { color: var(--green); border-top-color: var(--green); }

.rail { display: none; }

@media (min-width: 760px) {
  .tabbar { display: none; }
  .rail { display: flex; gap: 6px; }
  .rail a {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--muted);
    font-family: var(--font-label);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .06em;
  }
  .rail a svg { width: 17px; height: 17px; }
  .rail a[aria-current='page'] { background: var(--green); color: #fff; }
  .view { padding-bottom: 40px; }
  h1 { font-size: 38px; }
}

/* ------------------------------- cards ---------------------------------- */

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card--flag { padding: 0; overflow: hidden; }
.card--flag > .card-body { padding: 16px; }
.card-title { margin-bottom: 10px; }

/* ------------------------------ LCD timer ------------------------------- */

.lcd {
  background: var(--lcd-bg);
  border-radius: var(--radius);
  padding: 20px 14px 14px;
  text-align: center;
  font-family: var(--font-timer);
  font-weight: 700;
  color: var(--lcd-green);
  text-shadow: 0 0 12px rgba(57, 255, 106, .5);
  font-variant-numeric: tabular-nums;
  /* Fixed digit width: the readout must not shuffle sideways as it counts. */
  font-feature-settings: 'tnum' 1;
  letter-spacing: .03em;
}
.lcd-value { font-size: clamp(38px, 13vw, 58px); line-height: 1; display: block; }
.lcd-label {
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--lcd-dim);
  text-shadow: none;
  margin-top: 9px;
  display: block;
}
.lcd--day   { color: var(--lcd-amber); text-shadow: 0 0 12px rgba(255, 201, 63, .5); }
.lcd--night { color: var(--lcd-blue);  text-shadow: 0 0 12px rgba(85, 194, 255, .5); }
.lcd--idle  { color: var(--lcd-dim); text-shadow: none; }

/* The three totals across the top of Track Record. */
.lcd-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
/* A grid column is minmax(auto, 1fr), and that auto minimum is the content's
 * max-content width -- so a readout too wide to fit pushes the column, and the
 * whole page, past the screen edge instead of shrinking. min-width:0 is what
 * lets the column actually take its third. */
.lcd-row .lcd { padding: 14px 6px 10px; min-width: 0; overflow: hidden; }
/* Sized so eight digits of HH:MM:SS still fit a third of a 360px phone. */
.lcd-row .lcd-value { font-size: clamp(13px, 4.3vw, 24px); letter-spacing: 0; }
.lcd-row .lcd-label { font-size: 8px; letter-spacing: .12em; margin-top: 7px; }

/* ------------------------------ buttons --------------------------------- */

.btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  padding: 13px 20px;
  min-height: var(--tap);
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: .06em;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform .06s ease, background .15s ease;
}
/* An inline SVG has no intrinsic size, so inside a flex button it collapses
 * to nothing unless it is given one. */
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

.btn--green { background: var(--green); }
.btn--green:hover { background: var(--green-dark); }
.btn--red { background: var(--red); }
.btn--red:hover { background: var(--red-dark); }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
}
.btn--ghost:hover { border-color: var(--ink); }
.btn--block { width: 100%; }
.btn--save { font-size: 16px; padding: 18px; }

/* Start and Stop -- deliberately the largest thing on the screen, and set in
 * the title face rather than the label face because they are the headline of
 * the whole app. */
.btn--lap {
  font-family: var(--font-title);
  font-size: clamp(26px, 8vw, 34px);
  letter-spacing: .02em;
  padding: 26px 16px;
  border-radius: 18px;
  flex: 1;
}
.lap-buttons { display: flex; gap: 12px; }

/* ----------------------------- form fields ------------------------------ */

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type='text'], input[type='email'], input[type='password'],
input[type='date'], input[type='time'], input[type='number'], textarea, select {
  width: 100%;
  font-family: var(--font-body);
  /* 16px minimum: anything smaller makes iOS Safari zoom the page on focus. */
  font-size: 16px;
  padding: 12px;
  min-height: var(--tap);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
textarea { min-height: 88px; resize: vertical; }

/* Checkbox groups render as tappable chips -- far easier than a small square
 * when the phone is being passed between two people in a car. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  min-height: 44px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-dark);
  font-weight: 600;
}
.chip:has(input:focus-visible) { outline: 3px solid var(--green); outline-offset: 2px; }

/* ------------------------------- tables --------------------------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.record {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
table.record th {
  font-family: var(--font-label);
  font-weight: 400;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--muted);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--ink);
  position: sticky;
  top: 0;
  background: var(--paper);
}
table.record td { padding: 11px 10px; border-bottom: 1px solid var(--line); }
table.record tbody tr:hover { background: var(--bg); }
table.record .num { font-family: var(--font-timer); font-variant-numeric: tabular-nums; }
/* Durations inside the table stay in the body font. The timer face is right
 * for a readout you glance at and wrong for a column you read down. Tabular
 * figures keep the decimal points lined up all the same. */
table.record .dur { font-variant-numeric: tabular-nums; }

/* ------------------------------ progress -------------------------------- */

.meter {
  height: 14px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width .4s ease;
}
.meter--day > span { background: var(--amber); }
.meter--night > span { background: var(--blue); }

/* ------------------------- modal / bottom sheet -------------------------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 760px) { .sheet-backdrop { align-items: center; } }

.sheet {
  background: var(--paper);
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-lg);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 760px) { .sheet { border-radius: var(--radius); } }

.sheet-head { padding: 16px 16px 0; }
.sheet-body { padding: 16px; }
.sheet-foot { padding: 0 16px 16px; }

/* ------------------------------- toast ---------------------------------- */

.toast-root {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
}
.toast--bad { background: var(--red); }
.toast--good { background: var(--green); }

/* ------------------------------- misc ----------------------------------- */

.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row--between { justify-content: space-between; }
.grow { flex: 1; }

/* A section title with actions beside it. On a phone the title takes its own
 * line -- side by side, a two-word heading wraps mid-phrase and collides with
 * the buttons. */
.section-head { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.section-head .row { justify-content: flex-start; }
@media (min-width: 560px) {
  .section-head { flex-direction: row; align-items: center; justify-content: space-between; }
}

.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
}
.empty h3 { color: var(--ink); margin-bottom: 6px; }

.placeholder {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
  background: var(--paper);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============================= accounts ================================== */

/* ------------------------- signed-out screens --------------------------- */

#login-root {
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px calc(32px + env(safe-area-inset-bottom));
}
@media (min-width: 560px) { #login-root { align-items: center; } }

.auth-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 460px;
  overflow: hidden;
}

.auth-head { padding: 26px 24px 20px; text-align: center; }
.auth-mark { display: block; margin: 0 auto; width: 150px; height: auto; }
.auth-tag {
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: .18em;
  color: var(--muted);
  margin: 10px 0 0;
}

.auth-body { padding: 22px 20px 24px; }
.auth-body h1 { font-size: 26px; margin-bottom: 16px; }
.auth-intro { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.auth-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  margin-top: 18px;
}

/* A button that reads as a link -- real buttons, so they are reachable by
 * keyboard and announced correctly. */
.linkish {
  background: none;
  border: 0;
  padding: 8px 4px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--green-dark);
  text-decoration: underline;
  cursor: pointer;
}
.linkish:hover { color: var(--ink); }

/* Which kind of account. Two cards rather than a dropdown: the choice decides
 * what the rest of the form asks for, so it should be impossible to miss. */
.role-pick { display: grid; gap: 10px; margin-bottom: 18px; }
.role {
  text-align: left;
  background: var(--paper);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  display: block;
}
.role.is-on { border-color: var(--green); border-width: 2px; background: var(--green-soft); padding: 13.5px; }
.role-title {
  display: block;
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: .05em;
  margin-bottom: 4px;
}
.role.is-on .role-title { color: var(--green-dark); }
.role-note { display: block; font-size: 13px; color: var(--muted); line-height: 1.45; }

.checkline { display: flex; align-items: center; gap: 10px; margin: 4px 0 18px; cursor: pointer; font-size: 15px; }
.checkline input { width: 20px; height: 20px; accent-color: var(--green); }

.hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.form-error {
  background: var(--red-soft);
  border: 1.5px solid var(--red);
  color: var(--red-dark);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin: 0 0 16px;
  font-size: 14px;
}

/* Only ever rendered by the local dev fallback when no mail provider is set. */
.dev-note {
  background: var(--bg);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 13px;
  margin-top: 16px;
  word-break: break-all;
}

/* --------------------------- settings menu ------------------------------- */

.btn--icon { padding: 12px; }

.who {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.who strong { font-size: 17px; }
.who .muted { font-size: 14px; }

.pill {
  align-self: flex-start;
  margin-top: 6px;
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 4px 11px;
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .08em;
}

.menu { list-style: none; margin: 0; padding: 0; }
.menu li + li { border-top: 1px solid var(--line); }
.menu button, .menu a {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 14px 4px;
  min-height: var(--tap);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  font-family: var(--font-body);
}
.menu button:hover, .menu a:hover { background: var(--bg); }
.menu-label { display: block; font-size: 15.5px; }
.menu-note {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.people { list-style: none; margin: 0; padding: 0; }
.people li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}
.people li + li { border-top: 1px solid var(--line); }

/* The link code, made to be read aloud across a kitchen. */
.code-box {
  background: var(--lcd-bg);
  border-radius: var(--radius);
  padding: 22px 12px;
  text-align: center;
  margin: 16px 0 10px;
}
.code {
  font-family: var(--font-timer);
  font-weight: 700;
  font-size: clamp(26px, 9vw, 38px);
  letter-spacing: .08em;
  color: var(--lcd-green);
  text-shadow: 0 0 12px rgba(57, 255, 106, .5);
}

/* --------------------------- driver picker ------------------------------- */

.driver-strip { background: var(--bg); border-bottom: 1px solid var(--line); }
.driver-strip-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  max-width: 1100px;
  margin: 0 auto;
}
.driver-select {
  flex: 1;
  min-height: 40px;
  padding: 6px 10px;
  font-size: 15px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  background: var(--paper);
  max-width: 320px;
}

/* ================================ laps =================================== */

/* The elapsed time and clock range at the top of the Lap Complete form. */
.lap-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.lap-summary-time {
  font-family: var(--font-timer);
  font-weight: 700;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}

.lap-list { list-style: none; margin: 0; padding: 0; }
.lap-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.lap-list li + li { margin-top: 8px; }
.lap-list-time {
  font-family: var(--font-timer);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

/* Laps held on the phone because the save could not reach the server. Amber
 * rather than red: nothing is lost, it just has not landed yet. */
.queue-card {
  background: #FFF7E6;
  border: 1.5px solid #E0A000;
  box-shadow: none;
}
.queue-card h3 { font-size: 15px; }

/* ============================ track record =============================== */

/* The date column stays put while the rest scrolls, so you never lose track of
 * which drive a row belongs to on a phone. */
table.record th:first-child,
table.record td:first-child {
  position: sticky;
  left: 0;
  background: var(--paper);
  z-index: 1;
}
table.record th:first-child { z-index: 2; }
table.record tbody tr:hover td:first-child { background: var(--bg); }
table.record tbody tr { cursor: pointer; }
table.record tbody tr:focus-visible { outline: 3px solid var(--green); outline-offset: -3px; }

.notes-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Lap detail, as a definition list so it reads correctly when announced. */
.detail { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 0; }
/* Both cells stretch to the full row height. Centring the label instead
 * shrinks its box, which drops its top border below the value's and leaves the
 * dividing rule broken in the middle -- visibly so on any row whose value
 * wraps. The label sitting level with the first line of the value is also the
 * more usual way round. */
.detail dt {
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 12px 10px 12px 0;
  border-top: 1px solid var(--line);
  /* Nudges the small caps onto the same baseline as the larger value. */
  line-height: 1.7;
}
.detail dd {
  margin: 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.detail dt:first-of-type, .detail dd:first-of-type { border-top: 0; }

/* ============================== the printout ============================== */

.print-sheet {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 0 0 22px;
  color: var(--ink);
}
.print-head { padding: 20px 22px 0; }
.print-head h2 { margin-bottom: 14px; }
/* Label above the value, not beside it. Side by side, a long name wraps
 * under its own label and the line reads as two fields rather than one --
 * on the one line of this document that has to be unambiguous. */
.print-driver p {
  margin: 0 0 10px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.print-driver strong { font-size: 17px; }
@media (min-width: 520px) {
  .print-driver p { flex-direction: row; align-items: baseline; gap: 10px; }
}
.print-field-label {
  flex: none;
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--muted);
  margin-right: 10px;
}

.print-lessons { padding: 16px 22px 0; }
.print-lessons h3 { font-size: 14px; margin-bottom: 8px; }
.print-lesson-list {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 26px;
  font-size: 12.5px;
  line-height: 1.55;
}
@media (max-width: 560px) { .print-lesson-list { columns: 1; } }

.print-note { padding: 14px 22px 0; margin: 0; font-size: 13px; }

.print-table {
  width: calc(100% - 44px);
  margin: 14px 22px 0;
  border-collapse: collapse;
  font-size: 12px;
}
.print-table th, .print-table td {
  border: 1px solid var(--line-strong);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.print-table thead th, .print-table tfoot th {
  font-family: var(--font-label);
  font-weight: 400;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: .06em;
  background: var(--bg);
}
.print-table .num { font-variant-numeric: tabular-nums; text-align: right; }

.print-sign { padding: 20px 22px 0; }
.print-sign h3 { font-size: 14px; margin-bottom: 6px; }
.print-sign p { font-size: 12.5px; margin: 0 0 10px; line-height: 1.5; }
.print-figures { font-size: 13px !important; }
.print-sign-lines {
  display: flex;
  gap: 26px;
  margin-top: 30px;
  font-size: 11px;
  color: var(--muted);
}
.print-sign-lines span {
  border-top: 1px solid var(--ink);
  padding-top: 5px;
  flex: 1;
}
.print-sign-lines span:last-child { flex: 0 0 120px; }

.print-footer {
  padding: 20px 22px 0;
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

@media print {
  /* Everything that is app rather than document disappears. */
  .appbar, .tabbar, .rail, .toast-root, .sheet-backdrop,
  .print-hide, .driver-strip { display: none !important; }

  body { background: #fff; font-size: 11pt; }
  .view { padding: 0; max-width: none; }
  .print-sheet { box-shadow: none; border-radius: 0; padding: 0; }
  .print-head, .print-lessons, .print-note, .print-sign, .print-footer { padding-left: 0; padding-right: 0; }
  .print-table { width: 100%; margin-left: 0; margin-right: 0; }

  /* Repeat the column headings when the log runs over a page. */
  .print-table thead { display: table-header-group; }
  .print-table tr { break-inside: avoid; }
  /* Keep a signature block from being split across a page break. */
  .print-sign { break-inside: avoid; }

  @page { margin: 14mm; }
}

/* The escape hatch at the top of the Lap Complete form. Set apart from the
 * fields below it so it does not read as part of filling the form in. */
.keep-driving {
  margin-bottom: 18px;
  border-style: dashed;
}

/* =============================== goals =================================== */

.goal-row { margin-bottom: 16px; }
.goal-row:last-child { margin-bottom: 0; }

.goal-figure {
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink);
  white-space: nowrap;
  flex: none;
}
.goal-figure.is-met { color: var(--green-dark); }
.goal-tick { margin-left: 3px; }

/* A milestone that has been reached. Green because it is a finished total,
 * same as the green readout on Track Record. */
.met-pill {
  display: inline-block;
  vertical-align: 3px;
  margin-left: 8px;
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  font-family: var(--font-label);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .1em;
}

/* The per-lesson list runs to thirteen bars, so it gets tighter spacing than
 * the milestone cards to stay scannable. */
.card .goal-row + .goal-row { margin-top: 0; }

/* Edit sits beside its milestone heading rather than stretching under it: a
 * single small action, not a row of equals. */
.goal-row + .goal-row { margin-top: 0; }

/* Typed in upper case as you go. The server uppercases it too -- this is so
 * the field never appears to change its mind after you save. */
input.upper { text-transform: uppercase; }

/* The key under the Track Record table, explaining the skill numbers in its
 * Skills column. Two columns wherever there is room, so thirteen lines do not
 * push the page down. */
.lesson-key { margin-top: 12px; }
.lesson-key h3 { font-size: 14px; margin-bottom: 10px; }
.lesson-key ol {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 26px;
  font-size: 13px;
  line-height: 1.6;
}
.lesson-key li { break-inside: avoid; }
.lesson-key strong { color: var(--muted); margin-right: 3px; }
@media (max-width: 480px) { .lesson-key ol { columns: 1; } }

/* ------------------------- password reveal ------------------------------- */

.password-wrap { position: relative; display: block; }
/* Room for the button, so a long password never runs underneath it. */
.password-wrap input { padding-right: 48px; }

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 46px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.password-toggle:hover { color: var(--ink); }
.password-toggle svg { width: 20px; height: 20px; }
.password-toggle:focus-visible { outline: 3px solid var(--green); outline-offset: -3px; }
/* Pressed means the password is currently on screen, which is worth showing. */
.password-toggle[aria-pressed='true'] { color: var(--green-dark); }

/* A quiet line under the header while an email is unconfirmed. Amber, not red:
 * nothing is broken, something is merely waiting. */
.verify-strip {
  background: #FFF7E6;
  border-bottom: 1px solid #E0A000;
  padding: 9px 16px;
  font-size: 13.5px;
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  max-width: 1100px;
  margin: 0 auto;
}
.verify-strip .linkish { font-size: 13.5px; padding: 0; }
