/* Athena · a calm workspace
   Warm off-white sidebar beside a white page; the document table is the hero. One blue accent
   for links, actions, focus and selection. Soft tags only on restricted files. System UI sans.
   Direction contract: .impeccable/surfaces/. DESIGN.md records the system. */

:root {
  /* Surfaces */
  --page: #ffffff;
  --side: #f7f7f5;
  --hover: #efefed;
  --active: #e8e8e5;
  --well: #fbfbfa;
  --canvas: #f1f1ef;

  /* Page thumbnails (the drawn stand-in pages): one step darker than the lines so they read on white */
  --thumb-edge: #c3c2be;
  --thumb-ink: #97968f;
  --thumb-soft: #d3d2ce;

  /* Ink (warm near-black and two warm greys) */
  --ink: #37352f;
  --ink-2: #5f5e5b;
  --ink-3: #6f6e69;
  --ink-4: #a3a29e;

  /* Lines */
  --line: #e9e9e7;
  --line-2: #dcdcd9;

  /* Colour roles */
  /* Athena's colours, from the mark. Blue acts (links, buttons, focus, selection); navy is who and where (the tenant,
     page icons, counts waiting, the current step); sky is what was found (search and find highlights, a lit branch);
     red is the error and irreversible roles. Sky is a fill only: it's too light for text or thin lines. */
  --accent: #006fba;
  --accent-deep: #00578f;
  --accent-wash: #e5f4fb;
  --accent-ring: rgb(0 111 186 / 0.28);
  --navy: #0e0f57;
  --sky: #5bcbf5;
  --sky-wash: #d6f1fc;

  /* Error and audited actions */
  --red: #b7121a;
  --red-deep: #8f0e14;
  --red-wash: #fdebeb;
  --red-line: #f2c4c6;
  --red-ring: rgb(183 18 26 / 0.2);

  /* Tags: each restricted class takes one of these soft colours (General has none); red is legal hold's alone */
  --tag-pink: #f5e0e9;    --tag-pink-ink: #4c2337;
  --tag-green: #dbeddb;   --tag-green-ink: #1c3829;
  --tag-blue: #d3e5ef;    --tag-blue-ink: #183347;
  --tag-purple: #e8deee;  --tag-purple-ink: #412454;
  --tag-orange: #fadec9;  --tag-orange-ink: #49290e;
  --tag-yellow: #fdecc8;  --tag-yellow-ink: #402c1b;
  --tag-brown: #eee0da;   --tag-brown-ink: #442a1e;
  --tag-hold: #ffe2dd;    --tag-hold-ink: #5d1715;

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Helvetica, Arial, sans-serif;

  --r: 6px;
  --r-tag: 4px;
  --r-pop: 8px;
  --r-pill: 999px;
  --pop-shadow: 0 0 0 1px rgb(15 15 15 / 0.05), 0 3px 6px rgb(15 15 15 / 0.08), 0 9px 24px rgb(15 15 15 / 0.14);
  --side-w: 248px;
  --top-h: 44px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
  accent-color: var(--accent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-ring); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 0.18em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; color: var(--ink); }
p { margin: 0; text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon--doc, .icon--folder { color: var(--ink-3); }

* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 60;
  background: var(--page); color: var(--ink); padding: 8px 12px; border-radius: var(--r);
}
.skip-link:focus { top: 8px; box-shadow: var(--pop-shadow); }

/* ───────────── The app: sidebar + page ───────────── */

.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.scrim { display: none; }

/* --uifirst-bar: the height of the prototype's design toolbar when it's shown (0 in the product), so the sidebar's foot
   is never hidden under it. */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: calc(100dvh - var(--uifirst-bar, 0px));
  display: flex; flex-direction: column;
  background: var(--side);
  border-right: 1px solid var(--line);
  color: var(--ink-2);
}
.sb-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 16px; }
.sb-top { padding: 8px 8px 4px; }

/* Tenant switcher (the workspace switcher) */
.switcher { position: relative; }
.switcher > summary, .tenant-plain {
  display: flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 4px 8px; border-radius: var(--r);
  color: var(--ink); font-weight: 600; list-style: none;
}
.switcher > summary { cursor: pointer; }
.switcher > summary::-webkit-details-marker { display: none; }
.switcher > summary:hover { background: var(--hover); }
.switcher > summary .name, .tenant-plain .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher > summary .icon { margin-left: auto; color: var(--ink-3); }
.avatar {
  flex: none; display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: var(--r-tag);
  background: var(--navy); color: #fff;
  font-size: 0.75rem; font-weight: 650; line-height: 1;
}
.avatar--lg { width: 32px; height: 32px; border-radius: var(--r); font-size: 0.9375rem; }
.avatar--quiet { background: var(--active); color: var(--ink); }

.popover {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: -24px;
  min-width: 15rem; padding: 6px;
  background: var(--page); border-radius: var(--r-pop); box-shadow: var(--pop-shadow);
  animation: pop-in 120ms var(--ease-out);
}
@keyframes pop-in { from { opacity: 0; translate: 0 -4px; } }
.popover-caption { padding: 6px 8px 4px; font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.popover ul { margin: 0; padding: 0; list-style: none; }
.popover form { margin: 0; }
.popover-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 34px; padding: 4px 8px; border: 0; border-radius: var(--r);
  background: none; color: var(--ink); text-align: left; text-decoration: none;
}
.popover-item:hover:not(:disabled) { background: var(--hover); color: var(--ink); text-decoration: none; }
.popover-item:disabled { cursor: default; }
.popover-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popover-item .icon--check { color: var(--accent); }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 6px -6px; }
.popover-link { color: var(--ink-2); }

/* Search row */
.sb-search { position: relative; margin: 2px 8px 10px; display: block; }
.sb-search .icon { position: absolute; left: 9px; top: 50%; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.sb-search input {
  width: 100%; height: 32px; padding: 0 30px 0 32px;
  background: var(--page); border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--ink);
  transition: border-color 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
.sb-search input::placeholder { color: var(--ink-3); }
.sb-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.sb-search kbd {
  position: absolute; right: 7px; top: 50%; translate: 0 -50%;
  min-width: 18px; padding: 1px 5px; border: 1px solid var(--line-2); border-radius: var(--r-tag);
  font: 600 0.6875rem/1.3 var(--font); color: var(--ink-3); text-align: center; background: var(--side);
}

/* Navigation: file plans and their folder trees */
.sb-caption { padding: 14px 8px 4px; font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.sb-note { padding: 4px 8px; font-size: 0.8125rem; color: var(--ink-3); }
.nav, .nav ul { margin: 0; padding: 0; list-style: none; }
.nav-row {
  display: flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 3px 8px 3px calc(8px + var(--depth, 0) * 16px);
  border-radius: var(--r);
  color: var(--ink-2); text-decoration: none;
  transition: background-color 120ms var(--ease-out), color 120ms var(--ease-out);
}
.nav-row:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav-row[aria-current] { background: var(--active); color: var(--ink); font-weight: 600; }
.nav-row[aria-current] > .icon { color: var(--navy); }
.nav-row .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-row .count { flex: none; font-size: 0.75rem; color: var(--ink-3); font-weight: 400; }
.nav-row .chev { color: var(--ink-3); transition: rotate 120ms var(--ease-out); }
.nav-row.is-open .chev { rotate: 90deg; }
.nav-row .spacer { width: 16px; flex: none; }
.nav-row.unlinked .label { color: var(--ink-3); font-style: italic; }
.nav-row .only-you { flex: none; font-size: 0.6875rem; color: var(--ink-3); font-weight: 400; }
/* Under the plan list: making plans and seeing them all (US-009), quieter than the plans themselves. */
.rail-plan-links { margin-top: 2px; }
.nav-row--quiet { color: var(--ink-3); }
.nav-row--quiet .icon { width: 14px; height: 14px; }
.page-meta .only-you { font-size: 0.75rem; color: var(--ink-3); }
/* Signature: a "filed under" chip lights its folder here. */
.nav-row.lit { background: var(--sky-wash); color: var(--accent-deep); }
.nav-row.lit .count, .nav-row.lit .chev, .nav-row.lit .icon { color: var(--accent); }

.sb-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px 10px; border-top: 1px solid var(--line);
}
/* The account menu opens upwards from the foot. */
.account-menu { flex: 1; min-width: 0; }
.account-menu > summary {
  display: flex; align-items: center; gap: 8px; margin: -4px; padding: 4px 6px 4px 4px;
  border-radius: var(--r); list-style: none; cursor: pointer;
  transition: background-color 120ms var(--ease-out);
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { background: var(--hover); }
.account-menu > summary.is-current { background: var(--active); }
.account-menu > summary > .icon { flex: none; margin-left: auto; color: var(--ink-3); }
.sb-foot .who { flex: 1; min-width: 0; line-height: 1.3; }
.popover--up { top: auto; bottom: calc(100% + 8px); left: -4px; right: -4px; min-width: 0; animation-name: pop-up; }
@keyframes pop-up { from { opacity: 0; translate: 0 4px; } }
.account-head { padding: 6px 8px 4px; line-height: 1.35; }
.account-head b { display: block; font-weight: 600; color: var(--ink); }
.account-head span { display: block; font-size: 0.75rem; color: var(--ink-3); overflow-wrap: anywhere; }
.popover-item > .icon { flex: none; color: var(--ink-3); }
.sb-foot .who b { display: block; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-foot .who span { display: block; font-size: 0.75rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-foot form { margin: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none;
  border: 0; border-radius: var(--r); background: none; color: var(--ink-3);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }

/* Page column */
.page { min-width: 0; display: flex; flex-direction: column; background: var(--canvas); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  min-height: var(--top-h); padding: 0 16px;
  background: var(--canvas);
}
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; margin: 0; padding: 0; list-style: none; font-size: 0.875rem; }
.crumbs li { display: inline-flex; align-items: center; gap: 2px; min-width: 0; }
.crumbs li + li::before { content: "/"; padding: 0 4px; color: var(--ink-4); }
.crumbs a, .crumbs span {
  display: inline-block; padding: 2px 6px; border-radius: var(--r-tag);
  color: var(--ink-2); text-decoration: none; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumbs a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.crumbs [aria-current] { color: var(--ink); }

.acting {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  margin: 0 16px 4px; padding: 8px 12px;
  background: var(--red-wash); border-radius: var(--r);
  color: var(--ink); font-size: 0.8125rem;
}
.acting .icon { color: var(--red); }
.acting b { color: var(--red); font-weight: 650; }

.work { flex: 1; width: 100%; max-width: 100rem; padding: 20px 40px 96px; }
.work:focus { outline: none; }

/* ───────────── Page head, view tabs, toolbar ───────────── */

.page-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.page-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-title .icon { width: 28px; height: 28px; stroke-width: 1.3; color: var(--navy); }
.page-title h1 { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.02em; }
.page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding-left: 38px; font-size: 0.8125rem; color: var(--ink-3); }
.page-meta b { color: var(--ink); font-weight: 600; }
.levels span + span::before { content: "›"; margin: 0 5px; color: var(--ink-4); }

.view-tabs { display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
.view-tabs a {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: -1px; padding: 6px 10px 8px;
  border-bottom: 2px solid transparent;
  color: var(--ink-3); font-weight: 500; text-decoration: none;
}
.view-tabs a:hover { color: var(--ink); text-decoration: none; }
.view-tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }

/* Filters: compact chips; they apply on change (Apply stays for no-JS). */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 28px; padding: 0 4px 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--page); color: var(--ink-2); font-size: 0.8125rem;
  transition: border-color 120ms var(--ease-out), background-color 120ms var(--ease-out);
}
.chip:hover { background: var(--well); }
.chip:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.chip.is-set { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-deep); }
.chip > span { white-space: nowrap; }
summary.chip { list-style: none; cursor: pointer; padding-right: 8px; }
summary.chip::-webkit-details-marker { display: none; }
.chip b { font-weight: 500; color: var(--ink); max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.is-set b { color: var(--accent-deep); }
.chip .icon--down { width: 14px; height: 14px; color: var(--ink-3); }
.filter { position: relative; }
.filter[open] > summary.chip { background: var(--hover); }
.filter-pop { right: auto; min-width: 14rem; max-height: 20rem; overflow-y: auto; }
.choice { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 8px; border-radius: var(--r); cursor: pointer; }
.choice:hover { background: var(--hover); }
.choice input { margin: 0; }
.pop-field { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; font-size: 0.8125rem; color: var(--ink-2); }
.pop-field input { height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--page); color: var(--ink); }
.pop-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.filter-pop .btn { margin: 6px 8px 4px; }
.filters-toggle { display: none; padding-right: 10px; }
.filters-toggle .icon { width: 14px; height: 14px; }
.filters-clear { margin-left: 4px; font-size: 0.8125rem; }
/* Search results' filters sit under the search box, above the results panel. */
.search-filters { padding: 0 0 12px; border-bottom: 0; }
.chip select { field-sizing: content; }
.chip select, .chip input {
  border: 0; background: transparent; padding: 3px 6px 3px 0; min-height: 26px;
  color: var(--ink); font-size: 0.8125rem; border-radius: var(--r-pill);
}
.chip select:focus, .chip input:focus { outline: none; }
.chip input[type="text"], .chip input[type="search"] { width: 9.5rem; }
.chip input::placeholder { color: var(--ink-3); }
.chip--search { padding-left: 8px; }
.chip--search .icon { width: 14px; height: 14px; color: var(--ink-3); }
.chip--search input[type="search"] { width: 15rem; }
.js .filters-apply { display: none; }

/* ───────────── Panels: white surfaces on the canvas ───────────── */

.panel { background: var(--page); border: 1px solid var(--line); border-radius: var(--r-pop); }
.panel + .panel { margin-top: 16px; }
.view-tabs + .split, .view-tabs + .split .split-main > .panel:first-child { margin-top: 0; }
.view-tabs { margin-bottom: 14px; }
.panel-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 8px 14px; border-bottom: 1px solid var(--line);
}
.panel-lead, .panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.panel-count { font-size: 0.8125rem; color: var(--ink-3); }
.panel-count b { color: var(--ink); font-weight: 600; }
.panel-title { font-size: 0.875rem; font-weight: 600; }
.panel-callout { margin: 12px 14px 0; }
.panel .filters { padding: 8px 14px; }
.panel .table th:first-child, .panel .table td:first-child { padding-left: 14px; }
.panel .table th:last-child, .panel .table td:last-child { padding-right: 14px; }
.panel .table tbody:last-of-type tr:last-child td { border-bottom: 0; }
.panel .table-foot { padding: 10px 14px; border-top: 1px solid var(--line); }
.panel .empty { padding: 40px 20px; }
.panel .table th { background: var(--page); }
.menu { position: relative; }
.popover-item[aria-current] { color: var(--accent-deep); font-weight: 600; }

