/* KVALITO RIS shared UI (ARCHITECTURE.md 4.2.7; forms design docs/architecture/forms/DESIGN.md).
   Keep one definition per component. Selection uses a surface and text weight;
   never add decorative edge bars with borders, shadows or pseudo-elements.
   Elevation is limited to the three shadow tokens, motion to the duration tokens (off under
   prefers-reduced-motion), and no gradients. */
:root {
  --ink: #172b3a;
  --ink-soft: #52677a;
  --paper: #fff;
  --surface: #f4f7f9;
  --line: #e0e7ed;
  --control-line: #778996;
  --brand: #173f50;
  --brand-ink: #fff;
  --accent: #087b83;
  --focus-ring: #9a5b00;
  --focus-halo: #3d9ba2;
  --selected: #e7f3f1;
  --selected-ink: #07656a;
  --hover: #f0f5f6;
  --ok: #17663a;
  --warn: #8a5a00;
  --bad: #a31d1d;
  --info: #0b4f8a;
  --ok-surface: #e8f6ed;
  --warn-surface: #fff3de;
  --bad-surface: #ffeded;
  --info-surface: #ecf3f8;
  --radius: 8px;
  --control-radius: 6px;
  --small-radius: 4px;
  --brand-hover: #10313f;
  --brand-active: #0b2632;
  --control-hover-line: #566b7c;
  --neutral-surface: #eef2f5;
  --ok-line: #b9dfc7;
  --warn-line: #f0d6a6;
  --bad-line: #f1c0c0;
  --info-line: #c4d9ea;
  --bad-ring: #cf6f6f;
  --scrim: rgba(14, 30, 40, .4);
  --radius-lg: 12px;
  --radius-sheet: 16px;
  --shadow-xs: 0 1px 2px rgba(23, 43, 58, .05);
  --shadow-md: 0 2px 6px rgba(23, 43, 58, .05), 0 12px 32px rgba(23, 43, 58, .10);
  --shadow-lg: 0 4px 12px rgba(23, 43, 58, .06), 0 28px 72px rgba(23, 43, 58, .20);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-panel: 320ms;
  --header-h: 4.7rem;
  --nav-w: 16rem;
  --touch: 44px;
  --target-surface: #f3faf9;
  --target-flash: #cfe9e7;
  --banner-surface: #fff9ec;
  --ink-disabled: #8293a0;
  --control-strong: #71869a;
  --bad-hover: #8c1818;
  --ink-faint: #93a3af;
  --avatar-surface: #dfe9ef;
  --saved-flash: #cfe9e6;
  --strike-line: #9aabb7;
  --scrim-clear: rgba(14, 30, 40, 0);
  --chip-hover: #dbe4ea;
  --switch-hover: #5f7586;
  --accent-hover: #066a71;
  --ink-disabled-soft: #9aa9b4;
  --selected-line: #9dcdc8;
  --ink-code: #2b3f4e;
  --changed-surface: #f6fbfa;
  --gauge-track: #e9eef2;
  --spark-line: #8a9ba8;
  --warn-halo: #f6e2b6;
  --heat-1: #e8f2f2;
  --heat-2: #c9e3e2;
  --heat-3: #93c8c6;
  --heat-4: #256f73;
  --sum-surface: #fafcfd;
  --knob-shadow: rgba(23, 43, 58, .25);
  --age-0: #f1f5f8;
  --age-1: #b4c9d8;
  --age-2: #efc66b;
  --age-3: #eeb1aa;
  --chart-edge: #566b7c; /* the 3:1 outline of every light chart fill: age cells, swatches, bullet zones, gauge ring */
  --zone-ok: #cfe9d9;
  --zone-warn: #f3dc9a;
  --zone-bad: #eeb1aa;
  --series-1: var(--accent);
  --text-meta: .8rem; /* 12px: the floor for secondary text (meta, captions, tags, help) */
  --text-ui: .87rem; /* 13px: the floor for controls and interface text (tabs, labels, buttons, menus) */
  --text-body-sm: .93rem; /* 14px: compact body text (values, descriptions) */
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 1rem); }
[hidden] { display: none !important; }
body { margin: 0; background: var(--surface); color: var(--ink); }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration: none; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.015em; }
/* One heading scale for every page, dashboards included. */
h1 { font-size: 1.7rem; margin: .3rem 0 .7rem; font-weight: 700; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; font-weight: 650; }
h3 { font-size: 1rem; }
p { margin: .6rem 0 1rem; }
pre { max-width: 100%; overflow-x: auto; margin: 1rem 0; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--control-radius); font-size: var(--text-meta); line-height: 1.5; }
code { overflow-wrap: anywhere; }
pre code { overflow-wrap: normal; }
/* Long text blocks: extracted document text wraps; code and configuration scroll inside a bordered block. */
.document-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--text-meta); line-height: 1.55; }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--text-meta); line-height: 1.5; min-height: 16rem; white-space: pre; overflow: auto; }
.ref, .nowrap { white-space: nowrap; }
.muted, .help { color: var(--ink-soft); }
.eyebrow { display: block; margin: 0 0 .25rem; font-size: var(--text-meta); font-weight: 600; color: var(--ink-soft); }
.break-word { overflow-wrap: anywhere; }
/* Accessibility: focus and status meaning must survive the visual cleanup.
   Double ring: a 3px darker-amber outline (5.4:1 on white) separated from the element by a 2px paper ring, so it
   also reads on coloured chips and messages. Text controls use the teal border and halo of the forms section. */
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; box-shadow: 0 0 0 2px var(--paper); }
.icon { width: 1rem; height: 1rem; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: .85rem; height: .85rem; }
.icon-lg { width: 1.15rem; height: 1.15rem; }
.mono { font-family: var(--mono); font-size: .93em; }
.tabular { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--paper); padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 0; }
/* Header and account menus */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--line); }
.site-header a { color: var(--ink); }
.header-row { display: flex; align-items: center; min-height: 4.7rem; gap: 1rem; padding: .65rem 1.6rem; }
.header-row form { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.brand { display: flex; align-items: center; flex: 0 0 13.3rem; gap: .65rem; margin-right: 1rem; font-size: 1rem; font-weight: 700; letter-spacing: .13em; line-height: 1.2; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 2.65rem; height: 2.65rem; border-radius: var(--radius); background: var(--brand); color: var(--brand-ink); font-size: 1.45rem; letter-spacing: -.08em; }
.brand-caption { display: block; font-size: var(--text-meta); margin-top: .25rem; letter-spacing: .015em; font-weight: 450; color: var(--ink-soft); }
.workspace-name { margin-right: auto; min-width: 0; }
.account-menu { order: 2; }
.header-row .language-switch { order: 1; }
.workspace-name .eyebrow { font-size: var(--text-meta); margin: 0; }
.workspace-name strong { display: block; font-size: .87rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22rem; }
.tenant-name { font-weight: 600; }
.header-row .language-switch { gap: 0; padding: .15rem; border: 1px solid var(--line); border-radius: var(--control-radius); }
.brand + .language-switch { margin-left: auto; }
.language-switch button.secondary { font-size: var(--text-ui); padding: .25rem .4rem; border: 0; background: transparent; color: var(--ink-soft); min-height: 1.7rem; box-shadow: none; }
.language-switch button[aria-current="true"] { background: var(--selected); color: var(--selected-ink); font-weight: 700; border-radius: var(--small-radius); }
.menu { position: relative; }
.menu summary { display: flex; align-items: center; gap: .45rem; cursor: pointer; list-style: none; border: 1px solid var(--line); padding: .4rem .6rem; font-size: var(--text-ui); border-radius: var(--control-radius); min-height: 2.35rem; transition: background-color var(--dur-fast); }
.menu summary:hover { background: var(--hover); }
.menu summary::-webkit-details-marker { display: none; }
.menu summary > .icon { margin-left: .2rem; color: var(--ink-soft); transition: transform var(--dur-fast); }
.menu[open] summary > .icon { transform: rotate(180deg); }
.menu[open] summary { background: var(--hover); }
.menu ul { position: absolute; right: 0; top: 100%; z-index: 10; min-width: 15rem; margin: .3rem 0 0; padding: .65rem; list-style: none; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.menu ul { padding: .3rem; }
.menu ul li { padding: 0; }
.menu ul form { display: block; }
.menu ul .menu-item:hover { background: var(--hover); color: var(--ink); }
.menu-role { display: flex; flex-direction: column; padding: .45rem .6rem .55rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; font-size: var(--text-meta); color: var(--ink-soft); }
.menu-role strong { font-size: var(--text-ui); color: var(--ink); overflow-wrap: anywhere; }
.avatar { width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; background: var(--surface); font-weight: 700; color: var(--ink-soft); }
/* Navigation: current pages and selected tabs share the same flat treatment.
   The side column is a grid item, so its white surface and border run the full height of the page; only the
   navigation panel inside it is sticky. */
.side-column { background: var(--paper); border-right: 1px solid var(--line); min-width: 0; }
.navigation-panel { position: sticky; top: var(--header-h); max-height: calc(100vh - var(--header-h)); overflow-y: auto; }
button.nav-toggle { display: none; }
.site-nav { padding: 1.3rem .85rem; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { display: block; color: var(--ink-soft); padding: .5rem .8rem; border-radius: var(--control-radius); font-size: var(--text-ui); line-height: 1.45; margin: .12rem 0; text-decoration: none; transition: background-color var(--dur-fast), color var(--dur-fast); }
.site-nav a:hover, .tab-nav a:hover { background: var(--hover); color: var(--brand); }
.site-nav a[aria-current="page"], .tab-nav a[aria-current="page"] { background: var(--selected); color: var(--selected-ink); font-weight: 700; }
.nav-group-label { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0; padding: .35rem .8rem; border-radius: var(--control-radius); color: var(--ink-soft); font-size: var(--text-meta); font-weight: 650; cursor: pointer; list-style: none; }
.nav-group-label::-webkit-details-marker { display: none; }
.nav-group-label:hover { background: var(--hover); color: var(--ink); }
.nav-group-label .icon { transition: transform var(--dur-fast); }
.nav-group details:not([open]) > .nav-group-label .icon { transform: rotate(-90deg); }
.nav-group details > ul { margin-top: .2rem; }
.nav-group { margin-top: .6rem; }
/* The sidebar scrolls inside its sticky panel: a fade at the edge that has more shows it. */
.navigation-panel.has-more-below::after { content: ""; position: sticky; bottom: 0; display: block; height: 0; box-shadow: 0 0 1.25rem 1.25rem var(--paper); pointer-events: none; }
.navigation-panel.has-more-above::before { content: ""; position: sticky; top: 0; z-index: 1; display: block; height: 0; box-shadow: 0 0 1.25rem 1.25rem var(--paper); pointer-events: none; }
.site-nav .nav-help { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; border-radius: 0; }
.tab-nav { display: flex; flex-wrap: wrap; gap: .35rem; padding: .25rem; margin-bottom: 1rem; }
.tab-nav a { padding: .45rem .7rem; font-size: var(--text-ui); border-radius: var(--control-radius); color: var(--ink-soft); text-decoration: none; transition: background-color var(--dur-fast), color var(--dur-fast); }
/* Page layout: the shell is a grid (side column, content); without navigation it is a single column. */
.app-grid { display: grid; grid-template-columns: minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.has-nav .app-grid { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
.content-shell { min-width: 0; display: flex; flex-direction: column; }
/* The footer sits at the bottom of a short page. */
.content-shell > main { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
main { max-width: 88rem; padding: 2.25rem 2.5rem 3rem; margin: 0 auto; min-width: 0; }
.site-footer { display: flex; gap: 1rem; justify-content: flex-start; align-items: baseline; text-align: left; color: var(--ink-soft); padding: 1.25rem 2.5rem; border-top: 1px solid var(--line); font-size: var(--text-meta); }
.request-reference { margin-left: auto; font-size: var(--text-meta); overflow-wrap: anywhere; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.8rem; }
.page-heading h1 { margin-bottom: 0; overflow-wrap: anywhere; }
.page-heading > div { min-width: 0; }
.page-heading-main { flex: 1 1 auto; }
/* The reference of a record: a plain line above the H1, in normal case. */
.record-ref { margin: 0 0 .2rem; font-size: var(--text-ui); font-weight: 600; color: var(--ink-soft); overflow-wrap: anywhere; }
/* The actions line up with the H1, which sits below the reference line. */
.page-heading.has-ref > .page-actions { margin-top: 1.25rem; }
.back-link { margin: 0 0 1rem; font-size: var(--text-ui); }
.page-description { max-width: 46rem; color: var(--ink-soft); font-size: var(--text-body-sm); margin: .4rem 0 0; }
.page-heading > .page-actions { flex: 0 0 auto; }
.page-links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: .5rem 0 0; font-size: var(--text-ui); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.page-actions > form { margin: 0; }
/* Export links inside a page-actions group are ordinary buttons of the group. */
.page-actions > .export-buttons { display: contents; }
.page-actions .export-buttons summary.button { padding: .55rem .9rem; min-height: 2.55rem; }
.section-heading > a, .section-heading > span { font-size: var(--text-meta); }
.card, .metric-card, .feature-panel, .preview-source-card, .diff-block, .audit-panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.card > :last-child:not(dialog) { margin-bottom: 0; }
/* Section card: a head and a body. A card without a head keeps the plain padding. */
.card { margin-bottom: 1.25rem; min-width: 0; transition: background-color var(--dur-panel) var(--ease-out); }
.card:not(:has(> .card-head)) { padding: 1rem 1.25rem; }
.card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.25rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-title { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .6rem; min-width: 0; }
.card-action { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; font-weight: 650; letter-spacing: -.01em; }
.card-head .count { color: var(--ink-soft); font-weight: 500; font-size: var(--text-ui); }
.card-body { padding: 1.25rem; }
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child:not(dialog) { margin-bottom: 0; }
.card-foot { padding: .75rem 1.25rem; border-top: 1px solid var(--line); font-size: var(--text-ui); }
.card:target { background: var(--target-surface); scroll-margin-top: calc(var(--header-h) + 1.25rem); animation: card-saved var(--dur-panel) var(--ease-out); }
@keyframes card-saved { from { background-color: var(--target-flash); } to { background-color: var(--target-surface); } }
.card-updated { display: none; align-items: center; gap: .3rem; font-size: var(--text-meta); color: var(--selected-ink); font-weight: 600; }
.card:target .card-updated { display: inline-flex; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem); gap: 1.25rem; align-items: start; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; }
/* Dashboard and record lists */
a.metric-card { transition: background-color var(--dur-fast), border-color var(--dur-fast); }
a.metric-card:hover { background: var(--hover); border-color: var(--control-hover-line); }
.metric-card { padding: 1.1rem 1.25rem; color: var(--ink); text-decoration: none; min-width: 0; }
.metric-label { display: block; color: var(--ink-soft); font-size: var(--text-meta); font-weight: 550; }
.metric-value { display: block; font-size: 2.1rem; line-height: 1.35; margin: .35rem 0; font-weight: 700; letter-spacing: -.04em; }
.metric-detail { display: block; color: var(--ink-soft); font-size: var(--text-meta); }
.metric-card.attention .metric-value { color: var(--warn); }
.figure-tile { display: flex; flex-direction: column; min-width: 0; gap: .35rem; }
.figure-tile > .metric-card { display: block; flex: 1; }
.figure-source { display: block; color: var(--ink-soft); font-size: var(--text-ui); margin-top: .5rem; overflow-wrap: anywhere; }
.rate-tile a.metric-value { color: var(--ink); text-decoration: underline; text-decoration-color: var(--control-line); text-decoration-thickness: 1px; text-underline-offset: .15em; }
.rate-tile a.metric-value:hover { text-decoration-color: currentColor; }
.slot-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin: 0 0 1.5rem; font-size: var(--text-ui); }
.bar-table th, .figure-table th { overflow-wrap: anywhere; white-space: normal; }
.figure-table th { min-inline-size: 5.5rem; }
.figure-table th[scope="row"], .figure-table th:first-child { min-inline-size: 8rem; }
.bar-table td, .figure-table td { white-space: normal; }
.figure-table th, .figure-table td { padding-inline: .6rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(17rem, 1fr); gap: 1.5rem; align-items: start; }
.empty-state { padding: 1.25rem 0; }
.empty-state h3 { margin: .25rem 0 .75rem; font-size: 1rem; }
.empty-state p { color: var(--ink-soft); font-size: var(--text-ui); max-width: 37rem; margin: 0; }
.empty-state p + p { margin-top: .5rem; }
.contents-list { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 2rem; }
.contents-list a { display: inline-block; padding: .2rem 0; }
.record-list { list-style: none; padding: 0; margin: 0; }
.record-list > li { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.record-list > li:first-child { padding-top: .2rem; }
.record-list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.record-list a.record-title { display: block; font-size: var(--text-body-sm); color: var(--ink); font-weight: 650; text-decoration: none; }
.record-list a.record-title:hover { color: var(--accent); text-decoration: underline; }
.badge-group { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; }
.page-meta { color: var(--ink-soft); font-size: var(--text-body-sm); margin: .4rem 0 0; }
.record-meta form { margin: 0; }
.notification-list .ai-label { border: 0; padding: 0; margin-left: .4rem; font-weight: 400; }
.record-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; font-size: var(--text-meta); color: var(--ink-soft); margin: .45rem 0; }
.record-list p { margin: .3rem 0; font-size: .87rem; }
.person-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; }
.person-row[aria-current] { background: var(--hover); }
.person-current { font-weight: 700; font-size: .87rem; }
.status-list { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; margin: .5rem 0 1rem; font-size: var(--text-ui); }
.status-list dt { color: var(--ink-soft); }
.status-list dd { margin: 0; font-weight: 700; }
/* Messages use text labels and complete surfaces, without accent strips. */
.support-banner { background: var(--warn-surface); color: var(--warn); border-bottom: 1px solid var(--line); padding: .6rem 1.25rem; font-weight: 600; }
.environment-banner { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; padding: .55rem 2.5rem; font-size: var(--text-meta); color: var(--warn); background: var(--banner-surface); border-bottom: 1px solid var(--line); }
.environment-tag { display: inline-block; font-size: var(--text-meta); font-weight: 700; border: 1px solid currentColor; border-radius: var(--small-radius); padding: .06rem .35rem; }
.environment-banner a { color: var(--warn); font-weight: 650; }
.environment-links { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; margin-left: auto; }
.message { border: 1px solid var(--line); background: var(--paper); padding: .6rem 1rem; margin: 0 0 1rem; border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.message:has(+ .card), .message:has(+ .form-panel) { margin-bottom: 1.5rem; }
.message .message-level { font-weight: 700; margin-right: .4rem; color: var(--info); }
.message-success .message-level { color: var(--ok); }
.message-warning .message-level { color: var(--warn); }
.message-error .message-level { color: var(--bad); }
.inline-note { padding: .85rem 1rem; margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: var(--text-ui); color: var(--ink-soft); }
.inline-note > :last-child { margin-bottom: 0; }
.inline-note.warning { background: var(--warn-surface); color: var(--warn); }
/* Forms: one definition for the text controls (a plain input, select or textarea, or the .input class). The
   low-specificity defaults let invalid and focused controls keep their meaning. */
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea), .input { font: inherit; font-size: var(--text-ui); min-height: 2.5rem; padding: .5rem .75rem; border: 1px solid var(--control-line); border-radius: var(--control-radius); background: var(--paper); color: var(--ink); min-width: 0; max-width: 100%; box-shadow: var(--shadow-xs); transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background-color var(--dur-fast); }
.input { width: 100%; }
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea, .input):hover { border-color: var(--control-hover-line); }
:where(textarea), textarea.input { min-height: 5.5rem; line-height: 1.5; resize: vertical; }
:where(input, textarea)::placeholder, .input::placeholder { color: var(--ink-soft); opacity: 1; }
:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):disabled, .input:disabled { background: var(--surface); color: var(--ink-disabled); border-color: var(--line); box-shadow: none; cursor: not-allowed; }
:where(input:not([type=checkbox], [type=radio]), textarea):read-only:not(:disabled), .input[readonly] { background: var(--surface); box-shadow: none; }
.input.mono { font-family: var(--mono); font-size: var(--text-meta); }
/* Text-control focus: a teal border (5.0:1) plus a 3px halo that itself reaches 3:1 on white and on the page
   surface. The outline stays in the box as a transparent one, so forced-colours mode paints it in a system colour. */
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea):focus, .input:focus,
.chip-box:focus-within, .input-group:focus-within { outline: 2px solid transparent; outline-offset: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-halo); }
:is(input, select, textarea, .input)[aria-invalid="true"]:focus, .field-error :is(input, select, textarea):focus, .chip-input[data-invalid] .chip-box:focus-within, .input-group:has([aria-invalid="true"]):focus-within { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-ring); }
:is(input, select, textarea, .input)[aria-invalid="true"] { border-color: var(--bad); }
:where(select:not([multiple]):not([size])), select.input:not([multiple]) { appearance: none; padding-right: 2.25rem; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2352677a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; background-size: 1rem; }
/* File input: the native control stays visible and keyboard operable; only its button is styled. */
:where(input[type="file"]) { padding: .4rem .5rem; cursor: pointer; }
input[type="file"]::file-selector-button { margin-right: .75rem; padding: .35rem .75rem; border: 1px solid var(--control-line); border-radius: var(--small-radius); background: var(--paper); color: var(--ink); font: inherit; font-size: var(--text-ui); font-weight: 600; cursor: pointer; transition: background-color var(--dur-fast), border-color var(--dur-fast); }
input[type="file"]::file-selector-button:hover { background: var(--hover); border-color: var(--control-hover-line); }
/* Date: the native control (keyboard entry, phone pickers); .input-wrap swaps the browser glyph for the shared icon. */
.input-wrap { position: relative; display: block; }
.input-wrap > .icon { position: absolute; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.input-wrap > .icon-left { left: .75rem; }
.input-wrap > .icon-right { right: .75rem; }
.input-wrap > .icon-left ~ .input { padding-left: 2.25rem; }
input[type="date"] { font-variant-numeric: tabular-nums; }
.input-wrap > input[type="date"] { padding-right: 2.4rem; }
.input-wrap > input[type="date"]::-webkit-calendar-picker-indicator { position: absolute; right: .5rem; width: 1.5rem; height: 1.5rem; opacity: 0; cursor: pointer; }
/* Number with unit */
.input-group { display: flex; align-items: stretch; width: 100%; border: 1px solid var(--control-line); border-radius: var(--control-radius); background: var(--paper); box-shadow: var(--shadow-xs); transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.input-group:hover { border-color: var(--control-hover-line); }
.input-group:has([aria-invalid="true"]) { border-color: var(--bad); }
.input-group .input, .input-group .input:focus { border: 0; box-shadow: none; min-height: calc(2.5rem - 2px); font-variant-numeric: tabular-nums; }
.addon { display: flex; align-items: center; padding: 0 .75rem; border-left: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: var(--text-ui); border-radius: 0 var(--control-radius) var(--control-radius) 0; white-space: nowrap; }
.w-num { max-width: 12rem; }
:where(main form) { margin: 1rem 0 1.5rem; }
:where(main form > label) { display: block; margin: .75rem 0 .35rem; font-size: var(--text-ui); font-weight: 650; }
:where(main form > input:not([type="hidden"]), main form > select, main form > textarea) { display: block; width: 100%; max-width: 36rem; margin-bottom: 1rem; }
:where(main label:has(> input[type="checkbox"]), main label:has(> input[type="radio"])) { display: flex; align-items: flex-start; gap: .55rem; margin: .5rem 0; font-size: .87rem; font-weight: 450; cursor: pointer; }
/* Checkbox and radio: drawn boxes (a data: tick), 1.05rem; the label row is the touch target. */
input[type="checkbox"]:not(.switch), input[type="radio"] { appearance: none; flex: 0 0 auto; width: 1.05rem; height: 1.05rem; margin: .12rem 0 0; padding: 0; border: 1.5px solid var(--control-strong); border-radius: 4px; background: var(--paper) no-repeat center / .8rem; cursor: pointer; transition: background-color var(--dur-fast), border-color var(--dur-fast); }
input[type="checkbox"]:not(.switch):hover, input[type="radio"]:hover { border-color: var(--accent); }
input[type="checkbox"]:not(.switch):checked { background-color: var(--accent); border-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }
input[type="radio"] { border-radius: 50%; }
input[type="radio"]:checked { background-color: var(--accent); border-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='5' fill='white'/%3E%3C/svg%3E"); background-size: 1.05rem; }
input[type="checkbox"]:not(.switch):disabled, input[type="radio"]:disabled { background-color: var(--surface); border-color: var(--line); cursor: not-allowed; }
/* Fieldsets keep their grouping semantics; the notched box is gone. */
fieldset { min-width: 0; margin: 0 0 1.5rem; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: .5rem; font-size: var(--text-body-sm); font-weight: 650; }
/* Top-level sections of a sectioned form are white cards (no notch); nested fieldsets stay plain, with a smaller legend. */
.form-sections > fieldset { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.form-sections > fieldset > legend { float: left; width: 100%; margin: 0 0 .75rem; font-size: 1.05rem; letter-spacing: -.01em; }
.form-sections > fieldset > legend + * { clear: both; }
.form-sections > fieldset fieldset { margin-bottom: 1rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.form-sections > fieldset fieldset > legend { font-size: var(--text-ui); color: var(--ink-soft); }
fieldset > legend + p.help { margin: 0 0 .75rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; max-width: 76rem; }
.form-grid > .field { min-width: 0; }
.form-grid > .full-width { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; padding-top: 1rem; margin: 1.25rem 0 .25rem; border-top: 1px solid var(--line); }
.form-panel > .form-actions:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-panel, :where(.has-nav main > form:has(.field):not(.form-sections)) { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); padding: 1.5rem; margin-bottom: 1.5rem; }
/* A second job inside a panel, set apart from the first by the shared gap and rule. */
.subsection { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
/* The first sub-section opens its card without a rule; stacked key-value blocks keep the field gap. */
.card-body > .subsection:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.subsection > * + .kv, .kv + .kv { margin-top: 1.15rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .25rem; }
.field label, form[role="search"] > label { font-size: var(--text-ui); font-weight: 650; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { width: 100%; max-width: 36rem; }
.field label:has(> input[type="checkbox"]), .field label:has(> input[type="radio"]) { display: flex; font-weight: 450; }
.field.field-error input, .field.field-error select, .field.field-error textarea { border: 2px solid var(--bad); }
.field .help, .form-grid > .help, fieldset > .help { color: var(--ink-soft); margin: .25rem 0 0; font-size: var(--text-meta); }
.form-grid > .help { margin-bottom: .75rem; }
/* A checkbox that introduces a field keeps the same distance to it as two fields do. */
:where(main label:has(> input[type="checkbox"])):has(+ .field) { margin-bottom: 1rem; }
.field .error { color: var(--bad); font-weight: 600; margin: .25rem 0 0; }
.error-text { display: flex; align-items: flex-start; gap: .35rem; margin: 0; font-size: var(--text-meta); font-weight: 600; color: var(--bad); }
.field-switch + .error-text { margin: -.5rem 0 1rem; }
.req { color: var(--bad); margin-left: .15rem; }
.optional { margin-left: .3rem; font-weight: 450; color: var(--ink-soft); }
/* The one submit button of a sign-in screen (sign-in, forgot password, development sign-in) fills the card. */
.auth-submit { width: 100%; text-align: center; }
.password-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem .75rem; align-items: center; max-width: 36rem; }
.password-control label { grid-column: 1; grid-row: 1; margin: 0; }
.password-control input { grid-column: 1 / -1; grid-row: 2; }
.password-control .password-toggle { grid-column: 2; grid-row: 1; font-size: var(--text-ui); padding: .25rem .6rem; min-height: 2rem; }
.required-mark, .field-error-list { color: var(--bad); }
/* Buttons: primary by default; secondary, ghost, danger and link-button are modifiers; small and icon-only change the size.
   Cancel is always a secondary button. */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-size: var(--text-ui); font-weight: 600; line-height: 1.2; padding: .5rem .9rem; min-height: 2.5rem; border-radius: var(--control-radius); border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-xs); cursor: pointer; text-align: center; text-decoration: none; transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast); }
:where(button, .button):hover { background: var(--brand-hover); border-color: var(--brand-hover); }
:where(button, .button):active { background: var(--brand-active); }
button.secondary, .button.secondary { background: var(--paper); color: var(--ink); border-color: var(--control-line); }
button.secondary:hover, .button.secondary:hover { background: var(--hover); border-color: var(--control-hover-line); }
button.ghost, .button.ghost { background: transparent; border-color: transparent; color: var(--ink-soft); box-shadow: none; }
button.ghost:hover, .button.ghost:hover { background: var(--hover); color: var(--ink); }
/* One destructive-button rule: a destructive button on a page is a neutral button with red text; it turns solid red only
   inside a confirmation (a dialog), at the moment the person commits. */
button.danger, .button.danger { background: var(--paper); border-color: var(--control-line); color: var(--bad); }
button.danger:hover, .button.danger:hover { background: var(--bad-surface); border-color: var(--bad-line); }
dialog button.danger, dialog .button.danger { background: var(--bad); border-color: var(--bad); color: var(--brand-ink); }
dialog button.danger:hover, dialog .button.danger:hover { background: var(--bad-hover); border-color: var(--bad-hover); }
button.link-button, .button.link-button { min-height: 0; padding: 0; background: none; border: 0; box-shadow: none; color: var(--accent); }
button.link-button:hover, .button.link-button:hover { background: none; text-decoration: underline; }
button.small, .button.small { min-height: 1.9rem; padding: .2rem .65rem; font-size: var(--text-ui); gap: .35rem; }
button.icon-only, .button.icon-only { width: 2.5rem; padding: 0; }
button.icon-only.small, .button.icon-only.small { width: 1.9rem; }
button:disabled, .button[aria-disabled="true"] { background: var(--surface); border-color: var(--line); color: var(--ink-faint); box-shadow: none; cursor: not-allowed; }
:where(main button + button, main button + .button, main .button + a, main button + a) { margin-left: .4rem; }
.form-actions > :is(button, a, form), .page-actions > :is(button, a, form) { margin-left: 0; }
:where(main details > summary) { cursor: pointer; padding: .7rem 0; font-size: .87rem; font-weight: 650; }
:where(main details > summary):hover { color: var(--accent); }
:where(main details[open] > summary) { margin-bottom: .75rem; }
:where(main details + details, main form + details) { margin-top: 1rem; }
dl.pairs { display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(0, 3fr); gap: .75rem 1.5rem; margin: 1rem 0 1.5rem; font-size: var(--text-body-sm); }
dl.pairs > dt { color: var(--ink-soft); font-weight: 550; }
dl.pairs > dd { margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
main > dl.pairs { padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
/* Key-value lists. .kv is the grid of a section card, .kv-rows the label-left list of a side card; both replace the
   `dl.pairs` grid above. */
.kv, .kv-rows { padding: 0; border: 0; background: none; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 1.15rem 2rem; margin: 0; font-size: inherit; }
.kv-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kv-one-row { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.kv > div { min-width: 0; }
.kv dt { margin-bottom: .2rem; font-size: var(--text-meta); font-weight: 550; color: var(--ink-soft); }
.kv dd { margin: 0; font-size: var(--text-body-sm); overflow-wrap: anywhere; white-space: normal; }
.kv .span-2 { grid-column: span 2; }
.kv time, .kv-rows time { white-space: nowrap; }
.kv dd ul { margin: 0; padding-left: 1.1rem; }
.kv .span-all { grid-column: 1 / -1; }
@media (max-width: 600px) { .kv, .kv-two, .kv-one-row { grid-template-columns: minmax(0, 1fr); grid-auto-flow: row; grid-auto-columns: auto; } .kv .span-2 { grid-column: auto; } }
.empty-value { color: var(--ink-soft); }
.kv-rows { display: block; margin: 0; }
.kv-rows > div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: var(--text-ui); }
.kv-rows > div:first-child { padding-top: 0; }
.kv-rows > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv-rows dt { color: var(--ink-soft); font-weight: 400; }
.kv-rows dd { margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: normal; }
.person { display: inline-flex; align-items: center; gap: .45rem; }
.avatar-sm { display: inline-grid; place-items: center; flex: 0 0 auto; width: 1.45rem; height: 1.45rem; border-radius: 50%; background: var(--avatar-surface); color: var(--brand); font-size: var(--text-meta); font-weight: 700; letter-spacing: .02em; }
/* The value that was just saved is highlighted once. */
.flash-value { border-radius: var(--small-radius); animation: flash-value .32s var(--ease-out); }
@keyframes flash-value { 0%, 35% { background: var(--saved-flash); box-shadow: 0 0 0 3px var(--saved-flash); } 100% { background: transparent; box-shadow: 0 0 0 3px transparent; } }
/* Milestones: the key dates of a record in their order. The line connects ordered dates; it is not an accent. */
.milestones { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); margin: 0; padding: 0; list-style: none; }
.milestones li { position: relative; padding: 1.4rem .5rem 0 0; min-width: 0; }
.milestones li::before { content: ""; position: absolute; top: .42rem; left: 0; right: 0; height: 2px; background: var(--line); }
.milestones li.done::before { background: var(--accent); }
.milestones .node { position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 1rem; height: 1rem; border-radius: 50%; background: var(--paper); border: 2px solid var(--control-line); }
.milestones li.done .node { background: var(--accent); border-color: var(--accent); color: var(--brand-ink); }
.milestones li.done .node .icon { width: .6rem; height: .6rem; stroke-width: 3.5; }
.milestones .m-label { display: block; font-size: var(--text-meta); color: var(--ink-soft); font-weight: 550; line-height: 1.3; }
.milestones .m-date { display: block; margin-top: .15rem; font-size: var(--text-ui); font-weight: 600; }
.milestones .m-date.empty-value { font-weight: 450; }
:where(main article:not([class]), .impact-item) { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
/* Inside a card the first entry opens it without the gap, and the last closes it without a rule. */
.card-body > article:not([class]):first-child { padding-top: 0; }
.card-body > article:not([class]):first-child > :first-child { margin-top: 0; }
.card-body > article:not([class]):last-child { padding-bottom: 0; border-bottom: 0; }
/* Tables, filters and pagination */
.table-wrap { position: relative; overflow-x: auto; border-radius: var(--radius); margin: 1rem 0; max-width: 100%; }
.table-scroll-hint { color: var(--ink-soft); font-size: var(--text-meta); margin: 1rem 0 -.25rem; }
table { border-collapse: collapse; width: 100%; background: var(--paper); font-size: var(--text-ui); border: 1px solid var(--line); }
table th, table td { text-align: left; vertical-align: top; padding: .85rem .9rem; border-bottom: 1px solid var(--line); }
/* Cells keep a readable minimum so titles never shrink to one word per line; references, dates and badges stay on one line. */
table:has(th:nth-child(4)) td:not(.text) { min-width: 4.5rem; }
table:has(th:nth-child(5)) td:not(.text) { min-width: 7rem; }
table:is(:has(th:nth-child(4)), :has(th:nth-child(5))) td:not(.text):has(> .badge, > time, > .ref) { min-width: 0; }
table td:has(> .ref, > time, > .badge, > code.ref), table td.nowrap { white-space: nowrap; }
/* Long-text cells (rationales, descriptions) keep a readable width instead of one word per line. */
table td.text, table:has(th) td.text { min-width: 12rem; }
/* Description columns get a wider minimum so rows stay a few lines tall instead of a tall column of short lines. */
table td.text.text-wide { min-width: 24rem; }
/* Exact codes (audit actions, record identifiers) read as one token. */
table td code.code-token { overflow-wrap: normal; white-space: nowrap; }
table thead th { background: var(--surface); color: var(--ink-soft); font-size: var(--text-meta); font-weight: 650; white-space: nowrap; }
table th button.sort { background: none; border: 0; box-shadow: none; color: inherit; font-size: inherit; font-weight: 700; line-height: inherit; letter-spacing: inherit; padding: 0; min-height: 0; border-radius: 0; display: inline; text-align: left; }
table tbody th { padding: .85rem .9rem; font-size: inherit; font-weight: 600; color: var(--ink); text-align: left; }
table td:first-child { font-weight: 550; }
table tbody tr { transition: background-color var(--dur-fast); }
table tbody tr:hover { background: var(--hover); }
table td a { font-weight: 600; text-decoration: none; }
table td a:hover { text-decoration: underline; }
table caption { padding: .6rem 0; font-weight: 650; text-align: left; }
table td form { margin: .5rem 0; }
table tbody tr.detail-row:hover { background: none; }
table tbody tr:has(+ .detail-row) > td { border-bottom: 0; }
/* The empty-state text stays inside the visible width of a scrolling table. */
table td > .empty-state { padding: 0; position: sticky; left: 0; max-width: min(34rem, calc(100vw - 6rem)); white-space: normal; }
table tr.detail-row > td { padding-top: 0; min-width: 0; font-weight: 400; }
table tr.detail-row .table-wrap { margin: .75rem 0 .25rem; }
.table-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1rem; margin-bottom: .75rem; padding: 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
/* Each field spans label / control / help rows shared by the fields of one visual row, so controls align whatever the label or help length. */
.table-filters .field { display: grid; grid-row: span 3; grid-template-rows: subgrid; margin-bottom: 0; row-gap: .25rem; min-width: 0; padding-bottom: .8rem; }
.table-filters .field label { line-height: 1.3; align-self: end; }
.table-filters .field input:not([type="checkbox"]):not([type="radio"]), .table-filters .field select, .table-filters .field textarea { width: 100%; max-width: none; margin: 0; min-height: 2.4rem; box-sizing: border-box; }
.table-filters .field .help { margin: 0; }
.table-filters .filter-buttons { display: flex; flex-wrap: wrap; gap: .5rem; grid-row: span 3; align-self: end; margin: 0 0 .8rem; }
.table-filters .filter-buttons > * { margin: 0; }
.table-filters > button, .table-filters > a.button, .table-filters > label { grid-row: span 3; align-self: end; justify-self: start; margin: 0 0 .8rem; }
.table-filters > label { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.4rem; }
@media (max-width: 800px) { .table-filters .filter-action > span { display: none; } }
.table-filters .filter-action { justify-items: start; }
/* Small header filters and the training switch: label, select and button on one centred row (FORM-29). */
.inline-filter, .training-switch .inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; }
.inline-filter label { margin: 0; color: var(--ink-soft); font-size: var(--text-ui); }
.tab-nav + .inline-filter { margin-bottom: 1rem; }
.inline-filter select, .training-switch select { width: auto; min-width: 8rem; margin: 0; min-height: 2.4rem; }
.table-filters .filter-action > span { line-height: 1.3; }
.table-filters .filter-action > span { grid-row: 1; }
.table-filters .filter-action button { grid-row: 2; align-self: start; min-height: 2.4rem; margin: 0; }
@media (min-width: 801px) { .table-filters .field:first-child:has(input[type="search"]) { grid-column: span 2; } }
.filter-panel { margin-bottom: 1.25rem; }
.filter-panel > summary { cursor: pointer; font-size: var(--text-ui); font-weight: 650; padding: .7rem .1rem; color: var(--ink-soft); }
.pager { display: flex; gap: .75rem; align-items: center; margin-top: .75rem; font-size: var(--text-meta); color: var(--ink-soft); }
/* What a table shows and which filter is active: meta size, never larger than the table. */
.filter-summary { margin: 0 0 .6rem; font-size: var(--text-meta); color: var(--ink-soft); }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.filters-toggle { display: none; }
.period-form { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; margin: 0; }
.period-form label { margin: 0; font-size: var(--text-ui); color: var(--ink-soft); }
.period-form input[type="date"] { width: auto; min-height: 2.4rem; margin: 0; }
.table-filters .more-filters { grid-column: 1 / -1; }
.table-filters .more-filters > summary { cursor: pointer; font-size: var(--text-ui); font-weight: 600; color: var(--ink-soft); padding: .35rem 0; }
.table-filters .more-filters-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem 1rem; align-items: end; padding-top: .5rem; }
.table-filters .more-filters-body .field { grid-row: auto; grid-template-rows: none; padding-bottom: 0; }
.table-filters .more-filters-body > label { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.4rem; }
/* One Export menu per list or page; its links are menu rows. */
.export-buttons { display: flex; justify-content: flex-start; margin: .5rem 0; }
.export-buttons .dropdown-menu { min-width: 11rem; }
.export-buttons summary.button { font-size: var(--text-ui); }
/* Status meaning always includes a label (and an icon where one helps), never colour alone. Neutral is grey. */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; border: 1px solid var(--line); font-size: var(--text-meta); font-weight: 600; line-height: 1.4; white-space: nowrap; background: var(--neutral-surface); color: var(--ink); }
.badge .icon { width: .78rem; height: .78rem; stroke-width: 2.25; }
.badge-ok { background: var(--ok-surface); border-color: var(--ok-line); color: var(--ok); }
.badge-warn { background: var(--warn-surface); border-color: var(--warn-line); color: var(--warn); }
.badge-bad { background: var(--bad-surface); border-color: var(--bad-line); color: var(--bad); }
.badge-info { background: var(--info-surface); border-color: var(--info-line); color: var(--info); }
.badge-neutral { background: var(--neutral-surface); border-color: var(--line); color: var(--ink); }
.badge-none { background: var(--neutral-surface); border-color: var(--line); color: var(--ink); }
.badge-sm { gap: .25rem; padding: 0 .45rem; font-size: var(--text-meta); line-height: 1.3rem; }
.tag { display: inline-flex; align-items: center; height: 1.3rem; padding: 0 .4rem; border-radius: var(--small-radius); background: var(--neutral-surface); color: var(--ink-soft); font-size: var(--text-meta); font-weight: 650; }
.tag-changed { background: var(--selected); color: var(--selected-ink); }
.chip-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.ai-label { display: inline-block; max-width: 100%; overflow-wrap: anywhere; border: 1px solid var(--line); color: var(--info); border-radius: var(--small-radius); padding: .1rem .5rem; font-size: var(--text-ui); }
.ai-label .ai-review { color: var(--ink-soft); margin-left: .4rem; }
/* The (i) stays beside the label, never alone on the next line. */
.ai-group { display: inline-flex; align-items: flex-start; gap: .25rem; max-width: 100%; vertical-align: top; }
.ai-group .ai-label { min-width: 0; }
/* TRAINING MODE has its own tone (blue, solid tag) so it does not read as the amber demo note. */
.training-banner { color: var(--info); background: var(--info-surface); border-bottom-color: var(--info-line); }
.training-banner .training-tag { background: var(--info); border-color: var(--info); color: var(--brand-ink); }
/* The (i) sits at the right end: its tip grows leftwards so it never widens the page. */
.environment-banner .explain-tip { left: auto; right: 0; transform: none; }
.training-signature { margin: .3rem 0 0; font-size: var(--text-ui); color: var(--ink-soft); }
.simulated-steps { margin-top: .75rem !important; padding-top: .75rem !important; border-top: 1px solid var(--line); }
.simulated-steps li { font-style: italic; color: var(--ink-soft); font-size: var(--text-ui); }
/* Signatures, audit records and chronology */
/* A signature block is a panel of its own; inside a panel it is a plain subsection. */
.card .signature-block { margin: 1.5rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.card .signature-block:not(:last-child) { margin-bottom: 1rem; }
.card-body > .signature-block:only-child { margin: 0; padding-top: 0; border-top: 0; }
.legal-statement { margin: 0 0 1rem; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--control-radius); color: var(--ink); }
.legal-statement > :first-child { margin-top: 0; }
.legal-statement > :last-child { margin-bottom: 0; }
.signing-subjects { list-style: none; margin: 0; padding: 0; }
.signing-subjects > li { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.signing-subjects > li:last-child { border-bottom: 0; padding-bottom: 0; }
.signing-subjects dl { margin-bottom: 0; }
.sig { display: flex; gap: .8rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.sig:first-child { padding-top: 0; }
.sig:last-child { border-bottom: 0; padding-bottom: 0; }
.sig-icon { display: grid; place-items: center; flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ok-surface); color: var(--ok); }
.sig-icon.muted { background: var(--neutral-surface); color: var(--ink-soft); }
.sig-body { font-size: var(--text-ui); min-width: 0; }
.sig-body strong { font-weight: 650; }
.sig-meaning { display: block; }
.sig-time { display: block; font-size: var(--text-meta); color: var(--ink-soft); }
.signature-block ul { list-style: none; margin: 0; padding: 0; }
.signature-block li + li { margin-top: .5rem; border-top: 1px solid var(--line); padding-top: .5rem; }
/* Timeline: the neutral line connects time-ordered events; it is functional, not a container accent. The node is a
   small dot, or a .tl-node (icon, optionally .ok or .info) that covers it. */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; min-height: 1.75rem; padding: 0 0 1.15rem 2.6rem; margin: 0; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before { content: ""; position: absolute; left: calc(.875rem - .275rem); top: .6rem; width: .55rem; height: .55rem; border-radius: 50%; background: var(--ink-soft); }
.timeline > li::after { content: ""; position: absolute; top: 1.95rem; bottom: .2rem; left: calc(.875rem - .5px); width: 1px; background: var(--line); }
.timeline > li:last-child::after { display: none; }
.timeline time { color: var(--ink-soft); font-size: var(--text-body-sm); display: block; }
.timeline .tl-meta time { display: inline; font-size: inherit; }
.tl-from { color: var(--ink-soft); }
.tl-from.struck { text-decoration: line-through; }
.tl-node { position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink-soft); z-index: 1; }
.tl-node .icon { width: .85rem; height: .85rem; }
.tl-node.ok { background: var(--ok-surface); border-color: var(--ok-line); color: var(--ok); }
.tl-node.info { background: var(--info-surface); border-color: var(--info-line); color: var(--info); }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; padding-top: .2rem; font-size: var(--text-ui); }
.tl-head strong { font-weight: 600; }
.tl-kind { font-size: var(--text-meta); font-weight: 600; color: var(--ink-soft); }
.tl-meta { display: block; font-size: var(--text-meta); color: var(--ink-soft); }
.tl-note { margin-top: .45rem; padding: .55rem .75rem; border-radius: var(--control-radius); background: var(--surface); font-size: var(--text-meta); }
.tl-lines { margin: .45rem 0 0; padding-left: 1.1rem; font-size: var(--text-meta); }
.tl-lines li + li { margin-top: .2rem; }
.transition { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.audit-panel { padding: 1.5rem; margin: 1.5rem 0; min-width: 0; }
/* Alone at the top of a side column it lines up with the card beside it. */
.layout-2 > aside > .audit-panel:first-child { margin-top: 0; }
@media (max-width: 800px) { .audit-panel { padding: 1.1rem; } }
.audit-panel > h2:first-child, .audit-panel > .section-heading:first-child { margin-top: 0; }
/* Audit entries: who, when, what changed (old to new) and the reason. */
.audit, .audit-panel-list { list-style: none; margin: 0; padding: 0; }
.audit > li, .audit-panel-list > li { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.audit > li:first-child, .audit-panel-list > li:first-child { padding-top: 0; }
.audit > li:last-child, .audit-panel-list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.audit-panel-list time { display: block; color: var(--ink-soft); font-size: var(--text-meta); }
.audit-panel-list p { margin: .25rem 0 0; font-size: var(--text-ui); }
.audit-panel-list .audit-label { color: var(--ink-soft); }
.c-add { color: var(--ok); font-weight: 600; text-decoration: none; }
.c-remove { color: var(--bad); text-decoration: line-through; }
.audit-panel > :last-child { margin-bottom: 0; }
/* Full audit trail: the label of a field; its column name appears on hover and keyboard focus (FORM-04). */
.diff-block { padding: 1.25rem; margin: 1rem 0; }
.diff-block h2 { margin-top: 0; }
.diff-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.diff-columns > div { padding: 1rem; border-radius: var(--control-radius); background: var(--surface); min-width: 0; overflow-wrap: anywhere; }
ins { background: var(--ok-surface); color: var(--ok); text-decoration: underline; }
del { background: var(--bad-surface); color: var(--bad); text-decoration: line-through; }
/* Dialogs, errors and authentication */
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; max-width: 34rem; width: calc(100% - 2rem); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: var(--scrim); }
dialog form { margin: 0; }
dialog .dialog-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }
dialog .dialog-actions > * { margin-left: 0; }
dialog > p:first-of-type { margin-top: 0; }
.error-page { max-width: 38rem; margin: 3rem auto; }
.error-page .reference { color: var(--ink-soft); font-size: var(--text-body-sm); }
.without-nav main { max-width: 64rem; }
/* Edit components (forms design, DESIGN section 4). Markup comes from ui.html and ris.js; the definitions
   live here once. Shadows: --shadow-xs on cards and controls, --shadow-md on menus and toasts,
   --shadow-lg on side panels and dialogs. Motion: 120-320 ms ease-out, none under prefers-reduced-motion. */
