/* ==========================================================================
   InnoCRM
   Chrome is sans. Content is serif. Provenance is mono.
   Mobile-first: base styles are the phone; min-width queries enhance.
   ========================================================================== */

/* --- Typefaces (self-hosted; no external requests) ----------------------- */

@font-face {
  font-family: 'Fraunces';
  src: url('fonts/fraunces-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'Newsreader';
  src: url('fonts/newsreader-var.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'Newsreader';
  src: url('fonts/newsreader-var-italic.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-display: swap;
  font-style: italic;
}
@font-face {
  font-family: 'Public Sans';
  src: url('fonts/public-sans-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/plex-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
  font-style: normal;
}

/* --- Tokens -------------------------------------------------------------- */

:root {
  /* Cool paper, not warm cream. */
  --paper: #f5f7f6;
  --surface: #ffffff;
  --ink: #16181d;
  --slate: #5b6470;
  --hairline: #e1e4e2;
  --hairline-strong: #c8cdc9;

  /* The editor's pen. Used sparingly, for the one thing that needs weight. */
  --accent: #a6321f;
  --accent-wash: #fbf0ee;
  --accent-edge: #eccec8;
  --added: #2e7d46;
  --added-wash: #eef6f1;
  --added-edge: #cfe4d8;

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'Newsreader', Georgia, 'Times New Roman', serif;
  --chrome: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --provenance: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Fixed rem steps — product UI, not fluid chrome. */
  --step-xs: 0.75rem;
  --step-sm: 0.8125rem;
  --step-md: 0.875rem;

  --gap-1: 0.25rem;
  --gap-2: 0.5rem;
  --gap-3: 0.75rem;
  --gap-4: 1rem;
  --gap-5: 1.5rem;
  --gap-6: 2rem;
  --gap-7: 3rem;
  --gap-8: 4.5rem;

  --measure: 64ch;
  --radius: 6px;
  --rule: 1px solid var(--hairline);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --speed: 180ms;

  --z-sticky: 10;
  --z-skip: 100;
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* Nothing may push the page sideways. */
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--chrome);
  font-size: var(--step-md);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:where(a, button, input, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

img { max-width: 100%; height: auto; }

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: var(--z-skip);
  background: var(--ink);
  color: var(--paper);
  padding: var(--gap-3) var(--gap-4);
  font-size: var(--step-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { left: var(--gap-3); top: var(--gap-3); }

/* --- Masthead ------------------------------------------------------------ */

.masthead {
  background: var(--surface);
  border-bottom: var(--rule);
  padding-top: env(safe-area-inset-top);
}

.masthead-inner {
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--gap-2) max(var(--gap-4), env(safe-area-inset-right))
           var(--gap-2) max(var(--gap-4), env(safe-area-inset-left));
}

.wordmark {
  display: flex;
  align-items: center;
  gap: var(--gap-2);
  text-decoration: none;
  min-height: 44px;
  flex-wrap: wrap;
}
.wordmark-name {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1, 'opsz' 40;
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.spacer { flex: 1 1 auto; }

.who {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
  max-width: 10ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-form { display: inline; margin: 0; }

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

.column {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--gap-5) max(var(--gap-4), env(safe-area-inset-right)) var(--gap-8)
           max(var(--gap-4), env(safe-area-inset-left));
}
/* A register is a list, not prose — the reading measure is too tight once a
   name, its standing and three facts have to share a row. */
.column--wide { max-width: 72rem; }

.page-head { margin-bottom: var(--gap-5); }
.page-title {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1, 'opsz' 40;
  font-weight: 600;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}
.page-count {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
  margin: var(--gap-2) 0 0;
}

.crumb {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
  margin: 0 0 var(--gap-3);
}
.crumb a { text-decoration-color: var(--hairline-strong); text-underline-offset: 3px; }
.crumb a:hover { color: var(--ink); text-decoration-color: var(--slate); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-2);
  min-height: 44px;
  padding: 0 var(--gap-4);
  font-family: var(--chrome);
  font-size: var(--step-md);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--speed) var(--ease),
              background-color var(--speed) var(--ease);
}
.btn:hover { border-color: var(--slate); }
.btn:active { background: var(--paper); }

.btn--primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn--primary:hover { background: #23262d; border-color: #23262d; }

.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--slate);
  padding: 0 var(--gap-2);
}
.btn--quiet:hover { color: var(--ink); border-color: var(--hairline-strong); }

.btn--sm { font-size: var(--step-sm); padding: 0 var(--gap-3); }

.btn.is-working { pointer-events: none; opacity: 0.75; }

/* --- Flash --------------------------------------------------------------- */

.flash {
  max-width: var(--measure);
  margin: var(--gap-4) auto 0;
  padding: 0 var(--gap-4);
  display: grid;
  gap: var(--gap-2);
}
.flash-item {
  font-size: var(--step-sm);
  padding: var(--gap-3) var(--gap-4);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}
.flash-item::before {
  font-family: var(--provenance);
  font-weight: 500;
  margin-right: var(--gap-2);
}
.flash-item.ok { background: var(--added-wash); border-color: var(--added-edge); }
.flash-item.ok::before { content: '✓'; color: var(--added); }
.flash-item.error { background: var(--accent-wash); border-color: var(--accent-edge); }
.flash-item.error::before { content: '!'; color: var(--accent); }

/* Actions wrap rather than crowding one tap-dense row. */
.banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-2);
  margin-top: var(--gap-3);
}

/* --- Empty state --------------------------------------------------------- */

.empty {
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius);
  padding: var(--gap-6) var(--gap-4);
  text-align: center;
  background: var(--surface);
}
.empty-title {
  font-family: var(--display);
  font-variation-settings: 'opsz' 24;
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 var(--gap-2);
}
.empty p {
  color: var(--slate);
  font-size: var(--step-sm);
  margin: 0 auto var(--gap-4);
  max-width: 40ch;
}
.empty p:last-child { margin-bottom: 0; }