/* Page thumbnails: a stand-in first page, drawn by document type. */
.thumb { width: 22px; height: 29px; flex: none; display: block; }
.thumb-page { fill: var(--page); stroke: var(--thumb-edge); stroke-width: 1.5; }
.thumb-ink { fill: var(--thumb-ink); }
.thumb-soft { fill: var(--thumb-soft); }
.thumb-band { fill: var(--line); }
.thumb-line { fill: none; stroke: var(--line); stroke-width: 1.25; }
.thumb-frame { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.thumb-seal { fill: none; stroke: var(--ink-4); stroke-width: 1.5; }
.table tr.is-selected td, .table tr.is-selected:hover td { background: var(--accent-wash); }
.table tr.is-selected .doc-link { color: var(--accent-deep); }

/* Side peek: one document beside the list. */
.split.has-peek { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.split-main { min-width: 0; }
/* With the peek open, the view's own columns fold away (the peek lists every field). */
.has-peek .table .col-field, .has-peek .table td.field { display: none; }
.has-peek .table td.title { min-width: 12rem; width: auto; }
.has-peek .table .doc-meta { display: none; }
.has-peek .table td.filed-cell { width: 10.5rem; max-width: 10.5rem; }
.has-peek .table .filed { flex-wrap: nowrap; }
.has-peek .table .filed a { max-width: 8rem; }
/* One chip per row while the peek is open, with "+N" for the other filings. */
.has-peek .table .filed li:nth-child(n+2):not(.filed-more) { display: none; }
.filed-more { display: none; flex: none; padding: 1px 6px; border-radius: var(--r-tag); background: var(--hover); font-size: 0.75rem; color: var(--ink-3); }
.has-peek .table .filed-more { display: inline-block; }
/* One filter line while the peek is open: the chips fold behind "Filters". */
.js .has-peek .filters-toggle { display: inline-flex; }
.js .has-peek .filters:not(.is-open) .filter, .js .has-peek .filters:not(.is-open) .filters-clear { display: none; }
.peek {
  position: sticky; top: calc(var(--top-h) + 4px);
  max-height: calc(100dvh - var(--top-h) - 16px); overflow-y: auto;
  padding: 10px 16px 20px;
  background: var(--page); border: 1px solid var(--line); border-radius: var(--r-pop);
  animation: pop-in 120ms var(--ease-out);
}
.peek-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -6px 10px; }
.peek-page { display: grid; justify-items: center; gap: 8px; padding: 18px 16px 12px; background: var(--canvas); border-radius: var(--r-pop); }
/* The page image opens the document, in the viewer. */
a.peek-page { color: inherit; text-decoration: none; }
a.peek-page:hover { background: var(--active); color: inherit; text-decoration: none; }
a.peek-page:hover .peek-pages { color: var(--accent-deep); }
.peek-page .thumb, .peek-page img { width: 132px; height: auto; }
.peek-pages { font-size: 0.75rem; color: var(--ink-3); }
.peek-title { margin: 16px 0 6px; font-size: 1.0625rem; font-weight: 600; line-height: 1.35; }
.peek .marks { margin: 0 0 4px; }
.props { margin: 12px 0 0; font-size: 0.8125rem; }
.props > div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.props dt { color: var(--ink-3); }
.props dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.props .names { flex-direction: column; gap: 2px; }
.props .names li + li::before { content: none; }
.peek-caption { margin: 18px 0 8px; font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.peek-text { padding: 10px 12px; background: var(--well); border: 1px solid var(--line); border-radius: var(--r); font-size: 0.8125rem; line-height: 1.6; color: var(--ink-2); }
.peek .empty { padding: 24px 0; }

/* Recently opened */
.recent-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(15rem, calc(33.33% - 4px)), 1fr)); gap: 2px; margin: 0; padding: 6px; list-style: none; }
.recent-item { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 8px; border-radius: var(--r); color: var(--ink); text-decoration: none; }
.recent-item:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.recent-text { min-width: 0; line-height: 1.35; }
.recent-text b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-text span { display: block; font-size: 0.75rem; color: var(--ink-3); }

/* ───────────── Settings: entity types and their fields ───────────── */

.page-head--actions { flex-direction: row; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.page-head--actions > .btn { margin-top: 6px; }
.type-meta { display: none; }
/* "Done" confirmations are neutral: the accent means selection, not success. */
.callout--done { color: var(--ink); }
.callout--done > .icon { color: var(--ink-2); }
.type-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; }
.type-link .icon { color: var(--ink-3); }
.type-link:hover { color: var(--accent-deep); text-decoration: none; }
.type-row .sub { margin-left: 24px; }

.fields-table td { vertical-align: middle; }
.fields-table .col-order { width: 1%; padding-right: 0; }
.order { display: flex; gap: 0; margin: 0; }
.icon-btn--sm { width: 24px; height: 24px; }
.icon-btn--down .icon { rotate: 180deg; }
.icon-btn--danger { color: var(--red); }
.icon-btn--danger:hover { background: var(--red-wash); color: var(--red); }
.icon-btn--danger:disabled, .icon-btn--danger:disabled:hover { background: none; color: var(--ink-3); opacity: 0.6; cursor: not-allowed; }
.btn:disabled, .icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn--quiet:disabled:hover { background: var(--page); }
.btn:not(.btn--quiet):not(.btn--danger):disabled:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.field-link { font-weight: 500; }
.kind-label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); white-space: nowrap; }
.kind-label .icon { color: var(--ink-3); }
.flags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.flag { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: var(--r-tag); background: var(--hover); color: var(--ink-2); font-size: 0.75rem; font-weight: 500; line-height: 1.6; white-space: nowrap; }
.flag--quiet { background: none; color: var(--ink-3); padding-left: 0; }
.flag .icon { width: 12px; height: 12px; }
.fields-table .sub { max-width: 44ch; }

.hidden-list { margin: 0; padding: 4px 14px; list-style: none; }
.hidden-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hidden-list li:last-child { border-bottom: 0; }
.hidden-list b { font-weight: 500; color: var(--ink); }
.hidden-list form { margin: 0; }
.hidden-actions { display: flex; gap: 6px; }

.danger-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 14px; }
.danger-text { margin-top: 2px; font-size: 0.8125rem; color: var(--ink-2); }

/* The side panel as an editor */
.peek-sub { margin: 4px 0 16px; font-size: 0.8125rem; color: var(--ink-3); }
.peek-note { margin: 0 0 14px; padding: 8px 10px; background: var(--well); border: 1px solid var(--line); border-radius: var(--r); font-size: 0.8125rem; color: var(--ink-2); }
.panel-form .form-field { margin-bottom: 16px; }
.form-field textarea, .form-field select {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--page); color: var(--ink); font-size: 0.9375rem; line-height: 1.45;
  transition: border-color 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
.form-field select {
  height: 38px; padding-block: 0; padding-right: 32px; appearance: none;
  background: var(--page) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236f6e69' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4.5 6.25 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
}
.form-field textarea::placeholder { color: var(--ink-4); }
.form-field textarea { resize: vertical; }
.form-field textarea:focus, .form-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.form-field textarea[aria-invalid="true"], .form-field select[aria-invalid="true"] { border-color: var(--red); }
.form-field select:disabled { background-color: var(--well); color: var(--ink-2); }
.panel-form .form-field > input { height: 36px; font-size: 0.875rem; }
.panel-form .form-field textarea, .panel-form .form-field select { font-size: 0.875rem; }
.optional { font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.field-error { margin-top: 5px; font-size: 0.8125rem; color: var(--red); }
.field-hint { margin-top: 5px; font-size: 0.8125rem; color: var(--ink-3); }
.panel-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.875rem; }

fieldset.form-field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset.form-field > legend { padding: 0; margin-bottom: 6px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); }
.kind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kind-option {
  position: relative; display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r);
  cursor: pointer; transition: border-color 120ms var(--ease-out), background-color 120ms var(--ease-out);
}
.kind-option:hover { background: var(--well); }
.kind-option input { position: absolute; opacity: 0; pointer-events: none; }
.kind-option .icon { margin-top: 2px; color: var(--ink-3); }
.kind-option b { display: block; font-size: 0.8125rem; font-weight: 600; }
.kind-option small { display: block; font-size: 0.75rem; line-height: 1.35; color: var(--ink-3); }
.kind-option:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.kind-option:has(input:checked) .icon { color: var(--accent); }
.kind-option:has(input:checked) b { color: var(--accent-deep); }
.kind-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.kind-locked { padding: 10px 12px; background: var(--well); border: 1px solid var(--line); border-radius: var(--r); }
.kind-locked b { font-weight: 600; color: var(--ink); }
.kind-locked p { display: flex; gap: 6px; margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); }
.kind-locked p .icon { flex: none; width: 14px; height: 14px; margin-top: 2px; color: var(--ink-3); }
/* Choices and "points to" show only for their type (the page works with both visible when :has is missing). */
.field-form:has(input[name="Form.Kind"]) .for-kind { display: none; }
.field-form:has(input[name="Form.Kind"][value="Select"]:checked) .for-Select,
.field-form:has(input[type="hidden"][name="Form.Kind"][value="Select"]) .for-Select,
.field-form:has(input[name="Form.Kind"][value="EntityReference"]:checked) .for-EntityReference,
.field-form:has(input[type="hidden"][name="Form.Kind"][value="EntityReference"]) .for-EntityReference { display: block; }
.checks { display: grid; gap: 4px; margin-top: 4px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; }
.check b { display: block; font-size: 0.875rem; font-weight: 600; }
.check small { display: block; font-size: 0.8125rem; color: var(--ink-3); }
.hide-field { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.hide-field p { margin-bottom: 8px; font-size: 0.8125rem; color: var(--ink-3); }
.hide-field p.is-warning { color: var(--ink-2); }
.hide-field p.is-warning strong { color: var(--ink); font-weight: 600; }

/* Document types: access class and retention */
.field-hint--top { margin: -2px 0 8px; }
.class-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 6px; }
.class-option {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  padding: 9px 10px; border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer;
  transition: border-color 120ms var(--ease-out), background-color 120ms var(--ease-out);
}
.class-option:hover { background: var(--well); }
.class-option input { position: absolute; opacity: 0; pointer-events: none; }
.class-option b { font-size: 0.8125rem; font-weight: 600; }
.class-name { display: flex; align-items: center; gap: 8px; }
.current-mark { margin-left: auto; font-style: normal; font-size: 0.6875rem; font-weight: 600; color: var(--ink-3); }
.class-option:has(input:checked) .current-mark { color: var(--accent-deep); }
.class-option small { font-size: 0.75rem; line-height: 1.35; color: var(--ink-3); text-wrap: pretty; }
.class-option:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.class-option:has(input:checked) b, .class-option:has(input:checked) small { color: var(--accent-deep); }
.class-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* What the chosen class means (shown for the checked class only). */
.impact { display: none; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--well); font-size: 0.8125rem; color: var(--ink-2); }
.impact > .icon { flex: none; margin-top: 1px; color: var(--ink-3); }
.impact strong { color: var(--ink); font-weight: 600; }
/* Losing sight of documents is a consequence to confirm before saving: red, as for consequential actions. */
.impact--loss { background: var(--red-wash); border-color: var(--red-line); color: var(--ink); }
.impact--loss > .icon, .impact--loss strong { color: var(--red); }
.form-field > .confirm-loss { display: none; margin-top: 8px; }
.confirm-loss b { font-size: 0.875rem; font-weight: 500; }
.confirm-loss.is-invalid input { outline: 2px solid var(--red); outline-offset: 1px; }
.class-form:has(input[name="Details.AccessClassId"].loses:checked) .form-field > .confirm-loss, .form-field > .confirm-loss.is-invalid { display: flex; }
.check small.field-error { color: var(--red); }
/* A class change needs its reason (audited). */
.form-field > .reason-field { display: none; margin: 12px 0 0; }
.class-form:has(input[name="Details.AccessClassId"].changes:checked) .form-field > .reason-field, .form-field > .reason-field.is-invalid { display: block; }
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.segmented label { position: relative; padding: 6px 12px; font-size: 0.8125rem; color: var(--ink-2); cursor: pointer; border-left: 1px solid var(--line-2); }
.segmented label:first-child { border-left: 0; }
.segmented label:hover { background: var(--well); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--accent-wash); color: var(--accent-deep); font-weight: 600; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.retention-amount { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.875rem; color: var(--ink-2); }
.retention-amount label { margin: 0; }
.panel-form .retention-amount input { width: 4.5rem; height: 34px; }
.retention-after { white-space: nowrap; }
.hint-permanent { display: none; }
.retention:has(input[value="Permanent"]:checked) .hint-period { display: none; }
.retention:has(input[value="Permanent"]:checked) .hint-permanent { display: block; }
.retention:has(input[value="Years"]:checked) .unit-months, .retention:has(input[value="Months"]:checked) .unit-years { display: none; }
.retention:has(input[value="Permanent"]:checked) .retention-amount { display: none; }
.access-plain { color: var(--ink-2); }
.props--panel { margin: 0; padding: 2px 14px 6px; font-size: 0.875rem; }
.props--panel > div { grid-template-columns: 8rem minmax(0, 1fr); padding: 10px 0; }
.props--panel > div:last-child { border-bottom: 0; }
.props-note { display: block; margin-top: 2px; font-size: 0.8125rem; color: var(--ink-3); }

/* Platform: tenants */
a.tenant { color: var(--ink); text-decoration: none; }
a.tenant:hover { color: var(--ink); text-decoration: none; }
.platform-plain .brand-mark svg { display: block; width: 21px; height: 21px; }
.tenant-row .type-link .avatar { width: 22px; height: 22px; }
.page-meta--flush { padding-left: 0; }
.page-title .avatar--lg { width: 30px; height: 30px; font-size: 0.9375rem; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.class-list--two { grid-template-columns: 1fr 1fr; }
.people { margin: 0; padding: 4px 14px; list-style: none; }
.people li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people form { margin: 0; }
.people .tenant-text b { font-weight: 500; }
.sessions .tenant-text b { white-space: normal; }
.tenant-id { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.8125rem; color: var(--ink-2); }
.facts { display: grid; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--ink-2); }
.facts li { display: flex; gap: 8px; align-items: flex-start; }
.facts .icon { flex: none; width: 14px; height: 14px; margin-top: 2px; color: var(--ink-3); }
.facts b { color: var(--ink); font-weight: 600; }
.acting form { margin: 0 0 0 auto; }
.acting-reason { display: block; margin-top: 2px; color: var(--ink-2); }
.acting .acting-leave, .look-inside .acting-leave { border-color: var(--red-line); color: var(--red); }
.acting .acting-leave:hover, .look-inside .acting-leave:hover { background: var(--page); color: var(--red); border-color: var(--red); }

