/* Guldino Helps, stage build. Stage 7.3: the brand world of the reference build (tokens, Figtree, icons, components,
   the dino), copied and never changed there. Pine chrome, green-grey ground, white work surfaces. Gold only for handbook
   bookmarks and review warnings. Status is always a word plus an icon, never colour alone. */
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/assets/fonts/figtree-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/assets/fonts/figtree-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font: 'Figtree', ui-rounded, 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, 'Liberation Mono', monospace;

  /* pine: the brand family, measured from the logo (#193F34) */
  --pine-950: #0e261e;
  --pine-900: #133128;
  --pine-800: #193f34;
  --pine-700: #235748;
  --pine-600: #2d6f5c;
  --pine-500: #4b917c;
  --pine-300: #a8cdc1;
  --pine-200: #cde3db;
  --pine-100: #e2eee9;
  --pine-50: #f0f6f3;

  --ground: #f3f6f4;
  --surface: #ffffff;
  --rail: #e9efec;
  --line: #d5dfda;
  --line-strong: #b4c5be;

  --ink: #12261f;
  --ink-2: #3b5148;
  --ink-3: #566b62;
  --on-pine: #f4faf7;

  /* gold, from the name Gulden: only handbook bookmarks and review warnings */
  --gold-500: #c99a2e;
  --gold-700: #7a5906;
  --gold-100: #fbf0d3;

  --ok-ink: #14633f;
  --ok-bg: #dff2e7;
  --ok-line: #9fd2b4;
  --warn-ink: #7a4d00;
  --warn-bg: #ffefc6;
  --warn-line: #e6c36a;
  --danger-ink: #962029;
  --danger-bg: #fce5e5;
  --danger-line: #eba8ab;
  --info-ink: #1d5878;
  --info-bg: #e0eff7;
  --info-line: #a9cce0;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 22px;
  --sh-1: 0 1px 2px rgb(18 38 31 / 0.07), 0 0 0 1px rgb(18 38 31 / 0.02);
  --sh-2: 0 8px 22px -6px rgb(18 38 31 / 0.16), 0 2px 6px rgb(18 38 31 / 0.06);
  --sh-3: 0 22px 54px -14px rgb(18 38 31 / 0.3), 0 4px 12px rgb(18 38 31 / 0.08);

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

  --t-xs: 0.8125rem;
  --t-sm: 0.875rem;
  --t-base: 1rem;
  --t-md: 1.125rem;
  --t-lg: 1.3125rem;
  --t-xl: 1.625rem;
  --t-2xl: 2.125rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --topbar-h: 3.5rem;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 1rem); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--t-base) / 1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  accent-color: var(--pine-700);
  caret-color: var(--pine-700);
}
::selection { background: var(--pine-200); color: var(--pine-950); }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.2; color: var(--pine-900); text-wrap: balance; letter-spacing: -0.012em; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--pine-700); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--pine-900); }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--pine-600); outline-offset: 2px; border-radius: var(--r-sm); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--pine-500); background-clip: content-box; border: 2px solid transparent; }
::placeholder { color: var(--ink-3); opacity: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: var(--s-3); top: -4rem; z-index: 100; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--pine-800); color: var(--on-pine); transition: top 0.15s var(--ease-out); }
.skip-link:focus { top: var(--s-3); }

/* the team's icon set */
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 1em; height: 1em; }

/* ---------------------------------------------------------------- controls */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 2.75rem; padding: 0 var(--s-4);
  font: 600 var(--t-base) / 1 var(--font);
  color: var(--pine-900); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
