/* LHS Wellbeing — one stylesheet for the student-facing form and the staff
   dashboard behind the sign-in. They share a palette on purpose: a student
   who fills this in and a teacher who works it should recognise the same
   place, and the school's red is the thing that says so. */

:root {
  /* The school's own red, taken from its logo. Everything else on the page is
     a neutral chosen to sit under it: a warm grey rather than a cool one,
     because a blue-grey turns #a6192e slightly purple. */
  --accent: #a6192e;
  --accent-dark: #8a1526;
  --accent-darker: #6b0f1d;
  /* The accent's own channels, so every tint of it is one number away rather
     than the hex written out again at a different alpha. */
  --accent-rgb: 166, 25, 46;
  --accent-soft: rgba(var(--accent-rgb), 0.07);
  --accent-line: rgba(var(--accent-rgb), 0.22);

  --bg: #f4f2f1;
  --ink: #221f20;
  --muted: #6d6669;
  --muted-soft: #928a8d;
  --card: #ffffff;
  --line: #e0dbda;
  --line-soft: #efebea;

  /* One warning colour and one settled colour, both pulled towards the red so
     a row of status pills reads as one family rather than a paint chart. */
  --gold: #b07d1a;
  --gold-soft: rgba(176, 125, 26, 0.13);
  --blue: #2a5a80;
  --blue-soft: rgba(42, 90, 128, 0.11);
  --success: #2f6b46;
  --success-soft: rgba(47, 107, 70, 0.11);
  --danger: #a6192e;
  --danger-soft: rgba(var(--accent-rgb), 0.08);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  /* Headings and the wordmark. Work Sans is served from this site (see
     public/vendor/work-sans/) with Verdana behind it — both are wide and
     open, so a heading doesn't reflow to a different shape while the webfont
     arrives. */
  --font-display: "Work Sans", Verdana, Geneva, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Spacing scale — stick to these so the rhythm stays consistent. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --shadow-sm: 0 1px 2px rgba(34, 31, 32, 0.05), 0 2px 6px rgba(34, 31, 32, 0.05);
  --shadow: 0 2px 4px rgba(34, 31, 32, 0.05), 0 8px 24px rgba(34, 31, 32, 0.09);
  --shadow-lg: 0 4px 8px rgba(34, 31, 32, 0.06), 0 18px 48px rgba(34, 31, 32, 0.14);
  --ring: 0 0 0 3px rgba(var(--accent-rgb), 0.24);
}

* {
  box-sizing: border-box;
}

*:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-xs);
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--sp-3);
  /* Every heading in the display face, not just the big one — two sans faces
     mixed at random reads as a mistake rather than a choice. */
  font-family: var(--font-display);
  line-height: 1.25;
  color: var(--accent-dark);
  font-weight: 700;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 var(--sp-3); }
a { color: var(--accent); }

.hidden { display: none !important; }

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

.mono { font-family: var(--font-mono); }

/* ------------------------------------------------------------------ Header */

/* Brand on the left, the signed-in person on the right. Everything that
   belongs to them — their second factor, the way out — hangs off their own
   name rather than sitting in the tab strip, which is for the work. */
.masthead {
  background: var(--accent);
  color: #fff;
  padding: var(--sp-3) var(--sp-5);
}

/* The form and the sign-in page centre their header against a narrower
   page; the dashboard's topbar spans the width, the way the tab strip under
   it does. */
.masthead-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
  line-height: 1.2;
}

.wordmark span {
  display: block;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ---------- The menu under the signed-in name ---------- */

.user-menu {
  position: relative;
}

.user-menu-button {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.user-menu-button:hover,
.user-menu-button[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.45);
}

.user-menu-button > .fa-circle-user {
  font-size: 1.15rem;
  opacity: 0.9;
}

.user-menu-button .who {
  text-align: right;
  font-size: 0.82rem;
  line-height: 1.35;
}

.user-menu-button .who .name {
  font-weight: 700;
  display: block;
}

.user-menu-button .who .role {
  display: block;
  color: rgba(255, 255, 255, 0.78);
}

.user-menu-button .chevron {
  font-size: 0.7rem;
  opacity: 0.8;
  transition: transform 0.15s;
}

.user-menu-button[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  z-index: 40;
  min-width: 13rem;
  padding: var(--sp-1);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.user-menu-item:hover,
.user-menu-item:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.user-menu-item .fa-solid {
  width: 1rem;
  text-align: center;
  color: var(--accent);
  font-size: 0.9em;
}

/* ---------- Tabs ---------- */

/* Under the red strip rather than part of it: the active tab is marked in
   the school's red, which is enough colour for a dashboard somebody has open
   all day. Wraps rather than scrolls — a scrollbar under a strip of buttons
   hides where you can go. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  padding: 0 var(--sp-5);
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab:hover { color: var(--accent); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.panel { display: none; }
.panel.active { display: block; }

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line);
}

.subtab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.subtab:hover { color: var(--accent); }

.subtab.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.subpanel { display: none; }
.subpanel.active { display: block; }

/* ------------------------------------------------------------- Page shells */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-7);
}

