/* Roundtrip. Plain CSS, no build step.
   Rules of the house (spec section 6): body text never below 18px, high
   contrast, and nothing that only appears on hover. */

:root {
  --ink: #111418;
  --ink-soft: #3a4048;
  --paper: #ffffff;
  --wash: #f2f4f7;
  --line: #5c6672;
  --brand: #0b3d91;
  --brand-ink: #ffffff;
  --danger: #9b1c1c;
  --ok-bg: #e3f4e6;
  --ok-ink: #0f4a1f;
  --warn-bg: #fff3c4;
  --warn-ink: #4d3800;
  --error-bg: #fde4e4;
  --error-ink: #7a1212;
  --focus: #b35c00;
  --radius: 6px;
}

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

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

body.driver { font-size: 1.125rem; }

a { color: var(--brand); text-decoration: underline; text-underline-offset: 0.15em; }

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

.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 0.5rem 1rem; }
.skip:focus { left: 0; z-index: 10; }

h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 1rem; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
p { margin: 0 0 1rem; }
small, .small { font-size: 1rem; color: var(--ink-soft); }

/* ---- header and navigation */

.site-header { background: var(--brand); color: var(--brand-ink); }
.site-header .inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.25rem; padding: 0.5rem 1rem; max-width: 80rem; margin: 0 auto; }
.site-name { font-weight: 700; font-size: 1.25rem; color: var(--brand-ink); text-decoration: none; margin-right: 0.5rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; flex: 1; }
.site-nav a, .site-nav button {
  color: var(--brand-ink); background: transparent; border: 2px solid transparent; border-radius: var(--radius);
  font: inherit; padding: 0.55rem 0.8rem; min-height: 48px; display: inline-flex; align-items: center; cursor: pointer;
  text-decoration: underline; text-underline-offset: 0.2em;
}
.site-nav a[aria-current="page"] { border-color: var(--brand-ink); text-decoration: none; font-weight: 700; }
.site-nav form { margin: 0 0 0 auto; }
.site-nav :focus-visible { outline-color: #ffffff; }

main { max-width: 80rem; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
body.driver main, body.narrow main { max-width: 40rem; }

/* ---- messages */

.messages { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.messages li, .notice { border: 2px solid var(--line); border-left-width: 10px; border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 0.75rem; background: var(--wash); }
.messages .success, .notice.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-ink); }
.messages .warning, .notice.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-ink); }
.messages .error, .notice.error { background: var(--error-bg); color: var(--error-ink); border-color: var(--error-ink); }
.notice h2, .notice h3 { margin-top: 0; }
.notice ul { margin: 0.25rem 0 0.5rem; padding-left: 1.25rem; }

/* ---- buttons */

.button, button.button, input[type="submit"].button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0.6rem 1.1rem; font: inherit; font-weight: 600; text-decoration: none;
  color: var(--brand-ink); background: var(--brand); border: 2px solid var(--brand); border-radius: var(--radius); cursor: pointer;
}
.button.secondary { color: var(--brand); background: var(--paper); }
.button.danger { background: var(--danger); border-color: var(--danger); color: #ffffff; }
.button.danger.secondary { background: var(--paper); color: var(--danger); }
body.driver .button { min-height: 60px; width: 100%; font-size: 1.2rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0; align-items: center; }
.actions form { margin: 0; }
body.driver .actions { flex-direction: column; align-items: stretch; }

/* ---- forms */

label, legend { font-weight: 600; display: block; margin-bottom: 0.25rem; }
fieldset { border: 2px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem 1rem; margin: 0 0 1.25rem; }
legend { padding: 0 0.4rem; font-size: 1.1rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input[type="time"], input[type="datetime-local"], input[type="search"], input[type="tel"], select, textarea {
  font: inherit; color: var(--ink); background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 0.55rem 0.7rem; min-height: 48px; width: 100%; max-width: 32rem;
}
textarea { min-height: 6rem; }
body.driver input, body.driver select, body.driver textarea { min-height: 56px; font-size: 1.2rem; max-width: none; }
input[type="checkbox"], input[type="radio"] { width: 1.5rem; height: 1.5rem; margin: 0 0.6rem 0 0; vertical-align: middle; accent-color: var(--brand); }
.field { margin-bottom: 1.1rem; }
.field.check label, .choice label { display: flex; align-items: center; font-weight: 400; min-height: 48px; margin: 0; }
.field .help { color: var(--ink-soft); margin: 0.2rem 0 0; }
.errorlist { list-style: none; margin: 0.25rem 0; padding: 0; color: var(--error-ink); font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--error-ink); border-width: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 1.5rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: flex-end; background: var(--wash); border: 2px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1.25rem; }
.filters .field { margin: 0; min-width: 10rem; }
.filters input, .filters select { max-width: 14rem; }

/* ---- tables (dispatcher) */

.table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; vertical-align: top; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); }
thead th { border-bottom: 3px solid var(--ink); white-space: nowrap; }
tbody tr:nth-child(even) { background: var(--wash); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.flag td { background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }
.empty { padding: 1rem; background: var(--wash); border: 2px dashed var(--line); border-radius: var(--radius); }

/* ---- small pieces */

.tag { display: inline-block; padding: 0.1rem 0.55rem; border: 2px solid var(--ink); border-radius: 999px; font-size: 1rem; font-weight: 600; white-space: nowrap; background: var(--paper); color: var(--ink); }
.tag.medical { background: var(--ink); color: var(--paper); }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-ink); }
.tag.bad { background: var(--error-bg); color: var(--error-ink); border-color: var(--error-ink); }
.tag.good { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-ink); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.stats li { border: 2px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; }
.stats .value { display: block; font-size: 1.8rem; font-weight: 700; line-height: 1.1; }

.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: 0 2rem; }

dl.facts { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: 0.4rem 1rem; margin: 0 0 1.5rem; }
dl.facts dt { font-weight: 600; color: var(--ink-soft); }
dl.facts dd { margin: 0; }
body.driver dl.facts { grid-template-columns: 1fr; gap: 0; }
body.driver dl.facts dt { margin-top: 0.9rem; }
body.driver dl.facts dd { font-size: 1.3rem; font-weight: 600; }

/* ---- driver cards */

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.card { border: 2px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--paper); }
.card .when { font-size: 1.35rem; font-weight: 700; display: block; }
.card .where { display: block; margin: 0.25rem 0 0.75rem; }

.pagination { display: flex; gap: 1rem; align-items: center; margin: 1rem 0; }

@media (max-width: 40rem) {
  h1 { font-size: 1.5rem; }
  /* Name on its own line, links flowing beneath it, so the header stays short. */
  .site-header .inner { display: block; padding: 0.4rem 0.6rem; }
  .site-name { display: block; padding: 0.2rem 0.4rem; }
  .site-nav { gap: 0; }
  .site-nav a, .site-nav button { padding: 0.5rem 0.4rem; }
  .site-nav form { margin-left: 0; }
}