/* Side panel (sheet): a right-hand dialog; a full-screen sheet on phones. .is-open is set by script after showModal(). */
.sheet { position: fixed; inset: 0 0 0 auto; width: min(44rem, 100vw); max-width: 100vw; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: var(--paper); box-shadow: var(--shadow-lg); transform: translateX(104%); transition: transform var(--dur-panel) var(--ease-out); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; }
.sheet.is-open { transform: none; }
.sheet-sm { width: min(30rem, 100vw); }
.sheet-left { inset: 0 auto 0 0; width: min(18rem, 86vw); border-left: 0; border-right: 1px solid var(--line); transform: translateX(-104%); }
.sheet::backdrop { background: var(--scrim-clear); transition: background-color var(--dur-panel) var(--ease-out); }
.sheet.is-open::backdrop { background: var(--scrim); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.5rem 1rem; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 1.12rem; font-weight: 650; }
.sheet-sub { margin: .2rem 0 0; font-size: var(--text-meta); color: var(--ink-soft); }
.sheet-body { flex: 1; overflow-y: auto; padding: 1.4rem 1.5rem 2rem; overscroll-behavior: contain; }
.sheet-foot { display: flex; align-items: center; gap: .5rem; padding: .85rem 1.5rem; border-top: 1px solid var(--line); background: var(--paper); }
.sheet-foot .foot-note { margin-right: auto; font-size: var(--text-meta); color: var(--ink-soft); }
.sheet-foot .spacer { margin-right: auto; }
/* The static side panel of base.html: close button and error region above the body that the page fills. */
.sheet-close { position: absolute; top: .8rem; right: 1rem; z-index: 2; }
.sheet-close .icon { width: 1.2rem; height: 1.2rem; }
@media (min-width: 801px) { button.sheet-close.icon-only.small { width: 2.25rem; height: 2.25rem; } }
.head-title { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .35rem; }
/* A panel of one or two fields is 30 rem wide, a date field never stretches across it; the reason step covers the foot. */
@media (min-width: 801px) { .sheet:has(.panel-narrow) { width: min(30rem, 100vw); } }
.sheet:has(dialog[data-reason-dialog][open]) .sheet-foot { visibility: hidden; }
.sheet-body > .kv-rows { margin-bottom: 1.15rem; }
.field input[type="date"], .field .input-wrap:has(> input[type="date"]) { max-width: 14rem; }
.field .chip-input, .field .input-group { max-width: 36rem; } /* one field width */
.sheet .order-list .setting-control { display: flex; align-items: center; gap: .75rem; flex-wrap: nowrap; }
#side-panel .sheet-head { padding-right: 4rem; }
.panel-errors { margin: 0; padding: .6rem 4rem 0 1.5rem; } /* clear of the absolute close button */
.panel-errors:empty { display: none; }
.panel-errors .message { margin: 0; }
#side-panel-body, .panel-content { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sheet-left .sheet-body .site-nav { padding: 0; max-height: none; overflow: visible; border-top: 0; }
.side-panel-page { margin: 0 0 1.5rem; }
/* Modal (reason step and other dialogs of the new kit) */
.modal { width: min(32rem, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); margin: auto; padding: 0; border: 0; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(10px) scale(.98); transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); }
.modal[open] { display: flex; flex-direction: column; }
.modal.is-open { opacity: 1; transform: none; }
.modal::backdrop { background: var(--scrim-clear); transition: background-color var(--dur) var(--ease-out); }
.modal.is-open::backdrop { background: var(--scrim); }
.modal-head { display: flex; align-items: flex-start; gap: .85rem; padding: 1.3rem 1.5rem .2rem; }
.modal-icon { display: grid; place-items: center; flex: 0 0 auto; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--selected); color: var(--selected-ink); }
.modal-icon.danger { background: var(--bad-surface); color: var(--bad); }
.modal-head h2 { margin: .1rem 0 0; font-size: 1.05rem; font-weight: 650; }
.modal-head p { margin: .25rem 0 0; font-size: var(--text-ui); color: var(--ink-soft); }
.modal-body { padding: 1rem 1.5rem 1.25rem; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .85rem 1.5rem; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 12px 12px; }
/* The changes about to be recorded, listed in the reason step. */
.changes { margin: 0 0 1rem; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); }
.changes li { display: grid; grid-template-columns: minmax(7rem, 9rem) minmax(0, 1fr); gap: .75rem; padding: .55rem .8rem; border-bottom: 1px solid var(--line); font-size: var(--text-ui); }
.changes li:last-child { border-bottom: 0; }
.changes .c-field { color: var(--ink-soft); }
.changes .c-values { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .4rem; min-width: 0; overflow-wrap: anywhere; }
.changes del { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--strike-line); background: none; }
.changes ins { color: var(--ink); font-weight: 600; text-decoration: none; background: none; }
.changes .icon { color: var(--ink-soft); }
.changes-title { margin: 0 0 .45rem; font-size: var(--text-ui); font-weight: 600; color: var(--ink); }
/* Toast: the flash messages of a saved change. */
.toast-region { position: fixed; z-index: 80; right: 1.5rem; bottom: 1.5rem; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
body:has(.actionbar:not(.is-clean)) .toast-region { bottom: 5.25rem; }
.toast { display: flex; align-items: flex-start; gap: .7rem; width: min(25rem, calc(100vw - 2rem)); padding: .85rem .9rem .85rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: var(--shadow-md); pointer-events: auto; animation: toast-in 320ms var(--ease-out); }
.toast.is-leaving { animation: toast-out 200ms ease-in forwards; }
.toast-icon { display: grid; place-items: center; flex: 0 0 auto; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--ok-surface); color: var(--ok); }
.toast-icon.info { background: var(--info-surface); color: var(--info); }
.toast-icon.warning { background: var(--warn-surface); color: var(--warn); }
.toast-icon.error { background: var(--bad-surface); color: var(--bad); }
.toast .message { font-size: var(--text-ui); color: var(--ink-soft); margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; overflow-wrap: anywhere; }
.toast .message .message-level { font-size: var(--text-ui); display: block; margin: 0; font-weight: 650; color: var(--ink); }
.toast .message-success .message-level { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.toast .message-success { color: var(--ink); font-weight: 600; }
.toast > button { flex: 0 0 auto; margin: -.25rem -.3rem 0 0; }
.toast-icon .icon { width: .85rem; height: .85rem; stroke-width: 2.5; }
.toast-body { flex: 1; min-width: 0; font-size: var(--text-ui); }
.toast-body strong { display: block; font-weight: 650; }
.toast-body span { display: block; color: var(--ink-soft); font-size: var(--text-meta); margin-top: .1rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
/* Notices */
.notice { display: flex; align-items: flex-start; gap: .7rem; padding: .8rem 1rem; margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font-size: var(--text-ui); }
.notice > .icon { margin-top: .15rem; color: var(--info); }
.notice-info { background: var(--info-surface); border-color: var(--info-line); }
.notice-warn { background: var(--warn-surface); border-color: var(--warn-line); }
.notice-warn > .icon { color: var(--warn); }
.notice-ok { background: var(--ok-surface); border-color: var(--ok-line); }
.notice-ok > .icon { color: var(--ok); }
.notice > div:not(.notice-actions) { flex: 1 1 0; min-width: 0; }
.notice p { margin: .1rem 0 0; }
.notice .notice-actions { margin-left: auto; flex: 0 0 auto; }
/* Chip input (multi, single searchable select, free text): a WAI-ARIA combobox; one hidden input per chip. */
.chip-input { position: relative; }
.chip-box { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-height: 2.5rem; padding: .3rem .35rem .3rem .4rem; border: 1px solid var(--control-line); border-radius: var(--control-radius); background: var(--paper); box-shadow: var(--shadow-xs); cursor: text; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.chip-box:hover { border-color: var(--control-hover-line); }
.chip-input[data-invalid] .chip-box { border-color: var(--bad); }
.chip-input.is-disabled .chip-box { background: var(--surface); box-shadow: none; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; height: 1.7rem; padding: 0 .2rem 0 .55rem; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--neutral-surface); color: var(--ink); font-size: var(--text-ui); font-weight: 500; white-space: nowrap; }
.chip.static { padding-right: .55rem; }
.chip .code { color: var(--ink-soft); font-family: var(--mono); font-size: var(--text-meta); font-weight: 600; }
.chip-remove, button.chip-remove { display: grid; place-items: center; width: 1.625rem; height: 1.625rem; min-height: 0; padding: 0; border: 0; border-radius: var(--small-radius); background: none; box-shadow: none; color: var(--ink-soft); cursor: pointer; }
.chip-remove:hover, button.chip-remove:hover { background: var(--chip-hover); color: var(--ink); border: 0; }
.chip-remove .icon { width: .75rem; height: .75rem; stroke-width: 2.25; }
.chip-text { flex: 1 1 6rem; min-width: 6rem; height: 1.75rem; min-height: 0; padding: 0 .35rem; border: 0; outline: 2px solid transparent; background: transparent; box-shadow: none; color: var(--ink); font: inherit; font-size: var(--text-ui); }
.chip-text:focus { border: 0; box-shadow: none; outline: 2px solid transparent; }
.chip-input .chip-text, .chip-input .chip-text[aria-invalid="true"], .field.field-error .chip-input .chip-text, .field.field-error .chip-input .chip-text:focus, .chip-input .chip-text[aria-invalid="true"]:focus { border: 0; box-shadow: none; }
.chip-remove { margin-left: .15rem; }
.field-label-row { display: flex; align-items: center; gap: .25rem; margin-bottom: .25rem; }
.field-label-row > label { margin-bottom: 0; }
.listbox { position: absolute; z-index: 25; top: calc(100% + 4px); left: 0; right: 0; max-height: 15rem; overflow-y: auto; margin: 0; padding: .3rem; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); animation: pop var(--dur-fast) var(--ease-out); }
.option { display: flex; align-items: center; gap: .55rem; padding: .45rem .55rem; border-radius: var(--control-radius); font-size: var(--text-ui); cursor: pointer; }
.option .code { margin-left: auto; color: var(--ink-soft); font-family: var(--mono); font-size: var(--text-meta); }
.option .tick { width: .9rem; color: var(--accent); }
.option[hidden], .option-empty[hidden] { display: none; }
.option:not([aria-selected="true"]) .tick > * { visibility: hidden; }
.option .tick > * { width: .9rem; height: .9rem; }
.option.is-active, .option:hover { background: var(--hover); }
.option[aria-selected="true"] { font-weight: 650; }
.option-empty { padding: .55rem; font-size: var(--text-ui); color: var(--ink-soft); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
/* Switch: a checkbox with role="switch"; its state is also written as text. */
.switch { appearance: none; position: relative; flex: 0 0 auto; width: 2.3rem; height: 1.35rem; margin: 0; padding: 0; border: 0; border-radius: 999px; background: var(--control-strong); cursor: pointer; transition: background-color var(--dur) var(--ease-out); }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: calc(1.35rem - 6px); height: calc(1.35rem - 6px); border-radius: 50%; background: var(--paper); box-shadow: 0 1px 2px var(--knob-shadow); transition: transform var(--dur) var(--ease-out); }
.switch:hover { background: var(--switch-hover); }
.switch:checked { background: var(--accent); }
.switch:checked:hover { background: var(--accent-hover); }
.switch:checked::before { transform: translateX(.95rem); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch-control { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; }
.switch-state { min-width: 1.6rem; white-space: nowrap; font-size: var(--text-ui); font-weight: 600; color: var(--ink-soft); }
.switch:checked + .switch-state { color: var(--selected-ink); }
/* Segmented control: 2-4 short options, radios in one fieldset. */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--neutral-surface); }
.segmented > legend { padding: 0; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; border: 0; pointer-events: none; }
.segmented label { display: inline-flex; align-items: center; gap: .35rem; min-height: 1.85rem; padding: 0 .8rem; border-radius: var(--control-radius); color: var(--ink); font-size: var(--text-ui); font-weight: 550; cursor: pointer; transition: background-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast); }
.segmented label:hover { background: var(--line); }
.segmented input:checked + label { background: var(--paper); color: var(--ink); font-weight: 650; box-shadow: var(--shadow-xs); }
.segmented input:focus-visible + label { outline: 3px solid var(--focus-ring); outline-offset: 1px; box-shadow: 0 0 0 2px var(--paper); }
.segmented input:disabled + label { color: var(--ink-disabled-soft); cursor: not-allowed; }
/* Checkable cards (contacts, trials, documents, owner, retrieval method): the label wraps its input. */
.check-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.check-cards.one-col { grid-template-columns: minmax(0, 1fr); }
.check-card { display: flex; align-items: flex-start; gap: .7rem; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); cursor: pointer; transition: border-color var(--dur-fast), background-color var(--dur-fast); }
.check-card:hover { border-color: var(--control-hover-line); background: var(--hover); }
.check-card:has(input:checked) { background: var(--selected); border-color: var(--selected-line); }
.check-card:has(input:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 2px; box-shadow: 0 0 0 2px var(--paper); }
.check-card input:focus-visible { outline: 2px solid transparent; box-shadow: none; }
.check-card:has(input:disabled) { background: var(--surface); cursor: not-allowed; color: var(--ink-soft); }
.cc-main { min-width: 0; flex: 1; }
.cc-title { display: block; font-size: var(--text-ui); font-weight: 600; overflow-wrap: anywhere; }
.cc-sub { display: block; font-size: var(--text-meta); color: var(--ink-soft); overflow-wrap: anywhere; }
.check-card input:checked ~ .cc-main .cc-title { color: var(--selected-ink); }
/* List editor (URLs and other repeated values): rows cloned from a template. */
.list-editor { display: grid; gap: .45rem; }
.list-row { display: flex; align-items: center; gap: .4rem; }
.list-row .input-wrap, .list-row .input { flex: 1; min-width: 0; }
.row-index { flex: 0 0 1.3rem; color: var(--ink-soft); font-size: var(--text-meta); text-align: right; font-variant-numeric: tabular-nums; }
.list-editor .btn-add { justify-self: start; margin-left: 1.7rem; }
/* Configuration editors: records of a list (a rule, a document type), a condition, the read view of a content */
.records { display: grid; gap: .75rem; min-width: 0; }
.records-head h3, .view-block h3, .view-heading { margin: 0 0 .35rem; font-size: var(--text-ui); font-weight: 650; }
.records .btn-add { justify-self: start; }
.records-head .help { margin: 0 0 .25rem; font-size: var(--text-meta); color: var(--ink-soft); }
.records-head:empty { display: none; }
.record { min-width: 0; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.record-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.record-head h3 { margin: 0; font-size: var(--text-ui); font-weight: 650; }
.record-name { margin-left: .6rem; color: var(--ink-soft); font-weight: 500; }
.record-row { display: flex; align-items: flex-start; gap: .5rem; padding: .6rem .75rem; }
.record-row .form-grid { flex: 1; min-width: 0; }
.record-row > button { margin-top: 1.6rem; }
.record-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.record-group > legend { padding: 0; font-size: var(--text-ui); font-weight: 600; }
.condition { min-width: 0; margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius); }
.condition > legend { padding: 0 .35rem; font-size: var(--text-ui); font-weight: 600; }
.condition-group .records { margin-top: .5rem; }
.view-block { margin: 1.25rem 0 0; }
.view-heading { margin-top: 1.25rem; }
.view-block .count { color: var(--ink-soft); font-weight: 450; }
.field-label { display: block; margin-bottom: .25rem; font-size: var(--text-ui); font-weight: 600; }

