/*
 * Homeflow Assist — the dispatch desk.
 *
 * Three typographic voices, each meaning something:
 *   chrome     (sans)  navigation, buttons, forms — the tool itself
 *   instrument (mono)  labels, statuses, counters, timestamps — readings
 *   counsel    (serif) the assistant's written guidance — prose to be read
 *
 * Colour keeps the same discipline: the interface is cool (internal), and
 * warmth appears in exactly one place — the reply slip that goes to a customer.
 */

/*
 * The counsel voice, made the same everywhere.
 *
 * Left to the system stack it was Iowan Old Style on macOS, Palatino Linotype
 * on Windows and Georgia elsewhere — three faces at three x-heights carrying
 * the most important text in the product. XCharter is Bitstream Charter, which
 * that stack already asked for second, drawn by Matthew Carter for legibility
 * at text sizes. Subset to Latin and the punctuation used here: 28 KB for both.
 *
 * font-display: optional, not swap. The lede is the first thing read and swap
 * reflows it on every cold load; optional never shifts the layout, and on a
 * warm cache — every visit after the first, for a tool kept open all day — the
 * face is there at first paint.
 *
 * See XCHARTER-LICENCE.txt beside the files.
 * BITSTREAM CHARTER is a registered trademark of Bitstream Inc.
 */