/* Users and access classes */
.tab-count { font-size: 0.75rem; font-weight: 500; color: var(--ink-3); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-text { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; min-width: 0; line-height: 1.35; }
.person-text .type-link { min-width: 0; }
.person-email { flex-basis: 100%; font-size: 0.8125rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person--head { margin-top: 12px; align-items: flex-start; }
.person--head .peek-title { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; }
.table.members td.title, .has-peek .table.members td.title { width: 38%; }
.class-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.class-plain { font-size: 0.8125rem; color: var(--ink); }
.class-tags .class-plain + .tag, .class-tags .tag + .class-plain { margin-left: 2px; }
.muted { color: var(--ink-3); }
.invited { display: inline-flex; align-items: center; gap: 10px; }
.invited form { margin: 0; }
.class-list--rows { grid-template-columns: minmax(0, 1fr); }
.class-option.is-disabled { cursor: not-allowed; opacity: 0.5; }
.class-option.is-disabled:hover { background: none; }
.access-form .impact--loss { margin-top: 8px; }
.peek-more { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.8125rem; color: var(--ink-2); }
.peek-more p { margin: 0; }
.peek-more p + p { margin-top: 6px; }
.peek-more .peek-more-actions + p { margin-top: 14px; }
.peek-more .peek-caption { margin: 0 0 6px; }
.peek-more + .peek-more { margin-top: 16px; }
.peek-more-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.peek-more-actions form { margin: 0; }
.holder-list { margin: 0; padding: 0; list-style: none; font-size: 0.8125rem; }
.holder-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.holder-list li:last-child { border-bottom: 0; }
.holder-list span { color: var(--ink-3); }
.peek-count { margin: 6px 0 0; font-size: 0.75rem; color: var(--ink-3); }
.props + .peek-note { margin-top: 14px; }
.class-link { gap: 8px; }
.classes-table .type-row .sub { margin-left: 0; }
.peek-title .tag--lg { padding: 1px 8px; font-size: 0.9375rem; font-weight: 600; line-height: 1.5; }
.colour-field { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.swatches { display: flex; gap: 4px; }
.swatch { position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid transparent; border-radius: var(--r); cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch-dot { display: block; width: 20px; height: 20px; padding: 0; border-radius: var(--r-tag); box-shadow: inset 0 0 0 1px rgb(15 15 15 / 0.08); }
.swatch:hover { background: var(--hover); }
.swatch:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tag-preview { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.colour-field:has(input[value="Pink"]:checked) .tag-preview { background: var(--tag-pink); color: var(--tag-pink-ink); }
.colour-field:has(input[value="Green"]:checked) .tag-preview { background: var(--tag-green); color: var(--tag-green-ink); }
.colour-field:has(input[value="Blue"]:checked) .tag-preview { background: var(--tag-blue); color: var(--tag-blue-ink); }
.colour-field:has(input[value="Purple"]:checked) .tag-preview { background: var(--tag-purple); color: var(--tag-purple-ink); }
.colour-field:has(input[value="Orange"]:checked) .tag-preview { background: var(--tag-orange); color: var(--tag-orange-ink); }
.colour-field:has(input[value="Yellow"]:checked) .tag-preview { background: var(--tag-yellow); color: var(--tag-yellow-ink); }
.colour-field:has(input[value="Brown"]:checked) .tag-preview { background: var(--tag-brown); color: var(--tag-brown-ink); }
.table.classes-table td.title, .has-peek .table.classes-table td.title { width: 40%; min-width: 14rem; }
.classes-table td.num, .classes-table th.num { width: 1%; white-space: nowrap; padding-left: 20px; }
/* A held class, unticked: its "Holds" mark says what saving will do. */
.remove-mark { display: none; }
.class-option:has(input.was-held:not(:checked)) .hold-mark { display: none; }
.class-option:has(input.was-held:not(:checked)) .remove-mark { display: inline; color: var(--ink-2); }
.class-option:has(input.held:not(:checked)) .remove-mark { color: var(--red); }

/* Intake: batches, checking the cuts, separator sheets */
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.restricted-mark { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.restricted-mark .icon { width: 12px; height: 12px; }
.needs { display: block; margin-top: 3px; font-size: 0.75rem; font-weight: 600; color: var(--accent-deep); }
.needs-count { color: var(--accent-deep); }
.form-field > label.file-pick.drop, .file-pick.drop {
  display: grid; justify-items: center; gap: 4px; width: 100%; margin: 0; padding: 22px 16px;
  border: 1.5px dashed var(--line-2); border-radius: var(--r); background: var(--well); color: var(--ink-2); text-align: center; cursor: pointer;
  transition: border-color 120ms var(--ease-out), background-color 120ms var(--ease-out);
}
.file-pick.drop .icon { width: 20px; height: 20px; color: var(--ink-3); }
.file-pick.drop b { color: var(--accent); font-weight: 600; }
.file-pick.drop small { font-size: 0.75rem; color: var(--ink-3); }
.file-pick.drop:hover, .file-pick.drop.is-over { border-color: var(--accent); background: var(--accent-wash); text-decoration: none; }
.file-pick.drop.is-invalid { border-color: var(--red); }
.upload-list { display: grid; gap: 4px; }
.upload-list .file { position: relative; overflow: hidden; width: 100%; }
.file-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
.file-progress i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 120ms linear; }
.check.prefill b { font-weight: 600; }
.batch-files { margin: 0; padding: 4px 14px; list-style: none; }
.batch-files li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.875rem; }
.batch-files li:last-child { border-bottom: 0; }
.batch-files .icon { color: var(--ink-3); }
.batch-files small { color: var(--ink-3); font-size: 0.8125rem; }
.batch-files .is-failed small { color: var(--red); }
.batch-files .retry { margin: 0 0 0 auto; }
.batch-files .retry .file-pick { color: var(--ink); }
.cut-flow { display: grid; padding: 0 14px 6px; }
.doc-group { padding: 14px 0; border-top: 1px solid var(--line); }
.doc-group:first-child { border-top: 0; }
.doc-group--loose .doc-head h3 { color: var(--ink-3); }
.doc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin-bottom: 10px; scroll-margin-top: calc(var(--top-h) + 12px); }
.doc-head h3 { margin: 0; font-size: 0.875rem; font-weight: 600; }
.doc-sets { font-size: 0.8125rem; color: var(--ink-2); }
.doc-head .join { margin: 0 0 0 auto; }
.bpages { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 0; margin: 0; padding: 0; list-style: none; }
.bpage-item { display: flex; align-items: flex-start; }
.bpage { display: grid; justify-items: center; align-content: start; gap: 4px; width: 100px; font-size: 0.75rem; text-align: center; scroll-margin-top: calc(var(--top-h) + 12px); }
.page-no { color: var(--ink-3); }
.pg { position: relative; display: grid; align-content: start; gap: 5px; width: 64px; height: 86px; padding: 10px 8px; border: 1px solid var(--thumb-edge); border-radius: 2px; background: var(--page); }
.pg i { display: block; height: 2px; background: var(--thumb-soft); }
.pg i:first-child { width: 55%; background: var(--thumb-ink); }
.pg i:nth-child(3) { width: 80%; }
.pg--blank i { display: none; }
.pg--sheet { width: 36px; height: 48px; padding: 5px 4px; gap: 3px; flex: none; }
.pg--sheet i:first-child { width: 100%; height: 5px; background: var(--ink); }
.pg--sheet b { position: absolute; right: 4px; bottom: 4px; width: 11px; height: 11px; background: conic-gradient(var(--ink) 25%, transparent 0 50%, var(--ink) 0 75%, transparent 0) 0 0 / 4px 4px; }
.bpage.is-out .pg { opacity: 0.35; }
.bpage { position: relative; }
.bpage[draggable="true"] .pg { cursor: grab; }
/* A thumbnail opens that page large in the viewer (a dialog with script, ?open= without). */
.bpage-open { display: block; border-radius: 3px; }
.bpage-open:hover .pg { border-color: var(--ink-4); }
.bpage.is-dragging { opacity: 0.4; }
/* Where a dragged page will land: an accent bar before or after the page it's over. */
.bpage.is-drop-before::before, .bpage.is-drop-after::after { content: ""; position: absolute; top: 0; width: 3px; height: 86px; border-radius: 2px; background: var(--accent); }
.bpage.is-drop-before::before { left: -8px; }
.bpage.is-drop-after::after { right: 10px; }
.bpage.is-moving { width: 17rem; grid-template-columns: 64px minmax(0, 1fr); justify-items: start; column-gap: 10px; text-align: left; }
.bpage.is-moving .bpage-open { grid-row: span 4; }
.move-form { display: grid; gap: 6px; margin: 2px 0 0; font-size: 0.75rem; color: var(--ink-2); }
.move-form select { height: 30px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--page); font: inherit; font-size: 0.8125rem; color: var(--ink); }
.move-actions { display: flex; align-items: center; gap: 12px; }
.bpage.is-flagged { width: 15rem; grid-template-columns: 64px minmax(0, 1fr); justify-items: start; column-gap: 10px; text-align: left; }
.bpage.is-flagged .bpage-open { grid-row: span 3; }
.bpage.is-flagged .pg { box-shadow: 0 0 0 2px var(--accent); }
.flag-text { display: flex; gap: 5px; align-items: flex-start; font-size: 0.75rem; line-height: 1.4; color: var(--ink-2); }
.flag-text .icon { flex: none; width: 12px; height: 12px; margin-top: 2px; color: var(--accent-deep); }
.page-action { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 10px; margin: 0; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; font-size: 0.75rem; color: var(--accent); white-space: nowrap; cursor: pointer; }
.link-btn:hover { color: var(--accent-deep); text-decoration: underline; }
.cut-gap { display: flex; margin: 0; }
.cut-btn { position: relative; display: grid; place-items: center; width: 28px; height: 86px; padding: 0; border: 0; border-radius: var(--r-tag); background: none; color: var(--ink-3); cursor: pointer; }
/* On hover or focus, a dashed accent line shows where the new document would start. */
.cut-btn::before { content: ""; position: absolute; top: 2px; bottom: 2px; left: 50%; border-left: 1.5px dashed var(--line-2); }
.cut-btn .icon { position: relative; width: 16px; height: 16px; padding: 3px 0; background: var(--page); transform: rotate(90deg); }
.cut-btn:hover, .cut-btn:focus-visible { color: var(--accent); }
.cut-btn:hover::before, .cut-btn:focus-visible::before { border-left-color: var(--accent); }
.cut-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sheet-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-top: 1px dashed var(--line-2); border-bottom: 1px dashed var(--line-2); scroll-margin-top: calc(var(--top-h) + 12px); }
.sheet-row + .doc-group { border-top: 0; }
.doc-group + .sheet-row, .sheet-row:first-child { margin-top: 0; }
.sheet-row.is-flagged { margin: 6px 0; padding: 10px; border: 0; border-radius: var(--r); box-shadow: 0 0 0 2px var(--accent); }
.sheet-row.is-ignored { opacity: 0.7; }
.sheet-text { flex: 1; min-width: 12rem; display: grid; gap: 4px; }
.sheet-text p { margin: 0; font-size: 0.8125rem; color: var(--ink-2); }
.sheet-text b { color: var(--ink); font-weight: 600; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.row-actions form { margin: 0; }
.confirm-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-pop) var(--r-pop); background: var(--page); font-size: 0.8125rem; color: var(--ink-2); }
.confirm-bar p, .confirm-bar form { margin: 0; }
.danger-actions { display: flex; align-items: center; gap: 16px; margin: 0; font-size: 0.875rem; }
.sheet-layout { display: grid; grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); gap: 24px; align-items: start; }
.sheet-form { padding: 12px 14px 14px; }
.sheet-form .copies input { width: 6rem; }
.batches .type-row .sub { margin-left: 0; }
.sheet-preview { container-type: inline-size; display: grid; gap: 10px; max-width: 34rem; }
/* The sheet itself: sized from its width, so the preview and the A4 print are the same design. */
.sep-sheet {
  display: flex; flex-direction: column; aspect-ratio: 210 / 297; padding: 7% 8%;
  border: 1px solid var(--line-2); background: #fff; color: #111; font-size: 3.2cqi; line-height: 1.25;
}
.sep-top { display: flex; justify-content: space-between; gap: 1em; font-size: 0.55em; color: #555; }
.sep-body { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 0.7em; }
.sep-title { margin: 0; font-size: 1.1em; font-weight: 700; color: #555; }
.sep-line { margin: 0; font-size: 2.3em; font-weight: 750; letter-spacing: -0.01em; line-height: 1.08; overflow-wrap: anywhere; }
.sep-line small { display: block; margin-bottom: 0.2em; font-size: 0.3em; font-weight: 500; letter-spacing: 0; color: #555; }
.sep-line--plain { font-size: 1.1em; font-weight: 500; color: #333; }
.sep-restricted { align-self: flex-start; margin: 0.3em 0 0; padding: 0.1em 0.45em; border: 0.14em solid #111; font-size: 1.5em; font-weight: 800; letter-spacing: 0.08em; }
.sep-foot { display: flex; align-items: flex-end; gap: 1.2em; }
.sep-code { flex: none; width: 26%; fill: #111; }
.sep-how { font-size: 0.55em; color: #444; }
.sep-how p { margin: 0 0 0.5em; }
.print-sheets { margin: 0; padding: 24px; background: var(--canvas); }
.print-sheets .sep-sheet { width: min(100%, 210mm); margin: 0 auto 24px; font-size: calc(min(100vw - 48px, 210mm) * 0.032); }
.print-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; max-width: 210mm; margin: 0 auto 16px; font-size: 0.875rem; color: var(--ink-2); }
.print-bar p { margin: 0 auto 0 0; }
@media print {
  @page { size: A4; margin: 0; }
  .print-sheets { padding: 0; background: #fff; }
  .print-bar { display: none; }
  .print-sheets .sep-sheet { width: 210mm; height: 297mm; margin: 0; border: 0; font-size: calc(210mm * 0.032); break-after: page; }
}

/* Review: the queue beside the open document */
.chip-form { display: contents; }
.review-layout { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 16px; align-items: start; }
.review-layout > .panel { margin: 0; }
.review-list form { margin: 0; }
.select-ready { margin: 0; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.select-ready b { font-weight: 600; }
.review-items { margin: 0; padding: 0; list-style: none; }
.review-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: 0; }
.review-item:hover { background: var(--well); }
.review-item.is-selected { background: var(--accent-wash); }
.review-item input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; }
.review-item input:disabled { opacity: 0.35; }
.review-link { display: grid; gap: 2px; min-width: 0; color: var(--ink); text-decoration: none; }
.review-link:hover { text-decoration: none; }
.review-link b { font-size: 0.875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-item.is-selected .review-link b { color: var(--accent-deep); }
.review-sub, .review-meta { font-size: 0.75rem; color: var(--ink-3); }
.review-sub .conf-low, .review-sub .not-ready { color: var(--accent-deep); font-weight: 600; }
.review-head { display: grid; gap: 4px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.review-head h2 { font-size: 1.0625rem; font-weight: 600; }
.review-head-meta { font-size: 0.8125rem; color: var(--ink-3); }
.review-back { display: none; align-items: center; gap: 4px; font-size: 0.8125rem; }
.review-back .icon { width: 14px; height: 14px; transform: rotate(180deg); }
.review-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; padding: 16px; align-items: start; }
/* Every page of the waiting document, next to the suggestions; it stays in view while the form scrolls. */
.review-viewer { position: sticky; top: calc(var(--top-h) + 8px); min-width: 0; }
.review-form .form-field > label:not(.check), .review-form legend { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.conf { font-size: 0.75rem; font-weight: 500; color: var(--ink-3); }
.conf--low { font-weight: 600; color: var(--accent-deep); }
.conf--person { color: var(--ink-2); }
.mark { display: inline-flex; align-items: baseline; gap: 8px; }
/* JS-only: without script the ring stays until the person confirms. */
.looks-right { display: none; }
.js .looks-right { display: inline; }
.looks-right { padding: 0; border: 0; background: none; font: inherit; font-size: 0.75rem; font-weight: 600; color: var(--accent); cursor: pointer; }
.looks-right:hover { color: var(--accent-deep); text-decoration: underline; }
/* A doubtful suggestion wears the needs-you ring until the person touches it (site.js clears it). */
.is-doubtful > input, .is-doubtful > select, .review-links li.is-doubtful { box-shadow: 0 0 0 2px var(--accent); border-radius: var(--r); }
.review-links { display: grid; gap: 4px; margin: 0 0 8px; padding: 0; list-style: none; }
.review-links li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 8px; }
.review-links .check { padding: 6px 0; }
.add-link { width: 100%; }
.js .retype-btn { display: none; }
.retype-btn { margin-top: 6px; }
.review-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0 14px; }
.review-field { margin-bottom: 12px; }
.req { color: var(--ink-3); }
.review-access { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 4px 0 0; font-size: 0.8125rem; color: var(--ink-2); }
.review-access b { color: var(--ink); font-weight: 600; }
.review-access-note { flex-basis: 100%; color: var(--ink-3); }
.review-loss { display: flex; }
.review-actions { position: sticky; bottom: 0; background: var(--page); }

/* Support: tickets, the conversation, the queue */
.nav-badge { flex: none; margin-left: auto; min-width: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--navy); color: #fff; font-size: 0.6875rem; font-weight: 600; line-height: 18px; text-align: center; }
.nav-row:has(.nav-badge) .label { flex: 1; }
.unread-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.type-row.is-unread .type-link span:not(.sr-only) { font-weight: 650; }
.emails { margin-top: 16px; }
.emails-body { padding: 12px 14px 14px; font-size: 0.8125rem; }
.emails-body > p { margin: 0 0 10px; max-width: 72ch; color: var(--ink-2); }
.view-tabs .nav-badge { margin-left: 2px; }
.emails-form { margin: 0; }
.emails-form .check { max-width: 72ch; padding: 4px 0 0; }
.emails-body > .emails-saved { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; color: var(--ink-2); }
.emails-body > .emails-saved--failed, .emails-saved--failed .icon { color: var(--red); }
.emails-saved .icon { width: 14px; height: 14px; }
.panel-title .icon { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; color: var(--ink-3); }
.look-hint { margin: 0 0 10px; font-size: 0.8125rem; color: var(--ink-2); }
.look-actions { display: flex; gap: 8px; margin: 0 0 12px; }
.look-state { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; font-size: 0.8125rem; color: var(--ink-2); }
.look-state .icon { flex: none; width: 14px; height: 14px; margin-top: 2px; color: var(--red); }
.look-state b { color: var(--red); font-weight: 600; }
.look-inside .facts { margin-bottom: 12px; }
.acting-ticket { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.entry-seen { color: var(--ink-3); }
.peek-actions { display: flex; gap: 8px; }
.status { display: inline-block; padding: 0 7px; border-radius: var(--r-tag); background: var(--hover); color: var(--ink-2); font-size: 0.75rem; font-weight: 500; line-height: 1.6; white-space: nowrap; }
.status--new, .status--open { color: var(--ink); font-weight: 600; }
.status--resolved, .status--closed { background: none; color: var(--ink-3); padding-left: 0; }
.urgent { font-weight: 600; color: var(--ink); white-space: nowrap; }
.urgent .icon { width: 13px; height: 13px; margin-right: 3px; vertical-align: -2px; }
/* In a page head the status sits on the canvas, so it takes the panel colour and a line to read as a chip. */
.page-meta .status:not(.status--resolved, .status--closed) { background: var(--page); box-shadow: inset 0 0 0 1px var(--line-2); }
.nowrap { white-space: nowrap; }
.overdue { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.overdue .icon { width: 13px; height: 13px; }
.overdue-count { color: var(--ink); }
.tickets td.title { width: 60%; }
.tickets .type-row .sub { margin-left: 0; }
.timeline { margin: 0; padding: 6px 14px 4px; list-style: none; }
.entry { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry-body { flex: 1; min-width: 0; }
.entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 0.8125rem; color: var(--ink-3); }
.entry-head b { font-size: 0.875rem; font-weight: 600; color: var(--ink); }
.entry-side { color: var(--ink-2); }
.entry-head time { margin-left: auto; white-space: nowrap; }
.entry-text { margin-top: 4px; white-space: pre-line; max-width: 72ch; }
.entry--note .entry-body { padding: 8px 10px; background: var(--well); border: 1px dashed var(--line-2); border-radius: var(--r); }
.entry-system { display: flex; gap: 10px; align-items: baseline; padding: 8px 0 8px 8px; border-bottom: 1px solid var(--line); font-size: 0.8125rem; color: var(--ink-3); }
.entry-system b { color: var(--ink-2); font-weight: 600; }
/* System lines keep their time at the right, like messages. */
.entry-system-time { flex: none; margin-left: auto; padding-left: 12px; white-space: nowrap; }
.entry-system .dot { width: 6px; height: 6px; margin: 0 8px 1px 2px; border-radius: 50%; background: var(--line-2); flex: none; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--page); font-size: 0.8125rem; }
.file span, .file a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file small { color: var(--ink-3); white-space: nowrap; }
.file .icon { color: var(--ink-3); }
.refs { padding: 4px 14px 12px; }
.refs .field-hint { margin-top: 8px; }
.linkable { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0; padding: 0; list-style: none; max-height: 16rem; overflow-y: auto; }
.check--row { align-items: center; padding: 6px 4px; border-radius: var(--r); }
.check--row:hover { background: var(--well); }
.check--row .thumb { width: 18px; height: 24px; }
.check--row span { flex: 1; min-width: 0; }
.check--row b { font-size: 0.8125rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.check--row small { font-size: 0.75rem; }
.attach { display: grid; gap: 6px; justify-items: start; padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: var(--r); }
.attach .files { margin: 0; }
.files--picked { margin: 8px 0 0; }
.files[hidden] { display: none; }
.reply { padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.reply .form-field { margin-bottom: 8px; }
.reply-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; }
.file-pick { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-size: 0.8125rem; color: var(--accent); cursor: pointer; }
.file-pick:hover { color: var(--accent-deep); text-decoration: underline; }
.file-pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.reply-prompt { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; font-size: 0.8125rem; color: var(--ink-2); }
.reply-closed { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--well); font-size: 0.875rem; color: var(--ink-2); }
.reply-tabs { margin: -4px 0 10px; }
.reply-tabs a { font-size: 0.8125rem; padding-bottom: 6px; }
.reply--note textarea { background: var(--well); border-style: dashed; }
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.ticket-layout > * { min-width: 0; }
.ticket-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.ticket-side .panel + .panel { margin-top: 0; }
.side-forms { padding: 10px 14px 4px; }
.side-forms .form-field { margin-bottom: 12px; }
.side-forms .form-field select { height: 32px; font-size: 0.875rem; }
.queue-filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 14px; }
.segmented--links { margin: 0; padding: 0; list-style: none; background: var(--page); }
.segmented--links li { border-left: 1px solid var(--line-2); }
.segmented--links li:first-child { border-left: 0; }
.segmented--links a { display: block; padding: 5px 11px; font-size: 0.8125rem; color: var(--ink-2); text-decoration: none; }
.segmented--links a:hover { background: var(--well); color: var(--ink); text-decoration: none; }
.segmented--links a[aria-current] { background: var(--accent-wash); color: var(--accent-deep); font-weight: 600; }
a.chip { text-decoration: none; padding-right: 10px; }
a.chip:hover { text-decoration: none; }
.queue-tenant { margin: 0; }

/* ───────────── Buttons ───────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 12px;
  border: 1px solid var(--accent); border-radius: var(--r);
  background: var(--accent); color: #fff;
  font-weight: 600; font-size: 0.875rem; text-decoration: none; white-space: nowrap;
  transition: background-color 120ms var(--ease-out), border-color 120ms var(--ease-out);
}
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; text-decoration: none; }
.btn--quiet { background: var(--page); color: var(--ink); border-color: var(--line-2); }
.btn--quiet:hover { background: var(--hover); border-color: var(--line-2); color: var(--ink); }
.btn--block { width: 100%; min-height: 36px; }
/* Red actions, used sparingly: an irreversible delete, and suspending a tenant (it locks every member out). */
.btn--danger { background: var(--page); color: var(--red); border-color: var(--red-line); }
.btn--danger:hover { background: var(--red-wash); color: var(--red); border-color: var(--red-line); }
/* Red only when the delete can actually happen. */
.btn--danger:disabled, .btn--danger:disabled:hover { background: var(--page); color: var(--ink-3); border-color: var(--line-2); opacity: 0.7; }
.btn--danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn--danger-solid:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.btn--sm { min-height: 28px; padding: 0 10px; font-size: 0.8125rem; }

/* ───────────── The table ───────────── */

.table { width: 100%; border-collapse: collapse; }
.table caption { text-align: left; }
.table th {
  position: sticky; top: var(--top-h); z-index: 2;
  padding: 8px 10px; background: var(--page);
  border-bottom: 1px solid var(--line);
  text-align: left; font-size: 0.8125rem; font-weight: 500; color: var(--ink-3); white-space: nowrap;
}
.table td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th:first-child, .table td:first-child { padding-left: 2px; }
.table tbody tr:not(.group):hover td { background: var(--well); }
.table .num { text-align: right; }
.table .date { white-space: nowrap; color: var(--ink-2); width: 1%; }
.table .type { color: var(--ink-2); white-space: nowrap; }
.table .field { color: var(--ink-2); }
.table td.title { width: 52%; min-width: 18rem; max-width: 0; }
/* One line per document: icon, title (ellipsised), tags, then the grey number. */
.doc { display: flex; align-items: center; gap: 8px; min-width: 0; }
.doc-link { color: var(--ink); font-weight: 500; }
/* The title keeps its space first; the grey number gives way before it. */
.doc .doc-link { flex: 0 1 auto; min-width: 4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .marks { flex: none; margin-left: 0; }
.doc-meta { flex: 0 100 auto; min-width: 6.25em; overflow: hidden; text-overflow: ellipsis; font-size: 0.8125rem; color: var(--ink-3); white-space: nowrap; }
.doc-link:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-4); }
.sub { display: block; margin-top: 1px; font-size: 0.8125rem; color: var(--ink-3); }
.type-inline { display: none; }

.group th {
  position: static; padding: 12px 2px 4px; background: none;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem; font-weight: 600; color: var(--ink);
}
.group-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px 2px 2px;
  border: 0; border-radius: var(--r-tag); background: none; color: inherit; font-weight: 600;
}
.group-toggle:hover { background: var(--hover); }
.group-toggle .chev { color: var(--ink-3); rotate: 90deg; transition: rotate 120ms var(--ease-out); }
.group-toggle[aria-expanded="false"] .chev { rotate: 0deg; }
.group-toggle .step + .step::before { content: "›"; margin: 0 6px; color: var(--ink-4); font-weight: 400; }
.group-head { display: inline-flex; align-items: center; gap: 6px; }
.group .count { font-weight: 400; color: var(--ink-3); }

/* Folders */
.folder-row a { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; }
.folder-row a:hover { text-decoration: none; color: var(--accent-deep); }
.folder-row a .icon { color: var(--ink-3); }
.folder-row.unlinked a { color: var(--ink-2); font-style: italic; }
.folder-row td.num { color: var(--ink-2); width: 1%; white-space: nowrap; }

/* "Filed under" chips and linked names */
.filed, .names { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.filed a {
  display: inline-flex; align-items: center; gap: 4px; max-width: 16rem;
  padding: 1px 7px 1px 5px; border-radius: var(--r-tag);
  background: var(--hover); color: var(--ink-2); font-size: 0.8125rem; text-decoration: none;
  transition: background-color 120ms var(--ease-out), color 120ms var(--ease-out);
}
.filed a .icon { width: 13px; height: 13px; color: var(--ink-3); }
.filed a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filed a:hover, .filed a:focus-visible { background: var(--accent-wash); color: var(--accent-deep); text-decoration: none; }
.filed a:hover .icon, .filed a:focus-visible .icon { color: var(--accent); }
.names li { color: var(--ink-2); }
.names li + li::before { content: "·"; margin-right: 4px; color: var(--ink-4); }

/* Tags (restricted classes, legal hold) */
.marks { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: 1px; }
.tag {
  display: inline-block; padding: 0 6px; border-radius: var(--r-tag);
  font-size: 0.75rem; font-weight: 500; line-height: 1.55; white-space: nowrap;
}
.tag--pink { background: var(--tag-pink); color: var(--tag-pink-ink); }
.tag--green { background: var(--tag-green); color: var(--tag-green-ink); }
.tag--blue { background: var(--tag-blue); color: var(--tag-blue-ink); }
.tag--purple { background: var(--tag-purple); color: var(--tag-purple-ink); }
.tag--orange { background: var(--tag-orange); color: var(--tag-orange-ink); }
.tag--yellow { background: var(--tag-yellow); color: var(--tag-yellow-ink); }
.tag--brown { background: var(--tag-brown); color: var(--tag-brown-ink); }
.tag--hold { background: var(--tag-hold); color: var(--tag-hold-ink); }

.table-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px;
  padding: 10px 2px; font-size: 0.8125rem; color: var(--ink-3);
}
.pager { display: flex; gap: 6px; }

/* ───────────── Callouts and empty states ───────────── */

.callout {
  display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--well); border: 1px solid var(--line); border-radius: var(--r-pop);
  color: var(--ink-2);
}
.callout > .icon { margin-top: 2px; color: var(--ink-3); }
.callout-body { flex: 1; min-width: 12rem; }
.callout strong { color: var(--ink); font-weight: 600; }
.callout--error { background: var(--red-wash); border-color: var(--red-line); color: var(--ink); }
.callout--error > .icon, .callout--error strong { color: var(--red); }
.callout:focus { outline: none; }

.empty { padding: 48px 0 40px; max-width: 34rem; }
.empty h2 { font-size: 1.0625rem; font-weight: 600; margin-bottom: 6px; }
.empty p { color: var(--ink-2); }
.empty p + p, .empty p + .btn, .empty p + ul, .empty p + form { margin-top: 12px; }

/* ───────────── Search ───────────── */

.find { max-width: 56rem; }
.split.has-peek .find, .split.has-peek.find { max-width: none; }
.find > .panel, .find > .empty + .panel { margin-top: 16px; }
.find > .empty { padding: 28px 0 4px; }
.find-form { display: flex; gap: 8px; margin-bottom: 8px; }
.find-field { position: relative; flex: 1; }
.find-field .icon { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.find-field input {
  width: 100%; height: 44px; padding: 0 14px 0 42px;
  border: 1px solid var(--line-2); border-radius: var(--r-pop);
  background: var(--page); font-size: 1rem; color: var(--ink);
  transition: border-color 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
.find-field input::placeholder { color: var(--ink-3); }
.find-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.find-form .btn { min-height: 44px; padding: 0 18px; border-radius: var(--r-pop); }
.find-count { margin: 16px 0 4px; font-size: 0.8125rem; color: var(--ink-3); }
.tries { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 14px 0 0; list-style: none; }
.tries a {
  display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 0.8125rem; text-decoration: none;
}
.tries a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }

.hits { margin: 0; padding: 0; list-style: none; }
.hit { display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.hit:last-child { border-bottom: 0; }
.hit > .thumb { margin-top: 2px; }
.hit.is-selected { background: var(--accent-wash); }
.hit.is-selected .doc-link { color: var(--accent-deep); }
.hit-main { flex: 1; min-width: 0; }
.hit-meta { display: flex; flex-wrap: wrap; margin-top: 2px; font-size: 0.8125rem; color: var(--ink-3); }
.hit-meta > span { white-space: nowrap; }
.hit-meta > span:not(:last-child)::after { content: "·"; margin: 0 6px; color: var(--ink-4); }
.hit-meta > span.names-inline { white-space: normal; }
.hit-main > .flag, .type-link + .flag { margin-left: 8px; vertical-align: 1px; }
.snippet { display: block; margin-top: 6px; font-size: 0.8125rem; line-height: 1.55; color: var(--ink-2); max-width: 70ch; }
.snippet mark { background: var(--sky-wash); color: var(--ink); border-radius: var(--r-tag); padding: 0 2px; box-shadow: inset 0 -1.5px 0 var(--accent); }
.found-in { display: block; margin-top: 4px; font-size: 0.75rem; color: var(--ink-3); }

/* ───────────── The gate: sign-in, sign-out, choosing a tenant ───────────── */

/* Two halves on a wide screen: the form, and a brand panel where Athena's mark is found among the documents. */
.gate-page { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 44%); }
.gate-page:not(:has(.gate-art)) { display: block; }
.gate-side { display: flex; flex-direction: column; min-height: 100dvh; min-width: 0; }
.gate-side > main { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.gate-side > main:focus { outline: none; }
.gate-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; padding: 16px 20px 18px; font-size: 0.75rem; color: var(--ink-3); }
.gate-art {
  position: sticky; top: 0; height: calc(100dvh - var(--uifirst-bar, 0px)); display: flex; flex-direction: column; justify-content: center; gap: 44px;
  padding: 56px clamp(40px, 6vw, 104px); background: var(--canvas); border-left: 1px solid var(--line); overflow: hidden;
}
.gate-field { display: block; width: 100%; max-width: 420px; height: auto; }
.gate-doc { fill: #e3e2de; }
.gate-doc--light { fill: #eae9e5; }
/* The one authored moment: the mark's squares light up in its order, navy to red, a beat after the page appears. */
.gate-lit { fill: var(--fill); transform-box: fill-box; transform-origin: center; animation: gate-found 560ms var(--ease-out) both; animation-delay: calc(380ms + var(--step) * 120ms); }
@keyframes gate-found { from { fill: #e3e2de; transform: scale(0.84); } }
.gate-pitch h2 { max-width: 19ch; font-size: 1.75rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--ink); text-wrap: balance; }
.gate-pitch ul { display: grid; gap: 12px; max-width: 30rem; margin: 22px 0 0; padding: 0; list-style: none; }
.gate-pitch li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9375rem; line-height: 1.45; color: var(--ink-2); }
.gate-pitch .icon { flex: none; width: 16px; height: 16px; margin-top: 3px; color: var(--ink-3); }
/* With the brand panel beside it, the form needs no mark of its own; on a phone it keeps one. */
.gate-page:has(.gate-art) .gate-mark { display: none; }
@media (max-width: 960px) {
  .gate-page { display: block; }
  .gate-art { display: none; }
  .gate-page:has(.gate-art) .gate-mark { display: block; }
}
@media (prefers-reduced-motion: reduce) { .gate-lit { animation: none; } }
.gate-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; text-decoration: none; }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand svg { width: 24px; height: 24px; flex: none; }
.brand small { font-weight: 400; font-size: 0.8125rem; color: var(--ink-3); letter-spacing: 0; }
.gate-user { display: flex; align-items: center; gap: 10px; font-size: 0.8125rem; color: var(--ink-2); }
.gate-user form { margin: 0; }

.gate { width: auto; max-width: 22.5rem; margin: 40px auto 56px; padding: 0 20px; box-sizing: content-box; }
.gate--wide { max-width: 36rem; }
.gate-mark { display: block; width: 36px; height: 36px; margin-bottom: 22px; }
.gate-mark svg { display: block; width: 100%; height: 100%; }
.gate h1 { font-size: 1.625rem; font-weight: 700; letter-spacing: -0.02em; }
.gate-sub { margin-top: 6px; color: var(--ink-3); font-size: 0.875rem; }
.gate-sub b { font-weight: 600; color: var(--ink); white-space: nowrap; }
.gate-form { margin-top: 24px; }
.gate .callout { margin: 20px 0 0; }
.gate .callout + .gate-form { margin-top: 16px; }
.form-field { display: block; margin-bottom: 14px; }
.form-field > label:not(.check) { display: block; margin-bottom: 5px; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); }
.form-field > input, .reveal-field input, .retention-amount input {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--page); color: var(--ink); font-size: 0.9375rem;
  transition: border-color 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
.form-field > input::placeholder, .reveal-field input::placeholder { color: var(--ink-4); }
.form-field > input:focus, .reveal-field input:focus, .retention-amount input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.form-field > input[aria-invalid="true"], .reveal-field input[aria-invalid="true"], .retention-amount input[aria-invalid="true"] { border-color: var(--red); }
.form-field > input[aria-invalid="true"]:focus, .reveal-field input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--red-ring); }
.form-field--code input { height: 48px; font-size: 1.375rem; letter-spacing: 0.35em; text-align: center; padding-left: calc(11px + 0.35em); }
.form-field--recovery input { height: 44px; font-size: 1.125rem; letter-spacing: 0.1em; text-align: center; text-transform: uppercase; }
.gate-alt { display: block; margin-top: 14px; text-align: center; font-size: 0.8125rem; }

/* Accepting an invitation (US-031): three steps, the authenticator's QR and key, the recovery codes. */
.js-only { display: none; }
.js .js-only { display: inline-flex; }
.gate-steps { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 16px 0 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--ink-3); }
.gate-steps li { display: inline-flex; align-items: center; gap: 6px; }
.gate-steps .icon { width: 14px; height: 14px; color: var(--ink-2); }
.gate-steps li.is-done { color: var(--ink-2); }
.gate-steps li.is-current { color: var(--ink); font-weight: 600; }
.gate-step-n { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--line-2); border-radius: 50%; font-size: 0.6875rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.gate-steps li.is-current .gate-step-n { border-color: var(--navy); background: var(--navy); color: var(--page); }
.reveal-field { position: relative; }
.reveal-field input { padding-right: 64px; }
.reveal-toggle { display: none; position: absolute; top: 50%; right: 6px; transform: translateY(-50%); padding: 3px 8px; border: 0; border-radius: var(--r); background: none; font-size: 0.8125rem; color: var(--accent); cursor: pointer; }
.js .reveal-toggle { display: block; }
.reveal-toggle:hover { background: var(--hover); }
.auth-steps { margin: 0 0 20px; padding: 0; list-style: none; counter-reset: auth; font-size: 0.875rem; color: var(--ink-2); }
.auth-steps > li { position: relative; padding: 0 0 18px 30px; counter-increment: auth; }
.auth-steps > li::before { content: counter(auth); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--well); font-size: 0.75rem; font-weight: 600; color: var(--ink-2); }
.auth-steps label { display: block; margin-bottom: 8px; color: var(--ink-2); font-weight: 400; }
.auth-steps .form-field { margin: 0; }
.auth-steps .form-field--code input { max-width: 15rem; }
.gate-form--narrow { max-width: 26rem; }
.auth-qr { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; margin-top: 12px; }
.qr { display: block; width: 148px; height: 148px; border: 1px solid var(--line); border-radius: var(--r); }
.auth-key { flex: 1 1 12rem; min-width: 0; font-size: 0.8125rem; color: var(--ink-3); }
.auth-key code, .recovery-codes code { font-family: ui-monospace, "SF Mono", Consolas, monospace; color: var(--ink); }
.auth-key code { display: block; margin-top: 6px; font-size: 0.875rem; letter-spacing: 0.04em; line-height: 1.6; word-spacing: 0.2em; }
.auth-lead { font-size: 0.875rem; color: var(--ink-2); }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 14px 0 12px; padding: 14px 16px; list-style: none; border: 1px solid var(--line); border-radius: var(--r); background: var(--page); }
.recovery-codes code { font-size: 0.9375rem; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.recovery-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.gate-form .check + .btn { margin-top: 12px; }
@media print {
  .gate:has(.recovery-codes) :is(.gate-mark, .gate-steps, .recovery-actions, .check, .btn, .gate-aside) { display: none !important; }
  /* My account's new codes: only the heading and the codes. */
  body:has(.me-codes) :is(.sidebar, .topbar, .acting, .page-head, .callout, .work > .panel:not(.me-codes), .recovery-actions, .danger-text) { display: none !important; }
}
.gate-note { margin-top: 16px; font-size: 0.8125rem; color: var(--ink-3); }
.gate-aside { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.8125rem; color: var(--ink-3); }
.gate-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 24px; font-size: 0.875rem; }

