:root {
  /* Palette. Fixed by the brief; nothing outside this block introduces a
     colour, and every text pair is contrast-checked in the test suite. */
  --brand:       #12324a;   /* top bar and brand */
  --brand-dark:  #0d2537;   /* brand, pressed */
  --brand-tint:  #eaeff4;
  --text:        #17202a;   /* primary text */
  --text-muted:  #667085;   /* secondary text */
  --bg:          #f5f7fa;   /* page */
  --surface:     #ffffff;   /* content */
  --line:        #d9e1e8;   /* borders and rules */
  --accent:      #2e6f73;   /* primary action and links */
  --accent-dark: #255c60;   /* primary action, hovered */
  --ok:          #207a55;   /* success */
  --warn:        #9a6700;   /* warning, and a duplicate hit */
  --bad:         #b42318;   /* error and destructive */

  /* Tints, derived from the five status hues above rather than invented. */
  --ok-tint:   #e8f4ee;
  --warn-tint: #fdf8ef;
  --bad-tint:  #fbebe9;
  --idle:      #667085;
  --idle-tint: #f5f7fa;

  /* A border dark enough to clear 3:1 against white, which --line is not:
     --line draws decorative rules, --line-control draws interactive edges. */
  --line-control: #828fa1;

  /* Focus. Two values, because one hue cannot clear 3:1 against both a
     white field and the navy bar. */
  --focus: #b4530c;
  --focus-on-dark: #ffc178;

  /* Spacing: 4 / 8 / 12 / 16 / 24 / 32. Nothing between, nothing beyond. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;

  /* Type scale, fixed by the brief. */
  --t-status: 12px;   /* status labels */
  --t-help: 13px;     /* supporting text */
  --t-body: 14px;     /* body, table cells, buttons, labels */
  --t-card: 16px;     /* card and table titles */
  --t-section: 18px;  /* section headings */
  --t-page: 24px;     /* page title */
  --t-metric: 30px;   /* dashboard figures */

  --lh-page: 1.3;
  --lh-section: 1.35;
  --lh-body: 1.5;
  --lh-table: 1.4;
  --lh-help: 1.4;
  --lh-button: 1;

  --radius: 6px;      /* controls */
  --radius-lg: 8px;   /* containers */

  --control-h: 40px;
  --control-h-sm: 32px;

  /* Local system stacks only: a web font is a cross-origin request the CSP
     blocks, and would flash unstyled Chinese text besides. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono",
    "Courier New", monospace;

  /* Derived accents. Declared here so that no rule anywhere else in the
     file contains a colour literal. */
  --brand-accent: #7fb2dd;  /* current-tab marker on the navy bar */
  --ok-line:     #bfdac9;
  --warn-line:   #e3d2ab;
  --bad-line:    #e6c6c4;
  --accent-line: #c2d4e4;

  --shadow-chrome: 0 1px 0 rgba(23, 32, 42, 0.1);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  /* Chinese punctuation sits better with this off. */
  font-kerning: none;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}
h1 { font-size: var(--t-page); line-height: var(--lh-page); }
h2 { font-size: var(--t-section); line-height: var(--lh-section); }
h3, h4 { font-size: var(--t-card); line-height: var(--lh-section); }
p { margin: 0 0 var(--s3); }
ul, ol { margin: 0 0 var(--s3); padding-left: 1.4em; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }

hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }

/* A visible focus ring on everything interactive. Removing it makes the
 * application unusable by keyboard, which is not a trade worth making for
 * the appearance of a cleaner click. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--s3);
  top: -3rem;
  z-index: 100;
  padding: var(--s2) var(--s4);
  background: var(--surface);
  color: var(--accent);
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  transition: top 0.12s ease-out;
}
.skip-link:focus { top: var(--s3); }

/* The header is dark; the light-surface focus colour would barely show. */
.site-header :focus-visible { outline-color: var(--focus-on-dark); }

/* ==================================================================== */
/* Chrome                                                               */
/* ==================================================================== */
.container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 var(--s5);
}

.site-main { padding: var(--s5) 0 var(--s6); outline: none; }

.site-header {
  background: var(--brand);
  color: var(--surface);
  box-shadow: var(--shadow-chrome);
}
.site-header__bar {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 var(--s5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s5);
  min-height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s2);
  color: var(--surface);
  font-weight: 600;
  font-size: var(--t-card);
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--surface); text-decoration: none; }
.brand__mark {
  width: 6px;
  height: 18px;
  background: var(--brand-accent);
  border-radius: 1px;
}