/* --- Section nav --------------------------------------------------------- */

.nav { display: flex; gap: var(--gap-1); flex-wrap: wrap; }
.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--gap-3);
  font-size: var(--step-sm);
  font-weight: 500;
  color: var(--slate);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--ink); }
.nav-link.is-current { color: var(--ink); border-bottom-color: var(--accent); }

/* --- Toolbar: filters, search, primary action ---------------------------- */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--gap-3);
  margin-bottom: var(--gap-4);
}

.chips {
  display: flex;
  gap: var(--gap-2);
  overflow-x: auto;
  /* Chips scroll sideways on a phone rather than wrapping to four rows. */
  scrollbar-width: none;
  padding-bottom: var(--gap-1);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-2);
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 var(--gap-3);
  font-size: var(--step-sm);
  text-decoration: none;
  color: var(--slate);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  white-space: nowrap;
}
.chip:hover { border-color: var(--slate); color: var(--ink); }
.chip.is-current {
  color: var(--ink);
  border-color: var(--ink);
  font-weight: 600;
}
.chip-count {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
}
.chip.is-current .chip-count { color: var(--accent); }

.search { display: flex; gap: var(--gap-2); }
.search-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  /* 16px so iOS doesn't zoom the page when this takes focus. */
  font-size: 1rem;
  font-family: var(--chrome);
  padding: 0 var(--gap-3);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
}
.search-input:hover { border-color: var(--slate); }

.sorts {
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  flex-wrap: wrap;
  font-size: var(--step-xs);
  margin-bottom: var(--gap-2);
}
.sorts-label {
  font-family: var(--provenance);
  color: var(--slate);
  letter-spacing: 0.06em;
}
.sort { color: var(--slate); text-decoration: none; }
.sort:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.sort.is-current { color: var(--ink); font-weight: 600; text-decoration: underline; }

/* --- Record list --------------------------------------------------------- */

.records {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: var(--rule);
}
.records--inset { border-top: 0; }
.record {
  display: flex;
  flex-direction: column;
  gap: var(--gap-2);
  padding: var(--gap-3) 0;
  border-bottom: var(--rule);
}
.record.is-archived { opacity: 0.72; }

.record-main {
  display: flex;
  flex-direction: column;
  gap: var(--gap-1);
  text-decoration: none;
  /* A primary target: the whole block is tappable, not just the words. */
  min-height: 44px;
  justify-content: center;
}
a.record-main:hover .record-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.record-ref {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
  letter-spacing: 0.04em;
}
.record-name {
  font-family: var(--body);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.3;
}

