/* ==========================================================================
   Global Heritage Registry — design system
   1. Fonts  2. Tokens  3. Base  4. Layout  5. Brand & header  6. Country
   7. Buttons  8. Forms  9. Badges & marks  10. Tables  11. Content blocks
   12. Timeline  13. Dialog, toast, popover  14. Public pages  15. Item record
   16. Wizard  17. Workspace  18. Case  19. States  20. Utilities  21. Motion
   ========================================================================== */

/* 1. Fonts ---------------------------------------------------------------- */
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/source-serif-4-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 500; font-style: normal; font-display: swap; src: url(../fonts/source-serif-4-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-style: normal; font-display: swap; src: url(../fonts/source-serif-4-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: italic; font-display: swap; src: url(../fonts/source-serif-4-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url(../fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

/* 2. Tokens --------------------------------------------------------------- */
:root {
  /* Palette */
  --navy-950: #0b1422;
  --navy-900: #101c2e;
  --navy-800: #182840;
  --navy-700: #233858;
  --navy-600: #34507a;
  --navy-200: #c4cddb;
  --navy-100: #e3e8ef;

  --ivory-0:   #fffdf8;
  --ivory-50:  #f9f6ef;
  --ivory-100: #f2ede1;
  --ivory-200: #e8e1d0;

  --stone-300: #d6cfbf;
  --stone-400: #b5ac99;
  --stone-500: #877f6f;
  --stone-600: #6a6357;
  --stone-700: #4d4840;

  --ink:   #1b1e23;
  --ink-2: #3a3e45;
  --ink-3: #5c5f63;

  --brass-200: #e7d7b0;
  --brass-300: #d4bc85;
  --brass-500: #a6813f;
  --brass-600: #87682e;
  --brass-700: #6c5223;

  --green-700: #2b664b;  --green-50: #e7f0ea;  --green-200: #b9d3c3;
  --blue-700:  #2d5786;  --blue-50:  #e6edf5;  --blue-200:  #bccbdf;
  --amber-700: #85560a;  --amber-50: #f8eedb;  --amber-200: #e6cf9f;
  --red-700:   #9e3828;  --red-50:   #f7e6e1;  --red-200:   #e2b8ae;

  /* Semantic */
  --bg: var(--ivory-50);
  --surface: var(--ivory-0);
  --surface-sunken: var(--ivory-100);
  --text: var(--ink);
  --text-2: var(--ink-2);
  --text-3: var(--ink-3);
  --line: #e2dbcb;
  --line-strong: var(--stone-300);
  --accent: var(--brass-600);
  --link: var(--navy-700);
  --focus: #2d5786;

  /* Type */
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, "SFMono-Regular", monospace;

  --fs-2xs: 0.6875rem; /* 11 — overlines only */
  --fs-xs:  0.75rem;   /* 12 */
  --fs-sm:  0.8125rem; /* 13 */
  --fs-base: 0.9375rem;/* 15 */
  --fs-md:  1rem;      /* 16 */
  --fs-lg:  1.125rem;  /* 18 */
  --fs-xl:  1.375rem;  /* 22 */
  --fs-2xl: 1.75rem;   /* 28 */
  --fs-3xl: 2.25rem;   /* 36 */
  --fs-4xl: 3rem;      /* 48 */

  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-body: 1.55;

  /* Space (4px base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* Shape & elevation */
  --r-1: 2px;
  --r-2: 4px;
  --shadow-pop: 0 1px 2px rgba(16, 28, 46, .08), 0 12px 32px -8px rgba(16, 28, 46, .22);
  --shadow-dialog: 0 24px 64px -12px rgba(11, 20, 34, .4);

  --container: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* 3. Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-md)/var(--lh-body) var(--font-sans);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--navy-900); text-decoration-thickness: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; color: var(--text); }
p { margin: 0 0 var(--s-4); }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; }
dl, dd { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; }
button { font: inherit; color: inherit; }
::selection { background: var(--brass-200); color: var(--ink); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-1); }
.on-dark :focus-visible, .site-header :focus-visible, .ws-sidebar :focus-visible, .site-footer :focus-visible { outline-color: var(--brass-300); }

.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 1000;
  background: var(--ivory-0); color: var(--ink); padding: var(--s-3) var(--s-4);
  border: 2px solid var(--focus); font-weight: 500;
}
.skip-link:focus { top: var(--s-4); }

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

/* Typography roles */
.display { font: 400 clamp(2.125rem, 1.4rem + 2.6vw, var(--fs-4xl))/1.08 var(--font-serif); letter-spacing: -0.012em; }
.h1 { font: 500 clamp(1.75rem, 1.4rem + 1.2vw, var(--fs-3xl))/var(--lh-tight) var(--font-serif); letter-spacing: -0.008em; }
.h2 { font: 500 var(--fs-2xl)/var(--lh-tight) var(--font-serif); }
.h3 { font: 500 var(--fs-xl)/var(--lh-snug) var(--font-serif); }
.h4 { font: 600 var(--fs-md)/var(--lh-snug) var(--font-sans); }
.h5 { font: 600 var(--fs-base)/var(--lh-snug) var(--font-sans); }
.overline {
  font: 500 var(--fs-xs)/1.3 var(--font-sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent);
}
.lede { font-size: var(--fs-lg); line-height: 1.55; color: var(--text-2); max-width: 38em; }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.mono, .ref { font-family: var(--font-mono); font-feature-settings: "zero"; letter-spacing: 0; }
.ref { font-size: .95em; font-weight: 500; color: var(--ink); white-space: nowrap; }
.serif { font-family: var(--font-serif); }
.prose { max-width: 40em; }
.prose p { margin-bottom: var(--s-4); }

/* 4. Layout --------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding-inline: var(--gutter); }
.container--narrow { max-width: 880px; }
.section { padding-block: clamp(48px, 7vw, 96px); }
.section--tight { padding-block: clamp(32px, 4vw, 56px); }
.section + .section { border-top: 1px solid var(--line); }
.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.stack-lg > * + * { margin-top: var(--s-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.cluster--sm { gap: var(--s-2); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-5) var(--s-6); }
.rule-top { border-top: 1px solid var(--line); padding-top: var(--s-5); }

/* 5. Brand & header ------------------------------------------------------- */
.wordmark { display: inline-flex; align-items: center; gap: var(--s-3); color: inherit; text-decoration: none; }
.wordmark:hover { color: inherit; }
.wordmark .emblem { color: var(--ivory-0); flex: none; }
.emblem__accent { stroke: var(--brass-300); }
.emblem__gap { stroke: var(--navy-900); }
.wordmark__text { display: flex; flex-direction: column; line-height: 1; }
.wordmark__name { font: 500 1.1875rem/1 var(--font-serif); letter-spacing: .005em; }
.wordmark__sub { font: 500 9.5px/1 var(--font-sans); letter-spacing: .28em; text-transform: uppercase; margin-top: 5px; color: var(--brass-300); }
.wordmark--light .emblem { color: var(--navy-900); }
.wordmark--light .emblem__accent { stroke: var(--brass-500); }
.wordmark--light .emblem__gap { stroke: var(--surface); }
.wordmark--light .wordmark__sub { color: var(--brass-600); }

.site-header { background: var(--navy-900); color: var(--ivory-100); position: sticky; top: 0; z-index: 50; }
.site-header__bar { display: flex; align-items: center; gap: var(--s-5); height: var(--header-h); }
.site-header__nav { display: flex; align-items: stretch; height: 100%; gap: 0; margin-left: var(--s-4); }
.site-header__nav a {
  display: flex; align-items: center; padding: 0 var(--s-4); height: 100%;
  color: var(--navy-200); text-decoration: none; font-size: var(--fs-base); font-weight: 500;
  border-bottom: 2px solid transparent; border-top: 2px solid transparent;
}
.site-header__nav a:hover { color: var(--ivory-0); }
.site-header__nav a[aria-current="page"] { color: var(--ivory-0); border-bottom-color: var(--brass-300); }
.site-header__end { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.header-link {
  display: inline-flex; align-items: center; gap: var(--s-2); height: 40px; padding: 0 var(--s-3);
  color: var(--ivory-100); text-decoration: none; font-size: var(--fs-base); font-weight: 500; border-radius: var(--r-2);
  background: none; border: 0; cursor: pointer;
}
.header-link:hover { background: rgba(255,255,255,.07); color: var(--ivory-0); }
.header-avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brass-300); color: var(--navy-900); font: 600 11px/1 var(--font-sans); letter-spacing: .04em;
}
.menu-toggle { display: none; }

/* Workspace band: persistent statement of the active jurisdiction */
.jurisdiction-band { background: var(--ivory-100); border-bottom: 1px solid var(--line); font-size: var(--fs-sm); color: var(--text-2); }
.jurisdiction-band__inner { display: flex; align-items: center; gap: var(--s-3); min-height: 36px; flex-wrap: wrap; }
.jurisdiction-band .flag { width: 18px; height: 13.5px; }
.jurisdiction-band strong { color: var(--ink); font-weight: 600; }
.jurisdiction-band__sep { width: 1px; height: 14px; background: var(--stone-300); }
.jurisdiction-band__end { margin-left: auto; }

.demo-ribbon { background: var(--navy-950); color: var(--navy-200); font-size: var(--fs-xs); text-align: center; padding: 6px var(--gutter); letter-spacing: .02em; }
.demo-ribbon strong { color: var(--brass-300); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-right: var(--s-2); }

/* 6. Country selector ----------------------------------------------------- */
.flag { width: 20px; height: 15px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.14); border-radius: 1px; }
.country-trigger {
  display: inline-flex; align-items: center; gap: var(--s-3); height: 44px; padding: 0 var(--s-3) 0 var(--s-3);
  background: rgba(255,255,255,.04); color: var(--ivory-0); border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--r-2); cursor: pointer; text-align: left;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.country-trigger:hover { border-color: rgba(255,255,255,.34); background: rgba(255,255,255,.07); }