.nav-toggle {
  margin-left: auto;
  align-self: center;
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: var(--radius);
  padding: var(--s2) var(--s3);
  cursor: pointer;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 16px; height: 2px;
  background: var(--surface);
  content: "";
}
.nav-toggle__bars::before { transform: translateY(-5px); }
.nav-toggle__bars::after { transform: translateY(3px); }

.site-nav {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s5);
  justify-content: space-between;
}
.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  margin: 0; padding: 0;
}
.site-nav__list a {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 var(--s3);
  color: rgba(255, 255, 255, 0.82);
  font-size: var(--t-body);
  line-height: var(--lh-button);
  text-decoration: none;
  border-radius: var(--radius);
}
/* The current tab is marked with an inset rule rather than a border, so
   the marker cannot change the link's height or nudge its neighbours. */
.site-nav__list a.is-current {
  box-shadow: inset 0 -2px 0 var(--brand-accent);
}
.site-nav__list a:hover { color: var(--surface); background: rgba(255, 255, 255, 0.08); }
.site-nav__list a.is-current {
  color: var(--surface);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
}

.site-nav__account {
  display: flex;
  align-items: center;
  gap: var(--s4);
  font-size: var(--t-help);
  /* Two lines of account text still centre as one block. */
  align-self: center;
}
.site-nav__account a { color: rgba(255, 255, 255, 0.82); text-decoration: none; }
.site-nav__account a:hover { color: var(--surface); text-decoration: underline; }
.site-nav__account form { margin: 0; }
.site-nav__user {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  color: var(--surface);
  padding-left: var(--s4);
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}
.site-nav__role { color: rgba(255, 255, 255, 0.68); font-size: var(--t-status); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: var(--s4) 0;
  color: var(--text-muted);
  font-size: var(--t-status);
}
.site-footer p { margin: 0; }

/* ==================================================================== */
/* Page structure                                                       */
/* ==================================================================== */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s4);
  padding-bottom: var(--s3);
  margin-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
}
.page-head__meta {
  color: var(--text-muted);
  font-size: var(--t-help);
  line-height: var(--lh-help);
  margin: var(--s2) 0 0;
}
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--s2); }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  list-style: none;
  margin: 0 0 var(--s2);
  padding: 0;
  font-size: var(--t-status);
  color: var(--text-muted);
}
.crumbs li::after { content: "/"; margin-left: var(--s2); color: var(--line); }
.crumbs li:last-child::after { content: none; }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

/* A section is a heading and a rule, not another box inside a box. */
.section { margin-top: var(--s6); }
.section:first-child { margin-top: 0; }
.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  padding-bottom: var(--s2);
  margin-bottom: var(--s3);
  border-bottom: 1px solid var(--line);
}
.section__note { color: var(--text-muted); font-size: var(--t-help); }