.record-meta {
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  flex-wrap: wrap;
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
}
.record-fact--flag { color: var(--accent); }

/* --- Status -------------------------------------------------------------- */
/* Every pill carries a mark and its words. Colour is the third signal, never
   the only one — see the accessibility note in PRODUCT.md. */

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-1);
  font-family: var(--provenance);
  font-size: var(--step-xs);
  padding: 2px var(--gap-2);
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: var(--surface);
  white-space: nowrap;
}
.status-mark { font-weight: 500; }

.status--approved,
.status--closed {
  color: var(--added);
  border-color: var(--added-edge);
  background: var(--added-wash);
}
.status--declined {
  color: var(--accent);
  border-color: var(--accent-edge);
  background: var(--accent-wash);
}
.status--in_review,
.status--on_hold { color: var(--ink); border-color: var(--hairline-strong); }
.status--open { color: var(--ink); border-color: var(--ink); }
.status--draft,
.status--pending,
.status--withdrawn,
.status--archived,
.status--none { color: var(--slate); }

/* --- Detail pages -------------------------------------------------------- */

.detail-head {
  display: flex;
  flex-direction: column;
  gap: var(--gap-3);
  padding-bottom: var(--gap-4);
  border-bottom: var(--rule);
  margin-bottom: var(--gap-5);
}
/* min-width:0 so a long client name wraps inside the row instead of pushing
   the actions off the side of the page. */
.detail-head-main { min-width: 0; flex: 1 1 auto; }
.detail-ref {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
  letter-spacing: 0.04em;
  margin: 0 0 var(--gap-2);
}
.detail-title {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1, 'opsz' 44;
  font-weight: 600;
  font-size: 1.875rem;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.detail-standing {
  display: flex;
  gap: var(--gap-2);
  flex-wrap: wrap;
  margin: var(--gap-3) 0 0;
}
.detail-actions { display: flex; gap: var(--gap-2); flex-wrap: wrap; }

.panels { display: grid; gap: var(--gap-5); }
.panel { margin-bottom: var(--gap-5); }
.panels .panel { margin-bottom: 0; }
.panel-title {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0 0 var(--gap-3);
  padding-bottom: var(--gap-2);
  border-bottom: var(--rule);
}
/* A panel that carries its own action keeps the rule under both. */
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-3);
  margin-bottom: var(--gap-3);
  padding-bottom: var(--gap-2);
  border-bottom: var(--rule);
}
.panel-head .panel-title { margin: 0; padding: 0; border-bottom: 0; }

.panel-note {
  color: var(--slate);
  font-size: var(--step-sm);
  margin: 0;
}

/* Why an action isn't available, said in place of the button rather than only
   after someone presses it. */
.transitions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-3); }
.transitions .inline-form { display: inline-flex; }

.note {
  display: flex;
  align-items: flex-start;
  gap: var(--gap-2);
  font-size: var(--step-sm);
  line-height: 1.5;
  margin: 0;
  padding: var(--gap-3);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: var(--measure);
}
.note-mark { font-family: var(--provenance); font-weight: 500; }
.note--blocked {
  color: var(--ink);
  background: var(--accent-wash);
  border-color: var(--accent-edge);
}
.note--blocked .note-mark { color: var(--accent); }
.panel-prose {
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  margin: 0;
  max-width: var(--measure);
  /* Notes are stored as typed, newlines and all. */
  white-space: pre-wrap;
}

.meta-grid { margin: 0 0 var(--gap-3); }
/* Stacked on a phone: a fixed label column would leave a long value about
   170px to live in. The two-column form arrives at 34rem, where it fits. */