.country-trigger[aria-expanded="true"] { border-color: var(--brass-300); }
.country-trigger__label { display: flex; flex-direction: column; line-height: 1.1; }
.country-trigger__kicker { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--navy-200); font-weight: 500; }
.country-trigger__name { font-size: var(--fs-base); font-weight: 500; }
.country-trigger .icon { color: var(--navy-200); }
.country-trigger--light { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.country-trigger--light:hover { background: var(--surface); border-color: var(--stone-500); }
.country-trigger--light .country-trigger__kicker, .country-trigger--light .icon { color: var(--text-3); }
.country-trigger.is-confirmed { animation: confirm-ring 1.6s var(--ease) 1; }
@keyframes confirm-ring { 0% { box-shadow: 0 0 0 0 rgba(212,188,133,.7); } 100% { box-shadow: 0 0 0 10px rgba(212,188,133,0); } }

.country-pop {
  position: absolute; z-index: 80; width: 360px; max-width: calc(100vw - 24px);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: var(--r-2); box-shadow: var(--shadow-pop);
}
.country-pop[hidden] { display: none; }
.country-pop__head { padding: var(--s-3) var(--s-3) var(--s-2); border-bottom: 1px solid var(--line); }
.country-pop__title { font-size: var(--fs-xs); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); font-weight: 500; margin: 0 0 var(--s-2) var(--s-1); }
.country-pop__search { position: relative; }
.country-pop__search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.country-pop__search input { padding-left: 36px; }
.country-pop__list { max-height: min(420px, 60vh); overflow-y: auto; padding: var(--s-1) 0 var(--s-2); overscroll-behavior: contain; }
.country-pop__group { font-size: var(--fs-2xs); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; padding: var(--s-3) var(--s-4) var(--s-1); }
.country-opt {
  display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-4); min-height: 40px; color: var(--ink); text-decoration: none; cursor: pointer;
}
.country-opt:hover, .country-opt.is-active { background: var(--ivory-100); color: var(--ink); }
.country-opt[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--brass-500); background: var(--ivory-50); }
.country-opt__name { font-size: var(--fs-base); }
.country-opt__meta { display: flex; align-items: center; gap: var(--s-2); font: 400 var(--fs-xs)/1 var(--font-mono); color: var(--text-3); }
.country-opt__check { color: var(--brass-600); }
.country-pop__empty { padding: var(--s-5) var(--s-4); color: var(--text-3); font-size: var(--fs-sm); }
.country-pop__foot { border-top: 1px solid var(--line); padding: var(--s-2) var(--s-4); font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: var(--s-4); }
.kbd { font: 500 10.5px/1 var(--font-mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 3px; padding: 2px 5px; color: var(--text-2); background: var(--ivory-50); }

/* 7. Buttons -------------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--ink); --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-5);
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd);
  border-radius: var(--r-2); font: 500 var(--fs-base)/1 var(--font-sans); letter-spacing: .005em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease);
}
.btn:hover { color: var(--btn-fg); border-color: var(--stone-500); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary { --btn-bg: var(--navy-800); --btn-fg: var(--ivory-0); --btn-bd: var(--navy-800); }
.btn--primary:hover { --btn-bg: var(--navy-900); border-color: var(--navy-900); color: var(--ivory-0); }
.btn--accent { --btn-bg: var(--brass-300); --btn-fg: var(--navy-950); --btn-bd: var(--brass-300); }
.btn--accent:hover { --btn-bg: var(--brass-200); border-color: var(--brass-200); color: var(--navy-950); }
.btn--approve { --btn-bg: var(--green-700); --btn-fg: #fff; --btn-bd: var(--green-700); }
.btn--approve:hover { --btn-bg: #22533d; border-color: #22533d; color: #fff; }
.btn--danger { --btn-bg: var(--surface); --btn-fg: var(--red-700); --btn-bd: var(--red-200); }
.btn--danger:hover { --btn-bg: var(--red-50); border-color: var(--red-700); color: var(--red-700); }
.btn--danger-solid { --btn-bg: var(--red-700); --btn-fg: #fff; --btn-bd: var(--red-700); }
.btn--danger-solid:hover { --btn-bg: #852e20; border-color: #852e20; color: #fff; }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; padding: 0 var(--s-3); }
.btn--ghost:hover { --btn-bg: var(--ivory-100); border-color: transparent; }
.btn--on-dark { --btn-bg: transparent; --btn-fg: var(--ivory-0); --btn-bd: rgba(255,255,255,.3); }
.btn--on-dark:hover { --btn-bg: rgba(255,255,255,.06); border-color: rgba(255,255,255,.6); color: var(--ivory-0); }
.btn--sm { min-height: 36px; padding: 0 var(--s-3); font-size: var(--fs-sm); }
.btn--lg { min-height: 52px; padding: 0 var(--s-6); font-size: var(--fs-md); }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: 44px; }
.btn--icon.btn--sm { width: 36px; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-arrow { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 500; text-decoration: none; color: var(--link); }
.link-arrow .icon { transition: transform .15s var(--ease); }
.link-arrow:hover .icon { transform: translateX(3px); }
.link-arrow:hover { text-decoration: underline; }
.text-btn { background: none; border: 0; padding: 0; color: var(--link); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.text-btn:hover { text-decoration-thickness: 2px; }

/* 8. Forms ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field, .field + .field-row, .field-row + .field, .field-row + .field-row, .fieldset + .field, .field + .fieldset, .fieldset + .fieldset { margin-top: var(--s-5); }
.field-row { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.field-row > .field + .field { margin-top: 0; }
.label { font-size: var(--fs-base); font-weight: 500; color: var(--ink); display: flex; align-items: baseline; gap: var(--s-2); flex-wrap: wrap; }
.label__opt { font-weight: 400; font-size: var(--fs-sm); color: var(--text-3); }
.label__req { font-weight: 500; font-size: var(--fs-xs); color: var(--brass-700); letter-spacing: .04em; text-transform: uppercase; }
.hint { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.45; max-width: 46em; }
.why { display: flex; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); background: var(--ivory-100); border-left: 2px solid var(--brass-300); padding: var(--s-2) var(--s-3); line-height: 1.45; }
.why .icon { flex: none; color: var(--brass-600); margin-top: 1px; }

.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--stone-400); border-radius: var(--r-2);
  font: 400 var(--fs-md)/1.4 var(--font-sans);
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: #8d877c; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--stone-600); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(45,87,134,.22); }
.textarea { min-height: 120px; resize: vertical; line-height: var(--lh-body); }
.select {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235c5f63' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input--mono { font-family: var(--font-mono); letter-spacing: .02em; }
.input--sm, .select--sm { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: var(--fs-sm); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group__addon { display: flex; align-items: center; padding: 0 var(--s-3); border: 1px solid var(--stone-400); border-left: 0; background: var(--ivory-100); color: var(--text-2); font: 400 var(--fs-sm)/1 var(--font-mono); border-radius: 0 var(--r-2) var(--r-2) 0; }
.input-with-icon { position: relative; }
.input-with-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-with-icon > .input { padding-left: 40px; }

.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--red-700); box-shadow: inset 3px 0 0 var(--red-700); }
.field-error { display: none; align-items: flex-start; gap: 6px; color: var(--red-700); font-size: var(--fs-sm); font-weight: 500; line-height: 1.4; }
.field.has-error .field-error { display: flex; }
.field-error .icon { flex: none; margin-top: 1px; }

.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset > legend { padding: 0; margin-bottom: var(--s-3); }

.choice-list { display: grid; gap: var(--s-2); }
.choice-list--inline { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.choice {
  position: relative; display: grid; grid-template-columns: 20px 1fr; gap: var(--s-3); align-items: start;
  padding: var(--s-3) var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--r-2);
  background: var(--surface); cursor: pointer; transition: border-color .12s var(--ease), background-color .12s var(--ease);
}
.choice:hover { border-color: var(--stone-500); }
.choice input { margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--navy-800); }
.choice:has(input:checked) { border-color: var(--navy-700); background: var(--blue-50); box-shadow: inset 0 0 0 1px var(--navy-700); }
.choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice__title { font-weight: 500; display: block; }
.choice__desc { display: block; font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; line-height: 1.45; }
.check { display: inline-flex; gap: var(--s-3); align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--navy-800); flex: none; }

.error-summary {
  border: 1px solid var(--red-200); border-left: 4px solid var(--red-700); background: var(--red-50);
  padding: var(--s-4) var(--s-5); border-radius: var(--r-2); margin-bottom: var(--s-6);
}
.error-summary:focus { outline: 2px solid var(--red-700); outline-offset: 2px; }
.error-summary h2 { font: 600 var(--fs-md)/1.3 var(--font-sans); color: var(--red-700); margin-bottom: var(--s-2); display: flex; gap: var(--s-2); align-items: center; }
.error-summary ul { list-style: none; display: grid; gap: var(--s-1); }
.error-summary a { color: var(--red-700); font-weight: 500; }

/* 9. Badges & verification marks ----------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 var(--s-2);
  border-radius: var(--r-1); font: 500 var(--fs-xs)/1 var(--font-sans); letter-spacing: .02em; white-space: nowrap;
  border: 1px solid transparent;
}
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--neutral  { background: var(--ivory-200); color: var(--stone-700); }
.badge--info     { background: var(--blue-50);  color: var(--blue-700);  border-color: var(--blue-200); }
.badge--verified { background: var(--green-50); color: var(--green-700); border-color: var(--green-200); }
.badge--warning  { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-200); }
.badge--danger   { background: var(--red-50);   color: var(--red-700);   border-color: var(--red-200); }
.badge--muted    { background: transparent;     color: var(--stone-600); border-color: var(--line-strong); }
.badge--outline  { background: transparent; color: var(--text-2); border-color: var(--line-strong); }
.badge--demo     { background: transparent; color: var(--brass-700); border: 1px dashed var(--brass-500); letter-spacing: .08em; text-transform: uppercase; font-size: 10px; height: 20px; }
.badge--lg { height: 28px; font-size: var(--fs-sm); padding: 0 var(--s-3); }

.vmark { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; vertical-align: middle; }
.vmark .icon { flex: none; }
.vmark--verified   { color: var(--green-700); }
.vmark--submitted  { color: var(--stone-600); }
.vmark--estimated  { color: var(--blue-700); }
.vmark--unverified { color: var(--amber-700); }
.vmark--disputed   { color: var(--red-700); }

.priority { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.priority__bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.priority__bars i { width: 3px; background: var(--stone-300); }
.priority__bars i:nth-child(1) { height: 5px; } .priority__bars i:nth-child(2) { height: 8px; } .priority__bars i:nth-child(3) { height: 12px; }
.priority--standard i:nth-child(1) { background: var(--stone-600); }
.priority--elevated i:nth-child(-n+2) { background: var(--amber-700); }
.priority--urgent i { background: var(--red-700); }
.priority--urgent { color: var(--red-700); font-weight: 500; }

/* 10. Tables -------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-2); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.table th, .table td { padding: 12px var(--s-4); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--ivory-100);
  font: 600 var(--fs-xs)/1.2 var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--text-2);
  white-space: nowrap; border-bottom-color: var(--line-strong);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .1s; }
.table tbody tr:hover { background: var(--ivory-50); }
.table tbody tr.is-urgent td:first-child { box-shadow: inset 3px 0 0 var(--red-700); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
.table td.cell-primary a { font-weight: 500; color: var(--ink); text-decoration: none; }
.table td.cell-primary a:hover { text-decoration: underline; }
.table .cell-sub { display: block; font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.row-link { position: static; }
.table tbody tr.is-clickable { cursor: pointer; }
.sort-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; text-decoration: none; }
.sort-btn .icon { opacity: .4; }
.sort-btn:hover .icon, th[aria-sort] .sort-btn .icon { opacity: 1; }
.due--overdue { color: var(--red-700); font-weight: 500; }
.due--soon { color: var(--amber-700); font-weight: 500; }

/* 11. Content blocks ------------------------------------------------------ */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.panel__title { font: 600 var(--fs-base)/1.3 var(--font-sans); }
.panel__body { padding: var(--s-5); }
.panel__body--flush { padding: 0; }
.panel__foot { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line); background: var(--ivory-50); }