/* Tenant list (the workspace list) */
.gate-caption { margin: 28px 0 8px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-3); }
.gate .callout + .tenants { margin-top: 12px; }
.gate-warn { display: flex; align-items: baseline; gap: 8px; margin: -2px 0 10px; font-size: 0.8125rem; color: var(--ink-2); }
.tenants { margin: 0; padding: 4px; list-style: none; border: 1px solid var(--line); border-radius: var(--r-pop); }
.tenants form { margin: 0; }
.tenant {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 10px; border: 0; border-radius: var(--r);
  background: none; color: var(--ink); text-align: left;
  transition: background-color 120ms var(--ease-out);
}
.tenant:hover { background: var(--hover); }
.tenant-text { flex: 1; min-width: 0; line-height: 1.35; }
.tenant-text b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-text span { display: block; font-size: 0.8125rem; color: var(--ink-3); }
.tenant-state { flex: none; font-size: 0.8125rem; color: var(--ink-3); }
.tenant[aria-current] .tenant-state { color: var(--accent); display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.tenant .go { color: var(--ink-4); }
.tenant:hover .go { color: var(--ink-2); }

/* ───────────── Narrow screens ───────────── */

@media (max-width: 1180px) {
  .work { padding-inline: 24px; }
  .split.has-peek { display: block; }
  .peek {
    position: fixed; inset: 0 0 0 auto; z-index: 55; width: min(400px, 100vw);
    max-height: none; border-radius: 0; border-width: 0 0 0 1px; box-shadow: var(--pop-shadow);
  }
  /* The drawer covers the page: a scrim behind it; the page underneath is inert (site.js). */
  .split.has-peek::before { content: ""; position: fixed; inset: 0; z-index: 54; background: rgb(15 15 15 / 0.22); }
  .table .col-type { display: none; }
  .table .type-inline { display: inline; }
}

/* The page viewer (US-016): one page at a time on the canvas, a thumbnail strip, the scanned text beside it.
   Without script (no .is-paged) every page shows, one under another, with its text; the controls hide. */
.viewer { container: viewer / inline-size; display: grid; min-width: 0; background: var(--canvas); border-radius: var(--r-pop); --v-scale: 1; --v-rot: 0deg; --v-chrome: 15rem; }
.viewer:focus { outline: none; }
.viewer-bar { display: none; align-items: center; flex-wrap: wrap; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
.viewer.is-paged .viewer-bar { display: flex; }
.viewer-prev .icon { transform: rotate(180deg); }
.viewer-bar .icon-btn:disabled { opacity: 0.35; cursor: default; background: none; }
.viewer-count { min-width: 6.5rem; text-align: center; font-size: 0.8125rem; color: var(--ink-2); white-space: nowrap; }
.viewer-sep { width: 1px; height: 18px; margin: 0 6px; background: var(--line-2); }
.viewer-zoom { height: 30px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--page); font-size: 0.8125rem; }
.viewer-text-btn[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent-ring); color: var(--accent-deep); }
.viewer-find { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; height: 30px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--page); color: var(--ink-3); }
.viewer-find:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.viewer-find input { width: 10rem; min-width: 0; border: 0; outline: 0; background: none; font-size: 0.8125rem; color: var(--ink); }
.viewer-hits { font-size: 0.75rem; color: var(--ink-3); }
.viewer-hits:empty { display: none; }