.page--narrow {
  max-width: 620px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-6);
}

.card + .card { margin-top: var(--sp-5); }

.card-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.card-head h2 { margin: 0; }

.card-head .spacer { margin-left: auto; }

.lede {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 var(--sp-5);
}

/* --------------------------------------------------------------- Form bits */

.field { margin-bottom: var(--sp-4); }

/* The small-caps field heading. Checkbox and radio labels are excluded: they
   are a sentence the person reads, not a heading over a control, and the
   uppercase treatment made the form's truthfulness declaration shout. */
label.field-label,
.field > label:not(.check-label) {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.req { color: var(--accent); margin-left: 2px; }

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: -2px 0 7px;
}

input[type="text"],
input[type="email"],
input[type="search"],
select,
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.97rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

textarea {
  resize: vertical;
  min-height: 150px;
  line-height: 1.6;
}

.select-wrap { position: relative; }

.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236d6669' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}

select { padding-right: 36px; cursor: pointer; }

.radio-row {
  display: flex;
  gap: var(--sp-5);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  background: #fff;
}

.check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.93rem;
  font-weight: 500;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}

input[type="radio"],
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 1px 0 0;
  flex-shrink: 0;
}

/* --------------------------------------------------------------- Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

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

.btn--primary:hover:not(:disabled) { background: var(--accent-dark); }

.btn--ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.btn--ghost:hover:not(:disabled) { border-color: var(--muted-soft); }

.btn--danger {
  background: #fff;
  color: var(--accent-dark);
  border-color: var(--accent-line);
}

.btn--danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--accent);
}

.btn--block { width: 100%; }
.btn--sm { font-size: 0.86rem; padding: 7px 13px; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------------------------------------------------------------- Notices */

.notice {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: var(--sp-4);
  border: 1px solid;
}

.notice--ok {
  background: var(--success-soft);
  border-color: rgba(47, 107, 70, 0.28);
  color: #235436;
}

.notice--bad {
  background: var(--danger-soft);
  border-color: var(--accent-line);
  color: var(--accent-darker);
}

.notice--warn {
  background: var(--gold-soft);
  border-color: rgba(176, 125, 26, 0.32);
  color: #7a5710;
}

.notice--info {
  background: var(--blue-soft);
  border-color: rgba(42, 90, 128, 0.28);
  color: #1e4360;
}

.notice p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ Pills */