.meta-list { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; }
.meta-list > dt, .meta-list > dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.meta-list > dt { font-size: var(--fs-sm); color: var(--text-3); padding-right: var(--s-4); }
.meta-list > dd { font-size: var(--fs-base); color: var(--ink); display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-1) var(--s-3); }
.meta-list > dt:last-of-type, .meta-list > dd:last-of-type { border-bottom: 0; }
.meta-list--compact > dt, .meta-list--compact > dd { padding: 7px 0; }
.meta-list .value-unknown { color: var(--text-3); font-style: italic; }

.callout { display: grid; grid-template-columns: 20px 1fr; gap: var(--s-3); padding: var(--s-4) var(--s-5); border: 1px solid var(--line-strong); border-radius: var(--r-2); background: var(--surface); }
.callout > .icon { margin-top: 2px; }
.callout__title { font-weight: 600; margin-bottom: 2px; }
.callout p { font-size: var(--fs-base); color: var(--text-2); }
.callout--info { border-color: var(--blue-200); background: var(--blue-50); } .callout--info > .icon { color: var(--blue-700); }
.callout--warning { border-color: var(--amber-200); background: var(--amber-50); } .callout--warning > .icon { color: var(--amber-700); }
.callout--danger { border-color: var(--red-200); background: var(--red-50); } .callout--danger > .icon { color: var(--red-700); }
.callout--success { border-color: var(--green-200); background: var(--green-50); } .callout--success > .icon { color: var(--green-700); }
.callout--plain > .icon { color: var(--text-3); }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
.section-head__title { display: flex; flex-direction: column; gap: var(--s-2); }

.breadcrumb { display: flex; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-3); list-style: none; }
.breadcrumb li { display: inline-flex; align-items: center; gap: var(--s-2); }
.breadcrumb li + li::before { content: "/"; color: var(--stone-400); }
.breadcrumb a { color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--line-strong); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-4); height: 44px; white-space: nowrap;
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: var(--fs-base);
  border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--navy-800); }
.tab__count { font: 500 var(--fs-xs)/1 var(--font-mono); color: var(--text-3); background: var(--ivory-200); padding: 3px 6px; border-radius: 10px; }
.tab[aria-selected="true"] .tab__count, .tab[aria-current="page"] .tab__count { background: var(--navy-800); color: var(--ivory-0); }

.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-100); color: var(--navy-700); display: inline-grid; place-items: center; font: 600 11px/1 var(--font-sans); letter-spacing: .04em; flex: none; }
.avatar--sm { width: 24px; height: 24px; font-size: 9.5px; }

.thumb { width: 64px; aspect-ratio: 4 / 3; object-fit: cover; background: var(--ivory-200); border: 1px solid var(--line); border-radius: var(--r-1); flex: none; }
.thumb--lg { width: 112px; }
.thumb--empty { display: grid; place-items: center; color: var(--stone-500); }

.stat { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4) var(--s-5); }
.stat + .stat { border-left: 1px solid var(--line); }
.stat__label { font-size: var(--fs-sm); color: var(--text-3); }
.stat__value { font: 500 var(--fs-2xl)/1.1 var(--font-serif); font-variant-numeric: tabular-nums; }
.stat__note { font-size: var(--fs-xs); color: var(--text-3); }
.stat--alert .stat__value { color: var(--red-700); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); }

/* 12. Timeline ------------------------------------------------------------ */
.timeline { list-style: none; position: relative; }
.timeline > li { position: relative; display: grid; grid-template-columns: 112px 1fr; gap: var(--s-4); padding-bottom: var(--s-5); }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before { content: ""; position: absolute; left: 124px; top: 10px; bottom: -10px; width: 1px; background: var(--line-strong); }
.timeline > li:last-child::before { display: none; }
.timeline__date { font: 500 var(--fs-sm)/1.4 var(--font-mono); color: var(--text-2); text-align: right; padding-top: 1px; }
.timeline__body { position: relative; padding-left: var(--s-5); }
.timeline__body::before { content: ""; position: absolute; left: -4px; top: 6px; width: 9px; height: 9px; background: var(--surface); border: 1.5px solid var(--navy-700); border-radius: 50%; }
.timeline__title { font-weight: 600; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-3); }
.timeline__text { color: var(--text-2); font-size: var(--fs-base); margin-top: 2px; }
.timeline__meta { font-size: var(--fs-sm); color: var(--text-3); margin-top: var(--s-1); display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); align-items: center; }
.timeline__item--gap .timeline__body::before { border-style: dashed; border-color: var(--amber-700); background: var(--amber-50); }
.timeline__item--gap .timeline__title { color: var(--amber-700); }
.timeline__item--key .timeline__body::before { background: var(--navy-700); }
.timeline__item--disputed .timeline__body::before { border-color: var(--red-700); background: var(--red-50); }

.history { list-style: none; }
.history > li { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: var(--s-3); padding-bottom: var(--s-5); }
.history > li::before { content: ""; position: absolute; left: 15.5px; top: 34px; bottom: 2px; width: 1px; background: var(--line); }
.history > li:last-child::before { display: none; }
.history__icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ivory-100); color: var(--text-2); border: 1px solid var(--line); }
.history__icon--approved { background: var(--green-50); color: var(--green-700); border-color: var(--green-200); }
.history__icon--rejected, .history__icon--suspended, .history__icon--dispute_flagged { background: var(--red-50); color: var(--red-700); border-color: var(--red-200); }
.history__icon--evidence_requested, .history__icon--inspection_scheduled { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-200); }
.history__head { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); align-items: baseline; padding-top: 5px; }
.history__title { font-weight: 600; font-size: var(--fs-base); }
.history__when { font-size: var(--fs-sm); color: var(--text-3); }
.history__msg { margin-top: var(--s-1); color: var(--text-2); font-size: var(--fs-base); }
.history__internal { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--brass-700); }
.history__msg--internal { background: var(--ivory-100); border-left: 2px solid var(--brass-300); padding: var(--s-2) var(--s-3); }

/* 13. Dialog, toast, popover --------------------------------------------- */
dialog.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r-2); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-dialog);
}
dialog.dialog--wide { width: min(880px, calc(100vw - 32px)); }
dialog.dialog::backdrop { background: rgba(11, 20, 34, .55); }
dialog.dialog[open] { animation: dialog-in .18s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.dialog__form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); padding: var(--s-5) var(--s-5) var(--s-4); border-bottom: 1px solid var(--line); }
.dialog__title { font: 500 var(--fs-xl)/1.25 var(--font-serif); }
.dialog__body { padding: var(--s-5); overflow-y: auto; }
.dialog__foot { display: flex; justify-content: flex-end; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--line); background: var(--ivory-50); flex-wrap: wrap; }
.dialog--danger .dialog__head { border-top: 4px solid var(--red-700); }
.dialog--approve .dialog__head { border-top: 4px solid var(--green-700); }
.consequences { list-style: none; display: grid; gap: var(--s-2); margin: var(--s-3) 0 var(--s-4); }
.consequences li { display: grid; grid-template-columns: 20px 1fr; gap: var(--s-2); font-size: var(--fs-base); color: var(--text-2); }
.consequences .icon { margin-top: 2px; color: var(--text-3); }
.confirm-type { margin-top: var(--s-4); }