.viewer-stage { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 20px; min-width: 0; padding: 20px; overflow-x: auto; }
.viewer.is-paged .viewer-page:not(.is-current) { display: none; }
.viewer-page { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "sheet" "cap" "side"; gap: 8px; margin: 0; min-width: 0; }
.viewer-sheet-wrap { grid-area: sheet; position: relative; width: min(100%, 52rem); margin-inline: auto; aspect-ratio: 210 / 297; }
.viewer[data-side] .viewer-sheet-wrap { aspect-ratio: 297 / 210; width: min(100%, 64rem); }
.viewer-sheet {
  position: absolute; top: 50%; left: 50%; width: 100%; aspect-ratio: 210 / 297;
  translate: -50% -50%; rotate: var(--v-rot); transition: rotate 160ms var(--ease-out);
  background: var(--page); box-shadow: 0 0 0 1px var(--thumb-edge), 0 2px 6px rgb(15 15 15 / 0.06);
}
.viewer[data-side] .viewer-sheet { width: calc(100% * 210 / 297); }
.viewer-img { object-fit: contain; }
/* Fit the page: the whole sheet in view. */
.viewer[data-zoom="page"] .viewer-sheet-wrap { width: min(100%, calc((100dvh - var(--v-chrome)) * 210 / 297)); }
.viewer[data-zoom="page"][data-side] .viewer-sheet-wrap { width: min(100%, calc((100dvh - var(--v-chrome)) * 297 / 210)); }
/* Zoomed: wider than the stage, which scrolls and can be dragged. */
.viewer[data-zoom="scale"] .viewer-stage { max-height: calc(100dvh - 12rem); overflow: auto; cursor: grab; }
.viewer[data-zoom="scale"] .viewer-stage.is-dragging { cursor: grabbing; user-select: none; }
.viewer[data-zoom="scale"] .viewer-sheet-wrap { width: calc(100% * var(--v-scale)); max-width: none; }
.viewer[data-zoom="scale"] .viewer-page { justify-items: start; }