.meta-row {
  display: grid;
  gap: var(--gap-1);
  padding: var(--gap-2) 0;
  border-bottom: 1px solid var(--hairline);
}
.meta-row:last-child { border-bottom: 0; }
.meta-label {
  font-size: var(--step-sm);
  color: var(--slate);
}
.meta-value {
  margin: 0;
  font-size: var(--step-sm);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.meta-value.mono { font-family: var(--provenance); font-size: var(--step-xs); }

.provenance {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
  line-height: 1.6;
  margin: 0;
}

/* --- Onboarding steps ---------------------------------------------------- */
/* Stacked on a phone, a row once there is width. Done steps carry a tick as
   well as the fill, so progress isn't signalled by colour alone. */

.steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--gap-2);
  margin: 0 0 var(--gap-5);
  padding: 0;
}
.step {
  display: flex;
  align-items: flex-start;
  gap: var(--gap-3);
  padding: var(--gap-2) var(--gap-3);
  border: 1px solid transparent;
  border-radius: var(--radius);
}
.step-mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
}
.step-body { display: flex; flex-direction: column; min-width: 0; }
.step-label { font-size: var(--step-sm); font-weight: 500; }
.step-detail { font-size: var(--step-xs); color: var(--slate); }

.step.is-done .step-mark {
  color: var(--added);
  background: var(--added-wash);
  border-color: var(--added-edge);
}
.step.is-current {
  background: var(--surface);
  border-color: var(--hairline-strong);
}
.step.is-current .step-mark { color: var(--ink); border-color: var(--ink); }
.step.is-current .step-label { font-weight: 600; }

/* A flagged answer in a review summary. */
.meta-row.is-flagged .meta-label { color: var(--accent); }
.meta-aside {
  display: block;
  font-size: var(--step-xs);
  color: var(--slate);
  margin-top: var(--gap-1);
}

/* --- Checklist ----------------------------------------------------------- */

.checklist { list-style: none; margin: 0; padding: 0; }
.check {
  padding: var(--gap-4) 0;
  border-bottom: var(--rule);
}
.check:last-child { border-bottom: 0; }
/* A finding is worth spotting when scanning a long list. The pill already
   carries the mark and the word, so this is a third signal, not the only one. */
.check--fail {
  border-left: 2px solid var(--accent);
  padding-left: var(--gap-3);
  margin-left: calc(-1 * var(--gap-3) - 2px);
}

.check-head {
  display: flex;
  align-items: baseline;
  gap: var(--gap-3);
  flex-wrap: wrap;
}
.check-label {
  font-family: var(--body);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.3;
}
.check-detail {
  color: var(--slate);
  font-size: var(--step-sm);
  margin: var(--gap-2) 0 0;
  max-width: var(--measure);
}
.check-detail--retired { color: var(--accent); }
.check-note {
  font-family: var(--body);
  font-size: 1rem;
  margin: var(--gap-2) 0 0;
  padding-left: var(--gap-3);
  border-left: 2px solid var(--hairline-strong);
  max-width: var(--measure);
  white-space: pre-wrap;
}

/* A frozen answer: the value itself, given the weight the input had. */
.check-answer {
  font-family: var(--body);
  font-size: 1.0625rem;
  font-weight: 500;
  margin: var(--gap-3) 0 0;
}

/* Supporting lines under a question in the settings list. */
.record-help {
  display: block;
  font-size: var(--step-xs);
  color: var(--slate);
  line-height: 1.5;
  margin-top: var(--gap-1);
  max-width: var(--measure);
}
.record-help--flag { color: var(--accent); font-family: var(--provenance); }

/* A value that can't be edited but still has to read as a field. */
.field-static {
  font-size: var(--step-sm);
  font-weight: 500;
  margin: 0;
  padding: var(--gap-2) 0;
}

.check-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-2);
  margin-top: var(--gap-3);
}
.check-outcome { flex: 0 0 auto; width: auto; min-width: 10rem; }
.check-note-input { flex: 1 1 14rem; min-width: 0; }
.check-form .btn { flex: 0 0 auto; }

.check .provenance { margin-top: var(--gap-2); }

/* --- Decision actions ---------------------------------------------------- */

.transitions--stacked { flex-direction: column; align-items: stretch; }
.decision {
  display: flex;
  flex-direction: column;
  gap: var(--gap-2);
  align-items: flex-start;
  max-width: 34rem;
}
.decision .input { width: 100%; }

.meta-grid--tight { margin-top: var(--gap-4); }

/* --- Time entry ---------------------------------------------------------- */
/* Stacked on a phone; a single row of fields once there is width for one. */