/* Disclosure: a collapsible group with a reveal. */
.disclosure { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.disclosure > summary { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; font-size: var(--text-ui); font-weight: 600; cursor: pointer; list-style: none; border-radius: var(--radius); transition: background-color var(--dur-fast); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { background: var(--hover); }
.disclosure > summary .chev { transition: transform var(--dur) var(--ease-out); color: var(--ink-soft); }
.disclosure[open] > summary .chev { transform: rotate(90deg); }
.disclosure[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.disclosure > summary .muted { margin-left: auto; font-weight: 450; font-size: var(--text-meta); }
.disclosure-body { padding: 1rem .9rem; animation: reveal var(--dur) var(--ease-out); }
/* Raw system values (ui.technical_details): closed by default, small, in the code face. */
.tech-details { margin-top: .4rem; font-size: var(--text-meta); }
.tech-details > summary { display: inline-block; color: var(--accent); cursor: pointer; font-weight: 600; }
.tech-list { margin: .4rem 0 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .15rem .9rem; padding: .5rem .7rem; border-radius: var(--control-radius); background: var(--surface); }
.tech-list dt { color: var(--ink-soft); }
.tech-list dd { margin: 0; overflow-wrap: anywhere; }
.tech-list code { font-size: var(--text-meta); white-space: pre-wrap; }
/* A citation: whole sentences, with the link to the passage. */
.citation { margin: 0; padding: 0; }
.citation p { margin: 0; }
.citation .citation-link { margin-top: .2rem; font-size: var(--text-meta); }
@keyframes reveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.code-block { position: relative; margin: 0; padding: .9rem 1rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); font-family: var(--mono); font-size: var(--text-meta); line-height: 1.6; color: var(--ink-code); }
/* Settings rows: label and description on the left, the control on the right; a changed row carries a text tag. */
.setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, 20rem); gap: .5rem 2rem; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); transition: background-color var(--dur); }
.setting:last-child { border-bottom: 0; }
.setting.is-changed { background: var(--changed-surface); }
.setting-label { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; font-size: var(--text-ui); font-weight: 600; }
.setting-desc { margin: .15rem 0 0; font-size: var(--text-meta); color: var(--ink-soft); max-width: 36rem; }
.setting-control { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; min-width: 0; }
.setting-control > .segmented { width: 100%; }
.setting-control > .segmented label { flex: 1 1 auto; justify-content: center; padding: 0 .55rem; }
@media (min-width: 601px) {
  .setting-control > .segmented label { white-space: nowrap; }
}
.setting:has(> .setting-control > .segmented) { grid-template-columns: minmax(0, 1fr) minmax(16rem, 27rem); }
.setting-note, .setting-example { margin: 0; align-self: stretch; font-size: var(--text-meta); color: var(--ink-soft); }
.setting-note { color: var(--ink); }
.setting-control > .input, .setting-control > .input-group, .setting-control > .chip-input, .setting-control > .input-wrap { width: 100%; }
.setting-control .w-num { max-width: none; }
[data-dirty-row] .tag-changed { display: none; }
[data-dirty-row].is-changed .tag-changed { display: inline-flex; }
/* Stacked rows (ui.table; ris.js marks every list table): on narrow screens each row is a block. The cell with the row's
   first link is the title and its link covers the whole row (a 44 px target); other cells carry their column head. */