/* The drawn stand-in page, until a render exists. */
.vpage { container-type: inline-size; overflow: hidden; }
.vpage-body { position: absolute; inset: 0; display: grid; align-content: start; gap: 2.6cqi; padding: 12cqi 11cqi; }
.vpage i { display: block; height: max(2px, 0.9cqi); background: var(--thumb-soft); border-radius: 1px; }
.vpage i:nth-child(1) { width: 42%; height: max(3px, 1.6cqi); background: var(--thumb-ink); }
.vpage i:nth-child(2) { width: 26%; margin-bottom: 5cqi; }
.vpage i:nth-child(5n + 4) { width: 92%; }
.vpage i:nth-child(6) { width: 64%; margin-bottom: 3cqi; }
.vpage i:nth-child(11) { width: 58%; }
.vpage i:nth-child(12) { width: 30%; margin-top: 8cqi; background: var(--thumb-ink); }
.vpage--sheet b { display: block; width: 100%; height: 7cqi; background: var(--ink); }
.vpage--sheet i { width: 60%; margin-top: 3cqi; }
.vpage--sheet i:nth-child(2) { width: 60%; height: max(3px, 2cqi); margin-top: 8cqi; background: var(--thumb-ink); }
.vpage--sheet em { position: absolute; right: 11cqi; bottom: 11cqi; width: 26cqi; aspect-ratio: 1; background: conic-gradient(var(--ink) 25%, transparent 0 50%, var(--ink) 0 75%, transparent 0) 0 0 / 5cqi 5cqi; }
.viewer-page.is-failed .viewer-sheet { visibility: hidden; }
.viewer-failed { position: absolute; inset: 0; display: grid; place-content: center; gap: 4px; padding: 16px; text-align: center; font-size: 0.8125rem; color: var(--ink-2); background: var(--well); box-shadow: inset 0 0 0 1px var(--line-2); }
.viewer-failed[hidden] { display: none; }

.viewer-caption { grid-area: cap; display: flex; justify-content: center; flex-wrap: wrap; gap: 2px 10px; font-size: 0.75rem; color: var(--ink-3); }
.viewer-caption span + span { color: var(--ink-2); }
.viewer-caption span + span::before { content: "·"; margin-right: 10px; color: var(--ink-4); }
.viewer-side { grid-area: side; display: grid; align-content: start; gap: 12px; min-width: 0; }
.viewer-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.viewer-text { display: none; padding: 12px 14px; background: var(--page); border: 1px solid var(--line); border-radius: var(--r); }
.viewer:not(.is-paged) .viewer-text, .viewer.show-text .viewer-text { display: block; }
.viewer-text-head { margin-bottom: 6px; font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.viewer-text p { white-space: pre-wrap; font-size: 0.8125rem; line-height: 1.6; color: var(--ink-2); max-width: 70ch; }
.viewer-text mark { background: var(--sky-wash); color: var(--ink); border-radius: var(--r-tag); padding: 0 2px; box-shadow: inset 0 -1.5px 0 var(--accent); }
.viewer.is-paged:not(.show-text) .viewer-page:not(:has(.viewer-actions)) .viewer-side { display: none; }
/* A narrow viewer (review's column, a phone): one row of controls, find below; zoom stays on + and −. */
@container viewer (max-width: 30rem) {
  .viewer-zoom, .viewer-sep { display: none; }
  .viewer-count { min-width: 0; padding: 0 4px; }
  .viewer-find { flex: 1 1 8rem; margin: 0 0 0 4px; }
  .viewer-find input { width: 100%; }
  .viewer-stage { padding: 12px; }
}
/* Room for the text or the page's actions beside the sheet. */
@container viewer (min-width: 44rem) {
  .viewer.show-text .viewer-page, .viewer-page:has(.viewer-actions) { grid-template-columns: minmax(0, 1fr) 18rem; grid-template-areas: "sheet side" "cap side"; align-items: start; column-gap: 20px; }
  .viewer.show-text .viewer-text { position: sticky; top: 0; max-height: calc(100dvh - 12rem); overflow: auto; }
  .viewer-page:has(.viewer-actions) .viewer-actions { justify-content: flex-start; }
  /* Fitting the page, the sheet and its side sit together in the middle. */
  .viewer[data-zoom="page"].show-text .viewer-page, .viewer[data-zoom="page"] .viewer-page:has(.viewer-actions) { grid-template-columns: auto 18rem; justify-content: center; }
  .viewer[data-zoom="page"].show-text .viewer-sheet-wrap, .viewer[data-zoom="page"] .viewer-page:has(.viewer-actions) .viewer-sheet-wrap { width: min(calc(100cqi - 18rem - 60px), calc((100dvh - var(--v-chrome)) * 210 / 297)); }
  .viewer[data-zoom="page"][data-side].show-text .viewer-sheet-wrap, .viewer[data-zoom="page"][data-side] .viewer-page:has(.viewer-actions) .viewer-sheet-wrap { width: min(calc(100cqi - 18rem - 60px), calc((100dvh - var(--v-chrome)) * 297 / 210)); }
}

.viewer-strip { display: none; gap: 6px; margin: 0; padding: 8px 12px 10px; overflow-x: auto; list-style: none; border-top: 1px solid var(--line-2); }
.viewer.is-paged .viewer-strip { display: flex; }
.viewer-thumb { display: grid; justify-items: center; gap: 4px; padding: 5px 6px 3px; border: 0; border-radius: var(--r); background: none; font-size: 0.6875rem; color: var(--ink-3); }
.viewer-thumb:hover { background: var(--hover); }
.viewer-thumb .pg { width: 38px; height: 52px; padding: 6px 5px; gap: 3px; }
.viewer-thumb .pg--sheet { width: 38px; height: 52px; }
.viewer-thumb.is-current { background: var(--accent-wash); color: var(--accent-deep); font-weight: 600; }
.viewer-thumb.is-current .pg { border-color: var(--accent); }

/* Opened over another screen (intake): a dialog; Esc closes it. */
.viewer-dialog { width: min(76rem, calc(100vw - 32px)); height: calc(100dvh - 32px); max-height: none; padding: 0; overflow: hidden; border: 0; border-radius: var(--r-pop); background: var(--page); color: var(--ink); box-shadow: var(--pop-shadow); }
.viewer-dialog::backdrop { background: rgb(15 15 15 / 0.4); }
.viewer-dialog-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.viewer-dialog-head h2 { flex: 1; min-width: 0; font-size: 0.9375rem; font-weight: 600; }
.viewer-dialog-head form { margin: 0; }
.viewer-dialog[open] { display: flex; flex-direction: column; }
.viewer-dialog .viewer { flex: 1; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; border-radius: 0; --v-chrome: 19rem; }
.viewer-dialog .viewer-stage, .viewer-dialog .viewer[data-zoom="scale"] .viewer-stage { max-height: none; overflow: auto; }
/* Without script the dialog is open but not modal: pin it over the page all the same. */
.viewer-dialog[open]:not(:modal) { position: fixed; inset: 16px; z-index: 70; margin: auto; }
.viewer-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.viewer-page-actions form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.viewer-page-actions .flag-text { flex-basis: 100%; font-size: 0.8125rem; }

/* A document's own page: its pages in the viewer, its details beside them (US-016). */
.doc-head-bar { justify-content: space-between; }
.doc-heading { display: grid; gap: 6px; min-width: 0; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 23rem); gap: 16px; align-items: start; }
.doc-pages { min-width: 0; }
/* Fitting the page leaves room for the head and actions above it, so the strip shows there are more pages. */
.doc-pages .viewer { --v-chrome: 24rem; }
.doc-side { display: grid; gap: 16px; min-width: 0; }
.doc-side > .panel { margin: 0; }
.doc-props { margin: 0; padding: 2px 14px 6px; }
.doc-props > div:last-child { border-bottom: 0; }
.doc-props small { font-size: 0.75rem; color: var(--ink-3); }
.doc-panel-note { padding: 12px 14px; font-size: 0.8125rem; color: var(--ink-3); }
.doc-filed { display: grid; gap: 12px; margin: 0; padding: 12px 14px; list-style: none; }
.doc-filed-view { display: block; margin-bottom: 4px; font-size: 0.75rem; font-weight: 600; color: var(--ink-3); }
.doc-versions { margin: 0; padding: 4px; list-style: none; }
.doc-versions a { display: grid; gap: 1px; padding: 8px 10px; border-radius: var(--r); font-size: 0.8125rem; color: var(--ink); text-decoration: none; }
.doc-versions a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.doc-versions .is-selected a { background: var(--accent-wash); }
.doc-versions b { font-weight: 600; }
.doc-versions .is-selected b { color: var(--accent-deep); }
.doc-current { font-weight: 400; color: var(--ink-3); }
.doc-versions span { color: var(--ink-2); }
.doc-versions small { font-size: 0.75rem; color: var(--ink-3); }
.doc-edit-body { padding: 14px; }
.doc-links { margin: 0 0 8px; padding: 0; list-style: none; }
.doc-links .check { padding: 4px 0; }
/* My account (US-033): rows of the person's sign-in, the change forms above them, recent sign-ins. */
.me-change, .me-codes { margin-bottom: 16px; }
.me-form { padding: 14px; }
.me-form .panel-title { margin-bottom: 4px; }
.me-form .danger-text { margin-bottom: 12px; max-width: 44rem; }
.me-form .form-field { max-width: 26rem; }
.me-code input { max-width: 15rem; }
.me-codes .recovery-codes { max-width: 26rem; }
.me-done { margin-left: auto; }
.me-rows { margin: 0; padding: 0; list-style: none; }
.me-rows li { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 14px; }
.me-rows li + li { border-top: 1px solid var(--line); }
.me-rows li > div { min-width: 0; }
.me-rows b { display: block; font-size: 0.875rem; font-weight: 600; }
.me-rows b .flag { display: inline-flex; margin-left: 8px; vertical-align: 1px; font-weight: 500; }
.me-rows span { display: block; margin-top: 2px; font-size: 0.8125rem; color: var(--ink-3); }
.me-rows .me-low { display: inline; font-weight: 600; color: var(--accent-deep); }
.me-signins td.date { width: 1%; white-space: nowrap; }
.me-signins td.title { width: 30%; min-width: 12rem; max-width: none; }

/* Processing (US-020): the two choices side by side, the current one named, and the history of the choice. */
.proc-change { margin-bottom: 16px; }
.proc-state { margin-top: 2px; }
.proc-state b { font-weight: 600; color: var(--ink); }
.proc-change-body { padding: 14px; }
.proc-change-body .panel-title { margin-bottom: 4px; }
.proc-change-body .danger-text { margin-bottom: 12px; max-width: 44rem; }
.proc-options { display: grid; grid-template-columns: 1fr 1fr; }
.proc-option { padding: 14px; }
.proc-option + .proc-option { border-left: 1px solid var(--line); }
.proc-option h3 { display: flex; align-items: center; gap: 8px; font-size: 0.9375rem; font-weight: 600; }
.proc-option:not(.is-current) h3 { color: var(--ink-2); }
.proc-option .props > div { grid-template-columns: 9rem minmax(0, 1fr); }
.proc-rate { font-weight: 600; font-variant-numeric: tabular-nums; }
.proc-who span, .proc-who small, .proc-history td.title small { display: block; }
.proc-who small, .proc-history td.title small { font-size: 0.75rem; color: var(--ink-3); }
.proc-history td.proc-reason { color: var(--ink-2); font-size: 0.8125rem; }
.proc-history td.date { width: 1%; white-space: nowrap; }
.proc-who span { white-space: nowrap; }
.proc-history td.title { width: 30%; min-width: 12rem; max-width: none; }

/* The audit log (US-022): filters as chips, the events newest first, an event's detail in the peek. */
.audit-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.audit-filters .chip input[type="date"] { border: 0; background: none; font: inherit; font-size: 0.8125rem; color: var(--ink); }
.chip-check { gap: 6px; cursor: pointer; }
.chip-check input { margin: 0; }
.audit-filters .audit-search { flex: 1 0 16rem; max-width: 24rem; height: 32px; }
/* With an event open the list gives up the tenant column; the peek names it. */
.split.has-peek .audit-table .audit-tenant { display: none; }
.audit-table td.date { width: 1%; }
.audit-who span { display: block; white-space: nowrap; }
.audit-who small { display: block; font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; }
.audit-table td.audit-what { width: auto; }
.audit-reason { display: block; margin-top: 1px; font-size: 0.8125rem; color: var(--ink-2); }
.audit-group { display: block; margin-top: 1px; font-size: 0.75rem; color: var(--ink-3); }
.audit-support { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; color: var(--ink-2); }
.audit-support .icon { width: 12px; height: 12px; }
.audit-changes { margin-bottom: 4px; font-size: 0.8125rem; }
.audit-changes th, .audit-changes td { padding: 5px 8px 5px 0; }
.audit-session-head { font-size: 0.8125rem; color: var(--ink-2); }
.audit-session-head small { font-size: 0.75rem; color: var(--ink-3); }
.audit-session { display: grid; gap: 1px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 0.8125rem; }
.audit-session a { display: block; padding: 5px 8px; border-radius: var(--r); color: var(--ink); text-decoration: none; }
.audit-session a:hover { background: var(--hover); text-decoration: none; }
.audit-session li.is-selected a { background: var(--accent-wash); color: var(--accent-deep); }
.audit-session span { color: var(--ink-3); font-variant-numeric: tabular-nums; margin-right: 6px; }