.time-form {
  display: grid;
  gap: var(--gap-3);
  margin-bottom: var(--gap-5);
  padding-bottom: var(--gap-4);
  border-bottom: var(--rule);
}
.time-field { display: flex; flex-direction: column; min-width: 0; }
.time-field .field-label { margin-bottom: var(--gap-1); }
.time-field--check { justify-content: flex-end; }
.time-field--action { justify-content: flex-end; }
.time-field--action .btn { width: 100%; }

.record-fact--strong {
  color: var(--ink);
  font-weight: 500;
}

/* --- Recorded conflict checks -------------------------------------------- */

.panel-subtitle {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
  margin: var(--gap-5) 0 var(--gap-3);
}

.trail-list { list-style: none; margin: 0; padding: 0; }
.recorded-check {
  padding: var(--gap-3) 0;
  border-bottom: var(--rule);
}
.recorded-check:last-child { border-bottom: 0; }
.recorded-head {
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  flex-wrap: wrap;
  margin: 0 0 var(--gap-2);
}
.recorded-context {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
}
/* What the search actually showed, kept as written. Scrolls inside itself so a
   long list never widens the page. */
.recorded-summary {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  line-height: 1.6;
  color: var(--slate);
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--gap-2) var(--gap-3);
  margin: var(--gap-2) 0 0;
  overflow-x: auto;
  white-space: pre;
}

/* --- Trail --------------------------------------------------------------- */
/* Append-only, so it reads as a spine hanging off one continuous rule. */

.trail {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.trail::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--hairline-strong);
}
.trail-entry {
  position: relative;
  padding: 0 0 var(--gap-4) var(--gap-5);
}
.trail-entry:last-child { padding-bottom: 0; }
.trail-entry::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
}
.trail-entry:first-child::before { background: var(--accent); border-color: var(--accent); }
.trail-move {
  font-family: var(--provenance);
  font-size: var(--step-sm);
  margin: 0;
}
.trail-note {
  font-family: var(--body);
  font-size: 1rem;
  margin: var(--gap-2) 0 0;
  max-width: var(--measure);
  white-space: pre-wrap;
}

/* --- Role grants --------------------------------------------------------- */
/* A toggle that reads as its own state: held roles are filled, offered ones
   are outlined. The mark carries the state alongside the fill. */

.grant {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-1);
  min-height: 32px;
  padding: 0 var(--gap-3);
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
  background: var(--surface);
  border: 1px dashed var(--hairline-strong);
  border-radius: 999px;
  cursor: pointer;
}
.grant:hover { color: var(--ink); border-color: var(--slate); }
.grant-mark { font-weight: 500; }
.grant.is-held {
  color: var(--added);
  background: var(--added-wash);
  border-style: solid;
  border-color: var(--added-edge);
  font-weight: 500;
}

/* --- Forms --------------------------------------------------------------- */

.form { max-width: 40rem; }
.field { margin-bottom: var(--gap-5); }
.fieldset { border: 0; padding: 0; margin-inline: 0; }
.field-label {
  display: block;
  font-size: var(--step-sm);
  font-weight: 600;
  margin-bottom: var(--gap-2);
  padding: 0;
}
.field-hint { font-weight: 400; color: var(--slate); font-size: var(--step-xs); }
.field-note {
  font-size: var(--step-xs);
  color: var(--slate);
  margin: var(--gap-2) 0 0;
}

.input {
  width: 100%;
  min-height: 44px;
  /* 16px prevents iOS zoom-on-focus. */
  font-size: 1rem;
  font-family: var(--chrome);
  padding: var(--gap-2) var(--gap-3);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
}
.input:hover { border-color: var(--slate); }
.input--area { line-height: 1.5; resize: vertical; }

.choices { display: flex; gap: var(--gap-3); flex-wrap: wrap; }
.choice {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-2);
  min-height: 44px;
  padding: 0 var(--gap-3);
  font-size: var(--step-sm);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
.choice:hover { border-color: var(--slate); }
.choice:focus-within { border-color: var(--ink); }

.action-bar {
  display: flex;
  gap: var(--gap-2);
  padding-top: var(--gap-4);
  border-top: var(--rule);
}
.action-bar .btn { flex: 1 1 auto; }