.muted { color: var(--text-muted); }
.small { font-size: var(--t-help); line-height: var(--lh-help); }
.mono, code { font-family: var(--font-mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }

/* Reserved for genuinely self-contained objects: the login panel, a
 * profile block, an empty state. Not a default wrapper. */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.panel__head {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-size: var(--t-help);
  font-weight: 600;
  color: var(--text);
}
.panel__body { padding: var(--s4); }

.columns {
  display: grid;
  gap: var(--s5);
  align-items: start;
}
/* Grid items default to min-width:auto, which means a column refuses to
 * shrink below the min-content width of what it holds - and a table inside
 * .table-wrap still contributes its full min-content even though it has its
 * own scrollbar. Without this the whole page scrolls sideways on a phone
 * instead of just the table. */
.columns > * { min-width: 0; }
@media (min-width: 960px) {
  .columns--detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .columns--aside { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

/* ==================================================================== */
/* Metric strip                                                         */
/* ==================================================================== */
/* One bordered strip divided by hairlines, rather than N floating cards.
 * Same information, one object instead of six, and it stops the page
 * looking like a template with placeholder tiles. */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  /* Every tile in a strip gets the same height, so a two-line label cannot
     leave one cell taller than its neighbours. */
  grid-auto-rows: 1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 88px;
  padding: var(--s4);
  border-left: 1px solid var(--line);
}
.metric:first-child { border-left: 0; }
.metric__value {
  font-size: var(--t-metric);
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.metric__label {
  color: var(--text-muted);
  font-size: var(--t-help);
  font-weight: 400;
  line-height: var(--lh-help);
  margin-top: var(--s1);
}
.metric--quiet .metric__value { font-size: var(--t-section); color: var(--text); }
.metric--action { gap: var(--s2); align-items: flex-start; justify-content: center; }
.metric--action .btn { min-height: 40px; }
.metric--action .metric__label { margin-top: 0; }
.metric--flag .metric__value { color: var(--bad); }

/* ==================================================================== */
/* Fact bar                                                             */
/* ==================================================================== */
/* The handful of facts a reader needs before deciding what to do next,
 * on one line. Deliberately not six separate cards: it is one object. */
.factbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: var(--s5);
}
.fact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 68px;
  padding: var(--s3) var(--s4);
  border-left: 1px solid var(--line);
  min-width: 0;
}
.fact:first-child { border-left: 0; }
.fact__label { color: var(--text-muted); font-size: var(--t-status); margin-bottom: var(--s1); }
.fact__value {
  font-size: var(--t-help);
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.fact__value .status { font-weight: 600; font-size: var(--t-help); }

/* ==================================================================== */
/* Tables                                                               */
/* ==================================================================== */
/* Wrapped in .table-wrap so a wide table scrolls inside the page rather
 * than pushing the whole layout sideways on a narrow screen. */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
table { width: 100%; border-collapse: collapse; font-size: var(--t-body); line-height: var(--lh-table); }
/* A name is a single token for reading purposes; letting it wrap per word
   in a squeezed column is what made "Juan Miguel Santos" take three lines
   on a phone. */
td.primary-cell > a, td.primary-cell { overflow-wrap: normal; }
td.primary-cell > a { white-space: nowrap; }
caption {
  text-align: left;
  padding: var(--s3) var(--s4) 0;
  color: var(--text-muted);
  font-size: var(--t-status);
}
thead th {
  padding: var(--s3) var(--s4);
  text-align: left;
  font-size: var(--t-help);
  font-weight: 600;
  line-height: var(--lh-table);
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: var(--s3) var(--s4);
  text-align: left;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
tbody tr:first-child td { border-top: 0; }
tbody tr:hover td { background: var(--bg); }

td.numeric, th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
td.actions, th.actions { text-align: right; }
/* The identifying column carries the weight; everything else is support. */
td.primary-cell { font-weight: 600; color: var(--text); }
td.primary-cell a { text-decoration: none; }
td.primary-cell a:hover { text-decoration: underline; }
.cell-sub { display: block; font-weight: 400; color: var(--text-muted); font-size: var(--t-status); margin-top: 1px; }
.cell-actions { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: flex-end; }
.inline-form { display: inline; margin: 0; }

/* Long emails and position names must not set the column width. */
.truncate {
  display: block;
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.truncate--wide { max-width: 30ch; }

/* ==================================================================== */
/* Status                                                               */
/* ==================================================================== */
/* A dot plus a word. Not a filled pill: a table with eight pills per
 * screen reads as decoration, and colour alone would be the only carrier
 * of meaning. The word is always present. */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-status);
  font-weight: 500;
  line-height: var(--lh-help);
  color: var(--text);
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--idle);
  flex: none;
}
.status--new::before { background: var(--accent); }
.status--screening::before,
.status--interviewing::before { background: var(--warn); }
.status--interview_pending::before { background: var(--warn); }
.status--offered::before,
.status--succeeded::before { background: var(--ok); }
.status--rejected::before,
.status--failed::before { background: var(--bad); }
.status--running::before { background: var(--accent); }

/* A tag is for a standing property (blacklisted, encrypted), not a
 * workflow state. Square-ish, bordered, no fill gradient. */
.tag {
  display: inline-block;
  padding: 0 var(--s2);
  border-radius: var(--radius);
  border: 1px solid;
  font-size: var(--t-status);
  line-height: 20px;
  font-weight: 500;
  white-space: nowrap;
}
.tag--neutral { color: var(--idle); background: var(--idle-tint); border-color: var(--line); }
.tag--danger  { color: var(--bad);  background: var(--bad-tint);  border-color: var(--bad-line); }
.tag--warning { color: var(--warn); background: var(--warn-tint); border-color: var(--warn-line); }
.tag--success { color: var(--ok);   background: var(--ok-tint);   border-color: var(--ok-line); }
.tag--info    { color: var(--accent); background: var(--brand-tint); border-color: var(--accent-line); }

/* ==================================================================== */
/* Buttons                                                              */
/* ==================================================================== */
/* Default is the quiet outline button. Exactly one primary per screen,
 * so the eye has somewhere to go. */
.btn, button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h);
  padding: 0 var(--s4);
  font-family: inherit;
  font-size: var(--t-body);
  font-weight: 500;
  line-height: var(--lh-button);
  border-radius: var(--radius);
  border: 1px solid var(--line-control);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover, button:hover, input[type="submit"]:hover {
  background: var(--bg);
  border-color: var(--text-muted);
  color: var(--text);
  text-decoration: none;
}
.btn:active, button:active { background: var(--line); }