/* Pilot metrics (US-021): the targets as cards with a daily trend, then volumes, stage timings and what's behind a measure. */
.pilot-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.pilot-filters .chip input { border: 0; background: none; font: inherit; font-size: 0.8125rem; color: var(--ink); }
.pilot-targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 16px; margin-bottom: 16px; }
.pilot-targets > .panel { margin: 0; }
.pilot-card { display: grid; align-content: start; gap: 4px; padding: 14px 16px 16px; }
.pilot-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pilot-card-head h2 { font-size: 0.875rem; font-weight: 600; }
.pilot-status { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.pilot-status .icon { width: 13px; height: 13px; }
.pilot-status.is-met { color: var(--ink-2); }
/* A missed target needs someone's attention: the accent, not red (it isn't an error). */
.pilot-status.is-missed { color: var(--accent-deep); }
.pilot-value { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.pilot-card.is-reported .pilot-value { color: var(--ink-2); }
.pilot-target { font-size: 0.8125rem; color: var(--ink-2); }
.pilot-trend { display: block; width: 100%; height: 36px; margin-top: 8px; }
/* Days on target in sky, days that missed in navy (darker, so it reads without colour too); in the action blue only
   where the target itself isn't met, because that needs someone. The numbers are in the chart's text alternative. */
.pilot-trend rect { fill: var(--sky); }
.pilot-trend rect.off { fill: var(--navy); }
.pilot-trend rect.off.needs { fill: var(--accent); }
.pilot-trend line.target { stroke: var(--ink-3); stroke-width: 0.6; stroke-dasharray: 2 1.5; vector-effect: non-scaling-stroke; }
.pilot-trend-note { font-size: 0.6875rem; color: var(--ink-3); }
.pilot-measure { margin-top: 6px; font-size: 0.75rem; color: var(--ink-3); }
.pilot-drill { margin-top: 6px; font-size: 0.8125rem; font-weight: 500; }
.pilot-threshold { margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); }
.pilot-threshold summary { cursor: pointer; color: var(--ink-2); }
.pilot-threshold-form { display: grid; gap: 6px; margin-top: 8px; }
.pilot-threshold-input { display: flex; align-items: center; gap: 6px; }
.pilot-threshold-input input { width: 4.5rem; height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r); font: inherit; }
.pilot-threshold-form .btn { justify-self: start; }
.pilot-drill[aria-current] { font-weight: 600; color: var(--accent-deep); }
.pilot-numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0; margin: 0; }
.pilot-numbers > div { padding: 12px 14px; border-right: 1px solid var(--line); }
.pilot-numbers > div:last-child { border-right: 0; }
.pilot-per, .pilot-throughput { color: var(--ink-3); font-size: 0.8125rem; }
.pilot-numbers dt { font-size: 0.75rem; color: var(--ink-3); }
.pilot-numbers dd { margin: 2px 0 0; font-size: 1.25rem; font-weight: 600; color: var(--ink); }
.pilot-stages td.title { width: 30%; min-width: 8rem; }
.pilot-items { scroll-margin-top: calc(var(--top-h) + 12px); }
.pilot-items:focus { outline: none; }
.pilot-item-label { font-weight: 500; }
/* The printable report: an A4 column on screen, its own page margins in print (the separator sheet's are 0). */
@page pilot { size: A4; margin: 14mm 12mm; }
.pilot-print { page: pilot; max-width: 210mm; margin: 0 auto; padding: 16px 20px 32px; }
.pilot-print .pilot-numbers { grid-template-columns: repeat(5, 1fr); }
.pilot-print-bar { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; font-size: 0.875rem; }
.pilot-print-head { margin-bottom: 16px; }
.pilot-print-head h1 { font-size: 1.5rem; font-weight: 700; }
.pilot-print-head p { font-size: 0.8125rem; color: var(--ink-2); }
.pilot-signoff { margin-top: 24px; font-size: 0.8125rem; color: var(--ink-2); }
.pilot-sign { display: grid; grid-template-columns: 2fr 1.5fr 1fr; gap: 24px; margin-top: 28px; }
.pilot-sign span { padding-top: 6px; border-top: 1px solid var(--ink-3); font-size: 0.75rem; color: var(--ink-3); }
@media print {
  .gate-bar, .gate-art, .gate-foot, .pilot-print-bar { display: none !important; }
  .pilot-print { max-width: none; padding: 0; }
  .pilot-targets { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .pilot-card { padding: 10px; }
  .pilot-value { font-size: 1.375rem; }
  .pilot-trend-note, .pilot-measure { display: none; }
  .pilot-card, .panel { break-inside: avoid; box-shadow: none; }
  .pilot-signoff { break-inside: avoid; break-before: avoid; }
}

/* Legal holds, disposal and its log (US-017–019). */
.tag--restricted { background: var(--hover); color: var(--ink-2); }
.hold-choices { display: grid; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.hold-choices form { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); }
.hold-choices b { display: block; font-weight: 600; }
.hold-choices small { font-size: 0.75rem; color: var(--ink-3); }
.hold-reason { padding: 12px 14px; font-size: 0.875rem; color: var(--ink-2); max-width: 70ch; }
.hold-entities { display: grid; gap: 4px; margin: 0; padding: 12px 14px 4px; list-style: none; font-size: 0.875rem; }
.hold-entities small, .hold-list small { font-size: 0.75rem; color: var(--ink-3); }
.hold-list { flex-direction: column; gap: 2px; }
.hold-list li + li::before { content: none; }
.hold-lift { margin-bottom: 16px; }
.hold-lift-body { padding: 14px; }
.hold-lift-body .panel-title { margin-bottom: 4px; }
.hold-lift-body .danger-text { margin-bottom: 12px; }
.scope-part { margin-top: 4px; }
.blocked-note { font-weight: 600; color: var(--ink-2); }
.er-when { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.er-when .form-field { margin-bottom: 16px; }
.decide-option { padding: 6px 0; }
.decide-choices .check { padding: 2px 0; }
.decide-help { margin: 0 0 0 26px; font-size: 0.8125rem; color: var(--ink-3); max-width: 36ch; }
.disposal-docs td.pick { width: 1%; padding-right: 0; }
.disposal-docs td.pick input { width: 16px; height: 16px; margin: 3px 0 0; }
.disposal-hidden { display: flex; gap: 10px; margin: 0; }
.scope-find { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.scope-find input { flex: 1; min-width: 10rem; height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r); font: inherit; font-size: 0.875rem; }
.scope-find .field-hint { flex-basis: 100%; margin: 0; }
.js .scope-find { display: none; }
/* The red button shows only while disposing is chosen: it can't be undone. */
.decide .decide-dispose { display: none; }
.decide:has(input[value="Approve"]:checked) .decide-dispose { display: inline-flex; }
.decide:has(input[value="Approve"]:checked) .decide-record { display: none; }
.decide:has(input[value="Approve"]:checked) .decide-optional { visibility: hidden; }
.decide:not(:has(input[value="Refuse"]:checked)) .decide-review { display: none; }
.log-filters .chip input { border: 0; background: none; font: inherit; font-size: 0.8125rem; color: var(--ink); }
.log-table td.title { width: 26%; min-width: 12rem; }
.log-table td.title b { font-weight: 500; }
.log-hash { display: block; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.6875rem; color: var(--ink-3); }
.log-decision .plan-row-text b { font-weight: 500; }
.log-lift { display: grid; gap: 6px; max-width: 32rem; margin: 8px 0 0; font-size: 0.8125rem; color: var(--ink-2); }
.log-lift input { height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r); font: inherit; font-size: 0.875rem; }

/* The file plan builder (US-009): the form beside a preview of the top folders. */
.plan-builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); gap: 16px; align-items: start; }
.plan-builder > .panel { margin: 0; }
.plan-form { padding: 16px 18px 18px; }
.plan-section { margin: 0 0 22px; padding: 0 0 18px; border: 0; border-bottom: 1px solid var(--line); }
.plan-section > .form-field:last-child { margin-bottom: 0; }
fieldset.plan-section > legend { margin-bottom: 4px; font-size: 0.9375rem; font-weight: 600; color: var(--ink); }
.plan-levels { display: grid; gap: 8px; margin: 8px 0 10px; padding: 0; list-style: none; }
.plan-level { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.plan-level-no { display: grid; place-items: center; width: 24px; height: 36px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-3); }
.plan-level-pick select { width: 100%; }
.plan-level-actions { display: flex; gap: 2px; padding-top: 3px; }
.plan-level-actions .icon-btn:disabled { opacity: 0.35; cursor: default; background: none; }
.plan-down .icon { transform: rotate(180deg); }
.plan-types, .plan-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0 16px; margin-top: 4px; }
.plan-types .check, .plan-columns .check { padding: 5px 0; }
.plan-dated { display: grid; gap: 2px; margin: 14px 0 0; padding: 0; border: 0; min-width: 0; }
.plan-dated-legend { margin-bottom: 4px; padding: 0; font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); }
.plan-dated .check { padding: 4px 0; }
.plan-dated-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.plan-dated-row input[type="number"], .plan-dated-row input[type="date"], .plan-dated-row select {
  height: 32px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r); background-color: var(--page); font-size: 0.875rem; color: var(--ink);
}
.plan-past-amount { width: 5rem; }
.plan-dated-row select.plan-past-unit { width: auto; flex: none; height: 32px; padding-right: 30px; background-position: right 8px center; font-size: 0.875rem; }
.plan-dated-row input[type="date"] { width: auto; }
.plan-dated-and { font-size: 0.875rem; color: var(--ink-3); }
/* A range's own fields are quiet until their choice is picked (typing in them picks it, site.js). */
.plan-dated-row:not(:has(input[type="radio"]:checked)) :is(input[type="number"], input[type="date"], select) { color: var(--ink-3); background-color: var(--well); }
.plan-share:has(input[data-was-shared="true"]:not(:checked)) .plan-unshare { display: flex; }
.plan-only-you { font-size: 0.875rem; color: var(--ink-2); }
.plan-delete { margin-right: auto; color: var(--red); }
.plan-delete:hover { color: var(--red-deep); }
.js [data-plan-refresh] { display: none; }
.plan-side { position: sticky; top: calc(var(--top-h) + 8px); padding: 14px 16px 16px; }
.plan-preview-title { margin-bottom: 8px; font-size: 0.875rem; font-weight: 600; }
.plan-preview-sum { margin-bottom: 8px; font-size: 0.8125rem; color: var(--ink-2); }
.plan-preview-sum b { color: var(--ink); font-weight: 600; }
.plan-preview-list { display: grid; gap: 1px; margin: 0 0 8px; padding: 0; list-style: none; font-size: 0.875rem; }
.plan-preview-list li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--r); }
.plan-preview-list li span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-preview-list .icon { color: var(--ink-3); }
.plan-preview-list .count { font-size: 0.75rem; color: var(--ink-3); }
.plan-preview-list li.unlinked span:first-of-type { color: var(--ink-3); font-style: italic; }
.plan-preview-note { font-size: 0.75rem; color: var(--ink-3); }
.plan-preview[aria-busy="true"] { opacity: 0.6; }
.plan-preview-path { margin: -4px 0 8px; font-size: 0.8125rem; color: var(--ink-3); }
.plan-preview-problem { margin-bottom: 8px; font-size: 0.8125rem; color: var(--red); }
.plan-preview-list li.is-open { background: var(--well); }
.plan-preview-inside { display: block !important; padding: 0 0 4px 22px !important; }
.plan-preview-inside ul { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; font-size: 0.8125rem; }
.plan-preview-more { padding: 2px 6px; font-size: 0.75rem; color: var(--ink-3); }
.plan-mini { display: none; margin-top: 8px; font-size: 0.8125rem; color: var(--ink-2); }
.plan-col-count { margin-left: 4px; font-weight: 600; color: var(--ink-2); }
/* Every file plan: shared ones in their sidebar order (admins move them), then your own. */
.plan-list { margin: 0; padding: 0; list-style: none; }
.plan-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.plan-row:last-child { border-bottom: 0; }
.plan-order { display: flex; gap: 0; }
.plan-order form { margin: 0; }
.plan-order .icon-btn:disabled { opacity: 0.35; cursor: default; background: none; }
.plan-row-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.plan-row-meta { font-size: 0.8125rem; color: var(--ink-3); }
.plan-row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-row-actions form { margin: 0; }
@media (max-width: 1100px) {
  .plan-builder { grid-template-columns: minmax(0, 1fr); }
  .plan-side { position: static; }
  .plan-mini:not(:empty) { display: block; }
}
@media (max-width: 860px) {
  .plan-row { flex-wrap: wrap; }
  .plan-row-actions { flex-basis: 100%; }
}