button:hover:not(:disabled) { background: var(--pine-50); border-color: var(--pine-500); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--pine-800); border-color: var(--pine-800); color: var(--on-pine); box-shadow: 0 1px 0 rgb(255 255 255 / 0.12) inset, var(--sh-1); }
button.primary:hover:not(:disabled) { background: var(--pine-900); border-color: var(--pine-900); color: #fff; }
button.secondary { background: var(--surface); color: var(--pine-900); }
button.quiet { background: transparent; border-color: transparent; color: var(--pine-700); padding: 0 var(--s-3); }
button.quiet:hover:not(:disabled) { background: var(--pine-100); border-color: transparent; }
button.amber { color: var(--warn-ink); border-color: var(--warn-line); }
button.amber:hover:not(:disabled) { background: var(--warn-bg); border-color: var(--warn-ink); }
a.button { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 2.75rem; padding: 0 var(--s-4); border-radius: var(--r-md); font-weight: 600; text-decoration: none; }
a.button.secondary { background: var(--surface); color: var(--pine-900); border: 1px solid var(--line-strong); }
a.button.secondary:hover { background: var(--pine-50); border-color: var(--pine-500); }
button.linkish { min-height: 2rem; padding: 2px 6px; margin: -2px -6px; border: 0; background: none; color: var(--pine-700); text-decoration: underline; text-underline-offset: 3px; }
button.linkish:hover:not(:disabled) { background: none; color: var(--pine-900); }

input, textarea {
  width: 100%; min-height: 2.75rem; padding: 0.5rem 0.75rem;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:hover, textarea:hover { border-color: var(--pine-500); }
input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--pine-600); box-shadow: 0 0 0 3px rgb(75 145 124 / 0.28); }
input[type='checkbox'], input[type='radio'] { width: 1.15rem; height: 1.15rem; min-height: 0; padding: 0; margin: 0; flex: none; }
input[type='checkbox']:focus-visible, input[type='radio']:focus-visible { outline: 3px solid var(--pine-600); outline-offset: 2px; box-shadow: none; }
label { font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.msg { min-height: 1.5em; color: var(--ink-2); }
.msg.error { color: var(--danger-ink); font-weight: 500; }

/* ---------------------------------------------------------------- top bar: pine, the team's dino logo */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--s-5);
  min-height: var(--topbar-h); padding: 0 var(--s-5);
  background: var(--pine-800); color: var(--on-pine);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.06) inset, 0 2px 10px rgb(14 38 30 / 0.2);
}
.topbar :focus-visible { outline-color: #fff; }
/* the vector logo as a mask: it takes the colour of its surroundings, white on pine */
.logo { display: inline-flex; align-items: center; flex: none; color: var(--pine-800); text-decoration: none; }
.logo.on-pine, .topbar .logo { color: #fff; }
.logo-art { display: block; width: 8.4rem; height: 2.17rem; background: currentColor; -webkit-mask: url('/assets/guldino-logo.svg') left center / contain no-repeat; mask: url('/assets/guldino-logo.svg') left center / contain no-repeat; }
.views { display: flex; gap: var(--s-1); margin-right: auto; }
.views a { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 2.5rem; padding: 0 0.8rem; border-radius: var(--r-md); color: rgb(244 250 247 / 0.82); font-weight: 600; text-decoration: none; white-space: nowrap; transition: background 0.15s ease, color 0.15s ease; }
.views a:hover { background: rgb(255 255 255 / 0.1); color: #fff; }
.views a[aria-current='page'] { background: rgb(255 255 255 / 0.16); color: #fff; box-shadow: 0 -2px 0 #fff inset; }
.who { display: flex; align-items: center; gap: var(--s-3); }
.who-name { font-weight: 600; color: var(--on-pine); white-space: nowrap; }
button.on-pine-button { min-height: 2.5rem; background: transparent; border-color: rgb(255 255 255 / 0.35); color: #fff; }
button.on-pine-button:hover:not(:disabled) { background: rgb(255 255 255 / 0.12); border-color: #fff; }

/* Stage 7.4: a newer version was deployed while the page was open; the old page is covered until it is reloaded */
.update-bar { position: fixed; inset: 0; z-index: 60; display: grid; place-items: start center; padding: 12vh var(--s-4) var(--s-4); background: rgb(14 38 30 / 0.45); }
.update-card { width: min(30rem, 100%); display: grid; gap: var(--s-3); padding: var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-3); }
.update-card h2 { font-size: var(--t-lg); }
.update-card p { color: var(--ink-2); }
.update-card button { justify-self: start; }

/* inactivity warning: one minute before the server signs the agent out */
.idle-warning { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; width: min(640px, calc(100vw - 32px)); padding: 14px 18px; background: var(--surface); border: 1px solid var(--warn-line); border-radius: var(--r-lg); box-shadow: var(--sh-3); }
.idle-warning p { flex: 1 1 280px; }
.idle-warning strong { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- sign-in and name: the split page with the brand panel */
.loading { padding: 48px 20px; color: var(--ink-3); }
.login { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.login-brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-6);
  padding: var(--s-6) var(--s-7);
  color: var(--on-pine);
  /* Aaron's AI illustration (silk waves, made with ChatGPT, design-assets), labelled "Illustration created with AI" below */
  background:
    linear-gradient(160deg, rgb(10 28 22 / 0.9) 0%, rgb(14 38 30 / 0.7) 55%, rgb(14 38 30 / 0.5) 100%),
    url('/assets/site/waves.jpg') 40% center / cover no-repeat,
    var(--pine-900);
}
.login-brand :focus-visible { outline-color: #fff; }
.login-brand .logo-art { width: 10.4rem; height: 2.7rem; }
.login-pitch { position: relative; z-index: 1; max-width: 30rem; margin-top: auto; }
.login-pitch h1 { color: #fff; font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.08; letter-spacing: -0.02em; }
.login-pitch p { margin-top: var(--s-4); color: rgb(244 250 247 / 0.86); font-size: var(--t-md); max-width: 26rem; }
.login-mark { position: absolute; right: -4.5rem; bottom: -3.5rem; width: min(26rem, 52%); color: #fff; opacity: 0.09; pointer-events: none; transform: rotate(-6deg); }
.login-mark .mascot { width: 100%; height: auto; }
.ai-credit { position: relative; z-index: 1; margin-top: calc(var(--s-6) * -1 + var(--s-3)); font-size: var(--t-xs); color: rgb(244 250 247 / 0.72); }
.login-form { display: grid; place-items: center; padding: var(--s-6) var(--s-5); background: var(--ground); }
.login-card { width: min(24rem, 100%); display: flex; flex-direction: column; gap: var(--s-4); }
.login-card h2 { font-size: var(--t-xl); }
.login-card form { display: grid; gap: var(--s-2); }
.login-card form label { margin-top: var(--s-2); }
.login-card form button { margin-top: var(--s-4); width: 100%; }
.gate-lead { color: var(--ink-2); }
.gate-note { font-size: var(--t-sm); color: var(--ink-3); }

/* ---------------------------------------------------------------- work area */
.work { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.rail { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-5) var(--s-4); background: var(--surface); border-right: 1px solid var(--line); }
.rail-head { display: grid; gap: var(--s-3); }
.rail-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.rail-title { font-size: var(--t-md); }
.rail-toggle { display: none; }

.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.cell { position: relative; min-height: 3rem; padding: 4px 2px 2px; display: grid; justify-items: center; align-content: center; gap: 1px; font-weight: 650; font-variant-numeric: tabular-nums; font-size: var(--t-sm); color: var(--ink); background: var(--ground); border: 1px solid transparent; border-radius: var(--r-sm); }
.cell:hover:not(:disabled) { background: var(--surface); border-color: var(--pine-300); }
.cell .icon { width: 15px; height: 15px; }
.cell[aria-current='true'] { background: var(--pine-800); border-color: var(--pine-800); color: #fff; }
.cell[aria-current='true'] .icon { color: #fff !important; }
.cell .flag { position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; color: var(--warn-ink); }
.cell[aria-current='true'] .flag, .cell[aria-current='true'] .risk { color: #ffd98a !important; }
.cell.filtered-out { opacity: 0.25; }
.cell .marks { display: flex; gap: 3px; justify-content: center; align-items: center; min-height: 15px; }
.cell .risk { color: var(--danger-ink); }
.cell .review { color: var(--info-ink); }
.flagged-first { display: flex; align-items: center; gap: var(--s-2); min-height: 2rem; font-weight: 500; color: var(--ink-2); }

.legend { list-style: none; margin: 0; padding: var(--s-3) 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: var(--t-xs); color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .icon { width: 14px; height: 14px; }
.legend-new { grid-column: 1 / -1; color: var(--ink-3); }
.st-new { color: var(--ink-3); }
.st-drafted { color: var(--ink-2); }
.st-saved { color: var(--pine-600); }
.st-approved { color: var(--ok-ink); }
.st-failed { color: var(--danger-ink); }
.st-handover { color: var(--warn-ink); }

.syscheck { margin-top: auto; padding-top: var(--s-3); border-top: 1px solid var(--line); font-size: var(--t-sm); color: var(--ink-2); }
.syscheck summary { font-weight: 600; }
.syscheck p { margin-top: var(--s-2); }

/* ---------------------------------------------------------------- the case sheet */
.sheet { padding: var(--s-6) clamp(20px, 3vw, 44px) 4rem; max-width: 1240px; width: 100%; container-type: inline-size; }
.empty { max-width: 46ch; margin-top: 8vh; }
.empty-dino { width: 7rem; height: 7rem; color: var(--pine-800); margin-bottom: var(--s-4); }
.empty-dino .mascot { width: 100%; height: 100%; }
.empty h1 { font-size: var(--t-xl); }
.empty p { margin-top: var(--s-3); color: var(--ink-2); }

.case-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: var(--s-5); }
.case-head h1 { font-size: var(--t-2xl); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.case-meta { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 1.6rem; padding: 0.15rem 0.65rem; border-radius: 999px; font-size: var(--t-xs); font-weight: 650; line-height: 1.2; background: var(--rail); color: var(--ink-2); border: 1px solid transparent; }
.chip .icon { width: 0.95em; height: 0.95em; }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.chip.amber { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.chip.danger { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-line); }
.changed-chip { margin-left: auto; background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); }

.step { padding: var(--s-5) 0 var(--s-6); border-top: 1px solid var(--line); }
.step-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: var(--t-lg); margin-bottom: var(--s-4); }
.step-no { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--pine-800); color: var(--on-pine); font-size: var(--t-sm); font-weight: 700; font-variant-numeric: tabular-nums; flex: none; transform: translateY(-2px); }
.step-hint { font-size: var(--t-sm); font-weight: 400; color: var(--ink-3); }

/* the customer's message as a letter, with a second sheet peeking out below */
.letter { position: relative; isolation: isolate; max-width: 75ch; padding: var(--s-4) var(--s-5) var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.letter::after { content: ''; position: absolute; inset: auto 0.6rem -0.45rem 0.6rem; height: 0.7rem; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); z-index: -1; transform: rotate(0.4deg); }
.letter-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); font-size: var(--t-sm); color: var(--ink-3); }
.inquiry { margin: 0; font-size: var(--t-md); line-height: 1.65; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }

/* safety layer: risk as a word and an icon, triggers in quotes */
.risk-line { display: flex; align-items: center; gap: 6px; margin-top: var(--s-4); font-size: var(--t-sm); color: var(--ink-3); }
.risk-line .icon { color: var(--ok-ink); }
.risk-box { margin-top: var(--s-4); max-width: 75ch; }
.risk-box h3 { display: flex; align-items: center; gap: var(--s-2); }
.risk-box ul { margin: var(--s-2) 0 6px; padding-left: 20px; }
.risk-box li { margin: 4px 0; }
.notice.risk-box.risk-high { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-line); }
.notice.risk-box.risk-high h3 { color: var(--danger-ink); }
.trigger { font-weight: 700; }

/* banners: plain, warning (amber), danger (red), info (blue); always with a heading in words */
.notice { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.notice h3 { font-size: var(--t-base); margin-bottom: 4px; color: inherit; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice.amber { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.notice.danger { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-line); }
.review-notice { margin-bottom: var(--s-5); max-width: 75ch; background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); }
.review-notice h3 { display: flex; align-items: center; gap: var(--s-2); }
.notice .meta-line { color: inherit; opacity: 0.85; }

.draft-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.timer { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.draft-out { margin-top: var(--s-4); display: grid; gap: var(--s-3); max-width: 75ch; }
.draft-out > button { justify-self: start; }
.ready-line { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--ok-bg); color: var(--ok-ink); border: 1px solid var(--ok-line); font-weight: 600; }
.model-draft { margin: var(--s-2) 0 0; padding: var(--s-3) var(--s-4); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-md); white-space: pre-wrap; font-size: var(--t-sm); color: var(--ink-2); }
.meta-line { font-size: var(--t-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.earlier summary { color: var(--ink-2); font-size: var(--t-sm); }
.earlier ol { margin: var(--s-2) 0 0; padding-left: 20px; font-size: var(--t-sm); color: var(--ink-2); }
summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; min-height: 2.75rem; }
summary::-webkit-details-marker { display: none; }
summary .chev { width: 1em; height: 1em; transition: transform 0.2s var(--ease-out); }
details[open] > summary .chev { transform: rotate(90deg); }
.fact { white-space: nowrap; }

.pair { display: grid; grid-template-columns: 1fr; gap: 0 var(--s-6); border-top: 1px solid var(--line); }
.pair > .step { border-top: 0; }
.pair > .step + .step { border-top: 1px solid var(--line); }
@container (min-width: 640px) {
  .pair { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .pair > .step + .step { border-top: 0; }
}

/* handbook clauses as page cards with a gold bookmark */
.sources { display: grid; gap: var(--s-3); }
.source { padding: var(--s-3) var(--s-4) var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.source h3 { font-size: var(--t-base); display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; }
.source .cid { display: inline-flex; align-items: center; padding: 0.2rem 0.7rem 0.35rem 0.6rem; background: var(--gold-100); color: var(--gold-700); border: 1px solid #e3c877; border-radius: var(--r-sm) var(--r-sm) 0 0; font-size: var(--t-sm); font-weight: 700; font-variant-numeric: tabular-nums; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 4px), 0 100%); }
.source p { margin-top: var(--s-2); font-size: var(--t-sm); line-height: 1.6; color: var(--ink-2); white-space: pre-line; }
.old-wording { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.toggle-all { justify-self: start; margin-top: var(--s-3); }

/* step 4: the reply, the promise check, the review checks, the decision */
.editor textarea { min-height: 300px; resize: none; overflow: hidden; field-sizing: content; line-height: 1.6; padding: var(--s-3) var(--s-4); font-size: var(--t-base); box-shadow: var(--sh-1); }
@supports not (field-sizing: content) { .editor textarea { overflow: auto; } }
.pair .step-hint { flex-basis: 100%; padding-left: 2.5rem; }
.editor-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-3); align-items: center; }
.editor-actions .msg { flex: 1 1 200px; }
.promise-check { margin-top: var(--s-3); }
.promise-check .risk-line { margin-top: 0; }
.promise-check h3 { display: flex; align-items: center; gap: var(--s-2); }
.promise-check ul { margin: var(--s-2) 0 6px; padding-left: 20px; }
.promise-check li { margin: 6px 0; overflow-wrap: anywhere; }
.promise-check mark { background: var(--gold-100); color: var(--gold-700); box-shadow: 0 0 0 1px #e3c877; border-radius: 3px; padding: 0 3px; }
.promise-check .why { opacity: 0.9; }
.review-checks { margin-top: var(--s-4); display: grid; gap: var(--s-2); }
.review-checks legend { margin-bottom: var(--s-2); font-weight: 700; color: var(--pine-900); font-variant-numeric: tabular-nums; }
.review-checks .meta-line { margin: 0 0 4px; color: var(--warn-ink); font-size: var(--t-sm); }
.check { display: flex; gap: var(--s-3); align-items: flex-start; min-height: 2.75rem; padding: var(--s-2) var(--s-3); font-size: var(--t-base); font-weight: 500; color: var(--ink); line-height: 1.4; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.check:has(input:checked) { border-color: var(--pine-500); background: var(--pine-50); }
.check input { margin-top: 0.15rem; }
.check.confirm { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }
.check.confirm:has(input:checked) { border-color: var(--warn-ink); }
.unsaved { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--ink-2); font-weight: 600; }

.handover { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px dashed var(--line-strong); display: grid; gap: var(--s-3); }
.handover h3 { font-size: var(--t-md); }
.queues { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.queues label { display: flex; gap: var(--s-2); align-items: center; min-height: 2.75rem; font-size: var(--t-base); font-weight: 500; color: var(--ink); }
.handover textarea { min-height: 76px; }

.history { margin-top: var(--s-6); }
.history summary { font-weight: 600; color: var(--ink-2); }
.history ol { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: grid; gap: 6px; font-size: var(--t-sm); }
.history li { display: grid; grid-template-columns: 10ch 1fr; gap: 10px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.history b { color: var(--ink); font-weight: 650; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: var(--s-3) 0 0; font-size: var(--t-xs); }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; font-family: var(--mono); word-break: break-all; }

/* ---------------------------------------------------------------- the stage: Guldino at work while a draft is prepared */
.stage-panel { margin-top: var(--s-4); max-width: 75ch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden; }
.stage { --actor: 3.9rem; --pc: 5.3rem; --floor-h: 5.4rem; --base: 0.9rem; padding: var(--s-3) var(--s-4) var(--s-4); }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); min-height: 1.5rem; }
.stage-status { margin: 0; font-weight: 650; color: var(--pine-900); }
.stage-time { color: var(--ink-3); font-size: var(--t-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stage[data-state='idle'] .stage-time { display: none; }
.stage-floor { position: relative; height: var(--floor-h); margin-top: var(--s-2); border-radius: var(--r-md); background: var(--pine-50); overflow: hidden; }
.stage-track { position: absolute; left: var(--s-3); right: var(--s-3); bottom: var(--base); height: 2px; background: repeating-linear-gradient(90deg, var(--pine-300) 0 9px, transparent 9px 16px); }
.stage-actor { position: absolute; left: 0; bottom: var(--base); width: var(--actor); height: var(--actor); color: var(--pine-800); z-index: 3; }
.stage-actor.pose-walk { will-change: transform; }
.dino { width: 100%; height: 100%; transform-origin: 50% 100%; }
.dino .mascot { width: 100%; height: 100%; overflow: visible; transform-origin: 50% 100%; }
.dino.flip .mascot { transform: scaleX(-1); }
.mascot .g-legs, .mascot .g-work, .mascot .g-paws { display: none; }
.pose-work .g-idle, .pose-work .g-book, .pose-work .g-arm { display: none; }
.pose-work .g-work, .pose-work .g-legs, .pose-work .g-paws { display: block; }
.pose-walk .leg-a { transform-box: fill-box; transform-origin: center top; animation: g-step 0.3s infinite alternate; }
.pose-walk .leg-b { transform-box: fill-box; transform-origin: center top; animation: g-step 0.3s infinite alternate-reverse; }
.pose-walk .dino { animation: g-bob 0.3s infinite ease-in-out; }
.pose-type .paw-a { transform-origin: 99px 101px; animation: g-type 0.2s infinite alternate; }
.pose-type .paw-b { transform-origin: 99px 109px; animation: g-type 0.2s infinite alternate-reverse; }
.stage[data-state='idle'] .dino { animation: g-read 2.8s ease-in-out infinite; }
.stage[data-state='done'] .dino { animation: g-hop 0.6s var(--ease-out) 1; }
.stage-pc { position: absolute; left: 50%; bottom: var(--base); width: var(--pc); height: 4.6rem; transform: translateX(-50%); color: var(--pine-800); z-index: 2; }
.stage-monitor { position: absolute; right: 0.15rem; bottom: 0.9rem; width: 3.5rem; height: 2.8rem; border: 2px solid currentColor; border-radius: 6px; background: var(--surface); }
.stage-monitor::before { content: ''; position: absolute; left: calc(50% - 1px); bottom: -0.8rem; width: 2px; height: 0.75rem; background: currentColor; }
.stage-monitor::after { content: ''; position: absolute; left: calc(50% - 0.8rem); bottom: -0.8rem; width: 1.6rem; height: 2px; background: currentColor; }
.stage-code { margin: 0.45rem 0.45rem 0; display: grid; gap: 5px; }
.stage-code i { display: block; height: 3px; border-radius: 2px; background: var(--pine-500); width: 82%; transform-origin: left; }
.stage-code i:nth-child(2) { width: 56%; }
.stage-code i:nth-child(3) { width: 90%; }
.stage-pc.computing .stage-code i { animation: g-code 0.8s infinite alternate; }
.stage-pc.computing .stage-code i:nth-child(2) { animation-delay: 0.2s; }
.stage-pc.computing .stage-code i:nth-child(3) { animation-delay: 0.4s; }
.stage-kbd { position: absolute; left: 0.1rem; bottom: 0.55rem; width: 2.1rem; height: 5px; border-radius: 2px; background: currentColor; transform: skewX(-20deg); }
.stage-desk { position: absolute; left: -0.4rem; right: -0.4rem; bottom: 0; height: 3px; border-radius: 2px; background: currentColor; }
.stage-sheet { position: absolute; right: -0.35rem; top: 40%; width: 1.3rem; height: 1.7rem; border: 2px solid var(--pine-800); border-radius: 3px; background: #fff; opacity: 0; transform: rotate(-8deg); z-index: 4; }
.stage-sheet::before { content: ''; position: absolute; inset: 0.3rem 0.2rem; background: repeating-linear-gradient(to bottom, var(--pine-600) 0 2px, transparent 2px 6px); }
.stage-actor.carrying .stage-sheet { opacity: 1; }
.stage-sheet.flight { position: fixed; right: auto; opacity: 1; pointer-events: none; z-index: 80; box-shadow: var(--sh-2); }
/* the three steps double as the progress bar */
.stage-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); margin: var(--s-3) 0 0; padding: 0; list-style: none; }
.stage-steps li { display: flex; align-items: center; gap: 0.35rem; padding-top: 0.45rem; border-top: 3px solid var(--pine-100); color: var(--ink-3); font-size: var(--t-sm); line-height: 1.25; transition: border-color 0.4s var(--ease-out), color 0.3s ease; }
.stage-steps .icon { opacity: 0; transition: opacity 0.25s ease; }
.stage-steps li.now { border-top-color: var(--pine-800); color: var(--pine-900); font-weight: 700; }
.stage-steps li.done { border-top-color: var(--pine-600); color: var(--ink-2); }
.stage-steps li.done .icon { opacity: 1; color: var(--pine-600); }
@keyframes g-bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-3px) rotate(1deg); } }
@keyframes g-step { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
@keyframes g-type { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
@keyframes g-code { from { transform: scaleX(0.3); } to { transform: scaleX(1); } }
@keyframes g-read { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-2px) rotate(-1.2deg); } }
@keyframes g-hop { 0% { transform: translateY(0); } 40% { transform: translateY(-10px) rotate(-4deg); } 100% { transform: translateY(0); } }
/* the reply field glows once when the sheet has landed */
@keyframes arrive { from { box-shadow: 0 0 0 0 rgb(75 145 124 / 0.55); background: var(--pine-50); } to { box-shadow: 0 0 0 12px rgb(75 145 124 / 0); } }
.editor textarea.arrive { animation: arrive 1.3s var(--ease-out); }

/* ---------------------------------------------------------------- evaluation page */
.eval { max-width: 1320px; margin: 0 auto; padding: var(--s-6) var(--s-6) 4rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-6); }
.eval-head h1 { font-size: var(--t-2xl); letter-spacing: -0.03em; margin-bottom: 6px; }
.eval-head .case-meta { max-width: 90ch; }
.eval-h2 { font-size: var(--t-lg); margin-bottom: var(--s-3); }
.eval-h3 { font-size: var(--t-md); margin: var(--s-4) 0 var(--s-2); }
.eval-start { padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); display: grid; gap: var(--s-3); }
.start-row { display: flex; flex-wrap: wrap; gap: var(--s-4) var(--s-6); align-items: flex-end; }
.models { display: grid; gap: 2px; flex: 1 1 420px; }
.models legend { font-weight: 700; color: var(--pine-900); margin-bottom: 4px; }
.model-opt { display: grid; grid-template-columns: auto 1fr; column-gap: var(--s-3); align-items: center; padding: var(--s-2) 0; font-size: var(--t-base); font-weight: 500; color: var(--ink); }
.model-opt input { grid-row: span 2; }
.model-name { display: inline-flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; font-weight: 650; }
.model-price { grid-column: 2; font-size: var(--t-xs); font-weight: 400; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.start-actions { display: grid; gap: 6px; justify-items: start; }
.progress-box { display: grid; gap: var(--s-2); }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s-3) var(--s-6); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.meter-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: var(--t-sm); }
.meter-label { font-weight: 600; color: var(--ink-2); }
.meter-num { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.meter-bar { height: 8px; margin-top: 6px; border-radius: 999px; background: var(--rail); overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--pine-600); border-radius: 999px; transition: width 0.4s var(--ease-out); }
.meter.full .meter-bar span { background: var(--danger-ink); }
.meter-msg { margin-top: 6px; font-size: var(--t-sm); color: var(--danger-ink); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-1); }
.eval-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.eval-table th, .eval-table td { padding: var(--s-2) var(--s-3); text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.eval-table thead th { position: sticky; top: 0; background: var(--rail); color: var(--ink-2); font-weight: 650; white-space: nowrap; }
.eval-table td.num, .eval-table th.num { text-align: right; white-space: nowrap; }
.eval-table tr.current td, .eval-table tr.current th { background: var(--pine-50); }
.eval-table .chip { margin-left: 6px; font-size: 0.75rem; padding: 1px 8px; min-height: 0; }
.eval-table tbody th { font-weight: 700; white-space: nowrap; }
.eval-table tbody th .icon { width: 14px; height: 14px; margin-left: 6px; vertical-align: -2px; color: var(--danger-ink); }
.diff.better { color: var(--ok-ink); font-weight: 700; }
.diff.worse { color: var(--danger-ink); font-weight: 700; }
.changed-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: var(--t-sm); }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-2) var(--s-4); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s-3); margin: var(--s-4) 0 0; }
.tile { margin: 0; padding: var(--s-3) var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.tile dt { font-size: var(--t-sm); color: var(--ink-2); font-weight: 600; }
.tile dd { margin: 4px 0 0; display: grid; gap: 2px; }
.tile-value { font-size: var(--t-lg); font-weight: 700; letter-spacing: -0.02em; color: var(--pine-900); font-variant-numeric: tabular-nums; }
.tile-sub { font-size: var(--t-xs); color: var(--ink-3); }
.tile.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.rules-note { margin-top: var(--s-3); }
.rules-note ul { margin: var(--s-2) 0 0; padding-left: 20px; font-size: var(--t-sm); color: var(--ink-2); display: grid; gap: 4px; max-width: 100ch; }
.cases-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px var(--s-4); }
.verdict { display: inline-flex; gap: 6px; align-items: flex-start; }
.verdict .icon { width: 15px; height: 15px; margin-top: 2px; }
.verdict.good .icon { color: var(--ok-ink); }
.verdict.bad .icon { color: var(--danger-ink); }
.eval-table tr.problem > * { background: #fffaf0; }
.case-more td { padding-top: 0; }
.case-more summary { font-size: var(--t-sm); color: var(--ink-2); }
.case-more details[open] { padding: 4px 0 10px; }
.case-more .model-draft { max-width: 90ch; }

/* ---------------------------------------------------------------- Stage 8.1: accounts and roles */
.role-chip { display: inline-block; margin-left: var(--s-2); padding: 1px 8px; border-radius: 999px; background: rgb(255 255 255 / 0.14); color: var(--on-pine); font-size: var(--t-xs); font-weight: 650; vertical-align: 1px; }
.views a .count { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 5px; border-radius: 999px; background: #ffd98a; color: var(--pine-950); font-size: var(--t-xs); font-weight: 800; font-variant-numeric: tabular-nums; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 45; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; background: var(--surface); border: 1px solid var(--warn-line); border-radius: var(--r-lg); box-shadow: var(--sh-3); font-weight: 600; color: var(--ink); }
.toast a { font-weight: 700; }
.cell .risk-cleared { color: var(--ok-ink); }
.cell .flag.done { color: var(--ok-ink); }
.cell[aria-current='true'] .flag.done, .cell[aria-current='true'] .risk-cleared { color: #b9f0d0 !important; }
.notice.risk-box.cleared, .notice.risk-box.risk-high.cleared { background: var(--surface); color: var(--ink-2); border-color: var(--ok-line); }
.notice.risk-box.cleared h3 { color: var(--ok-ink); }
.cleared-line { margin-top: var(--s-2); color: var(--ink); }
.risk-box .editor-actions { margin-top: var(--s-2); }
.clear-risk { margin-top: var(--s-2); }
.clear-risk summary { color: inherit; font-weight: 600; }
.clear-risk-form { display: grid; gap: var(--s-2); max-width: 60ch; }
.clear-risk-form label, .handover-panel label { color: inherit; }
.handover-panel { margin-bottom: var(--s-5); max-width: 75ch; display: grid; gap: var(--s-2); }
.handover-panel h3 { display: flex; align-items: center; gap: var(--s-2); }
.handover-panel.done { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.handover-panel .editor-actions { margin-top: 0; }
.info-notice { margin-bottom: var(--s-5); max-width: 75ch; background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); }
.info-notice h3 { display: flex; align-items: center; gap: var(--s-2); }
.reply-view { max-width: 75ch; font-size: var(--t-base); color: var(--ink); }
.history .acct { color: var(--ink-3); font-weight: 400; }
.ho-table tr.unseen > * { background: #fffaf0; }
.ho-table .ho-reason { min-width: 24ch; max-width: 52ch; }
.ho-table button { min-height: 2.25rem; white-space: nowrap; }
.empty-line { display: flex; align-items: center; gap: var(--s-2); color: var(--ink-2); }
.empty-line .icon { color: var(--ok-ink); }
.change-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--t-sm); }
.change-log li { display: grid; grid-template-columns: 12ch 1fr; gap: 10px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.change-log b { color: var(--ink); font-weight: 650; }

/* ---------------------------------------------------------------- smaller screens */
@media (max-width: 1200px) and (min-width: 761px) {
  .work { grid-template-columns: 248px minmax(0, 1fr); }
  .rail { padding: var(--s-4) var(--s-3); }
}
@media (max-width: 52rem) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: var(--s-5); gap: var(--s-4); min-height: 0; }
  .login-pitch { margin-top: var(--s-4); }
  .login-pitch h1 { font-size: var(--t-xl); }
  .login-pitch p { display: none; }
  .login-mark { width: 9rem; right: -1rem; bottom: -1.5rem; }
  .ai-credit { margin-top: 0; }
}
@media (max-width: 760px) {
  .work { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: var(--s-3) var(--s-4); }
  .rail-toggle { display: inline-flex; }
  .work.has-case:not(.rail-open) .rail :is(#filter, .grid, .legend, .syscheck, .flagged-first) { display: none; }
  .grid { grid-template-columns: repeat(10, 1fr); }
  .cell { min-height: 2.75rem; font-size: 0.78rem; }
  .cell .icon { width: 13px; height: 13px; }
  .syscheck { margin-top: 0; }
  .queues { grid-template-columns: 1fr; }
  .case-head h1 { font-size: var(--t-xl); }
  .topbar { flex-wrap: wrap; padding: var(--s-2) var(--s-4) 0; gap: var(--s-2) var(--s-3); }
  .topbar .logo-art { width: 7.2rem; height: 1.86rem; }
  .who { margin-left: auto; }
  .who-name { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
  .toast { right: 16px; left: 16px; bottom: 16px; max-width: none; }
  .views { order: 3; width: calc(100% + 2rem); margin: 0 -1rem; padding: 0 var(--s-2); border-top: 1px solid rgb(255 255 255 / 0.1); }
  .views a { border-radius: 0; }
  .eval { padding: var(--s-5) var(--s-4) var(--s-7); }
  .eval-head h1 { font-size: var(--t-xl); }
  .sheet { padding-top: var(--s-5); }
  .stage { --actor: 3.6rem; --pc: 4.9rem; padding-inline: var(--s-3); }
  .stage-steps li { font-size: var(--t-xs); }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
  .who-name #who { display: none; }
  .role-chip { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