/* --- Sign in ------------------------------------------------------------- */

.signin {
  min-height: 76vh;
  display: grid;
  place-items: center;
  padding: var(--gap-6) var(--gap-4);
}
.signin-inner { width: 100%; max-width: 26rem; }
.signin-mark {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 0, 'WONK' 1, 'opsz' 48;
  font-weight: 600;
  font-size: 2.5rem;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 0 var(--gap-3);
}
.signin-rule { width: 3rem; height: 2px; background: var(--accent); margin-bottom: var(--gap-4); }
.signin-blurb {
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--slate);
  margin: 0 0 var(--gap-6);
  max-width: 34ch;
}
.signin .btn { width: 100%; }
/* One button per enabled identity provider, stacked. */
.signin-providers { display: grid; gap: var(--gap-3); }
.signin-note {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--slate);
  margin-top: var(--gap-4);
  line-height: 1.6;
}
.dev-form { display: grid; gap: var(--gap-3); }
.dev-form input {
  width: 100%;
  font-family: var(--chrome);
  font-size: 1rem;
  min-height: 44px;
  padding: 0 var(--gap-3);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  color: var(--ink);
}
.dev-flag {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  color: var(--accent);
  background: var(--accent-wash);
  border: 1px solid var(--accent-edge);
  border-radius: var(--radius);
  padding: var(--gap-2) var(--gap-3);
  margin-top: var(--gap-4);
}

/* --- Notice (errors) ----------------------------------------------------- */

.notice {
  min-height: 68vh;
  display: grid;
  place-items: center;
  padding: var(--gap-6) var(--gap-4);
  text-align: center;
}
.notice-inner { max-width: 34rem; }
.notice-code {
  font-family: var(--provenance);
  font-size: var(--step-xs);
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: var(--gap-3);
}
.notice-message {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 0, 'WONK' 0, 'opsz' 30;
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 var(--gap-5);
  text-wrap: balance;
}

/* --- Motion -------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Enhancement: tablet
   ========================================================================== */

@media (min-width: 34rem) {
  .who { max-width: 22ch; }

  .meta-row { grid-template-columns: 9rem minmax(0, 1fr); gap: var(--gap-3); }

  /* A record becomes one row: identity on the left, facts trailing right. */
  .record {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-4);
  }
  .record-main { flex: 1 1 auto; min-width: 0; }
  .record-meta { flex: 0 0 auto; justify-content: flex-end; }

  .detail-head {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
  .detail-actions { flex: 0 0 auto; }

  .action-bar { justify-content: flex-end; }
  .action-bar .btn { flex: 0 0 auto; }
}

/* ==========================================================================
   Enhancement: desktop
   ========================================================================== */

@media (min-width: 62rem) {
  /* Day · duration · what you did · billable · Record, in one line. */
  .time-form {
    grid-template-columns: 10rem 8rem minmax(0, 1fr) auto auto;
    align-items: end;
    gap: var(--gap-3);
  }
  .time-field--matter { grid-column: 1 / -1; }

  .toolbar {
    flex-direction: row;
    align-items: center;
    gap: var(--gap-4);
  }
  .chips { flex: 1 1 auto; overflow-x: visible; flex-wrap: wrap; }
  .search { flex: 0 0 auto; }
  .search-input { width: 16rem; }

  /* Record and acceptance sit side by side once there is room for both. */
  .panels { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap-7); }
}

/* --- Conflicts register -------------------------------------------------- */
/* A register hit is the one someone put on a list deliberately, for exactly
   this moment — so it reads louder than an incidental name match. */

.record--register {
  border-left: 2px solid var(--accent);
  padding-left: var(--gap-3);
  margin-left: calc(-1 * var(--gap-3) - 2px);
}
.record--register .record-ref { color: var(--accent); }

/* A file input is a browser control; give it the same box as the rest. */
input[type="file"].input {
  padding: var(--gap-2) var(--gap-3);
  line-height: 1.6;
  cursor: pointer;
}

/* A toolbar whose actions are a related group: download, upload, add. Wraps
   as a unit on a phone rather than scattering across the search box. */
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gap-2);
}