/* Entities (US-008): a list per type, one entity's page, the new form and the quick create in a dialog. */
.entity-bar { flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
.entity-bar .entity-search { flex: 1 1 16rem; max-width: 26rem; height: 32px; }
.entity-clear { font-size: 0.8125rem; }
.table.entities td.title { width: 34%; min-width: 14rem; }
.table.entities .col-field { color: var(--ink-2); }
.entity-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 23rem); gap: 16px; align-items: start; }
.entity-main { display: grid; gap: 16px; min-width: 0; }
.entity-main > .panel { margin: 0; }
.entity-props > div { grid-template-columns: 9rem minmax(0, 1fr); }
.entity-note { margin: -4px 0 12px; font-size: 0.8125rem; color: var(--ink-3); }
.entity-history li { padding: 8px 10px; font-size: 0.8125rem; }
.entity-change { display: grid; gap: 1px; }
.entity-change span { color: var(--ink-2); }
.entity-change small { font-size: 0.75rem; color: var(--ink-3); }
.entity-plans { flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 14px; margin: 0; list-style: none; }
.entity-new { display: grid; gap: 12px; max-width: 40rem; }
.entity-type-pick { margin: 0; }
.entity-new > .panel { margin: 0; }
/* The same name in the type: a person decides, so it wears the needs-you ring (not an error). */
.same-name { display: grid; gap: 4px; margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); }
.same-name strong { color: var(--ink); font-weight: 600; }
.same-name .check { padding: 2px 0; }
.same-choices { display: grid; gap: 2px; margin: 6px 0 0; padding: 0; border: 0; }
.same-choices .check { padding: 4px 0; }
/* In the quick dialog the matches push the form down rather than being clipped by it. */
.quick-dialog .link-options { position: static; margin-top: 4px; box-shadow: none; border: 1px solid var(--line-2); }
.quick-dialog { width: min(32rem, calc(100vw - 32px)); height: fit-content; max-height: calc(100dvh - 32px); overflow: auto; }
.quick-dialog[open] { display: block; }
.entity-quick { margin: 0; }
.entity-quick-body { padding: 16px 18px 18px; }
.entity-quick-body .panel-form-actions { margin-top: 12px; }
.quick-cancel { font-size: 0.875rem; }
.panel.danger + .entity-layout, .merge-panel + .entity-layout { margin-top: 16px; }
.doc-delete { margin-bottom: 16px; }
.review-delete { float: right; margin-left: 12px; }
.trash-title { font-weight: 500; color: var(--ink); }
.remember-device { margin: 4px 0 14px; }
.rules-form { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; padding: 14px; }
.rules-form .check { flex: 1 1 28rem; }
.delete-rights { margin-top: 14px; }
/* Tenant admins delete what they see: the rights are only for members. */
.panel-form:has(input[type="radio"][value="TenantAdmin"]:checked) .delete-rights { display: none; }
.class-option--small { padding: 6px 10px; }
.class-option--small .class-name { font-size: 0.8125rem; }
.review-delete-confirm { margin: 0 14px 14px; }
.doc-note { margin: -8px 0 12px; font-size: 0.8125rem; color: var(--ink-3); text-align: right; }
/* Merging (US-030): find the one to keep, then compare field by field; the final step is red (it removes one). */
.merge-body { padding: 14px; }
.merge-intro { margin-bottom: 12px; font-size: 0.875rem; color: var(--ink-2); max-width: 70ch; }
.merge-find { display: grid; gap: 10px; max-width: 32rem; }
.merge-find-actions { display: flex; align-items: center; gap: 16px; font-size: 0.875rem; }
.link-match { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: var(--r); color: var(--ink); font-size: 0.875rem; text-decoration: none; }
.link-match:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.link-match b { flex: 1; min-width: 0; font-weight: 500; }
.link-match small { font-size: 0.75rem; color: var(--ink-3); }
.merge-table { margin-bottom: 16px; }
.merge-table th[scope="row"] { width: 12rem; font-weight: 400; color: var(--ink-3); text-align: left; }
.merge-table td { width: 80%; }
.merge-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.merge-table tr.is-different td { color: var(--ink); }
.merge-choice { display: flex; align-items: flex-start; gap: 8px; padding: 4px 6px; border-radius: var(--r); cursor: pointer; }
.merge-choice:has(input:checked) { background: var(--accent-wash); }
.merge-choice input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; }
.merge-choice:has(input:checked) span { font-weight: 600; color: var(--accent-deep); }
.merge-same { color: var(--ink-4); }
.merge-table tbody th { padding: 7px 10px 7px 2px; border-bottom: 1px solid var(--line); vertical-align: top; }
/* Which side a choice is from: the column heads show it on wide screens (screen readers still hear it); on a phone each choice shows it. */
.merge-side { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; font-weight: 400; color: var(--ink-3); }
.merge-changed { margin-top: 2px; color: var(--accent-deep); }
.merge-moves { margin-bottom: 16px; font-size: 0.875rem; }
.merge-moves h3 { margin-bottom: 4px; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.merge-moves ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.merge-confirm { padding: 12px 0 0; border-top: 1px solid var(--line); }
.merge-confirm .danger-text strong { color: var(--ink); }
@media (max-width: 1180px) {
  .entity-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .entity-bar .entity-search { flex-basis: 100%; max-width: none; }
  /* Two dates on a phone: each says which it is. */
  .entity-docs td.date[data-label]::before { content: attr(data-label) ": "; color: var(--ink-4); }
  .disposal-docs td.date { display: block; padding-top: 0; }
  /* The tick gets its own gutter on a phone, left of the drawn page. */
  .disposal-docs tr:has(> td.pick) { position: relative; }
  /* Stage timings on a phone: each number says what it is. */
  /* An event on a phone: what happened first, then who, when and where on one line. */
  .audit-table tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; }
  .audit-table td.audit-what { order: -1; flex-basis: 100%; padding-left: 0; }
  .audit-table tr > td.audit-who, .audit-table tr > td.date, .audit-table tr > td.audit-tenant { order: 1; margin: 0; padding: 2px 0 0; font-size: 0.75rem; color: var(--ink-3); width: auto; }
  .audit-table td.audit-who span, .audit-table td.audit-who small { display: inline; font-size: 0.75rem; color: var(--ink-2); }
  .audit-table td.audit-who small::before { content: ", "; }
  .audit-table td.audit-who::before { content: "· "; }
  /* A search hit's meta on a phone: one flowing line, each part after a dot, so no line ends on a stray "·". */
  .hit-meta { display: block; }
  .hit-meta > span { white-space: normal; }
  .hit-meta > span:not(:last-child)::after { content: none; }
  .hit-meta > span + span::before { content: "·"; margin: 0 6px; color: var(--ink-4); }
  /* My account on a phone: the button goes under its row's words; a sign-in reads result, then when, browser and place. */
  .me-rows li { flex-wrap: wrap; }
  .me-signins tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; }
  .me-signins td.title { order: -1; flex-basis: 100%; }
  .me-signins tr > td { width: auto; padding: 2px 0 0; font-size: 0.75rem; color: var(--ink-3); }
  .me-signins tr > td.title { font-size: 0.875rem; color: var(--ink); }
  .me-signins tr > td:not(.title):not(.date)::before { content: "· "; }
  /* Processing on a phone: the choices stack; a change reads as its change, then when and who, then why. */
  .proc-options { grid-template-columns: 1fr; }
  .proc-option + .proc-option { border-left: 0; border-top: 1px solid var(--line); }
  .proc-history tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; }
  .proc-history td.title { order: -1; flex-basis: 100%; }
  .proc-history tr > td.date, .proc-history tr > td.proc-who { order: 1; width: auto; padding: 2px 0 0; font-size: 0.75rem; color: var(--ink-3); }
  .proc-history td.proc-who span, .proc-history td.proc-who small { display: inline; font-size: 0.75rem; color: var(--ink-2); }
  .proc-history td.proc-who small::before { content: ", "; }
  .proc-history td.proc-who::before { content: "· "; }
  .proc-history tr > td.proc-reason { order: 2; flex-basis: 100%; padding-top: 2px; }
  /* A change on a phone: the field, then each value says whether it's before or after. */
  .audit-changes tr { padding: 8px 0; }
  .audit-changes td { padding: 1px 0; }
  .audit-changes td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); }
  /* The tenant takes its own line rather than wrapping after a stray dot. */
  .audit-table tr > td.audit-tenant { flex-basis: 100%; padding-top: 0; }
  .pilot-stages td[data-label] { display: inline; }
  .pilot-stages td[data-label]::before { content: attr(data-label) "\00a0"; color: var(--ink-3); }
  .pilot-stages td[data-label] + td[data-label]::before { content: "\00a0\00b7\00a0" attr(data-label) "\00a0"; }
  .pilot-numbers { grid-template-columns: 1fr 1fr; }
  .pilot-numbers > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .pilot-numbers > div:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .disposal-docs td.pick { position: absolute; left: 6px; top: 14px; width: auto; }
  .disposal-docs tr:has(> td.pick) .thumb { visibility: hidden; }
  .merge-table tbody th { border-bottom: 0; padding-bottom: 2px; }
  .merge-side { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }
  .merge-pick { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* Finding an entity to link: a search box; with script the matches drop down under it (a listbox). */
.link-find { position: relative; }
.link-find-row { display: flex; gap: 8px; }
.link-find-box { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--page); color: var(--ink-3); }
.link-find-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.link-find-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 0.875rem; color: var(--ink); }
.link-find-box input::placeholder { color: var(--ink-4); }
.link-find.is-live .link-find-submit { display: none; }
/* A search that only works with script (review keeps its select for no-script). */
.link-find--js:not(.is-live) { display: none; }
.link-options li.is-create { border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); }
.link-options li.is-create:first-child { border-top: 0; border-radius: var(--r); }
.link-options li.is-create b { color: var(--accent-deep); font-weight: 600; }
.link-options { position: absolute; left: 0; right: 0; top: 40px; z-index: 30; max-height: 16rem; margin: 0; padding: 4px; overflow-y: auto; list-style: none; background: var(--page); border-radius: var(--r-pop); box-shadow: var(--pop-shadow); }
.link-options[hidden] { display: none; }
.link-options li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: var(--r); font-size: 0.875rem; cursor: pointer; }
.link-options li[aria-selected="true"] { background: var(--accent-wash); }
.link-options li[aria-selected="true"] b { color: var(--accent-deep); }
.link-options b, .link-matches b { font-weight: 500; }
.link-options small, .link-matches small { flex: none; font-size: 0.75rem; color: var(--ink-3); }
.link-matches { display: grid; gap: 2px; margin: 8px 0 0; padding: 0; list-style: none; }
.link-matches button { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--r); background: none; font-size: 0.875rem; text-align: left; }
.link-matches button:hover, .link-matches button:focus-visible { background: var(--hover); }
.link-matches b { flex: 1; min-width: 0; }
.link-add { font-size: 0.8125rem; font-weight: 600; color: var(--accent); }
.link-note { margin-top: 5px; font-size: 0.8125rem; color: var(--ink-3); }
.link-note:empty { display: none; }
.theirs b { font-weight: 600; color: var(--ink); }
@media (max-width: 1180px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto var(--uifirst-bar, 0px) 0; z-index: 50;
    width: min(20rem, 86vw); height: auto;
    translate: -100% 0; visibility: hidden;
    transition: translate 200ms var(--ease-out), visibility 0s linear 200ms;
    box-shadow: var(--pop-shadow);
  }
  .app[data-nav-open] .sidebar { translate: 0 0; visibility: visible; transition: translate 200ms var(--ease-out); }
  .app[data-nav-open] .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgb(15 15 15 / 0.28); }
  .menu-btn { display: inline-grid; margin-left: -6px; position: relative; }
  /* The sidebar is a drawer here, so unread tickets show as a dot on the button that opens it. */
  .menu-unread { display: none; }
  .app:has(.nav-badge) .menu-unread { display: inline; }
  .app:has(.nav-badge) .menu-btn::after { content: ""; position: absolute; top: 5px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--navy); box-shadow: 0 0 0 2px var(--canvas); }
  .topbar { padding: 0 12px; }
  .work { padding: 16px 12px 96px; }
  .peek { width: 100vw; border: 0; }
  .panel-bar { padding: 8px 12px; }
  .ticket-layout { grid-template-columns: minmax(0, 1fr); }
  .sheet-layout { grid-template-columns: minmax(0, 1fr); }
  .review-layout { grid-template-columns: minmax(0, 1fr); }
  .review-layout.has-doc .review-list { display: none; }
  .review-layout:not(.has-doc) .review-doc { display: none; }
  .review-back { display: inline-flex; }
  .work:has(.review-layout.has-doc) .queue-filters, .work:has(.review-layout.has-doc) .page-head .page-meta { display: none; }
  .review-viewer { position: static; }
  .review-body { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .bpage-item:has(.is-flagged), .bpage.is-flagged, .bpage-item:has(.is-moving), .bpage.is-moving { width: 100%; }
  .cut-flow { padding-inline: 10px; }
  /* The Act inside form, once asked for, comes first on a phone rather than below the conversation. */
  .ticket-layout:has(.look-inside form.panel-form) > .ticket-side { order: -1; }
  .look-inside { scroll-margin-top: calc(var(--top-h) + 12px); }
  /* The status filter stays one row and scrolls sideways rather than orphaning its last option. */
  .queue-filters .segmented--links:first-child { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .queue-filters .segmented--links:first-child li { flex: none; }
  .queue-filters .segmented--links a { white-space: nowrap; }
  .timeline { padding-inline: 12px; }
  .entry-head time { margin-left: 0; }
  .reply { padding-inline: 12px; }
  /* Platform on phones: people rows wrap their chips under the name; callouts drop their action below. */
  /* Only rows with an invitation (chip + Resend) wrap; an active admin keeps one line. */
  .people li:has(> form) { flex-wrap: wrap; row-gap: 6px; }
  .people li:has(> form) .tenant-text { flex: 1 1 calc(100% - 44px); }
  .people li:has(> form) > .flag { margin-left: 34px; }
  .callout > .btn { margin-left: 24px; }
  .acting { display: block; }
  .acting > .icon { display: inline-block; vertical-align: -3px; margin-right: 6px; }
  .acting > span { display: inline; }
  .acting form { margin: 8px 0 0; }
  /* List group headings wrap inside the panel instead of running past it. */
  .group th { white-space: normal; }
  .group-head { display: flex; align-items: baseline; gap: 6px; max-width: 100%; }
  .group-toggle { flex: 0 1 auto; min-width: 0; flex-wrap: wrap; align-items: baseline; text-align: left; }
  .group-head .count { flex: none; }
  .props--panel > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  /* Fields: name across, then type and rules on one line; the move buttons sit top right. */
  .fields-table tr:has(> td.title) { position: relative; padding-right: 64px; }
  .table tr:has(> td.title) > td.col-order { position: absolute; top: 6px; right: 8px; width: auto; }
  .fields-table td.kind, .fields-table td.rules { order: 1; margin-right: 10px; }
  .fields-table td.kind::before, .fields-table td.rules::before { content: none; }
  /* Entity types and fields: one left edge for every line of a row. */
  body .panel .table tr.type-row, body .panel .fields-table tr:has(> td.title) { padding-left: 12px; }
  body .table tr.type-row > td.title, body .fields-table tr:has(> td.title) > td.title { margin-left: 0; }
  .type-row .type-link .icon { display: none; }
  .type-row .sub { margin-left: 0; }
  .type-row td:not(.title) { display: none; }
  .type-meta { display: block; margin-top: 2px; font-size: 0.8125rem; color: var(--ink-3); }
  .count-note { display: none; }
  .panel .filters { padding: 8px 12px; }
  .hit { padding: 12px; }
  .page-title h1 { font-size: 1.5rem; }
  .page-meta { padding-left: 0; }
  .table th { position: static; }
  .chip--search { flex: 1; min-width: 0; }
  .chip--search input[type="search"] { width: 100%; }
  .js .filters-toggle { display: inline-flex; }
  .filters.is-open .chip--search { flex-basis: 100%; }
  .js .filters:not(.is-open) .filter, .js .filters:not(.is-open) .filters-clear { display: none; }
  .filter-pop { position: fixed; left: 16px; right: 16px; top: auto; min-width: 0; }

  /* The table restacks: every row keeps its data, laid out as an entry. */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: auto; }
  .table tr { padding: 10px 2px; border-bottom: 1px solid var(--line); }
  .table tr.group { padding: 0; border: 0; }
  .table tr.group th { display: block; }
  .table td { padding: 0; border: 0; }
  .table tbody tr:not(.group):hover td { background: none; }
  /* Entries: the title line, one grey meta line, then the other filings as chips. */
  .table tr:has(> td.title) { display: flex; flex-wrap: wrap; align-items: baseline; padding: 9px 2px; font-size: 0.8125rem; color: var(--ink-3); }
  .table tr:has(> td.title) > td.title { flex-basis: 100%; order: 0; min-width: 0; max-width: none; width: auto; margin-bottom: 2px; font-size: 0.875rem; color: var(--ink); }
  .table tr:has(> td.title) > td.field, .table tr:has(> td.title) > td.date, .table tr:has(> td.title) > td.type { order: 1; width: auto; color: var(--ink-3); white-space: nowrap; }
  .table tr:has(> td.title) > td.type::after, .table tr:has(> td.title) > td.field::after { content: "·"; margin: 0 6px; color: var(--ink-4); }
  .table tr:has(> td.title) > td.field::before { content: attr(data-label) " "; color: var(--ink-4); }
  .table tr:has(> td.title) > td.filed-cell { flex-basis: 100%; order: 2; margin-top: 4px; }
  .table .doc { display: block; position: relative; padding-left: 32px; min-height: 29px; }
  .table .doc > .thumb { position: absolute; left: 0; top: 0; }
  .table .doc .marks { margin-left: 6px; }
  .table .doc-meta { margin-left: 6px; }
  .table .doc-link { white-space: normal; }
  .table tr:has(> td.title) { padding-left: 34px; }
  .panel .table td:first-child, .panel .table td:last-child { padding-left: 0; padding-right: 0; }
  .panel .table tr:has(> td.title) { padding: 9px 12px 9px 44px; }
  .panel .table tr.folder-row { padding: 10px 12px; }
  .table tr:has(> td.title) > td.title { margin-left: -32px; }
  .table tr:has(> td.title) > td.filed-cell { padding-left: 0; }
  .table tr:has(> td.title) > td.type { padding-left: 0; }
  .table td.is-blank, .table td:empty { display: none; }
  /* No drawn page in the audit table: no room kept for one. */
  .panel .table.audit-table tr:has(> td.title), .panel .table.proc-history tr:has(> td.title), .panel .table.me-signins tr:has(> td.title) { padding-left: 12px; }
  .audit-filters .audit-search { flex-basis: 100%; max-width: none; }
  .table.audit-table tr:has(> td.title) > td.title, .table.proc-history tr:has(> td.title) > td.title, .table.me-signins tr:has(> td.title) > td.title { margin-left: 0; }
  /* A sign-in on a phone: the result, then "28 Sept 2026, 07:58 · Edge on Windows · Johannesburg, ZA". */
  .table.me-signins tr:has(> td.title) > td:not(.title) { order: 1; }
  .table td.num { text-align: left; }
  .folder-row { display: flex !important; justify-content: space-between; align-items: center; }
  .folder-row td.num::before { display: none !important; }
  .find-form .btn { padding: 0 14px; }
  .gate { margin-top: 24px; padding: 0 16px; }
  .gate-bar { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* Page pictures in the thumbnails (GetBatchPageImage, GetDocumentPageImage): the stand-in's size, the page itself inside. */
.pg-img { padding: 0; object-fit: cover; object-position: top; }