@font-face {
  font-family: "XCharter";
  src: url("/assets/xcharter-regular-c7291a44.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: optional;
}

@font-face {
  font-family: "XCharter";
  src: url("/assets/xcharter-italic-684e9fbe.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: optional;
}

:root {
  /* This design is light. Saying so keeps native controls, scrollbars and
     autofill from rendering dark against a hard-coded light palette. */
  color-scheme: light;

  --ink: #14202b;
  --ink-soft: #46586a;
  /* Every label, every table heading and every hint is this colour — the
     smallest text in the product carrying the most structural meaning. It used
     to be #7b8b9a, which is 3.50:1 on white. */
  --ink-faint: #5b6e80;
  --paper: #eef1f4;
  --card: #ffffff;
  --card-sunk: #fbfcfd;
  --rule: #d5dce3;
  --rule-soft: #e6ebef;

  --signal: #0e6e5c;
  --signal-dark: #0a5245;
  --signal-wash: #e4f0ed;
  /* --signal is 2.68:1 against the rail, under the 3:1 floor for a focus
     indicator, so the dark surfaces get their own. */
  --signal-light: #7fd3c0;

  --alert: #a6431f;
  --alert-wash: #f8ebe6;

  /* The rail: light on dark, each clearing 4.5:1 on --ink. */
  --rail-text: #cfd8e0;
  --rail-soft: #9fb0be;
  --rail-faint: #7c8fa1;

  /* Warmth, reserved. The slip is the only warm surface in the product and
     nothing outside .slip may use these. The token that used to be called
     --amber had leaked onto an admin tag and a picker warning; the name is the
     fence. */
  --slip: #fdf6e9;
  --slip-edge: #e2d3b4;
  --slip-ink: #4a3b1f;
  --slip-label: #8a6512;

  --font-chrome: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-counsel: "XCharter", "Iowan Old Style", Charter, Georgia, serif;
  --font-instrument: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Three voices, three scales. A single ratio across all three would be a
     fiction: they are different systems doing different jobs, which is what the
     note at the top of this file already says. */
  --type-reading: 10px;
  --type-reading-lg: 12px;

  --type-ui-sm: 13px;
  --type-ui: 15px;
  --type-ui-lg: 17px;
  --type-ui-xl: 22px;

  --type-counsel: 16.5px;
  --type-counsel-lede: 21px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  --rail: 17.5rem;
  --radius-sm: 3px;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(20, 32, 43, 0.06), 0 8px 24px -18px rgba(20, 32, 43, 0.4);
  --shadow-lift: 0 24px 60px -30px rgba(0, 0, 0, 0.7);
}

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

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

body {
  margin: 0;
  font-family: var(--font-chrome);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--signal-dark); }
a:hover { color: var(--signal); }

/* An outline already follows the element's own corners. The border-radius that
   used to be declared here was mutating focused elements' actual radius from
   6px down to 3px, so buttons visibly changed shape on tab. */
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.rail :focus-visible,
.admin__nav :focus-visible,
.gate :focus-visible { outline-color: var(--signal-light); }

/* Off-screen, but read aloud and reachable. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--space-2);
  top: -3rem;
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: var(--type-ui-sm);
  text-decoration: none;
}

.skip:focus { top: var(--space-2); }

/* The interface is unanimated by design. This takes the snap off hover and
   nothing more: 120ms is below the threshold at which motion reads as motion. */
@media (prefers-reduced-motion: no-preference) {
  a,
  .btn,
  .rail__item,
  .picker__option,
  .admin__nav-item {
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
  }
}

/* ---------- instrument voice ---------- */

.label {
  font-family: var(--font-instrument);
  font-size: var(--type-reading);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

.meta {
  font-family: var(--font-instrument);
  font-size: var(--type-reading-lg);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- shell ---------- */

.desk {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  background: var(--ink);
  color: var(--rail-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail__brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rail__wordmark {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #fff;
  margin: 0;
}

.rail__wordmark span { color: var(--rail-faint); font-weight: 400; }

.rail__tagline {
  font-family: var(--font-instrument);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rail-faint);
  margin: 0.35rem 0 0;
}

.rail__action { padding: 1rem 1rem 0.75rem; }

.rail__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.6rem 1rem;
}

.rail__section {
  padding: 0.75rem 0.65rem 0.4rem;
  color: var(--rail-faint);
}

.rail__empty {
  padding: 0.5rem 0.65rem;
  font-size: 13px;
  color: var(--rail-soft);
  line-height: 1.5;
}

.rail__item {
  display: block;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius);
  color: var(--rail-text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
}

.rail__item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.rail__item[aria-current="page"] {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--signal);
}

.rail__item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rail__item-meta {
  display: block;
  font-family: var(--font-instrument);
  font-size: 10.5px;
  color: var(--rail-soft);
  margin-top: 0.2rem;
  letter-spacing: 0.02em;
}

.rail__foot {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.rail__who { min-width: 0; }
.rail__who strong { display: block; color: #fff; font-weight: 550; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__who span { font-family: var(--font-instrument); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rail-faint); }

.rail__link {
  color: var(--rail-soft);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.rail__link:hover { color: #fff; text-decoration: underline; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* ---------- flash ---------- */

.flash--inline { margin: 0 0 var(--space-3); }

.flash {
  margin: var(--space-4) var(--space-5) 0;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  font-size: 14px;
  border: 1px solid;
}

.flash--notice { background: var(--signal-wash); border-color: #b9d8d0; color: var(--signal-dark); }
.flash--alert { background: var(--alert-wash); border-color: #e6c3b7; color: var(--alert); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-chrome);
  font-size: 14px;
  font-weight: 550;
  line-height: 1;
  padding: 0.6rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  cursor: pointer;
  text-decoration: none;
  background: var(--card);
  color: var(--ink);
}

.btn:hover { border-color: var(--ink-faint); color: var(--ink); }

.btn--primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn--primary:hover { background: var(--signal-dark); border-color: var(--signal-dark); color: #fff; }

.btn--block { width: 100%; }
.btn--small { font-size: 12.5px; padding: 0.4rem 0.65rem; }
.btn--quiet { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn--quiet:hover { background: rgba(20, 32, 43, 0.05); color: var(--ink); border-color: transparent; }
.btn--danger { color: var(--alert); border-color: #e6c3b7; background: var(--card); }
.btn--danger:hover { background: var(--alert-wash); border-color: var(--alert); color: var(--alert); }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- conversation thread ---------- */

.thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.thread__head {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  background: var(--card);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.thread__title { margin: 0.15rem 0 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }
.thread__head-actions { display: flex; gap: 0.4rem; align-items: center; }

.thread__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem 1.5rem 2rem;
}

.thread__inner { max-width: 46rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem; }

.turn { display: flex; flex-direction: column; gap: 0.5rem; }
.turn--ask { align-items: flex-end; }
.turn__label { display: flex; align-items: baseline; gap: 0.6rem; }

.ask {
  max-width: 90%;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* answer worksheet */

.answer {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  /*
   * No overflow: hidden here. It clipped the slip's perforation flat — the one
   * element this file calls its signature — for the whole life of the design.
   * The bottom corners are rounded on the last child instead.
   */
}

.answer > :last-child {
  border-bottom-left-radius: calc(var(--radius) - 1px);
  border-bottom-right-radius: calc(var(--radius) - 1px);
}

.answer__body { padding: var(--space-5) 1.35rem var(--space-2); }

/*
 * Who does the work, before the detail. Three fixed positions with one filled —
 * the same "one of a known set, one active" grammar the progress row uses, so
 * the two readings in the product agree with each other. No colour: routing is
 * a fact about whose hands, not a judgement about how bad it is.
 */
.routing {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-4) 1.35rem 0;
}

.routing__track {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.routing__stop {
  font-family: var(--font-instrument);
  font-size: var(--type-reading);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: var(--space-1) var(--space-2);
  white-space: nowrap;
}

.routing__stop + .routing__stop { border-left: 1px solid var(--rule); }
.routing__stop--on { background: var(--ink); color: #fff; font-weight: 600; }

.routing + .answer__body { padding-top: var(--space-4); }

/*
 * The bottom line is the answer. It is the card's lede — first, biggest and
 * unlabelled, because a label above it would only repeat what its position
 * already says.
 */
.lede {
  font-family: var(--font-counsel);
  font-size: var(--type-counsel-lede);
  line-height: 1.4;
  color: var(--ink);
  margin: 0;
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

.lede + .field {
  border-top: 1px solid var(--rule-soft);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
}

.field { padding-bottom: var(--space-4); }
.field + .field { border-top: 1px solid var(--rule-soft); padding-top: var(--space-4); }

.field__label { display: block; margin-bottom: var(--space-2); }

.field__text {
  font-family: var(--font-counsel);
  font-size: var(--type-counsel);
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/*
 * A checklist reads as a list. What to check is work you do, so it gets an
 * empty box; what to confirm is something you say to the customer, so it is set
 * in the counsel italic and marked with a dash — spoken, not done.
 */
.checklist {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-counsel);
  font-size: var(--type-counsel);
  line-height: 1.5;
  color: var(--ink-soft);
}

.checklist li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: var(--space-2);
  overflow-wrap: anywhere;
}

.checklist li:last-child { margin-bottom: 0; }

.field--what-to-check .checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--ink-faint);
  border-radius: 1px;
}

.field--what-to-confirm .checklist { font-style: italic; }

.field--what-to-confirm .checklist li::before {
  content: "\2014";
  position: absolute;
  left: 0;
  font-style: normal;
  color: var(--ink-faint);
}

.answer__plain {
  padding: 1.1rem 1.35rem;
  font-family: var(--font-counsel);
  font-size: 16.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
}

/*
 * The signature: the customer reply is a tear-off slip. It is the only warm
 * surface in the interface and the only perforated edge — "this part leaves
 * the building".
 */
.slip {
  background: var(--slip);
  border-top: 2px dashed var(--slip-edge);
  padding: 1.1rem 1.35rem 1.25rem;
  position: relative;
}

.slip::before,
.slip::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule);
}

.slip::before { left: -7px; }
.slip::after { right: -7px; }

.slip__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.slip__head .btn--copy { margin-left: auto; }
.slip__confidence { color: var(--slip-label); }

/*
 * Warmth means ready to go to a customer. When the assistant is not confident,
 * it is not ready — so the slip keeps its shape and its perforation and loses
 * its warmth. It has not been printed on the good paper yet.
 */
.slip--unsure { background: var(--card); border-top-color: var(--rule); }
.slip--unsure .slip__label { color: var(--alert); }
.slip--unsure .slip__text { color: var(--ink); }

.slip--unsure .btn--copy {
  background: var(--card);
  border-color: var(--rule);
  color: var(--ink);
}

.slip--unsure .btn--copy:hover {
  background: var(--paper);
  border-color: var(--ink-faint);
  color: var(--ink);
}

.slip__caution {
  font-family: var(--font-chrome);
  font-size: var(--type-ui-sm);
  color: var(--alert);
  margin: 0 0 var(--space-3);
}

.slip__label { color: var(--slip-label); }

.slip__text {
  font-family: var(--font-counsel);
  font-size: var(--type-counsel);
  line-height: 1.6;
  color: var(--slip-ink);
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.btn--copy {
  background: var(--slip-ink);
  border-color: var(--slip-ink);
  color: var(--slip);
  font-weight: 600;
  /* "Copied" is shorter than "Copy reply", so this used to resize under the
     cursor at the exact moment it was clicked. */
  min-width: 8.5rem;
}
.btn--copy:hover { background: #2f2512; border-color: #2f2512; color: #fff; }

/* feedback strip */

.feedback {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border-top: 1px solid var(--rule-soft);
  background: #fbfcfd;
  flex-wrap: wrap;
}


.feedback__given {
  font-family: var(--font-instrument);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--signal-dark);
}

/* ---------- status ticket ---------- */

.ticket {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--signal);
  background: var(--card);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

.ticket__actions { grid-column: 2; grid-row: 1; }

.ticket__readout {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.ticket__stall { color: var(--alert); }

/*
 * Elapsed against this product's own median, and nothing else. It is a
 * measurement, not a progress bar: capped at 90% so it never reaches the end,
 * and it never claims to know how much is left.
 */
.ticket__gauge {
  grid-column: 1 / -1;
  height: 2px;
  background: var(--rule-soft);
  border-radius: 1px;
  overflow: hidden;
}

.ticket__gauge-fill { display: block; height: 100%; background: var(--signal); }

.ticket__gauge-fill--10 { width: 10%; }
.ticket__gauge-fill--20 { width: 20%; }
.ticket__gauge-fill--30 { width: 30%; }
.ticket__gauge-fill--40 { width: 40%; }
.ticket__gauge-fill--50 { width: 50%; }
.ticket__gauge-fill--60 { width: 60%; }
.ticket__gauge-fill--70 { width: 70%; }
.ticket__gauge-fill--80 { width: 80%; }
.ticket__gauge-fill--90 { width: 90%; }

/*
 * A question that produced no answer. Set in chrome, not counsel: the assistant
 * did not counsel anything here, the tool is reporting what happened.
 */
.ticket--receipt {
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  gap: var(--space-2);
  border-left-color: var(--ink-faint);
}

.receipt__text {
  font-family: var(--font-chrome);
  font-size: var(--type-ui);
  color: var(--ink-soft);
  margin: 0;
  max-width: 46ch;
}

.ticket--failed { border-left-color: var(--alert); }
.ticket--stopped { border-left-color: var(--ink-faint); }

.ticket__stations { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.station {
  font-family: var(--font-instrument);
  font-size: var(--type-reading);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.station--done { color: var(--ink-soft); }

.station--current {
  color: var(--signal-dark);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.station--current::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  animation: pulse 1.6s ease-in-out infinite;
}

.station__sep { color: var(--ink-faint); font-size: var(--type-reading); }

.ticket__note { font-size: 13.5px; color: var(--ink-soft); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

@media (prefers-reduced-motion: reduce) {
  .station--current::before { animation: none; }
}

/* ---------- composer ---------- */

.composer {
  border-top: 1px solid var(--rule);
  background: var(--card);
  padding: 1rem 1.5rem 1.25rem;
}

.composer__inner { max-width: 46rem; margin: 0 auto; }

.composer__field {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.composer textarea {
  flex: 1;
  font-family: var(--font-chrome);
  font-size: 15px;
  line-height: 1.5;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  resize: vertical;
  min-height: 4.5rem;
  color: var(--ink);
  background: var(--card);
}

.composer textarea:focus-visible {
  border-color: var(--signal);
  outline: 2px solid var(--signal);
  outline-offset: 1px;
}
.composer textarea[disabled] { background: var(--paper); color: var(--ink-faint); }

.composer__hint { margin: 0.5rem 0 0; font-size: 12.5px; color: var(--ink-faint); }

/* ---------- empty / centred states ---------- */

.blank {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 3rem 1.5rem;
}

.blank__inner { max-width: 34rem; }
.blank h1 { font-size: 1.4rem; margin: 0.5rem 0 0.4rem; letter-spacing: -0.015em; }
.blank p { color: var(--ink-soft); margin: 0 0 1.25rem; }

/* ---------- product picker ---------- */

.picker { display: grid; gap: 0.6rem; margin: 1.25rem 0; }

.picker__option {
  display: block;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0.9rem 1rem;
  cursor: pointer;
}

.picker__option:hover { border-color: var(--signal); }
.picker__option input { margin-right: 0.6rem; }
.picker__option strong { font-weight: 600; }
.picker__option p { margin: 0.3rem 0 0 1.4rem; font-size: 13.5px; color: var(--ink-soft); }
.picker__option-note { margin: var(--space-1) 0 0 1.4rem; font-size: var(--type-ui-sm); color: var(--ink-soft); }

/* ---------- sign in ---------- */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--ink);
  padding: 2rem 1.25rem;
}

.gate__card {
  width: 100%;
  max-width: 23rem;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-lift);
}

.gate__brand { margin: 0 0 0.15rem; font-size: 1.15rem; font-weight: 650; letter-spacing: -0.015em; }
.gate__brand span { color: var(--ink-faint); font-weight: 400; }
.gate__note { margin-top: var(--space-5); }
.gate__sub { margin: 0 0 1.5rem; font-size: 10px; color: var(--ink-faint); font-family: var(--font-instrument); letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------- forms ---------- */

.form { display: grid; gap: 1.1rem; }
/* align-content keeps label, field and hint packed at the top. Without it a
   row stretched by a taller neighbour spreads its own three parts out, and
   fields in adjacent columns stop lining up. */
.form__row { display: grid; gap: var(--space-1); align-content: start; }
.form__row label { font-size: 13.5px; font-weight: 550; color: var(--ink); }
.form__row input[type="text"],
.form__row input[type="email"],
.form__row input[type="password"],
.form__row input[type="number"],
.form__row textarea,
.form__row select {
  font-family: var(--font-chrome);
  font-size: 14.5px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  width: 100%;
  /* A field should be the size of what goes in it. Nothing typed into any of
     these needs more than this, and a full-width input on a wide screen makes
     the value harder to read, not easier. */
  max-width: 28rem;
}

.form__row textarea { max-width: 46rem; }

.form__row input:focus-visible,
.form__row textarea:focus-visible,
.form__row select:focus-visible {
  border-color: var(--signal);
  outline: 2px solid var(--signal);
  outline-offset: 1px;
}

.form__hint { font-size: 12.5px; color: var(--ink-faint); margin: 0; }
.form__actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.form__check { display: flex; align-items: center; gap: 0.5rem; font-size: 14px; }
/*
 * Columns cap at 24rem rather than sharing the row equally: on a wide page,
 * 1fr turned a pair of fields into two 800px inputs. Now more fields sit side
 * by side and each one stays the size of the thing it holds.
 */
.form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 24rem));
  justify-content: start;
  gap: var(--space-4);
}

.errors {
  background: var(--alert-wash);
  border: 1px solid #e6c3b7;
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  color: var(--alert);
  font-size: 13.5px;
}
.errors ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }

.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.5rem; }
.checkgrid label { display: flex; align-items: center; gap: 0.5rem; font-size: 14px; padding: 0.4rem 0.55rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }

/* ---------- admin ---------- */

.admin__nav { background: var(--ink); padding: 0 0 0.5rem; }
.admin__nav-items { display: flex; gap: 0.15rem; padding: 0 1rem; flex-wrap: wrap; }

.admin__nav-item {
  color: var(--rail-soft);
  text-decoration: none;
  font-size: 13.5px;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
}
.admin__nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.admin__nav-item[aria-current="page"] { background: rgba(255, 255, 255, 0.12); color: #fff; }

/*
 * Admin pages are mostly dense tables, and they were capped at 78rem and pinned
 * to the left, so a wide monitor showed a third of the screen as dead space
 * beside a table whose details column had nowhere to go. The cap is now
 * generous enough to fill an ordinary 1900px window, and the page centres
 * beyond that rather than hugging the rail — unlimited width is not a virtue,
 * a row too wide to track across is harder to read, not easier.
 */
.page {
  padding: var(--space-5) var(--space-5) var(--space-7);
  /* width is not redundant: .page is a flex item in a column, where an auto
     inline margin makes the item shrink to its content instead of filling. */
  width: 100%;
  max-width: 120rem;
  margin-inline: auto;
}
.page__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page__title { margin: 0.2rem 0 0.25rem; font-size: 1.35rem; letter-spacing: -0.015em; }
.page__lede { margin: 0; color: var(--ink-soft); font-size: 14px; max-width: 46rem; }

.panel {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.panel__head { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--rule-soft); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.panel__body { padding: 1.1rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1px; background: var(--rule-soft); }
.stat { background: var(--card); padding: 1rem 1.1rem; }
.stat__value { font-family: var(--font-instrument); font-size: 1.5rem; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; display: block; margin-top: 0.3rem; }
.stat__sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 0.2rem; display: block; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-family: var(--font-instrument);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.table td { padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table__num { font-family: var(--font-instrument); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.table__actions { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/*
 * Where a wide table puts its spare width.
 *
 * A table at 100% shares spare width across every column, which on a large
 * monitor pushes the two ends of a row so far apart that the eye loses the
 * line. Instead each column holds its natural single-line width and the one
 * variable-length column absorbs everything left over. If even that is not
 * enough the table scrolls, which is what .table-scroll is for.
 */
.table th,
.table td { white-space: nowrap; }

.table__grow { width: 100%; }
.table__grow,
.table td.table__grow { white-space: normal; }

.tag {
  display: inline-block;
  font-family: var(--font-instrument);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  background: #fbfcfd;
  white-space: nowrap;
}

.tag--ok { color: var(--signal-dark); border-color: #b9d8d0; background: var(--signal-wash); }
/* Not an error and not a success: something an administrator has not finished. */
.tag--pending { color: var(--ink); border-color: var(--ink-faint); background: var(--paper); }
.tag--bad { color: var(--alert); border-color: #e6c3b7; background: var(--alert-wash); }

.note { font-size: 13px; color: var(--ink-soft); margin: 0.35rem 0 0; }
.empty { padding: 1.5rem 1.1rem; color: var(--ink-faint); font-size: 14px; }
@media (max-width: 60rem) {
  .desk { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  .rail__scroll { max-height: 14rem; }
}

/* The way back out of the admin area, set apart from the section links. */
.admin__nav-item--back { color: var(--rail-text); }
.admin__nav-divider {
  width: 1px;
  align-self: stretch;
  margin: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.14);
}

/* When an administrator can also use the assistant, the admin link is the
   quieter of the two actions. */
.rail__action-secondary { margin-top: 0.4rem; }