.pill {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill--new       { background: var(--accent-soft);  color: var(--accent-dark); border: 1px solid var(--accent-line); }
.pill--in_progress { background: var(--blue-soft);  color: #1e4360; border: 1px solid rgba(42, 90, 128, 0.26); }
.pill--following_up { background: var(--gold-soft); color: #7a5710; border: 1px solid rgba(176, 125, 26, 0.3); }
.pill--resolved  { background: var(--success-soft); color: #235436; border: 1px solid rgba(47, 107, 70, 0.26); }
.pill--admin     { background: var(--accent-soft);  color: var(--accent-dark); border: 1px solid var(--accent-line); }
.pill--muted     { background: #f0edec; color: var(--muted); border: 1px solid var(--line); }

.pill--emergency {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

/* ------------------------------------------------------------------ Table */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 14px;
  background: #faf9f9;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr.is-emergency { background: rgba(var(--accent-rgb), 0.035); }

tr.clickable { cursor: pointer; }

tr.clickable:hover {
  background: var(--accent-soft);
}

/* ---------- Rows that are done with ---------- */

/* Resolved reports, colleagues who have left, archived categories. These
   used to carry `opacity: 0.55`, which dims a row's text and its pills
   together and makes the hover state look like a smear rather than a
   highlight — the row you are pointing at should be the one you can read
   most easily, not least.
   So: the text is greyed with a colour, the pills keep their shape but lose
   their saturation, and pointing at the row brings all of it back. */
tr.is-muted td {
  color: var(--muted-soft);
}

tr.is-muted .ref {
  color: var(--muted-soft);
}

tr.is-muted .pill {
  filter: grayscale(0.8);
  opacity: 0.75;
}

tr.is-muted:hover {
  background: var(--accent-soft);
}

tr.is-muted:hover td,
tr.is-muted:hover .ref {
  color: var(--ink);
}

tr.is-muted:hover .ref {
  color: var(--accent-dark);
}

tr.is-muted:hover .pill {
  filter: none;
  opacity: 1;
}

/* An emergency that has been resolved is still worth finding again, so the
   tint stays even while the row is greyed. */
tbody tr.is-emergency.is-muted {
  background: rgba(var(--accent-rgb), 0.02);
}

td.tight { white-space: nowrap; }

.ref {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.empty {
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  color: var(--muted);
}

/* ----------------------------------------------------------------- Filters */

/* Search on the left and the chips on the right. Search is what somebody
   reaches for when they know which report they want; the chips are for when
   they don't, and they are also the thing that gets clicked all day, so they
   sit where the hand already is. */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.filter-bar .form-row {
  flex: 1 1 260px;
  min-width: 220px;
}

.filter-bar .form-row label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.filter-bar .form-row label .fa-solid {
  color: var(--accent);
  font-size: 0.85em;
  margin-right: 2px;
}

.filter-bar input[type="search"] {
  width: 100%;
  padding: 9px 13px;
  font-size: 0.92rem;
}

.filter-chips {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-left: auto;
}

/* A short form that is one input and one button — adding a category, sending
   a test — rather than a column of fields. */
.inline-form {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
}

.inline-form input {
  width: auto;
  flex: 1 1 240px;
  min-width: 200px;
  padding: 9px 13px;
  font-size: 0.92rem;
}

.chip {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chip[aria-pressed="true"]:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.chip .count {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.8rem;
  opacity: 0.8;
}

/* ------------------------------------------------- A pill that opens a menu */

/* Where a status is shown is where somebody reaches to change it, so the
   pill in the table is the control. `.pill` sets the size and the weight,
   but a <button> would otherwise take the browser's own face for form
   controls, so the family is spelt out. */
button.pill.menu-pill {
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

button.pill.menu-pill:hover {
  filter: brightness(0.94);
}

/* The global focus rule squares every corner off; a pill keeps its own. */
button.pill.menu-pill:focus-visible {
  border-radius: 999px;
}

.menu-pill-caret {
  font-size: 0.62em;
  opacity: 0.65;
}

/* Fixed, and on the body rather than in the row: a row redraws the moment a
   change lands, and a table cell's overflow would clip it. */
.pop-menu {
  position: fixed;
  z-index: 60;
  min-width: 13.5rem;
  max-width: 19rem;
  padding: var(--sp-1);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.pop-menu-caption {
  margin: 0;
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.pop-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.pop-menu-item .fa-solid {
  width: 1rem;
  text-align: center;
  color: var(--accent);
  font-size: 0.9em;
}

.pop-menu-item:hover,
.pop-menu-item:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.pop-menu-item.is-current {
  background: var(--bg);
}

.pop-menu-item.is-current .pop-menu-tick {
  margin-left: auto;
  color: var(--success);
}

/* ------------------------------------------------------------------ Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(34, 31, 32, 0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  overflow-y: auto;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  padding: var(--sp-6);
  margin: auto;
}

.modal--wide { max-width: 760px; }

.modal-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: var(--sp-5);
}

/* ------------------------------------------------------- Report detail */

.detail-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0;
  font-size: 0.93rem;
  margin-bottom: var(--sp-5);
}

.detail-grid dt {
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted);
}

.detail-grid dd {
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.narrative {
  background: #faf9f9;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  padding: var(--sp-4) var(--sp-5);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: var(--sp-5);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--line);
  padding-left: var(--sp-4);
}

.timeline li {
  position: relative;
  padding-bottom: var(--sp-4);
  font-size: 0.89rem;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: calc(var(--sp-4) * -1 - 5px);
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline .when {
  display: block;
  font-size: 0.78rem;
  color: var(--muted-soft);
}

/* ------------------------------------------------- Two-factor enrolment */

/* These lived in a <style> block in dashboard.html and moved here when the
   nav was rebuilt — one stylesheet is easier to keep honest than one and a
   half. */

.qr-box {
  display: flex;
  gap: var(--sp-5);
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: var(--sp-5);
}

.qr-box svg {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #fff;
}

/* The key somebody types in by hand when the camera won't cooperate.
   `user-select: all` so one click takes the whole thing — it is 32
   characters of base32 and selecting it by dragging is miserable. */
.secret {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  word-break: break-all;
  background: #faf9f9;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  user-select: all;
}

.recovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: 1rem;
  margin: var(--sp-4) 0;
}

.recovery-grid span {
  background: #faf9f9;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  text-align: center;
  user-select: all;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* A select sitting inside a table row or a toolbar rather than in a form.
   Narrower than a form field and with the caret pulled in close to the text:
   at 150px wide with the arrow pinned 14px off the right edge, a short name
   like "Mr Reid" left a stretch of empty box between the two and read as a
   gap rather than a control. */
.inline-select {
  width: auto;
  min-width: 0;
  padding: 6px 22px 6px 10px;
  font-size: 0.86rem;
}

/* The caret follows it in. Scoped to a wrapper class rather than written
   with :has(), so it does not depend on how old the browser is.
   
   The wrapper has to shrink to the select for that to mean anything: it is a
   block by default, so in a table cell it stretched the full column width
   while the select sized to its own content, and the caret — positioned
   against the wrapper — ended up marooned halfway across the cell. */
.select-wrap--tight {
  display: inline-block;
}

.select-wrap--tight::after {
  right: 8px;
}

/* ------------------------------------------------------------- Responsive */

@media (max-width: 720px) {
  .page { padding: var(--sp-5) var(--sp-4) var(--sp-6); }
  .card { padding: var(--sp-5) var(--sp-4); }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid dt { border-bottom: none; padding-bottom: 0; }
  .tabs { padding: 0 var(--sp-4); }
  .filter-chips { margin-left: 0; }
}