.btn--primary, button.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--surface);
  font-weight: 600;
}
.btn--primary:hover, button.btn--primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: var(--surface);
}

.btn--danger, button.btn--danger {
  background: var(--surface);
  border-color: var(--bad-line);
  color: var(--bad);
}
.btn--danger:hover, button.btn--danger:hover {
  background: var(--bad-tint);
  border-color: var(--bad);
  color: var(--bad);
}

.btn--ghost, button.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
}
.btn--ghost:hover, button.btn--ghost:hover { background: var(--brand-tint); color: var(--accent-dark); }

.btn--small, button.btn--small {
  height: var(--control-h-sm);
  padding: 0 var(--s3);
  font-size: var(--t-help);
}

.btn.is-disabled, button[disabled], input[type="submit"][disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg);
  color: var(--text-muted);
  border-color: var(--line);
}
.btn.is-disabled:hover, button[disabled]:hover { background: var(--bg); border-color: var(--line); }

/* Kept for legacy call sites; renders as the default quiet button. */
.btn--quiet { background: var(--surface); color: var(--text); border-color: var(--line-control); }

/* ==================================================================== */
/* Forms                                                                */
/* ==================================================================== */
.form { max-width: 44rem; }
.form--narrow { max-width: 24rem; }
.form--wide { max-width: none; }

.field { margin-bottom: var(--s4); }
.field > label {
  display: block;
  font-size: var(--t-body);
  font-weight: 500;
  line-height: var(--lh-body);
  color: var(--text);
  margin-bottom: var(--s1);
}

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], input[type="tel"], input[type="url"],
select, textarea {
  width: 100%;
  height: var(--control-h);
  font-family: inherit;
  font-size: var(--t-body);
  line-height: var(--lh-body);
  color: var(--text);
  padding: 0 var(--s3);
  background: var(--surface);
  border: 1px solid var(--line-control);
  border-radius: var(--radius);
}
input[type="file"] {
  width: 100%;
  font-family: inherit;
  font-size: var(--t-body);
  padding: var(--s2) var(--s3);
  background: var(--surface);
  border: 1px dashed var(--line-control);
  border-radius: var(--radius);
}
select { padding-right: var(--s2); }
textarea { height: auto; min-height: 5.5rem; padding: var(--s2) var(--s3); resize: vertical; line-height: var(--lh-body); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }

input:hover, select:hover, textarea:hover { border-color: var(--text-muted); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }

input[type="checkbox"], input[type="radio"] { width: auto; height: auto; margin: 0; }

/* A checkbox reads as a single statement with its label, not as a heading
 * above an unlabelled box. */
.field--checkbox > label,
.field__inline {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-help);
  font-weight: 400;
  color: var(--text);
  margin-bottom: 0;
}

.field--invalid input, .field--invalid select, .field--invalid textarea {
  border-color: var(--bad);
  background: var(--bad-tint);
}
.field__help { margin: var(--s1) 0 0; color: var(--text-muted); font-size: var(--t-status); line-height: 1.5; }
.field__error {
  margin: var(--s1) 0 0;
  padding-left: var(--s2);
  border-left: 2px solid var(--bad);
  color: var(--bad);
  font-size: var(--t-status);
  font-weight: 600;
}