.toasts { position: fixed; z-index: 200; bottom: var(--s-5); left: 50%; transform: translateX(-50%); display: grid; gap: var(--s-2); width: min(480px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: grid; grid-template-columns: 20px 1fr auto; gap: var(--s-3); align-items: start;
  padding: var(--s-3) var(--s-4); background: var(--navy-900); color: var(--ivory-0); border-radius: var(--r-2);
  box-shadow: var(--shadow-pop); font-size: var(--fs-base); animation: toast-in .2s var(--ease);
}
.toast .icon { margin-top: 2px; }
.toast--success .icon { color: #8fd0ad; }
.toast--error { background: #5d1d14; }
.toast--error .icon { color: #f2b3a7; }
.toast--info .icon { color: var(--brass-300); }
.toast__close { background: none; border: 0; color: var(--navy-200); cursor: pointer; padding: 2px; margin: -2px; border-radius: var(--r-1); }
.toast__close:hover { color: #fff; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all .2s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.menu { position: absolute; z-index: 80; min-width: 220px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-2); box-shadow: var(--shadow-pop); padding: var(--s-1) 0; color: var(--ink); }
.menu[hidden] { display: none; }
.menu__head { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); margin-bottom: var(--s-1); }
.menu__item { display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: 10px var(--s-4); background: none; border: 0; text-align: left; color: var(--ink); text-decoration: none; font-size: var(--fs-base); cursor: pointer; }
.menu__item:hover, .menu__item:focus-visible { background: var(--ivory-100); color: var(--ink); outline: none; }
.menu__item .icon { color: var(--text-3); }
.menu__sep { height: 1px; background: var(--line); margin: var(--s-1) 0; }
.has-pop { position: relative; }

/* 14. Public pages -------------------------------------------------------- */
.hero { padding-block: clamp(32px, 5vw, 72px) clamp(40px, 5vw, 72px); background: var(--bg); position: relative; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero__title { margin: var(--s-4) 0 var(--s-5); max-width: 17ch; }
.hero__title em { font-style: italic; color: var(--brass-700); }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); margin-top: var(--s-6); }
.lookup { margin-top: var(--s-7); max-width: 620px; }
.lookup__label { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); margin-bottom: var(--s-2); font-weight: 500; flex-wrap: wrap; }
.lookup__scope { font-size: var(--fs-sm); color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.lookup__scope .flag { width: 16px; height: 12px; }
.lookup__row { display: flex; border: 1px solid var(--stone-500); border-radius: var(--r-2); background: var(--surface); overflow: hidden; transition: box-shadow .12s var(--ease), border-color .12s; }
.lookup__row:focus-within { border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(45,87,134,.2); }
.lookup__row .icon { margin: 0 0 0 var(--s-4); align-self: center; color: var(--text-3); flex: none; }
.lookup__row input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0 var(--s-3); height: 56px; font: 400 var(--fs-md)/1 var(--font-sans); color: var(--ink); }
.lookup__row input:focus { outline: none; }
.lookup__row .btn { border-radius: 0; min-height: 56px; border: 0; }
.lookup__examples { margin-top: var(--s-3); font-size: var(--fs-sm); color: var(--text-3); display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); }
.lookup__examples a { font-family: var(--font-mono); font-size: var(--fs-xs); }

/* The documentation sheet: a catalogue page composed from a live record */
.sheet { position: relative; background: var(--surface); border: 1px solid var(--line-strong); padding: var(--s-4); }
.sheet::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--line); pointer-events: none; }
.sheet__plate { position: relative; background: var(--ivory-100); border: 1px solid var(--line); }
.sheet__plate img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.sheet__fig { position: absolute; left: var(--s-3); top: var(--s-3); font: 500 var(--fs-2xs)/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--stone-600); background: var(--ivory-0); padding: 5px 7px; border: 1px solid var(--line); }
.sheet__record { position: relative; display: grid; grid-template-columns: 1fr auto; gap: var(--s-2) var(--s-4); padding: var(--s-4) var(--s-1) var(--s-1); align-items: start; }
.sheet__name { font: 500 var(--fs-xl)/1.2 var(--font-serif); }
.sheet__name a { color: inherit; text-decoration: none; }
.sheet__name a:hover { text-decoration: underline; }
.sheet__ref { font: 500 var(--fs-sm)/1 var(--font-mono); color: var(--text-2); margin-top: var(--s-2); }
.sheet__facts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); margin-top: var(--s-2); }
.sheet__facts div { padding: var(--s-3) var(--s-3) 0 0; }
.sheet__facts div + div { padding-left: var(--s-3); border-left: 1px solid var(--line); }
.sheet__facts dt { font-size: var(--fs-2xs); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.sheet__facts dd { font-size: var(--fs-sm); font-weight: 500; display: flex; flex-direction: column; gap: 4px; }
.sheet__caption { margin-top: var(--s-3); font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: var(--s-2); align-items: center; }

.process { display: grid; grid-template-columns: repeat(4, 1fr); counter-reset: step; }
.process__step { padding: var(--s-5) var(--s-5) 0 0; border-top: 1px solid var(--ink); }
.process__step + .process__step { padding-left: var(--s-5); border-left: 1px solid var(--line); }
.process__num { font: 400 var(--fs-3xl)/1 var(--font-serif); color: var(--brass-600); font-variant-numeric: oldstyle-nums; }
.process__title { font: 600 var(--fs-md)/1.3 var(--font-sans); margin: var(--s-4) 0 var(--s-2); }
.process__text { font-size: var(--fs-base); color: var(--text-2); }

.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.split--rev { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }

.applications { display: grid; gap: 0; border-top: 1px solid var(--line-strong); }
.application-row { display: grid; grid-template-columns: 48px 1fr auto; gap: var(--s-4); padding: var(--s-5) 0; border-bottom: 1px solid var(--line-strong); align-items: start; color: inherit; text-decoration: none; }
.application-row:hover { color: inherit; }
.application-row:hover .application-row__title { text-decoration: underline; }
.application-row__icon { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--navy-700); background: var(--surface); }
.application-row__title { font: 500 var(--fs-xl)/1.25 var(--font-serif); color: var(--ink); text-underline-offset: 4px; }
.application-row__text { color: var(--text-2); margin-top: var(--s-1); font-size: var(--fs-base); max-width: 36em; }
.application-row__meta { font-size: var(--fs-sm); color: var(--text-3); margin-top: var(--s-2); }
.application-row > .icon { margin-top: 12px; color: var(--text-3); }

.legend { list-style: none; display: grid; gap: 0; border-top: 1px solid var(--line); }
.legend li { display: grid; grid-template-columns: 180px 1fr; gap: var(--s-4); padding: var(--s-3) 0; border-bottom: 1px solid var(--line); align-items: baseline; font-size: var(--fs-base); color: var(--text-2); }
.legend .vmark { font-size: var(--fs-sm); }

.jurisdictions { columns: 4 200px; column-gap: var(--s-6); }
.jurisdictions__region { break-inside: avoid; margin-bottom: var(--s-5); }
.jurisdictions__region h3 { font: 600 var(--fs-xs)/1.3 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding-bottom: var(--s-2); border-bottom: 1px solid var(--line-strong); margin-bottom: var(--s-1); }
.jurisdictions ul { list-style: none; }
.jurisdictions a { display: flex; align-items: center; gap: var(--s-3); padding: 7px 0; color: var(--ink); text-decoration: none; font-size: var(--fs-base); border-bottom: 1px solid var(--line); }
.jurisdictions a:hover .j-name { text-decoration: underline; }
.jurisdictions a[aria-current="true"] .j-name { font-weight: 600; }
.jurisdictions .j-code { margin-left: auto; font: 400 var(--fs-xs)/1 var(--font-mono); color: var(--text-3); }
.jurisdictions .j-pilot { font-size: var(--fs-2xs); letter-spacing: .08em; text-transform: uppercase; color: var(--brass-700); }

.statement { background: var(--navy-900); color: var(--navy-100); }
.statement .h2, .statement h2, .statement h3 { color: var(--ivory-0); }
.statement .overline { color: var(--brass-300); }
.statement p { color: var(--navy-200); }
.statement a { color: var(--ivory-0); }
.statement__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); }
.statement dl { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s-6); }
.statement dl > div { padding: var(--s-4) 0; border-top: 1px solid rgba(255,255,255,.14); }
.statement dt { font-weight: 600; color: var(--ivory-0); margin-bottom: var(--s-1); font-size: var(--fs-base); }
.statement dd { font-size: var(--fs-base); color: var(--navy-200); line-height: 1.5; }

.site-footer { background: var(--navy-950); color: var(--navy-200); padding: var(--s-7) 0 var(--s-5); font-size: var(--fs-sm); }
.site-footer a { color: var(--navy-100); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer__grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: var(--s-6); }
.site-footer h2 { font: 600 var(--fs-xs)/1.3 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ivory-0); margin-bottom: var(--s-3); }
.site-footer ul { list-style: none; display: grid; gap: var(--s-2); }
.site-footer__base { margin-top: var(--s-7); padding-top: var(--s-4); border-top: 1px solid rgba(255,255,255,.1); display: flex; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.site-footer .wordmark__name { color: var(--ivory-0); }
.site-footer .emblem__gap { stroke: var(--navy-950); }

/* Catalogue */
.catalogue { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s-7); align-items: start; }
.filters { position: sticky; top: calc(var(--header-h) + var(--s-5)); }
.filters__group { padding: var(--s-4) 0; border-bottom: 1px solid var(--line); }
.filters__group:first-child { padding-top: 0; }
.filters__title { font: 600 var(--fs-xs)/1.3 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin-bottom: var(--s-3); }
.filters .check { font-size: var(--fs-base); padding: 4px 0; }
.filters__count { margin-left: auto; font: 400 var(--fs-xs)/1 var(--font-mono); color: var(--text-3); }
.filters .check { display: flex; width: 100%; }
.results { list-style: none; border-top: 1px solid var(--ink); }
.result { display: grid; grid-template-columns: 136px 1fr auto; gap: var(--s-5); padding: var(--s-5) 0; border-bottom: 1px solid var(--line); align-items: start; }
.result__img { width: 136px; aspect-ratio: 4/3; background: var(--ivory-100); border: 1px solid var(--line); object-fit: cover; }
.result__noimg { width: 136px; aspect-ratio: 4/3; border: 1px dashed var(--line-strong); display: grid; place-items: center; text-align: center; color: var(--text-3); font-size: var(--fs-xs); padding: var(--s-2); background: var(--ivory-50); }
.result__name { font: 500 var(--fs-xl)/1.2 var(--font-serif); }
.result__name a { color: var(--ink); text-decoration: none; }
.result__name a:hover { text-decoration: underline; }
.result__line { color: var(--text-2); margin-top: var(--s-1); font-size: var(--fs-base); }
.result__meta { margin-top: var(--s-3); display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--fs-sm); color: var(--text-3); align-items: center; }
.result__aside { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-2); text-align: right; }