@media (max-width: 800px) {
  table.stacked thead { display: none; }
  table.stacked, table.stacked tbody, table.stacked td, table.stacked th { display: block; width: auto; min-width: 0; }
  table.stacked tbody tr { display: flex; flex-direction: column; gap: .6rem; position: relative; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
  table.stacked tbody tr:last-child { border-bottom: 0; }
  table.stacked th, table.stacked td { padding: 0; border: 0; white-space: normal; }
  table.stacked td[data-label]::before { content: attr(data-label); display: block; margin-bottom: .2rem; font-size: var(--text-meta); font-weight: 600; color: var(--ink-soft); }
  table.stacked td:empty { display: none; }
  table.stacked .row-title { order: -1; font-size: var(--text-body-sm); font-weight: 650; }
  table.stacked :is(td, th).row-title[data-label]::before { display: none; }
  table.stacked a.row-link::after { content: ""; position: absolute; inset: 0; }
  table.stacked tbody tr :is(a:not(.row-link), button, summary, input, select, label) { position: relative; z-index: 1; }
  table.stacked tbody tr.detail-row { display: block; }
}
/* Signature-policy matrix */
.matrix { width: 100%; border-collapse: collapse; border: 0; font-size: var(--text-ui); }
.matrix th, .matrix td { padding: .8rem 1.25rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.matrix thead th { padding-top: .6rem; padding-bottom: .6rem; background: var(--surface); color: var(--ink-soft); font-size: var(--text-meta); font-weight: 650; }
.matrix tbody tr:last-child > * { border-bottom: 0; }
.matrix tbody tr.is-changed { background: var(--changed-surface); }
.matrix th[scope="row"] { font-weight: 600; width: 32%; }
.matrix .col-req { width: 11rem; }
/* Dropdown menu: a <details> that works without script; script adds Escape, arrows and outside click. */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu { position: absolute; z-index: 26; top: calc(100% + 6px); right: 0; min-width: 16rem; margin: 0; padding: .3rem; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-md); animation: pop var(--dur-fast) var(--ease-out); }
.dropdown-menu.left { right: auto; left: 0; }
.menu-item, button.menu-item { display: flex; align-items: center; justify-content: flex-start; gap: .6rem; width: 100%; min-height: 0; padding: .5rem .6rem; border: 0; border-radius: var(--control-radius); background: none; box-shadow: none; color: var(--ink); font: inherit; font-size: var(--text-ui); font-weight: 400; text-align: left; text-decoration: none; cursor: pointer; }
.menu-item .icon { color: var(--ink-soft); }
.menu-item:hover, button.menu-item:hover { background: var(--hover); color: var(--ink); border: 0; }
.menu-item.danger, .menu-item.danger .icon { color: var(--bad); }
.menu-item.danger:hover, button.menu-item.danger:hover { background: var(--bad-surface); color: var(--bad); }
.menu-item .hint { margin-left: auto; font-size: var(--text-meta); color: var(--ink-soft); }
.menu-sep { height: 1px; margin: .3rem .2rem; background: var(--line); }
.menu-label { padding: .35rem .6rem .2rem; font-size: var(--text-meta); font-weight: 650; color: var(--ink-soft); }
/* Page forms: section nav and sticky action bar. */
.form-layout { display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); gap: 2rem; align-items: start; }
.form-nav { position: sticky; top: calc(var(--header-h) + 1.5rem); }
.form-nav ol, .form-nav ul { margin: 0; padding: 0; list-style: none; }
.form-nav ol[data-nav-plain] .step-mark { display: none; }
.form-nav ol[data-nav-plain] a.has-error .step-mark { display: grid; }
.form-nav a { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; margin-bottom: 2px; border-radius: var(--control-radius); color: var(--ink-soft); font-size: var(--text-ui); text-decoration: none; transition: background-color var(--dur-fast), color var(--dur-fast); }
.form-nav a:hover { background: var(--hover); color: var(--ink); }
.form-nav a[aria-current="true"] { background: var(--selected); color: var(--selected-ink); font-weight: 650; }
.step-mark { display: grid; place-items: center; flex: 0 0 auto; width: 1.3rem; height: 1.3rem; border: 1px solid var(--control-line); border-radius: 50%; background: var(--paper); font-size: var(--text-meta); font-weight: 650; color: var(--ink-soft); }
.step-mark .icon { width: .7rem; height: .7rem; stroke-width: 3; }
.form-nav a.is-complete .step-mark { background: var(--accent); border-color: var(--accent); color: var(--brand-ink); }
.form-nav a.has-error .step-mark { background: var(--bad-surface); border-color: var(--bad-line); color: var(--bad); }
.form-nav .nav-state { margin-left: auto; font-size: var(--text-meta); font-weight: 600; color: var(--bad); }
.form-nav-foot { margin-top: 1rem; padding: .75rem .6rem 0; border-top: 1px solid var(--line); font-size: var(--text-meta); color: var(--ink-soft); }
.form-card { scroll-margin-top: calc(var(--header-h) + 1.25rem); }
.actionbar { position: sticky; bottom: 0; z-index: 20; border-top: 1px solid var(--line); background: var(--paper); }
.actionbar-inner { display: flex; align-items: center; gap: .6rem; max-width: 88rem; margin: 0 auto; padding: .75rem 2.5rem; }
.actionbar-status { display: flex; align-items: center; gap: .5rem; margin-right: auto; font-size: var(--text-ui); color: var(--ink-soft); }
.actionbar-status strong { color: var(--ink); font-weight: 650; }
.js .actionbar.is-clean { display: none; }
.dirty-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--warn); }
/* Version strip of a versioned configuration, and the milestone-style flow steps. */
.version-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; padding: .9rem 1.25rem; margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-xs); font-size: var(--text-ui); }
.version-strip .vs-item { display: flex; flex-direction: column; gap: .1rem; }
.version-strip .vs-label { font-size: var(--text-meta); color: var(--ink-soft); font-weight: 550; }
.version-strip .vs-note { margin: 0 0 0 auto; color: var(--ink-soft); font-size: var(--text-meta); }
.version-strip .vs-flow { margin: 0 0 0 auto; padding: 0; list-style: none; display: flex; align-items: center; gap: .4rem; color: var(--ink-soft); font-size: var(--text-meta); flex-wrap: wrap; }
@media (max-width: 1100px) {
  .header-row { gap: .65rem; padding: .65rem 1rem; }
  .brand { flex-basis: 12rem; margin-right: 0; }
  :root { --nav-w: 14rem; }
  main { padding: 1.6rem; }
  .environment-banner { padding: .65rem 1.6rem; }
  .account-name { display: none; }
  .dashboard-grid, .layout-2, .form-layout { grid-template-columns: minmax(0, 1fr); }
  .form-nav { display: none; }
  .actionbar-inner { padding: .75rem 1.6rem; }
}
@media (max-width: 800px) {
  .site-header { position: relative; }
  .has-nav .app-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .side-column { border-right: 0; }
  .navigation-panel { position: static; max-height: none; overflow: visible; }
  /* One row: menu button, the K tile, the workspace (or "Switch client"), the language switch, the account. */
  .header-row { flex-wrap: wrap; gap: .4rem; padding: .4rem .75rem; min-height: 0; }
  .brand { flex: 0 0 auto; margin-right: 0; min-width: 0; }
  .brand > span:last-child { display: none; }
  .brand-mark { width: 2.25rem; height: 2.25rem; font-size: 1.25rem; }
  .header-row .language-switch { margin-left: 0; }
  .header-row .language-switch button.secondary { min-height: var(--touch); min-width: var(--touch); }
  .workspace-name { order: 0; flex: 1 1 0; margin: 0; }
  .workspace-name .eyebrow { display: none; }
  .workspace-name strong { max-width: none; }
  .header-row:has(.client-menu) .workspace-name { display: none; }
  .client-menu { order: 0; flex: 1 1 0; min-width: 0; }
  .client-menu summary { min-width: 0; }
  .client-menu summary { overflow: hidden; white-space: nowrap; }
  /* With script the navigation lives in a left sheet opened by the header button; without it the list stays below the header. */
  .js .side-column { display: none; }
  .js button.nav-toggle { display: inline-grid; flex: 0 0 auto; }
  .site-nav { max-height: 65vh; overflow-y: auto; padding: .7rem 1rem 1rem; border-top: 1px solid var(--line); }
  .site-nav a { min-height: var(--touch); display: flex; align-items: center; }
  main { padding: 1.4rem 1rem 2rem; }
  /* A banner is one line; its sentence is cut with an ellipsis (the tag and the (i) carry the meaning). */
  .environment-banner { flex-wrap: nowrap; padding: .5rem 1rem; gap: .5rem; }
  .environment-banner a { margin-left: 0; flex: 0 0 auto; }
  .environment-banner .banner-text { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .environment-banner .explain-button { margin: 0 !important; }
  .environment-links { margin-left: 0; flex: 0 0 auto; }
  .environment-links a { display: inline-flex; align-items: center; min-height: var(--touch); }
  .page-heading { display: block; }
  .page-actions { margin-top: 1rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-panel { padding: 1.1rem; }
  dl.pairs { grid-template-columns: minmax(0, 1fr); gap: .25rem; }
  dl.pairs > dd { margin-bottom: .8rem; }
  .record-meta, .badge-group { gap: .6rem .8rem; }
  .person-row form, .person-row button { width: 100%; }
  .person-row button { min-height: var(--touch); }
  .account-menu { order: 2; }
  .metric-card { padding: .9rem; }
  .metric-value { font-size: 1.9rem; }
  a.metric-value { display: flex; align-items: center; min-height: var(--touch); }
  .metric-label { font-size: var(--text-meta); }
  .site-footer { padding: 1rem; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
  .site-footer a { display: inline-flex; align-items: center; min-height: var(--touch); padding-inline: .5rem; margin-inline: -.5rem; }
  .site-footer a { min-width: var(--touch); justify-content: center; }
  .site-footer button.link-button { min-height: var(--touch); padding-inline: .5rem; margin-inline: -.5rem; }
  /* Links that stand alone: figures in table cells and the action link of a card head. */
  td a[data-figure-value], th a[data-figure-value], td > a:only-child:not(.row-link), .card-action a:not(.button), .section-heading a:not(.button) { display: inline-flex; align-items: center; min-width: var(--touch); min-height: var(--touch); }
  td.num a[data-figure-value] { justify-content: flex-end; }
  /* Padding, not a flex box: a flex box would drop the space between the number and its words. */
  .foot-links a { display: inline-block; min-width: var(--touch); min-height: var(--touch); box-sizing: border-box; padding-block: .7rem; }
  .request-reference { margin-left: 0; width: 100%; }
  .diff-columns { grid-template-columns: minmax(0, 1fr); }
  /* Touch targets: 44 px for buttons, text controls, summaries and switches; checkbox and radio rows are 44 px high. */
  h1 { font-size: 1.4rem; }
  button, .button, button.small, .button.small, .password-control .password-toggle, table th button.sort { min-height: var(--touch); }
  button.link-button, .button.link-button { min-height: 0; }
  button.icon-only, .button.icon-only, button.icon-only.small, .button.icon-only.small { width: var(--touch); }
  .inline-filter select, .training-switch select { min-height: var(--touch); }
  .export-buttons summary.button, .page-actions .export-buttons summary.button { min-height: var(--touch); }
  :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea), .input, .chip-box, .table-filters .field input:not([type="checkbox"]):not([type="radio"]), .table-filters .field select, .table-filters .filter-action button { min-height: var(--touch); font-size: 1rem; }
  .input-group .input, .input-group .input:focus { min-height: calc(var(--touch) - 2px); }
  .chip-text { font-size: 1rem; height: var(--touch); }
  /* A chip that can be removed is a 44 px row on a phone, its remove button 44 px square (engineer decision 5). */
  .chip-box .chip { height: calc(var(--touch) + 2px); }
  .chip-box .chip-remove, .chip-box button.chip-remove { width: var(--touch); height: var(--touch); }
  main summary, .menu summary { min-height: var(--touch); padding-block: .85rem; }
  .nav-group-label { min-height: var(--touch); }
  .page-links a { display: inline-flex; align-items: center; min-height: var(--touch); }
  .menu summary { padding-block: .4rem; display: flex; align-items: center; }
  :where(main label:has(> input[type="checkbox"]), main label:has(> input[type="radio"])) { min-height: var(--touch); align-items: center; }
  .switch-control, .menu-item, button.menu-item, .segmented label { min-height: var(--touch); }
  .sheet, .sheet-sm { width: 100vw; border-left: 0; transform: translateY(100%); }
  .sheet.is-open { transform: none; }
  .sheet-left { width: min(18rem, 86vw); transform: translateX(-104%); }
  .sheet-head { padding: .9rem 1rem .8rem; }
  .sheet-body { padding: 1.1rem 1rem 1.5rem; }
  .sheet-foot { padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom)); }
  .sheet-foot .foot-note { display: none; }
  .sheet-foot button, .sheet-foot .button, .modal-foot button, .modal-foot .button, .actionbar-inner button, .actionbar-inner .button { flex: 1; }
  .modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; transform: translateY(100%); max-height: 92vh; }
  .modal.is-open { transform: none; }
  .modal-foot { border-radius: 0; padding-bottom: calc(.85rem + env(safe-area-inset-bottom)); }
  .modal-head { padding: 1.1rem 1rem .2rem; }
  .modal-body { padding: .9rem 1rem 1rem; }
  .changes li { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .toast-region { left: 1rem; right: 1rem; bottom: 1rem; }
  body:has(.actionbar:not(.is-clean)) .toast-region { bottom: 8.5rem; }
  .toast { width: 100%; }
  .card-head { flex-wrap: wrap; padding: .65rem 1rem; }
  .card-head .card-action { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; }
  .period-form { display: grid; grid-template-columns: auto 1fr; width: 100%; }
  .period-form input[type="date"] { min-width: 0; width: 100%; }
  .period-form button { grid-column: 1 / -1; justify-self: start; }
  .card-body { padding: 1rem; }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
  .kv .span-2 { grid-column: 1 / -1; }
  /* Standalone links (back link, pager, audit trail link, status counts) get a full target. The pipeline's own rules are in m8_reporting.css. */
  .back-link a, .pager a, .panel-link a, .sum-item, .page-actions > a:not(.button) { display: inline-flex; align-items: center; min-height: var(--touch); }
  a.sum-item, .pager a { min-width: var(--touch); justify-content: center; }
  .auth-footer a, .slot-line a, .kv dd > a:only-child { display: inline-flex; align-items: center; min-height: var(--touch); }
  .brand { min-width: var(--touch); min-height: var(--touch); justify-content: center; }
  .status-summary { display: inline-flex; flex-wrap: wrap; column-gap: .5rem; }
  .contents-list { columns: 1; }
  .contents-list a { min-height: var(--touch); display: inline-flex; align-items: center; }
  .rows a { display: inline-flex; align-items: center; min-height: var(--touch); }
  .record-list a.record-title { min-height: var(--touch); padding-block: .7rem; }
  .record-list a.record-title .ai-label { white-space: nowrap; }
  .tab-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; margin-inline: -.25rem; }
  .tab-nav a { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: var(--touch); white-space: nowrap; }
  .filters-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; margin: 0 0 .75rem; }
  .filters-toggle::after { content: ""; width: .5rem; height: .5rem; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); margin-top: -.25rem; }
  .filters-toggle[aria-expanded="true"]::after { transform: rotate(225deg); margin-top: .25rem; }
  .js .table-filters[data-collapsed] { display: none; }
  .page-actions:empty { display: none; }
  .milestones { grid-template-columns: minmax(0, 1fr); }
  .milestones li { padding: 0 0 .8rem 1.75rem; }
  .milestones li::before { top: 1.1rem; bottom: -.1rem; left: calc(.5rem - 1px); right: auto; width: 2px; height: auto; }
  .milestones li:last-child::before { display: none; }
  .milestones .node { top: .1rem; }
  .milestones .m-label, .milestones .m-date { display: inline; }
  .milestones .m-date { float: right; margin: 0; }
  .setting { grid-template-columns: minmax(0, 1fr); padding: .9rem 1rem; }
  .setting-control { justify-content: flex-start; align-items: flex-start; }
  .setting:has(> .setting-control > .segmented) { grid-template-columns: minmax(0, 1fr); }
  .matrix thead { display: none; }
  .matrix, .matrix tbody, .matrix tr, .matrix td, .matrix th { display: block; width: auto; }
  .matrix tbody tr { padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
  .matrix tbody tr:last-child { border-bottom: 0; }
  .matrix th, .matrix td { padding: 0; border: 0; }
  .matrix th[scope="row"] { width: auto; margin-bottom: .55rem; }
  .matrix td + td { margin-top: .6rem; }
  .matrix .col-req { width: auto; }
  .matrix td[data-label]::before { content: attr(data-label); display: block; margin-bottom: .3rem; font-size: var(--text-meta); font-weight: 600; color: var(--ink-soft); }
  .actionbar-inner { padding: .65rem 1rem calc(.65rem + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .actionbar-status { width: 100%; }
  .notice { flex-wrap: wrap; }
  .notice .notice-actions { flex-basis: 100%; margin-left: 1.7rem; }
  .list-editor .btn-add { margin-left: 0; }
  .row-index { display: none; }
}
/* Input components (FORM-32): the pieces that the .field rules above would otherwise bend. */
.field .segmented label { margin: 0; }
.field .check-card { display: flex; margin: 0; font-size: inherit; font-weight: inherit; }
.field-switch .switch-control { margin-top: .15rem; }
.field > .segmented, fieldset.field > .segmented { align-self: flex-start; }
fieldset.field > .check-cards, fieldset.field > .list-editor, fieldset.field > .segmented { margin-top: .1rem; }
.list-row .row-index { user-select: none; }
.step-mark .sm-done, .step-mark .sm-err { display: none; }
.form-nav a.is-complete .step-mark .sm-num, .form-nav a.has-error .step-mark .sm-num { display: none; }
.form-nav a.is-complete .step-mark .sm-done { display: grid; }
.form-nav a.has-error .step-mark .sm-err { display: inline; }
.form-nav a.has-error.is-complete .step-mark .sm-done { display: none; }
.copy-status { margin-left: .5rem; font-size: var(--text-meta); font-weight: 600; color: var(--selected-ink); }
.copy-status:empty { display: none; }
@media (max-width: 639px) {
  .switch::after { content: ""; position: absolute; inset: -.75rem -.4rem; }
}
@media (max-width: 800px) {
  .setting.setting-inline { grid-template-columns: minmax(0, 1fr) auto; }
  .setting-inline .setting-control { justify-content: flex-end; align-items: flex-end; }
}
/* Reduced motion switches every transition and animation off (sheet, dialog, disclosure, toast, save highlight). */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
/* Record header meta line and list rows of a section card (FORM-08): a status, a few facts, then rows with a title,
   a sub line and an action at the end (IMPs, delegated tasks). */
.head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin-top: .75rem; font-size: var(--text-ui); color: var(--ink-soft); }
.head-meta .meta-item { display: inline-flex; align-items: center; gap: .4rem; }
.head-meta strong { color: var(--ink); font-weight: 600; }
.rows { margin: 0; padding: 0; list-style: none; }
.rows > li { display: flex; align-items: center; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.rows > li:first-child { padding-top: 0; }
.rows > li:last-child { border-bottom: 0; padding-bottom: 0; }
.rows .row-main { flex: 1; min-width: 0; }
.rows .row-title { display: block; font-size: var(--text-ui); font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.rows a.row-title:hover { color: var(--accent); text-decoration: underline; }
.rows .row-sub { display: flex; flex-wrap: wrap; gap: .35rem .75rem; margin-top: .3rem; font-size: var(--text-meta); color: var(--ink-soft); align-items: center; }
.card-note { margin: 0 0 1rem; font-size: var(--text-ui); color: var(--ink-soft); }
.meta-line { margin: .1rem 0 .85rem; font-size: var(--text-meta); color: var(--ink-soft); }
.action-group-danger { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
@media print {
  .site-header, .side-column, .environment-banner, .site-footer, .page-actions, .actionbar, .toast-region { display: none; }
  .has-nav .app-grid { display: block; }
  main { max-width: none; padding: 0; }
  .card, .metric-card { break-inside: avoid; }
}


/* The home page's list of work: one linked count per kind of work that waits for a decision. */
.work-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: .75rem; margin: 0; padding: 0; list-style: none; }
.work-row > a { display: flex; align-items: baseline; gap: .75rem; height: 100%; min-height: var(--touch); padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: background-color var(--dur-fast), border-color var(--dur-fast); }
.work-row > a:hover { background: var(--hover); border-color: var(--control-hover-line); }
.work-row.is-attention > a { border-left: 4px solid var(--warn); }
.work-count { font-size: 1.75rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