/* Field groups give a long form a reading rhythm. */
.fieldset { border: 0; margin: 0 0 var(--s5); padding: 0; }
.fieldset__legend {
  display: block;
  width: 100%;
  padding: 0 0 var(--s2);
  margin-bottom: var(--s4);
  border-bottom: 1px solid var(--line);
  font-size: var(--t-help);
  font-weight: 600;
  color: var(--text);
}
.field-row { display: grid; gap: var(--s4); }
@media (min-width: 720px) {
  .field-row--2 { grid-template-columns: 1fr 1fr; }
  .field-row--3 { grid-template-columns: 1fr 1fr 1fr; }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: center;
  padding-top: var(--s4);
  margin-top: var(--s4);
  border-top: 1px solid var(--line);
}
/* A short panel form does not need a rule separating two fields from one
   button; the panel edge already does that job. */
.form-actions--plain { padding-top: 0; margin-top: var(--s4); border-top: 0; }
.auth .form-actions--plain { margin-top: var(--s5); }
.auth .form-actions--plain button { width: 100%; }

/* Filter bar: the search field leads, the rest are qualifiers. */
.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s4);
  margin-bottom: var(--s4);
}
.filters__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s3) var(--s4);
  align-items: end;
}
.filters .field { margin-bottom: 0; }
/* The free-text search leads the filter bar and gets double width. Matched
   with :first-of-type, not :first-child: the form partial emits hidden
   inputs ahead of the first field, so :first-child matched nothing. */
.filters__row > .field:first-of-type { grid-column: span 2; }
/* Desktop: the panel has no collapse control and stays open. The markup
   ships open, so a browser with no JavaScript shows every filter on every
   screen; app.js folds it away on a phone, where it would otherwise push
   the data two screens down. */
.filters__summary { display: none; }

.filters__actions {
  display: flex;
  gap: var(--s2);
  align-items: center;
  padding-top: var(--s3);
  margin-top: var(--s3);
  border-top: 1px solid var(--line);
}

/* ==================================================================== */
/* Decision choices                                                     */
/* ==================================================================== */
/* Three mutually exclusive actions, each with its consequence written
 * next to it. Side by side so the destructive one is never the only thing
 * on screen, and never the default. */
.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s4);
}
.choice {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin: 0;
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.choice__title { margin: 0; font-size: var(--t-body); }
.choice__hint { margin: 0; color: var(--text-muted); font-size: var(--t-help); flex: 1 1 auto; }
.choice .field { margin-bottom: 0; }
.choice button { align-self: flex-start; }

/* ==================================================================== */
/* Messages, empty and error states                                     */
/* ==================================================================== */
.messages { margin-bottom: var(--s4); }
.alert {
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-control);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: var(--t-help);
  margin-bottom: var(--s2);
}
.alert:last-child { margin-bottom: 0; }
.alert--success { background: var(--ok-tint);   border-color: var(--ok-line); border-left-color: var(--ok);   color: var(--ok); }
.alert--error,
.alert--danger  { background: var(--bad-tint);  border-color: var(--bad-line); border-left-color: var(--bad);  color: var(--bad); }
.alert--warning { background: var(--warn-tint); border-color: var(--warn-line); border-left-color: var(--warn); color: var(--warn); }
.alert--info,
.alert--debug   { background: var(--brand-tint); border-color: var(--accent-line); border-left-color: var(--accent); color: var(--accent); }

.empty {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s6) var(--s4);
  text-align: center;
}
.empty__title { font-weight: 600; margin-bottom: var(--s1); color: var(--text); }
.empty__hint { color: var(--text-muted); font-size: var(--t-help); margin: 0; }

.error-page { max-width: 32rem; margin: 0 auto; padding: var(--s6) 0; text-align: center; }
.error-page__code {
  font-family: var(--font-mono);
  font-size: var(--t-help);
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin: 0 0 var(--s3);
}
.error-page__title { margin: 0 0 var(--s3); font-size: var(--t-page); }
.error-page p { color: var(--text-muted); font-size: var(--t-help); }

/* The login screen is the only page without the application shell. */
.auth { display: flex; justify-content: center; padding: var(--s6) var(--s4); }
.auth__panel {
  width: 100%;
  max-width: 22rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s6);
}
.auth__brand {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding-bottom: var(--s4);
  margin-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
}
.auth__brand h1 { font-size: var(--t-section); margin: 0; }
.auth__mark { width: 4px; height: 22px; background: var(--brand); border-radius: 1px; }
.auth__note { color: var(--text-muted); font-size: var(--t-status); margin: var(--s4) 0 0; line-height: 1.55; }
/* On the login page a full-width flash bar above a 22rem panel reads as two
   unrelated pages; keep it the same width as the panel. */