/* 15. Item record --------------------------------------------------------- */
.record-head { padding: var(--s-6) 0 var(--s-5); border-bottom: 1px solid var(--line); }
.record-head__ref { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin: var(--s-4) 0 var(--s-3); }
.record-head__ref .ref { font-size: var(--fs-lg); letter-spacing: .02em; }
.record-head__title { max-width: 22ch; }
.record-head__line { margin-top: var(--s-3); color: var(--text-2); font-size: var(--fs-lg); }
.copy-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px solid var(--line-strong); color: var(--text-2); height: 28px; padding: 0 var(--s-2); border-radius: var(--r-1); font-size: var(--fs-xs); cursor: pointer; }
.copy-btn:hover { border-color: var(--stone-500); color: var(--ink); }

.record { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 56px); padding-top: var(--s-6); align-items: start; }
.gallery__main { position: relative; background: var(--ivory-100); border: 1px solid var(--line); }
.gallery__main button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery__main img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: var(--ivory-100); }
.gallery__expand { position: absolute; right: var(--s-3); bottom: var(--s-3); display: inline-flex; align-items: center; gap: var(--s-2); background: rgba(16,28,46,.82); color: #fff; padding: 6px 10px; font-size: var(--fs-xs); border-radius: var(--r-1); pointer-events: none; }
.gallery__caption { display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) 0; font-size: var(--fs-sm); color: var(--text-2); border-bottom: 1px solid var(--line); }
.gallery__caption .mono { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.gallery__thumbs { display: flex; gap: var(--s-2); margin-top: var(--s-3); list-style: none; overflow-x: auto; padding-bottom: 2px; }
.gallery__thumbs button { padding: 0; border: 1px solid var(--line); background: var(--ivory-100); cursor: pointer; width: 96px; flex: none; position: relative; }
.gallery__thumbs button[aria-current="true"] { outline: 2px solid var(--navy-800); outline-offset: 1px; }
.gallery__thumbs img { width: 96px; aspect-ratio: 4/3; object-fit: cover; }
.gallery__empty { aspect-ratio: 4/3; border: 1px dashed var(--line-strong); background: repeating-linear-gradient(135deg, transparent 0 11px, rgba(181,172,153,.18) 11px 12px), var(--ivory-50); display: grid; place-items: center; text-align: center; padding: var(--s-6); color: var(--text-2); }
.gallery__empty .icon { margin: 0 auto var(--s-3); color: var(--stone-500); }

.record-section { padding: var(--s-6) 0; border-top: 1px solid var(--line); }
.record-section:first-child { border-top: 0; padding-top: 0; }
.record-section__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); margin-bottom: var(--s-4); flex-wrap: wrap; }
.record-nav { position: sticky; top: var(--header-h); z-index: 20; background: rgba(249,246,239,.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.record-nav .tabs { border-bottom: 0; }
.dimension-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: var(--surface); }
.dimension-grid > div { padding: var(--s-3) var(--s-4); }
.dimension-grid > div + div { border-left: 1px solid var(--line); }
.dimension-grid dt { font-size: var(--fs-xs); color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.dimension-grid dd { font: 500 var(--fs-lg)/1.3 var(--font-mono); margin-top: 4px; }
.dimension-grid dd small { font-size: var(--fs-xs); color: var(--text-3); font-weight: 400; }
.quote { font-family: var(--font-serif); font-size: var(--fs-lg); line-height: 1.5; color: var(--ink-2); border-left: 2px solid var(--brass-300); padding-left: var(--s-4); }

.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(8, 13, 22, .96); display: grid; grid-template-rows: auto 1fr auto; color: var(--ivory-100); }
.lightbox[hidden] { display: none; }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); }
.lightbox__stage { position: relative; overflow: hidden; display: grid; place-items: center; touch-action: none; cursor: grab; }
.lightbox__stage.is-dragging { cursor: grabbing; }
.lightbox__stage img { max-width: 92vw; max-height: 78vh; transform-origin: center; transition: transform .15s var(--ease); user-select: none; -webkit-user-drag: none; }
.lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox__nav--prev { left: var(--s-4); } .lightbox__nav--next { right: var(--s-4); }
.lightbox__caption { padding: var(--s-3) var(--s-4) var(--s-4); text-align: center; font-size: var(--fs-sm); color: var(--navy-200); }
.lightbox .btn--icon { --btn-bg: rgba(255,255,255,.06); --btn-fg: #fff; --btn-bd: rgba(255,255,255,.18); }
.lightbox .btn--icon:hover { --btn-bg: rgba(255,255,255,.14); color: #fff; }
.lightbox__zoom { font: 500 var(--fs-xs)/1 var(--font-mono); min-width: 48px; text-align: center; }

/* 16. Wizard -------------------------------------------------------------- */
.wizard-top { background: var(--surface); border-bottom: 1px solid var(--line); }
.wizard-top__inner { display: flex; align-items: center; gap: var(--s-4); min-height: 72px; flex-wrap: wrap; padding-block: var(--s-3); }
.wizard-top__title { display: flex; flex-direction: column; gap: 2px; }
.wizard-top__title .h3 { font-size: var(--fs-xl); }
.saved-state { margin-left: auto; display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-3); min-height: 32px; }
.saved-state[data-state="saved"] .icon { color: var(--green-700); }
.saved-state[data-state="dirty"] { color: var(--amber-700); }
.saved-state[data-state="saving"] .icon { animation: spin 1s linear infinite; }
.saved-state[data-state="error"] { color: var(--red-700); font-weight: 500; }

.wizard { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); padding-block: var(--s-6) var(--s-9); align-items: start; }
.steps { list-style: none; position: sticky; top: calc(var(--header-h) + var(--s-5)); counter-reset: s; }
.steps li { position: relative; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 13.5px; top: 34px; bottom: -6px; width: 1px; background: var(--line-strong); }
.steps li.is-done:not(:last-child)::after { background: var(--navy-700); }
.step-link { display: grid; grid-template-columns: 28px 1fr; gap: var(--s-3); align-items: center; padding: var(--s-2) 0; min-height: 52px; color: var(--text-2); text-decoration: none; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.step-link:hover .step-link__label { color: var(--ink); text-decoration: underline; }
.step-link__num { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--stone-400); background: var(--surface); display: grid; place-items: center; font: 500 var(--fs-sm)/1 var(--font-mono); color: var(--text-2); transition: all .2s var(--ease); }
.step-link__label { font-size: var(--fs-base); font-weight: 500; line-height: 1.25; }
.step-link__sub { display: block; font-size: var(--fs-xs); color: var(--text-3); font-weight: 400; margin-top: 2px; }
.is-done .step-link__num { background: var(--navy-800); border-color: var(--navy-800); color: var(--ivory-0); }
.is-current .step-link__num { border: 2px solid var(--navy-800); color: var(--navy-800); font-weight: 600; box-shadow: 0 0 0 4px var(--blue-50); }
.is-current .step-link__label { color: var(--ink); font-weight: 600; }
.has-issue .step-link__num { border-color: var(--red-700); color: var(--red-700); background: var(--red-50); }
.wizard-progress { display: none; }

.wizard-panel[hidden] { display: none; }
.wizard-panel__head { margin-bottom: var(--s-6); max-width: 40em; }
.wizard-panel__step { font: 500 var(--fs-sm)/1 var(--font-mono); color: var(--text-3); margin-bottom: var(--s-3); }
.wizard-panel__title { margin-bottom: var(--s-3); }
.wizard-form { max-width: 680px; }
.form-section { padding-top: var(--s-6); margin-top: var(--s-6); border-top: 1px solid var(--line); }
.form-section__title { font: 600 var(--fs-md)/1.3 var(--font-sans); margin-bottom: var(--s-1); }
.form-section__intro { color: var(--text-3); font-size: var(--fs-sm); margin-bottom: var(--s-4); }

.wizard-actions { position: sticky; bottom: 0; z-index: 30; background: rgba(255,253,248,.97); border-top: 1px solid var(--line-strong); backdrop-filter: blur(6px); }
.wizard-actions__inner { display: flex; align-items: center; gap: var(--s-3); min-height: 72px; padding-block: var(--s-3); }
.wizard-actions__spacer { flex: 1; }
.wizard-actions__count { font-size: var(--fs-sm); color: var(--text-3); }

/* Parties in succession — three visually distinct roles */
.party { border: 1px solid var(--line-strong); border-radius: var(--r-2); background: var(--surface); }
.party__head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
.party__role { font: 600 var(--fs-xs)/1.2 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; }
.party__body { padding: var(--s-4); }
.party--applicant { border-top: 3px solid var(--stone-600); } .party--applicant .party__role { color: var(--stone-700); }
.party--current { border-top: 3px solid var(--navy-700); } .party--current .party__role { color: var(--navy-700); }
.party--proposed { border-top: 3px solid var(--brass-500); } .party--proposed .party__role { color: var(--brass-700); }
.party__chip { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.party--applicant .party__chip { background: var(--ivory-200); color: var(--stone-700); }
.party--current .party__chip { background: var(--navy-100); color: var(--navy-700); }
.party--proposed .party__chip { background: var(--brass-200); color: var(--brass-700); }
.transfer { display: grid; grid-template-columns: 1fr 48px 1fr; align-items: stretch; }
.transfer__arrow { display: grid; place-items: center; color: var(--brass-600); }
.party__name { font: 500 var(--fs-lg)/1.3 var(--font-serif); }
.party__line { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }

/* Uploads */
.dropzone {
  position: relative; display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-6) var(--s-5); text-align: center;
  border: 1.5px dashed var(--stone-400); border-radius: var(--r-2); background: var(--ivory-50); transition: all .15s var(--ease);
}
.dropzone.is-over { border-color: var(--navy-700); background: var(--blue-50); }
.dropzone__icon { color: var(--navy-700); }
.dropzone__title { font-weight: 600; }
.dropzone__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center; margin-top: var(--s-2); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-kind { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; justify-content: center; font-size: var(--fs-sm); color: var(--text-2); }
.upload-kind .select { width: auto; min-width: 220px; }