.site-main:has(.auth) .messages { max-width: 22rem; margin: 0 auto var(--s3); }

/* ==================================================================== */
/* Definition lists                                                     */
/* ==================================================================== */
.definitions { margin: 0; font-size: var(--t-help); }
.definitions div {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: var(--s3);
  padding: var(--s2) 0;
  border-top: 1px solid var(--line);
}
.definitions div:first-child { border-top: 0; padding-top: 0; }
.definitions dt { color: var(--text-muted); margin: 0; font-size: var(--t-status); padding-top: 1px; }
.definitions dd { margin: 0; overflow-wrap: anywhere; }

/* ==================================================================== */
/* Notes, pagination, misc                                              */
/* ==================================================================== */
.notes { list-style: none; margin: var(--s4) 0 0; padding: 0; }
.notes li { padding: var(--s3) 0; border-top: 1px solid var(--line); font-size: var(--t-help); }
.notes li:first-child { border-top: 0; }
.note__meta { display: flex; gap: var(--s2); align-items: baseline; color: var(--text-muted); font-size: var(--t-status); }
.note__author { font-weight: 600; color: var(--text); }

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s4);
}
.pagination__status { color: var(--text-muted); font-size: var(--t-status); font-variant-numeric: tabular-nums; }

.stack > * + * { margin-top: var(--s4); }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s5); }
.steps { margin: 0; padding-left: 1.3em; color: var(--text-muted); font-size: var(--t-help); }
.steps li { padding: 2px 0; }

/* ==================================================================== */
/* Narrow screens                                                       */
/* ==================================================================== */
@media (max-width: 768px) {
  .container { padding: 0 var(--s4); }
  .site-header__bar { padding: var(--s2) var(--s4); align-items: center; min-height: 52px; }

  /* At least 44x44 to hit, and the icon centred inside it. */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
  }

  /* The drawer. Fixed, so opening it slides over the page instead of
     pushing the content down - which is what the old layout did, and why
     the dashboard ended up below eight menu items. */
  .site-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    width: min(300px, 86vw);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: var(--s4) 0 var(--s6);
    background: var(--brand);
    box-shadow: -2px 0 12px rgba(23, 32, 42, 0.28);
    /* Only the drawer scrolls; the page behind it does not move. */
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .site-nav__list { flex-direction: column; padding: 0 var(--s4); }
  .site-nav__list a {
    padding: var(--s3) var(--s2);
    min-height: 44px;
    font-size: var(--t-body);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    border-left: 3px solid transparent;
  }
  .site-nav__list a.is-current {
    border-bottom-color: rgba(255, 255, 255, 0.12);
    border-left-color: var(--brand-accent);
    padding-left: var(--s3);
  }

  .site-nav__account {
    flex-wrap: wrap;
    gap: var(--s3);
    margin: var(--s4) var(--s4) 0;
    padding-top: var(--s4);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }
  .site-nav__user {
    flex: 1 0 100%;
    flex-direction: row;
    align-items: baseline;
    gap: var(--s2);
    padding-left: 0;
    border-left: 0;
  }
  .site-nav__account a { min-height: 44px; display: inline-flex; align-items: center; }

  .nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(23, 32, 42, 0.45);
  }
  /* While the drawer is open the page behind must not scroll with it. */
  body.nav-open { overflow: hidden; }

  .page-head { flex-direction: column; align-items: stretch; }
  .page-head__actions .btn { flex: 1 1 auto; min-height: 44px; }

  .metrics, .factbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Rows size to their own content here. With equal rows (1fr) a taller
     full-width action tile stretched the figures above it, so the same
     kind of tile was 90px in one strip and 115px in the next. Tiles in
     one row still share a height. */
  .metrics { grid-auto-rows: minmax(88px, auto); }
  .metric, .fact { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .metric:nth-child(-n + 2), .fact:nth-child(-n + 2) { border-top: 0; }
  .metric:nth-child(odd), .fact:nth-child(odd) { border-left: 0; }
  /* An odd last tile spans the row rather than leaving half of the strip
     empty behind a border. No metric is dropped to make it fit. */
  .metrics > .metric:last-child:nth-child(odd),
  .factbar > .fact:last-child:nth-child(odd) { grid-column: 1 / -1; }

  .filters__row { grid-template-columns: 1fr; }
  .filters__row > .field:first-of-type { grid-column: auto; }

  /* Phone: the filter block folds away so the data is the first thing on
     screen. Every field is still in the form and still submitted. */
  .filters__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    font-size: var(--t-body);
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    list-style: none;
  }
  .filters__summary::-webkit-details-marker { display: none; }
  .filters__summary::after { content: "展开"; color: var(--accent); font-weight: 400; }
  .filters__panel[open] > .filters__summary { margin-bottom: var(--s3); }
  .filters__panel[open] > .filters__summary::after { content: "收起"; }

  /* D2: `width: 100%` made the table shrink to the container instead of
     overflowing it, so .table-wrap never scrolled and five columns were
     squeezed into 430px - measured: an 82px name column breaking
     "Juan Miguel Santos" across three lines. Sizing to content lets the
     wrapper do its job, and min-width keeps a narrow table full width. */
  .table-wrap table { width: auto; min-width: 100%; }
  /* Now that the wrapper scrolls, a column has no reason to squeeze its
     contents: "黄启铭" was being split across two lines to save width that
     the scroller was already prepared to give. Cells holding free text or
     several tags opt back in. */
  .table-wrap th, .table-wrap td { white-space: nowrap; }
  .table-wrap td.cell-wrap,
  .table-wrap td:has(.tag),
  .table-wrap td:has(.field__help) { white-space: normal; min-width: 14ch; }
  thead th, tbody td { padding: var(--s3); }
  .truncate, .truncate--wide { max-width: 18ch; }
  .form-actions .btn, .form-actions button { flex: 1 1 auto; }
  .definitions div { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .choices { grid-template-columns: 1fr; }

  /* D4: a long note next to a short title squeezed both. Stack them. */
  .section__head { flex-direction: column; align-items: flex-start; gap: var(--s1); }
  .page-head { gap: var(--s3); }

  /* D5: 16px is the threshold below which iOS Safari zooms the page on
     focus, which then leaves the form scrolled sideways. */
  /* Same selector list as the base rule: a bare `input` loses to
     `input[type="text"]` on specificity, so the override never applied. */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="date"], input[type="number"], input[type="search"],
  input[type="tel"], input[type="url"], input[type="file"],
  select, textarea {
    font-size: 16px;
  }

  /* A 13px checkbox is not a touch target. Enlarge it and make the whole
     label row hittable. */
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .field--checkbox > label, .field__inline { min-height: 44px; }

  /* D6: a finger target is 44px. Raising the shared control height covers
     inputs, selects and buttons in one place rather than per component. */
  :root { --control-h: 44px; --control-h-sm: 44px; }
  .btn--small, button.btn--small { padding: 0 var(--s4); }
  input[type="file"] { min-height: 44px; }
}

/* A phone that is 360px wide still gets a real gutter, just a tighter one. */
@media (max-width: 380px) {
  .container { padding: 0 var(--s3); }
  .site-header__bar { padding: var(--s2) var(--s3); }
}

/* `display: flex` on .site-nav outranks the user agent's
 * `[hidden] { display: none }`, so the drawer stayed on screen even with
 * the attribute set - which is exactly the "the menu is always open on a
 * phone" symptom this pass had to fix. Say it explicitly. */
[data-nav-enhanced] .site-nav[hidden] { display: none; }

/* The no-JavaScript fallback: the navigation is only collapsible once the
 * script that can reopen it is running, so until then `hidden` is ignored
 * and the menu stays reachable. */
html:not([data-nav-enhanced]) .site-nav[hidden] { display: flex; }
@media (max-width: 768px) {
  html:not([data-nav-enhanced]) .site-nav {
    position: static;
    width: auto;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .site-header, .site-footer, .skip-link, .page-head__actions,
  .pagination, .filters, .form-actions { display: none; }
  body { background: var(--surface); font-size: 12px; }
  .table-wrap, .panel { border-color: var(--line-control); }
}


/* ---------------------------------------------------------------------- *
 * Historical resume review: the original and its fields, side by side.
 * On a phone the two stack - a 390px screen cannot show both at once.
 * ---------------------------------------------------------------------- */
.review-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s4);
  align-items: start;
}
.review-split > section { min-width: 0; }
.review-doc {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}
.doc-text {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: var(--s3);
  max-width: 60rem;
}
.doc-text p { margin: 0 0 var(--s2); white-space: pre-wrap; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }

@media (max-width: 900px) {
  .review-split { grid-template-columns: minmax(0, 1fr); }
}