.uploads { list-style: none; display: grid; gap: var(--s-2); margin-top: var(--s-4); }
.upload { display: grid; grid-template-columns: 88px 1fr auto; gap: var(--s-4); align-items: center; padding: var(--s-2); padding-right: var(--s-3); border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-2); }
.upload--doc { grid-template-columns: 44px 1fr auto; }
.upload__thumb { width: 88px; aspect-ratio: 4/3; object-fit: cover; background: var(--ivory-100); border-radius: var(--r-1); }
.upload__docicon { width: 44px; height: 44px; display: grid; place-items: center; background: var(--ivory-100); color: var(--navy-700); border-radius: var(--r-1); }
.upload__name { font-weight: 500; font-size: var(--fs-base); overflow-wrap: anywhere; }
.upload__meta { font-size: var(--fs-sm); color: var(--text-3); display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; margin-top: 2px; }
.upload__bar { height: 4px; background: var(--ivory-200); border-radius: 2px; overflow: hidden; margin-top: var(--s-2); }
.upload__bar span { display: block; height: 100%; background: var(--navy-700); width: 0; transition: width .15s linear; }
.upload__state { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.upload__state--saved { color: var(--green-700); }
.upload__state--pending { color: var(--amber-700); }
.upload__state--error { color: var(--red-700); }
.upload.is-error { border-color: var(--red-200); background: var(--red-50); }
.upload__actions { display: flex; gap: var(--s-1); }
.upload__caption { margin-top: var(--s-2); }

.photo-checklist { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border: 1px solid var(--line); background: var(--surface); margin-bottom: var(--s-5); }
.photo-checklist li { display: flex; gap: var(--s-2); align-items: flex-start; padding: var(--s-3); font-size: var(--fs-sm); color: var(--text-2); }
.photo-checklist li + li { border-left: 1px solid var(--line); }
.photo-checklist li.is-met { color: var(--green-700); }
.photo-checklist .icon { flex: none; margin-top: 1px; }

.duplicate-warning { margin-top: var(--s-4); }
.duplicate-warning[hidden] { display: none; }

.review-block { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-2); }
.review-block + .review-block { margin-top: var(--s-4); }
.review-block__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--line); background: var(--ivory-50); }
.review-block__title { font: 600 var(--fs-base)/1.3 var(--font-sans); display: flex; gap: var(--s-3); align-items: center; }
.review-block__title .mono { color: var(--text-3); font-weight: 500; }
.review-block__body { padding: var(--s-2) var(--s-5) var(--s-3); }
.review-block.has-issue { border-color: var(--red-200); }
.review-block.has-issue .review-block__head { background: var(--red-50); }
.review-missing { color: var(--red-700); font-weight: 500; font-size: var(--fs-sm); display: inline-flex; gap: 4px; align-items: center; }
.review-photos { display: flex; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-2) 0; }
.review-photos img { width: 104px; aspect-ratio: 4/3; object-fit: cover; border: 1px solid var(--line); }

.item-pick { display: grid; grid-template-columns: 88px 1fr auto; gap: var(--s-4); align-items: center; padding: var(--s-3); border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-2); }
.item-pick + .item-pick { margin-top: var(--s-2); }
.item-pick:has(input:checked) { border-color: var(--navy-700); box-shadow: inset 0 0 0 1px var(--navy-700); background: var(--blue-50); }
.item-pick input { width: 18px; height: 18px; accent-color: var(--navy-800); }

/* 17. Workspace ----------------------------------------------------------- */
.ws { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.ws-sidebar { background: var(--navy-950); color: var(--navy-200); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.ws-sidebar__brand { padding: var(--s-4) var(--s-5); height: 64px; display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,.08); }
.ws-sidebar__brand .wordmark { color: var(--ivory-0); }
.ws-sidebar .emblem__gap { stroke: var(--navy-950); }
.ws-sidebar__section { padding: var(--s-4) var(--s-3) var(--s-2); }
.ws-sidebar__label { font: 600 var(--fs-2xs)/1 var(--font-sans); letter-spacing: .14em; text-transform: uppercase; color: #7f8ba0; padding: 0 var(--s-3) var(--s-2); }
.ws-nav { list-style: none; display: grid; gap: 2px; }
.ws-nav a { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-3); height: 40px; border-radius: var(--r-2); color: var(--navy-200); text-decoration: none; font-size: var(--fs-base); font-weight: 500; }
.ws-nav a:hover { background: rgba(255,255,255,.06); color: var(--ivory-0); }
.ws-nav a[aria-current="page"] { background: rgba(212,188,133,.12); color: var(--ivory-0); box-shadow: inset 2px 0 0 var(--brass-300); }
.ws-nav a[aria-current="page"] .icon { color: var(--brass-300); }
.ws-nav__count { margin-left: auto; font: 500 var(--fs-xs)/1 var(--font-mono); color: var(--navy-200); background: rgba(255,255,255,.08); padding: 4px 7px; border-radius: 10px; }
.ws-nav__count--alert { background: var(--red-700); color: #fff; }
.ws-sidebar__foot { margin-top: auto; padding: var(--s-4) var(--s-5); border-top: 1px solid rgba(255,255,255,.08); font-size: var(--fs-xs); color: #7f8ba0; }

.ws-main { min-width: 0; display: flex; flex-direction: column; }
.ws-top { height: 64px; display: flex; align-items: center; gap: var(--s-4); padding: 0 var(--s-6); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.ws-top__search { flex: 1; max-width: 440px; }
.ws-top__search .input { min-height: 40px; background: var(--ivory-50); }
.ws-top__end { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); }
.ws-user { display: inline-flex; align-items: center; gap: var(--s-2); background: none; border: 0; padding: 4px; border-radius: var(--r-2); cursor: pointer; }
.ws-user:hover { background: var(--ivory-100); }
.ws-user__name { font-size: var(--fs-sm); font-weight: 500; text-align: left; line-height: 1.2; }
.ws-user__role { display: block; font-size: var(--fs-xs); color: var(--text-3); font-weight: 400; }
.ws-content { padding: var(--s-6) var(--s-6) var(--s-8); flex: 1; }
.ws-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
.ws-head__title { font: 500 var(--fs-2xl)/1.2 var(--font-serif); }
.ws-head__sub { color: var(--text-3); font-size: var(--fs-base); margin-top: var(--s-1); }
.ws-menu-toggle { display: none; }

.toolbar { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; padding: var(--s-3); background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-2) var(--r-2) 0 0; }
.toolbar + .table-wrap { border-radius: 0 0 var(--r-2) var(--r-2); }
.toolbar .input-with-icon { flex: 1 1 240px; max-width: 360px; }
.toolbar .select { width: auto; }
.toolbar__end { margin-left: auto; font-size: var(--fs-sm); color: var(--text-3); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; background: var(--navy-100); color: var(--navy-800); border-radius: var(--r-1); font-size: var(--fs-sm); text-decoration: none; }
.chip:hover { color: var(--navy-900); background: var(--navy-200); }

.pipeline { display: flex; height: 10px; border-radius: 2px; overflow: hidden; background: var(--ivory-200); }
.pipeline span { display: block; height: 100%; }
.pipeline-legend { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-2) var(--s-4); margin-top: var(--s-4); font-size: var(--fs-sm); }
.pipeline-legend li { display: flex; align-items: center; gap: var(--s-2); }
.pipeline-legend i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.pipeline-legend b { margin-left: auto; font: 500 var(--fs-sm)/1 var(--font-mono); }

.worklist { list-style: none; }
.worklist li { display: grid; grid-template-columns: 1fr auto; gap: var(--s-3); padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--line); align-items: center; }
.worklist li:last-child { border-bottom: 0; }
.worklist a { color: var(--ink); text-decoration: none; font-weight: 500; }
.worklist a:hover { text-decoration: underline; }

.ws-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s-5); align-items: start; }

/* 18. Case workspace ------------------------------------------------------ */
.case-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: var(--s-5) var(--s-6) 0; }
.case-head__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.case-head__title { font: 500 var(--fs-2xl)/1.2 var(--font-serif); margin-top: var(--s-2); }
.case-head__facts { display: flex; flex-wrap: wrap; gap: 0; margin-top: var(--s-4); border-top: 1px solid var(--line); }
.case-head__facts > div { padding: var(--s-3) var(--s-5) var(--s-3) 0; margin-right: var(--s-5); border-right: 1px solid var(--line); }
.case-head__facts > div:last-child { border-right: 0; }
.case-head__facts dt { font-size: var(--fs-xs); color: var(--text-3); letter-spacing: .04em; }
.case-head__facts dd { font-size: var(--fs-base); font-weight: 500; margin-top: 2px; display: flex; align-items: center; gap: var(--s-2); }
.case { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s-5); padding: var(--s-5) var(--s-6) var(--s-8); align-items: start; }
.case__aside { position: sticky; top: calc(64px + var(--s-5)); display: grid; gap: var(--s-4); }
.case__main { display: grid; gap: var(--s-4); min-width: 0; }
.decision { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-2); }
.decision__head { padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.decision__body { padding: var(--s-4) var(--s-5); display: grid; gap: var(--s-3); }
.decision__primary { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.decision__secondary { display: grid; gap: 0; border-top: 1px solid var(--line); }
.decision__secondary .menu__item { padding-inline: var(--s-5); border-bottom: 1px solid var(--line); }
.decision__secondary .menu__item:last-child { border-bottom: 0; }
.decision__blocked { font-size: var(--fs-sm); color: var(--text-2); display: grid; grid-template-columns: 18px 1fr; gap: var(--s-2); }
.decision__blocked .icon { color: var(--amber-700); margin-top: 2px; }
.reqs { list-style: none; }
.reqs li { display: grid; grid-template-columns: 22px 1fr auto; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--line); align-items: start; font-size: var(--fs-base); }
.reqs li:last-child { border-bottom: 0; }
.reqs .icon { margin-top: 2px; }
.reqs .is-outstanding .icon { color: var(--amber-700); }
.reqs .is-received .icon { color: var(--green-700); }
.reqs .is-waived { color: var(--text-3); }
.reqs__detail { display: block; font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.checks { list-style: none; }
.checks li { display: grid; grid-template-columns: 20px 1fr; gap: var(--s-2); padding: var(--s-2) 0; font-size: var(--fs-sm); color: var(--text-2); }
.checks .ok { color: var(--green-700); } .checks .warn { color: var(--amber-700); } .checks .bad { color: var(--red-700); }
.item-strip { display: grid; grid-template-columns: 160px 1fr; gap: var(--s-5); }
.item-strip img, .item-strip .thumb--empty { width: 160px; aspect-ratio: 4/3; object-fit: cover; border: 1px solid var(--line); background: var(--ivory-100); }
.docs { list-style: none; }
.docs li { display: grid; grid-template-columns: 36px 1fr auto; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--line); }
.docs li:last-child { border-bottom: 0; }
.docs__icon { width: 36px; height: 36px; display: grid; place-items: center; background: var(--ivory-100); color: var(--navy-700); border-radius: var(--r-1); }
.docs__name { font-weight: 500; font-size: var(--fs-base); overflow-wrap: anywhere; }
.docs__meta { font-size: var(--fs-sm); color: var(--text-3); }
.doc-preview { min-height: 420px; display: grid; place-items: center; background: var(--ivory-100); border: 1px solid var(--line); }
.doc-preview iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.doc-preview img { max-height: 70vh; width: auto; }

.status-track { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); counter-reset: t; }
.status-track li { position: relative; padding-top: var(--s-5); font-size: var(--fs-sm); color: var(--text-3); }
.status-track li::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--line-strong); }
.status-track li::after { content: ""; position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--stone-400); }
.status-track li.is-done::before { background: var(--navy-700); }
.status-track li.is-done::after { background: var(--navy-700); border-color: var(--navy-700); }
.status-track li.is-current { color: var(--ink); font-weight: 600; }
.status-track li.is-current::after { border-color: var(--navy-700); box-shadow: 0 0 0 4px var(--blue-50); }
.status-track li.is-alert::after { border-color: var(--amber-700); background: var(--amber-50); }
.status-track li.is-negative::after { border-color: var(--red-700); background: var(--red-700); }

/* 19. States -------------------------------------------------------------- */
.empty { padding: var(--s-8) var(--s-5); text-align: center; display: grid; justify-items: center; gap: var(--s-3); }
.empty__mark { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--stone-600); background: var(--ivory-50); }
.empty__title { font: 500 var(--fs-xl)/1.3 var(--font-serif); }
.empty__text { color: var(--text-2); max-width: 38em; }
.empty--compact { padding: var(--s-6) var(--s-5); }
.state-page { min-height: 60vh; display: grid; place-items: center; padding: var(--s-8) var(--gutter); }
.state-page__inner { max-width: 560px; }
.state-page__code { font: 500 var(--fs-sm)/1 var(--font-mono); color: var(--brass-700); letter-spacing: .08em; }
.skeleton { background: linear-gradient(90deg, var(--ivory-200) 0, var(--ivory-100) 40%, var(--ivory-200) 80%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--r-1); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.offline-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 400; background: var(--amber-700); color: #fff; text-align: center; font-size: var(--fs-sm); padding: 8px var(--gutter); display: flex; align-items: center; justify-content: center; gap: var(--s-2); }
.offline-banner[hidden] { display: none; }
.success-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-200); }

.auth { min-height: calc(100vh - var(--header-h)); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth__aside { background: var(--navy-900); color: var(--navy-200); padding: clamp(32px, 6vw, 80px); display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-6); }
.auth__aside h2 { color: var(--ivory-0); }
.auth__main { padding: clamp(32px, 6vw, 80px); display: flex; align-items: center; }
.auth__form { width: 100%; max-width: 420px; }

/* 20. Utilities ----------------------------------------------------------- */
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); } .mt-7 { margin-top: var(--s-7); }
.mb-2 { margin-bottom: var(--s-2); } .mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); } .mb-5 { margin-bottom: var(--s-5); } .mb-6 { margin-bottom: var(--s-6); }
.hide-mobile { } .show-mobile { display: none !important; }
.text-right { text-align: right; }
.w-full { width: 100%; }
[hidden] { display: none !important; }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1100px) {
  .case { grid-template-columns: minmax(0, 1fr) 320px; }
  .site-header__nav a { padding: 0 var(--s-3); }
}

@media (max-width: 960px) {
  .hero__grid, .split, .split--rev, .statement__grid, .record, .ws-grid { grid-template-columns: 1fr; }
  .hero__visual { max-width: 560px; }
  .process { grid-template-columns: 1fr 1fr; }
  .process__step:nth-child(3) { padding-left: 0; border-left: 0; }
  .process__step { padding-bottom: var(--s-5); }
  .catalogue { grid-template-columns: 1fr; gap: var(--s-5); }
  .filters { position: static; }
  .filters[data-collapsible] .filters__body { display: none; }
  .filters[data-collapsible].is-open .filters__body { display: block; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .wizard { grid-template-columns: 1fr; gap: var(--s-5); padding-top: var(--s-4); }
  .steps { display: none; }
  .wizard-progress { display: block; }
  .case { grid-template-columns: 1fr; padding: var(--s-4); }
  .case__aside { position: static; order: -1; }
  .case-head { padding: var(--s-4) var(--s-4) 0; }
  .auth { grid-template-columns: 1fr; }
  .auth__aside { order: 2; }

  .ws { grid-template-columns: 1fr; }
  .ws-sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 120; transform: translateX(-100%); transition: transform .2s var(--ease); }
  .ws.is-nav-open .ws-sidebar { transform: none; box-shadow: var(--shadow-dialog); }
  .ws-scrim { position: fixed; inset: 0; background: rgba(11,20,34,.5); z-index: 110; }
  .ws-menu-toggle { display: inline-flex; }
  .ws-top { padding: 0 var(--s-4); gap: var(--s-2); }
  .ws-content { padding: var(--s-5) var(--s-4) var(--s-8); }
  .ws-top__search { display: none; }
  .ws-user__name { display: none; }
}

@media (max-width: 820px) {
  .site-header__nav { display: none; }
  .menu-toggle { display: inline-flex; }
  .site-header.is-open .site-header__nav {
    display: flex; flex-direction: column; position: absolute; left: 0; right: 0; top: var(--header-h); height: auto;
    background: var(--navy-900); border-top: 1px solid rgba(255,255,255,.08); padding: var(--s-2) 0 var(--s-4); margin: 0; box-shadow: var(--shadow-pop);
  }
  .site-header.is-open .site-header__nav a { height: 52px; padding: 0 var(--gutter); border: 0; border-left: 3px solid transparent; }
  .site-header.is-open .site-header__nav a[aria-current="page"] { border-left-color: var(--brass-300); }
  .country-trigger__kicker { display: none; }
  .header-link__label { display: none; }
}

@media (max-width: 640px) {
  :root { --header-h: 56px; }
  body { font-size: var(--fs-md); }
  .hide-mobile { display: none !important; }
  .show-mobile { display: revert !important; }
  .wordmark__sub { display: none; }
  .wordmark__name { font-size: 1.0625rem; }
  .site-header__bar { gap: var(--s-2); }
  .country-trigger { height: 40px; padding: 0 var(--s-2); gap: var(--s-2); }
  .country-trigger__name { font-size: var(--fs-sm); max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .country-pop { position: fixed; left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100%; max-width: none; border-radius: var(--r-2) var(--r-2) 0 0; max-height: 85vh; display: flex; flex-direction: column; }
  .country-pop[hidden] { display: none; }
  .country-pop__list { max-height: none; flex: 1; }
  .country-opt { min-height: 48px; }
  .jurisdiction-band__end { display: none; }
  .process { grid-template-columns: 1fr; }
  .process__step + .process__step { padding-left: 0; border-left: 0; }
  .sheet__facts { grid-template-columns: 1fr 1fr; }
  .sheet__facts div:nth-child(3) { grid-column: 1 / -1; border-left: 0; padding-left: 0; border-top: 1px solid var(--line); margin-top: var(--s-3); }
  .statement dl { grid-template-columns: 1fr; }
  .legend li { grid-template-columns: 1fr; gap: var(--s-1); }
  .site-footer__grid { grid-template-columns: 1fr; }
  .result { grid-template-columns: 96px 1fr; gap: var(--s-4); }
  .result__img, .result__noimg { width: 96px; }
  .result__aside { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; }
  .record-head__title { font-size: var(--fs-2xl); }
  .dimension-grid { grid-template-columns: 1fr 1fr; }
  .dimension-grid > div:nth-child(3) { border-left: 0; }
  .dimension-grid > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .meta-list { grid-template-columns: 1fr; }
  .meta-list > dt { border-bottom: 0; padding-bottom: 0; }
  .meta-list > dd { padding-top: 2px; }
  .timeline > li { grid-template-columns: 1fr; gap: var(--s-1); padding-left: var(--s-5); }
  .timeline > li::before { left: 4px; top: 8px; }
  .timeline__date { text-align: left; }
  .timeline__body { padding-left: 0; }
  .timeline__body::before { left: calc(-1 * var(--s-5)); top: -18px; }
  .transfer { grid-template-columns: 1fr; }
  .transfer__arrow { transform: rotate(90deg); height: 40px; }
  .upload { grid-template-columns: 64px 1fr; }
  .upload__thumb { width: 64px; }
  .upload__actions { grid-column: 1 / -1; justify-content: flex-end; }
  .upload--doc { grid-template-columns: 44px 1fr; }
  .wizard-actions__inner { gap: var(--s-2); }
  .wizard-actions .btn { padding: 0 var(--s-4); }
  .wizard-actions__save-label { display: none; }
  .item-strip { grid-template-columns: 1fr; }
  .item-strip img, .item-strip .thumb--empty { width: 100%; }
  .status-track { grid-template-columns: 1fr; gap: var(--s-3); }
  .status-track li { padding: 0 0 0 var(--s-6); }
  .status-track li::before { display: none; }
  .decision__primary { grid-template-columns: 1fr; }
  .case-head__facts > div { margin-right: var(--s-4); padding-right: var(--s-4); }
  .stat + .stat { border-left: 0; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:nth-child(even) { border-left: 1px solid var(--line); }
  .stats .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .dialog__foot { flex-direction: column-reverse; }
  .dialog__foot .btn { width: 100%; }
  dialog.dialog { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: var(--r-2) var(--r-2) 0 0; }

  /* Tables become labelled records on narrow screens */
  .table--responsive thead { display: none; }
  .table--responsive, .table--responsive tbody, .table--responsive tr, .table--responsive td { display: block; width: 100%; }
  .table--responsive tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2) var(--s-4); }
  .table--responsive td { padding: 0; border: 0; }
  .table--responsive td[data-label]::before { content: attr(data-label); display: block; font-size: var(--fs-xs); color: var(--text-3); letter-spacing: .04em; margin-bottom: 2px; }
  .table--responsive td.cell-primary { grid-column: 1 / -1; order: -1; }
  .table--responsive td.cell-wide { grid-column: 1 / -1; }
  .table--responsive td.hide-sm { display: none; }
  .table--responsive tbody tr.is-urgent td:first-child { box-shadow: none; }
  .table--responsive tbody tr.is-urgent { box-shadow: inset 3px 0 0 var(--red-700); }
}

/* 21. Motion -------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media print {
  .site-header, .site-footer, .record-nav, .demo-ribbon, .jurisdiction-band, .gallery__thumbs, .btn, .copy-btn { display: none !important; }
  body { background: #fff; }
  .record { grid-template-columns: 1fr 1fr; }
}

/* Inline helpers */
.cell-sub { display: block; font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.inline-note { display: flex; align-items: center; gap: 6px; }
.inline-note .icon { flex: none; }
.record + .record { padding-top: var(--s-6); }
.filters .check { align-items: baseline; }
.filters .check input { align-self: flex-start; }
.fieldset > legend.filters__title { float: left; width: 100%; }
.fieldset > legend.filters__title + * { clear: both; }
.table .mono, .table .ref { white-space: nowrap; }
.table .cluster { flex-wrap: nowrap; white-space: nowrap; }
@media (min-width: 961px) {
  .ws { background: linear-gradient(to right, var(--navy-950) 248px, transparent 248px); }
}
.textarea[rows="2"] { min-height: 72px; }
.icon { flex-shrink: 0; }
@media (max-width: 640px) {
  .case-head__facts { display: grid; grid-template-columns: 1fr 1fr; }
  .case-head__facts > div { border-right: 0; margin-right: 0; padding-right: var(--s-3); border-bottom: 1px solid var(--line); }
  .case-head__facts > div:nth-child(2) { grid-column: 1 / -1; order: 5; border-bottom: 0; }
  .case-head__facts .select { width: 100%; }
  .header-link { padding: 0 var(--s-2); }
}

/* Pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-top: var(--s-5); }
.pager__list { list-style: none; display: flex; align-items: center; gap: var(--s-1); }
.pager__num { display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 var(--s-2); border-radius: var(--r-2); color: var(--ink); text-decoration: none; font: 500 var(--fs-sm)/1 var(--font-mono); }
.pager__num:hover { background: var(--ivory-100); color: var(--ink); }
.pager__num.is-current { background: var(--navy-800); color: var(--ivory-0); }
.pager__gap { color: var(--text-3); padding: 0 var(--s-1); }
.pager__mobile { padding: 0 var(--s-3); }
.pager .btn[aria-disabled="true"] { opacity: .45; }
.auth__aside a { color: var(--ivory-0); } .auth__aside a:hover { color: #fff; }
@media (max-width: 640px) {
  .site-header__bar { gap: var(--s-2); }
  .site-header__end { gap: 0; flex-shrink: 0; }
  .site-header__end .header-link > .icon:last-of-type:not(:first-child) { display: none; }
  .wordmark { min-width: 0; gap: var(--s-2); }
  .wordmark .emblem { width: 28px; height: 28px; }
  .wordmark__name { font-size: 1rem; }
  .country-trigger__name { max-width: 64px; }
}
@media (max-width: 360px) {
  .wordmark__text { display: none; }
}

/* Camera ------------------------------------------------------------------ */
dialog.camera {
  width: min(920px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); padding: 0;
  border: 0; border-radius: var(--r-2); background: #0b0f16; color: #fff; overflow: hidden;
  display: none; grid-template-rows: auto minmax(0, 1fr) auto;
}
dialog.camera[open] { display: grid; }
dialog.camera::backdrop { background: rgba(5, 8, 14, .85); }
.camera__bar { display: flex; align-items: center; justify-content: space-between; padding: var(--s-3) var(--s-4); }
.camera__title { font: 500 var(--fs-md)/1.2 var(--font-sans); color: #fff; }
.camera__stage { position: relative; display: grid; place-items: center; background: #000; min-height: 240px; overflow: hidden; }
.camera__video, .camera__still { width: 100%; height: 100%; max-height: calc(100vh - 200px); object-fit: contain; display: block; }
.camera__video.is-mirrored { transform: scaleX(-1); }
.camera__guide { position: absolute; inset: 12%; border: 1.5px dashed rgba(255,255,255,.45); border-radius: var(--r-2); pointer-events: none; }
.camera__still:not([hidden]) ~ .camera__guide { display: none; }
.camera__message { position: absolute; inset: auto var(--s-4) var(--s-4); background: rgba(11, 15, 22, .85); padding: var(--s-3) var(--s-4); border-radius: var(--r-2); font-size: var(--fs-base); line-height: 1.45; text-align: center; }
.camera__message[hidden], .camera__message:empty { display: none; }
.camera__controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5) calc(var(--s-4) + env(safe-area-inset-bottom)); }
.camera__side { display: flex; justify-content: flex-start; }
.camera__shutter { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 4px; cursor: pointer; }
.camera__shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; transition: transform .1s; }
.camera__shutter:active span { transform: scale(.9); }
.camera__shutter:disabled { opacity: .35; cursor: not-allowed; }
.camera__shutter[hidden] { display: none; }
.camera__review { grid-column: 1 / -1; display: flex; justify-content: center; gap: var(--s-3); flex-wrap: wrap; }
.camera__review .btn { min-width: 150px; }
.camera__icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; cursor: pointer; }
.camera__icon-btn:hover { background: rgba(255,255,255,.16); }
.camera__icon-btn[hidden] { display: none; }
.camera :focus-visible { outline-color: var(--brass-300); }
@media (max-width: 640px) {
  dialog.camera { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .camera__video, .camera__still { max-height: none; }
}

/* Mobile refinements */
.legend li.legend__compact { grid-template-columns: 150px 1fr; font-size: var(--fs-sm); }
@media (max-width: 640px) {
  .legend li.legend__compact { grid-template-columns: 1fr; }
  .copy-btn { height: 36px; padding: 0 var(--s-3); font-size: var(--fs-sm); }
  .record-head__ref { gap: var(--s-2); }
  .case-head__top .cluster, .ws-head .btn { width: 100%; }
  .ws-head .btn { justify-content: center; }
  .panel__head { padding: var(--s-3) var(--s-4); flex-wrap: wrap; }
  .panel__body { padding: var(--s-4); }
  .worklist li { padding: var(--s-3) var(--s-4); grid-template-columns: 1fr; }
  .docs li { padding: var(--s-3) var(--s-4); grid-template-columns: 36px 1fr; }
  .docs li > .btn, .docs li > a.btn { grid-column: 1 / -1; justify-self: start; }
  .reqs li { padding: var(--s-3) var(--s-4); }
  .toolbar .input-with-icon { max-width: none; flex-basis: 100%; }
  .toolbar .select { flex: 1 1 140px; }
  .dropzone { padding: var(--s-5) var(--s-4); }
  .dropzone__actions { width: 100%; flex-direction: column; }
  .dropzone__actions .btn { width: 100%; min-height: 48px; }
  .upload-kind { flex-direction: column; align-items: stretch; width: 100%; }
  .upload-kind .select { min-width: 0; width: 100%; }
  .wizard-panel__head { margin-bottom: var(--s-5); }
  .lookup__row input { font-size: 16px; }
  .input, .select, .textarea { font-size: 16px; } /* prevents iOS zoom on focus */
  .site-footer { padding-top: var(--s-6); }
  .history > li { grid-template-columns: 28px 1fr; }
  .history__icon { width: 28px; height: 28px; }
  .history > li::before { left: 13.5px; }
  .item-pick { grid-template-columns: 64px 1fr auto; gap: var(--s-3); }
  .item-pick .thumb { width: 64px !important; }
}

/* System log */
.log-entry summary { cursor: pointer; list-style: none; }
.log-entry summary::-webkit-details-marker { display: none; }
.log-entry summary::before { content: "▸"; display: inline-block; width: 1em; color: var(--text-3); transition: transform .15s; }
.log-entry[open] summary::before { transform: rotate(90deg); }
.log-entry__msg { font-size: var(--fs-base); color: var(--ink); overflow-wrap: anywhere; }
.log-trace { margin: 0; padding: var(--s-3) var(--s-3) var(--s-3) var(--s-6); background: var(--ivory-100); border: 1px solid var(--line); border-radius: var(--r-2); font-size: var(--fs-xs); line-height: 1.7; overflow-x: auto; }
.log-trace li { white-space: nowrap; }
.log-table td.cell-wide { max-width: 560px; }

/* About: our story */
.story p { font-size: var(--fs-md); line-height: 1.75; color: var(--text-2); margin-bottom: var(--s-5); }
.story .story__lead { font-family: var(--font-serif); font-size: var(--fs-lg); line-height: 1.6; color: var(--ink); }
.milestones { list-style: none; border-top: 1px solid var(--ink); }
.milestones li { display: grid; grid-template-columns: 112px 1fr; gap: var(--s-5); padding: var(--s-5) 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.milestones__year { font: 400 var(--fs-2xl)/1 var(--font-serif); color: var(--brass-600); font-variant-numeric: oldstyle-nums; }
.milestones strong { display: block; font-weight: 600; margin-bottom: var(--s-1); }
.milestones p { color: var(--text-2); font-size: var(--fs-base); margin: 0; }
@media (max-width: 640px) {
  .milestones li { grid-template-columns: 1fr; gap: var(--s-2); }
  .story .story__lead { font-size: var(--fs-md); }
}
