/* Documents — register and editor. Inherits the shell's tokens from /process/theme.css. */
/* Outer row: the five data columns and an actions menu. */
.documents-row {
  display: grid;
  grid-template-columns: 1fr 2.75rem;
  align-items: center;
}
.documents-cells,
.table-head.documents-row > .documents-cells {
  display: grid;
  grid-template-columns: 8rem minmax(12rem, 1fr) 8rem 10rem 6.5rem;
  gap: 0.75rem;
  align-items: center;
}
/* What a document at a higher unit is already met by, said on the row that carries the
   obligation rather than in a second request per row. */
.documents-met { font-size: 0.75rem; opacity: 0.8; display: block; }
.documents-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.documents-link span[data-state] { font-size: 0.85rem; }

/* ⋯ — the row's actions, in one menu, so the columns stay neat. */
.documents-menu { position: relative; justify-self: center; }
.documents-menu > summary { list-style: none; cursor: pointer; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 8px; font-size: 1.1rem; line-height: 1; color: var(--muted, #6b6b6b); }
.documents-menu > summary::-webkit-details-marker { display: none; }
.documents-menu > summary:hover, .documents-menu[open] > summary { background: var(--surface-hover, rgba(0, 0, 0, 0.05)); color: inherit; }
.documents-menu-items { position: absolute; right: 0; top: 2.2rem; z-index: 5; min-width: 12rem; width: max-content; max-width: min(24rem, calc(100vw - 2rem)); display: grid; padding: 0.3rem; border: 1px solid var(--line, rgba(0, 0, 0, 0.14)); border-radius: 10px; background: #fff; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12); }
.documents-menu-items > a, .documents-menu-items > button { font: inherit; text-align: left; padding: 0.45rem 0.7rem; border: 0; border-radius: 7px; background: none; color: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.documents-menu-items > a:hover, .documents-menu-items > button:hover, .documents-menu-items > a:focus-visible, .documents-menu-items > button:focus-visible { background: var(--surface-hover, rgba(0, 0, 0, 0.05)); outline: none; }

/* Tags: the same pills and filters the process library draws (library.css). */
.tag-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 0 0 14px; }
.tag-filters:empty { display: none; }
.tag-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted, #667085); }
.tag-filter select { font: inherit; color: inherit; border: 1px solid var(--line, #e4e7ec); border-radius: 8px; padding: 4px 8px; background: #fff; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font: inherit; font-size: 11.5px; line-height: 1.3; color: inherit; background: #f2f4f7; border: 1px solid transparent; border-radius: 999px; padding: 2px 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.tag:hover { border-color: var(--brand, #007b77); background: #eef6f5; }
.tag em { font-style: normal; color: var(--muted, #667085); margin-right: 4px; }
.tag em::after { content: ":"; }
.tag.by-ai { border-style: dashed; border-color: #cfd4dc; }
.tag.pending { border-style: dotted; border-color: #b8860b; background: #fffbea; color: #6b5300; cursor: default; }
.tag.more { cursor: default; color: var(--muted, #667085); }
.tag-remove { font: inherit; border: 0; background: none; color: var(--muted, #667085); cursor: pointer; padding: 0 0 0 4px; line-height: 1; }
.ghost.small { font-size: 12px; padding: 2px 8px; }
.documents-tag-editor { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; padding: 0.5rem 0.9rem 0.7rem 9.5rem; background: var(--surface-2, #fafafa); border-top: 1px dashed var(--line, rgba(0, 0, 0, 0.08)); }
.documents-tag-add { display: flex; gap: 0.4rem; align-items: center; }
.documents-tag-add select, .documents-tag-add input { font: inherit; padding: 0.3rem 0.5rem; border: 1px solid var(--line, #cfcfcf); border-radius: 8px; }
.documents-copy {
  font: inherit;
  cursor: pointer;
  justify-self: start;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line, rgba(0, 0, 0, 0.14));
  border-radius: 6px;
  font-size: 0.85rem;
  color: inherit;
  text-decoration: none;
}
.documents-copy:hover,
.documents-copy:focus-visible {
  background: var(--surface-hover, rgba(0, 0, 0, 0.03));
  outline: none;
}
.documents-link {
  padding: 0.65rem 0.9rem;
  color: inherit;
  text-decoration: none;
  border-top: 1px solid var(--line, rgba(0, 0, 0, 0.08));
}
.documents-link:hover,
.documents-link:focus-visible {
  background: var(--surface-hover, rgba(0, 0, 0, 0.03));
  outline: none;
}
.documents-link span:first-child {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.documents-link span[data-state="published"] { color: var(--ok, #1a7f4b); }
.documents-link span[data-state="draft"] { color: var(--muted, #6b6b6b); }
.documents-link span[data-state="archived"] { color: var(--muted, #6b6b6b); text-decoration: line-through; }
.documents-empty,
.documents-status { padding: 0.75rem 0.9rem; color: var(--muted, #6b6b6b); }
.documents-status:empty { display: none; }
/* What just happened, with a close button (bridgeconnect/notice.js; D4, 2026-11-04). */
.documents-status .bridge-notice-close { border: 0; background: none; color: inherit; font: inherit; font-size: 1.1em; line-height: 1; margin-left: 0.4rem; padding: 0 0.35rem; min-width: 28px; min-height: 28px; cursor: pointer; vertical-align: middle; }
.documents-status .bridge-notice-close::before { content: "×"; }
.documents-status .bridge-notice-close:hover, .documents-status .bridge-notice-close:focus-visible { color: var(--text, #101828); }

.documents-dialog { border: 0; border-radius: 12px; padding: 0; max-width: 32rem; width: calc(100% - 2rem); }
.documents-dialog form { display: grid; gap: 0.9rem; padding: 1.4rem; }
/* A document number is one long word (ABC_APZ-AU_OHS_PL_…): it wraps inside the dialog instead of
   widening it past the screen, so Info fits without a sideways scroll (the customer's review, 2026-10-27). */
.documents-dialog form > * { min-width: 0; }
.documents-dialog h2, .documents-dialog p, .documents-dialog dd, .documents-dialog li { overflow-wrap: anywhere; }
.documents-dialog label { display: grid; gap: 0.3rem; font-weight: 600; }
.documents-dialog input[type="text"], .documents-dialog input:not([type]), .documents-dialog select {
  font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--line, #cfcfcf); border-radius: 8px;
}
.documents-check { display: flex; gap: 0.5rem; align-items: center; font-weight: 500; }
.documents-check[hidden] { display: none; }
.documents-hint { margin: 0; color: var(--muted, #6b6b6b); }
.documents-dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }
/* THE BUTTONS OF A POP-UP, ONE SIZE AND SHAPE (Bryan's review, 2026-11-04 [12:50–13:20]: Finish review's Cancel
   was "a square looking button in grey" beside Submit my review, in "a different size text… let's change that
   cancel button to look like that"). In every pop-up here the way out is outlined and the action filled, at the
   same height, corners and type; a destructive action keeps its red. */
.documents-dialog .documents-dialog-actions > button {
  display: inline-flex; align-items: center; justify-content: center; min-width: 7rem; height: 40px; padding: 0 16px;
  border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; color: var(--ink, #27272a);
  font: inherit; font-size: 13px; font-weight: 650; line-height: 1.2; white-space: nowrap; cursor: pointer;
}
.documents-dialog .documents-dialog-actions > button.primary { border-color: var(--brand, #007b77); background: var(--brand, #007b77); color: #fff; }
.documents-dialog .documents-dialog-actions > button.danger { padding: 0 16px; border-color: #b42318; background: #b42318; color: #fff; font-size: 13px; font-weight: 650; }
.documents-dialog .documents-dialog-actions > button.danger:disabled { border-color: #fda29b; background: #fda29b; }
.documents-dialog .documents-dialog-actions > button:hover:not(:disabled) { border-color: #98a2b3; }
.documents-dialog .documents-dialog-actions > button.primary:hover:not(:disabled),
.documents-dialog .documents-dialog-actions > button.danger:hover:not(:disabled) { border-color: transparent; filter: brightness(1.06); }
/* Import Existing Documents and its way back are links that look like the buttons beside them. */
.library-actions a[data-import-back] { display: inline-flex; align-items: center; color: inherit; text-decoration: none; }
/* Info: the history a document brought in already approved kept from before (documents.js importedInfo). */
.documents-info-history-heading { margin: 0.2rem 0 0; font-size: 0.95rem; }
.documents-info-versions { margin: 0.4rem 0 0; font-size: 0.9rem; }
.documents-info-versions > summary { cursor: pointer; font-weight: 600; }
.documents-info-versions-table { width: 100%; border-collapse: collapse; margin: 0.4rem 0; table-layout: fixed; font-variant-numeric: tabular-nums; }
.documents-info-versions-table th:nth-child(1) { width: 14%; }
.documents-info-versions-table th:nth-child(2) { width: 22%; }
.documents-info-versions-table th:nth-child(3) { width: 24%; }
.documents-info-versions-table th, .documents-info-versions-table td { text-align: left; vertical-align: top; padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--border, #e2e5ea); overflow-wrap: anywhere; }
.documents-info-versions-table th { font-weight: 600; white-space: nowrap; }
.documents-info-history { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.2rem; font-size: 0.9rem; overflow-wrap: anywhere; }
/* Share (share-dialog.js): the copy, the link for someone outside, and the links already sent. */
.documents-share section { display: grid; gap: 0.6rem; }
.documents-share section + section { border-top: 1px solid var(--line, rgba(0, 0, 0, 0.08)); padding-top: 0.9rem; }
.documents-share h3 { margin: 0; font-size: 1rem; }
.documents-share .documents-share-copy button { justify-self: start; }
.documents-share .documents-share-send button.primary { justify-self: start; }
.documents-share input[type="email"], .documents-share input[type="number"] { font: inherit; padding: 0.5rem 0.6rem; border: 1px solid var(--line, #d0d5dd); border-radius: 8px; }
/* No link can go, and why (D3): the dialog's one thing to read, so plain body text, not muted. */
.documents-share-off { margin: 0; padding: 0.6rem 0.75rem; border-radius: 8px; background: #f2f4f7; color: #101828; }
.documents-share-result { margin: 0; color: var(--success-text, #027a48); }
.documents-share-result.error { color: var(--danger, #b42318); }
.documents-share-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.documents-share-rows li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }
.documents-share-who { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.documents-share-state { color: var(--muted, #667085); font-size: 0.9em; }
/* Take Back asks in its row first (share-dialog.js takeBackButton): the question, then Take Back and Keep It. */
.documents-share-ask { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; padding: 0.5rem 0.6rem; border-radius: 8px; background: #fef3f2; }
.documents-share-ask-text { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.documents-share-ask .quiet-button.danger { color: #b42318; font-weight: 600; }
@media (pointer: coarse) { .documents-share-ask .quiet-button { min-height: 44px; } }
.documents-share button { font: inherit; font-weight: 600; border-radius: 8px; padding: 8px 16px; cursor: pointer; }
.documents-share button:not(.primary) { border: 1px solid var(--line, #d0d5dd); background: var(--surface, #fff); color: inherit; }
.documents-share button.primary { color: #fff; border: 1px solid var(--brand, #007b77); background: var(--brand, #007b77); }
.documents-share button.quiet-button { padding: 4px 10px; font-weight: 500; }
.documents-share button:disabled { opacity: 0.55; cursor: not-allowed; }

/* The documents pages sit in the product shell (rail + main) like the process library,
   but have no third column: the library reserves 320px for its create panel and only
   collapses it when that panel exists and is closed. */
.library-shell { grid-template-columns: var(--bb-rail-w) minmax(0, 1fr); }
/* …except the register's own Your AI (documents-ai.js): a third column where there is room
   for it, over the page where there is not. Closed, it is gone and the ✦ brings it back. */
.documents-ai { min-height: 0; overflow: hidden; border-left: 1px solid var(--line, #e4e7ec); background: #fff; }
.documents-ai[hidden] { display: none; }
@media (min-width: 1200px) {
  .library-shell:has(> .documents-ai:not([hidden])) { grid-template-columns: var(--bb-rail-w) minmax(0, 1fr) 340px; }
}
@media (max-width: 1199px) {
  .documents-ai { position: fixed; top: 0; right: 0; bottom: 0; height: auto; z-index: 40; width: min(380px, 100vw); box-shadow: -10px 0 30px rgba(16, 24, 40, .14); }
}

/* Editor — the head, the status line when there is one, and then the editor taking
   everything left.

   A COLUMN, not a grid with counted rows. It was `grid-template-rows: auto auto 1fr`,
   which is only correct while all three children exist: `#editor-status` is `hidden` the
   moment the document loads, `[hidden]` is `display:none`, and a display:none child is
   not a grid item — so the editor landed in the SECOND (auto) track and collapsed to an
   iframe's intrinsic 150px, with the 1fr track sitting empty underneath it. Two lines of
   Word and a screenful of grey. A flex column cannot be wrong about how many children it
   has. */
.editor-shell { display: flex; flex-direction: column; height: 100vh; min-height: 0; }
/* Inside the shell the editor fills its column edge to edge; the shell owns the height. */
.editor-page > main.editor-main { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.editor-page .editor-shell { height: 100%; min-height: 0; flex: 1 1 auto; }
.editor-head {
  display: flex; align-items: center; gap: 1rem; padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line, rgba(0, 0, 0, 0.08)); background: var(--surface, #fff);
}
/* The title big and bold, the number under it (customer call, 2026-10-30). A long title wraps
   rather than pushing the actions off the screen. */
.editor-head h1.editor-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; font-size: 1.35rem; line-height: 1.2; }
.editor-head .editor-title { font-weight: 750; overflow-wrap: anywhere; }
.editor-head .editor-number { font-size: 0.8rem; font-weight: 500; color: var(--muted, #667085); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.editor-head .editor-number:empty { display: none; }
.editor-head .editor-badge {
  font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 999px;
  background: var(--surface-hover, rgba(0, 0, 0, 0.06)); color: var(--muted, #444);
}
.editor-head .editor-badge[data-mode="edit"] { background: #e6f4ec; color: #1a7f4b; }
.editor-head .editor-badge[data-mode="view"] { background: #fff4e0; color: #8a5a00; }
/* Quieter than the mode badge beside it: this states a standing fact about the editor,
   not the state of this session. */
.editor-head #editor-autosave { background: transparent; color: var(--muted, #667085); }
/* Where the draft is kept, as a link (customer video, 2026-10-21). */
.editor-head .editor-saved-where { color: var(--brand, #007b77); text-decoration: none; }
.editor-head .editor-saved-where:hover { text-decoration: underline; }
/* Your AI, closed: its ✦ Ask AI in the header (a dot when it has something new). */
.editor-actions .editor-ask-ai { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--brand, #007b77); border-radius: 999px; background: #fff; color: var(--brand, #007b77); font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.editor-actions .editor-ask-ai[hidden] { display: none; }
.editor-actions .editor-comment { min-height: 40px; padding: 0 22px; font-size: 0.95rem; font-weight: 750; }
.editor-actions .editor-comment[hidden] { display: none; }
.editor-actions .editor-ask-ai[data-attention]::after { content: ""; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; background: #d92d20; }
.editor-actions .editor-ask-ai:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand, #007b77) 40%, #fff); outline-offset: 2px; }
/* The next step on a draft: the one primary action in the header. */
.editor-actions .editor-next-step { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 8px; background: var(--brand, #007b77); color: #fff; font-weight: 700; font-size: 0.85rem; text-decoration: none; white-space: nowrap; }
.editor-actions .editor-next-step[hidden] { display: none; }
.editor-actions .editor-next-step:hover { filter: brightness(1.06); }
.editor-actions .editor-next-step:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand, #007b77) 40%, #fff); outline-offset: 2px; }
#download-button { flex: 0 0 auto; }
.editor-head .editor-spacer { flex: 1; }
/* What each reader action does: one quiet line each, under the header (customer call,
   2026-10-21). Wraps on a phone rather than pushing past the screen. */
.editor-reader-help {
  display: flex; flex-wrap: wrap; gap: 0.2rem 1.5rem; margin: 0; padding: 0.45rem 1rem;
  list-style: none; border-bottom: 1px solid var(--line, rgba(0, 0, 0, 0.08));
  background: var(--surface, #fff); color: var(--muted, #667085); font-size: 0.8rem; line-height: 1.35;
}
.editor-reader-help[hidden] { display: none; }
/* Finish review is a .documents-dialog, the look of every pop-up here; its one line of its own says what sending is doing.
   WIDER AND SHORTER (Bryan's review, 2026-11-04 [12:50–13:20]: "a little bit more rectangular… a lot of open text
   that could be filled"): no gap under the heading, the sentence and the box filling the width, the box three lines. */
.documents-dialog.editor-finish-dialog { max-width: 40rem; }
.editor-finish-dialog form { gap: 0.65rem; padding: 1.25rem 1.5rem 1.35rem; }
.editor-finish-dialog h2 { margin: 0; font-size: 1.2rem; line-height: 1.3; }
.editor-finish-dialog p { margin: 0; }
.editor-finish-dialog textarea { width: 100%; min-height: 4.6rem; padding: 0.55rem 0.7rem; border: 1px solid var(--line, #cfcfcf); border-radius: 8px; font: inherit; resize: vertical; }
.editor-finish-dialog .documents-dialog-actions { margin-top: 0.15rem; }
.editor-finish-status { color: var(--muted, #667085); }
.editor-finish-status[hidden] { display: none; }
.editor-finish-status[data-tone="error"] { color: #a12a2a; }
/* Saving and sending a consultee's review: the document is read-only until it is answered or given back. */
.editor-finishing { opacity: .6; pointer-events: none; }
/* The "Why am I asked to confirm this?" note opens under the header, inset like it. */
.editor-shell > .bc-read-why { margin: 0.5rem 1rem; }
.editor-reader-help li { min-width: 0; overflow-wrap: anywhere; }
.editor-reader-help strong { margin-right: 0.35rem; color: var(--ink, #344054); font-weight: 600; }
.editor-frame { border: 0; width: 100%; height: 100%; background: #f3f3f3; }
.editor-status { padding: 2rem; color: var(--muted, #6b6b6b); }
.editor-status[data-tone="error"] { color: #a12a2a; }
/* A SEAT'S TERMS ARE ONE SENTENCE, NOT A LOADING SCREEN (Bryan's review, 2026-11-04 [11:46–12:24]: "about half that
   thickness… the Fluence Energy colour palette… close that gap"). What the reviewer is asked to do sits in a thin
   band in the company's own colours: its tint, with its line under it (theme.js sets --brand-tint and --brand-line
   from the palette the company saved; TheBridge's own only where none is saved). At every width. */
.editor-status[data-tone="seat"] {
  padding: 0.65rem 1rem; font-size: 0.85rem; line-height: 1.4; color: var(--ink, #27272a);
  background: var(--brand-tint, #eaf8f7); border-bottom: 1px solid var(--brand-line, #9bdedb);
}
.editor-actions { display: flex; gap: 0.5rem; align-items: center; }
.editor-actions input[type="file"] { display: none; }
/* The header's own buttons wear their neighbours' shape (onboarding e2e, 2026-10-23: "Upload a file
   into this draft" sat beside the styled Ask AI and next step as a bare browser button). Plain ones
   are outlined; a primary one is filled like the next step. Ask AI and the "?" keep their own. */
.editor-actions > button:not(.editor-ask-ai):not(.bc-read-why-button),
.editor-actions > label > button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 12px;
  border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; color: var(--ink, #344054);
  font: inherit; font-size: 0.85rem; font-weight: 600; line-height: 1.2; cursor: pointer;
}
.editor-actions > button.primary:not(.editor-ask-ai) { border-color: var(--brand, #007b77); background: var(--brand, #007b77); color: #fff; font-weight: 700; }
.editor-actions > button.ghost { border-color: transparent; background: transparent; color: var(--brand, #007b77); }
.editor-actions > button:not(.editor-ask-ai):not(.bc-read-why-button):hover:not(:disabled),
.editor-actions > label > button:hover:not(:disabled) { border-color: #98a2b3; }
.editor-actions > button.primary:not(.editor-ask-ai):hover:not(:disabled) { filter: brightness(1.06); }
.editor-actions > button:not(.editor-ask-ai):not(.bc-read-why-button):focus-visible,
.editor-actions > label > button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand, #007b77) 40%, #fff); outline-offset: 2px; }
.editor-actions > button[hidden], .editor-actions > label[hidden] { display: none; }
.editor-actions > label { display: inline-flex; }
/* A phone: when the header carries actions ("I have read and understood this", "Download",
   "Raise a change"), it wraps so they stay on screen (DMS retest, 2026-10-10: "Raise a change"
   sat at x = 565 on a 390 px screen) — the back arrow and the title share the first row, and
   the actions take a row of their own. A header with no action showing (a new document being
   written) keeps its single row: wrapping it would take the height the page needs (D-013). */
@media (max-width: 700px) {
  .editor-head:has(.editor-actions > :not([hidden])) { flex-wrap: wrap; gap: 0.5rem; }
  .editor-head:has(.editor-actions > :not([hidden])) h1 { flex: 1 1 calc(100% - 2.5rem); min-width: 0; overflow-wrap: anywhere; }
  .editor-head:has(.editor-actions > :not([hidden])) .editor-spacer { display: none; }
  .editor-head h1.editor-heading { font-size: 1.1rem; }
  .editor-actions:has(> :not([hidden])) { flex: 1 1 100%; flex-wrap: wrap; min-width: 0; }
  .editor-actions > button, .editor-actions > label { flex: 1 1 auto; min-width: 0; white-space: normal; }
  /* The "?" beside "I have read and understood this" stays a round button, never stretched. */
  .editor-actions > .bc-read-why-button { flex: 0 0 28px; }
  /* WHATEVER THE FONT: a badge never runs past the screen — a long unit or "conforms to" name,
     or wider metrics (DejaVu Sans on Linux sets this header ~20 px taller than Segoe UI), wraps
     inside the badge instead. */
  .editor-head .editor-badge { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  /* A CONTRIBUTOR'S SEAT (comment, suggest, co-author: #9451) shows no action, but its badges and
     "Saves automatically" do not fit beside the title: on one row the title was squeezed into a
     column four lines tall and "Saves automatically" sat past the screen's edge. They take a row
     of their own, as actions do — no taller than the squeezed title was. The writer's seat (a new
     document being written) is not a contributor's and keeps its single row (D-013). */
  .editor-head:has(#editor-mode[data-seat="comment"]),
  .editor-head:has(#editor-mode[data-seat="suggest"]) { flex-wrap: wrap; gap: 0.5rem; }
  .editor-head:has(#editor-mode[data-seat="comment"]) h1,
  .editor-head:has(#editor-mode[data-seat="suggest"]) h1 { flex: 1 1 calc(100% - 2.5rem); min-width: 0; overflow-wrap: anywhere; }
  .editor-head:has(#editor-mode[data-seat="comment"]) .editor-spacer,
  .editor-head:has(#editor-mode[data-seat="suggest"]) .editor-spacer { display: none; }
  /* On a phone the seat's band is tighter still: its padding no more than one of its lines, so the document keeps the
     height (D-013). */
  .editor-status[data-tone="seat"] { padding: 0.5rem 1rem; }
}

/* How a document begins — three equal choices, not a checkbox afterthought. */
.documents-start {
  border: 1px solid var(--line, #d9dce3);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  margin: 0.25rem 0 0;
  display: grid;
  gap: 0.5rem;
}
.documents-start legend { padding: 0 0.35rem; font-size: 0.85rem; opacity: 0.75; }
.documents-radio { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; }
.documents-radio input { margin-top: 0.25rem; }
.documents-radio span { display: grid; gap: 0.1rem; }
.documents-radio small { opacity: 0.7; line-height: 1.35; }

/* ── The editor and its AI, side by side ──────────────────────────────────────
   The document is the work; the AI is beside it, not on top of it. A fixed-width
   column rather than a proportional one, so the page a person is writing does not
   reflow every time the window changes. */
.editor-split { display: flex; flex: 1 1 auto; min-height: 0; gap: 0; }
.editor-split .editor-frame { flex: 1 1 auto; min-width: 0; }

/* ── Suggestions & comments ───────────────────────────────────────────────────
   A drawer along the bottom of the editor, not a third column: it is read after the
   document, not beside it, and the document must not lose width to something closed.
   Collapsed it is one line; open it takes a bounded share of the height and scrolls. */
.editor-markup { flex: 0 0 auto; border-top: 1px solid var(--line, #e4e7ec); background: var(--surface, #fff); }
.editor-markup > summary {
  cursor: pointer; padding: 0.5rem 1rem; font-weight: 600; font-size: 0.85rem;
  color: var(--muted, #475467); list-style-position: inside;
}
/* Sits on the summary line, and must not toggle the drawer it refreshes — the script
   stops the click; this only keeps it out of the way of the label. */
.editor-markup-refresh {
  font: inherit; font-size: 0.75rem; font-weight: 600; margin-left: 0.75rem;
  padding: 0.1rem 0.5rem; border: 1px solid var(--line, #e4e7ec); border-radius: 999px;
  background: none; color: var(--muted, #667085); cursor: pointer;
}
/* ACCEPT STANDS OUT (Bryan's review, 2026-11-23, item 15): the page's own primary colours, bold, beside a plain Reject. */
.editor-markup-refresh.primary { border-color: var(--brand, #007b77); background: var(--brand, #007b77); color: #fff; font-weight: 700; }
.editor-markup-refresh.primary:hover:not(:disabled),
.editor-markup-refresh.primary:focus-visible { background: var(--brand, #007b77); filter: brightness(1.06); }
.editor-markup-refresh:hover,
.editor-markup-refresh:focus-visible { background: var(--surface-hover, rgba(0, 0, 0, 0.05)); outline: none; }
.editor-markup-refresh:focus-visible { box-shadow: 0 0 0 2px var(--brand, #007b77); }
/* Add Comment, on the panel's line (Bryan's review video, 2026-11-06): the one action there, so in the brand's colour. */
.editor-markup-comment { border-color: var(--brand, #007b77); color: var(--brand, #007b77); }
.editor-markup-comment[hidden] { display: none; }
.editor-markup-body { max-height: min(40vh, 340px); overflow-y: auto; padding: 0 1rem 0.75rem; }
/* People consulted: the people first, then every comment in the document under its own small heading. */
.editor-people-comments { border-top: 1px solid var(--line, #e4e7ec); }
.editor-people-comments[hidden] { display: none; }
.editor-people-heading { margin: 0.6rem 1rem 0.2rem; font-size: 0.8rem; font-weight: 600; color: var(--muted, #667085); }
/* Blocks in source order, never tracks by index: a row has an anchor line only when it is
   a comment, and placing anything by number is the bug editorLayout.test.ts guards. */
.editor-markup-row { padding: 0.5rem 0; border-top: 1px solid var(--line, #eef0f3); }
.editor-markup-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; }
.editor-markup-kind {
  border-radius: 999px; padding: 0.05rem 0.45rem;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  background: #eef0f3; color: #475467;
}
.editor-markup-kind[data-kind="insert"] { background: #e6f4ec; color: #1a7f4b; }
.editor-markup-kind[data-kind="delete"] { background: #fdeaea; color: #a12a2a; }
.editor-markup-who { font-weight: 600; font-size: 0.8rem; }
.editor-markup-when { font-size: 0.75rem; color: var(--muted, #667085); }
.editor-markup-text { margin: 0.15rem 0 0; font-size: 0.85rem; white-space: pre-wrap; }
/* The words the comment is ABOUT, so a remark like "this is the wrong window" still
   means something away from the paragraph it was left on. */
.editor-markup-anchor {
  margin: 0.2rem 0 0; padding-left: 0.6rem;
  border-left: 2px solid var(--line, #e4e7ec);
  font-size: 0.8rem; color: var(--muted, #667085); white-space: pre-wrap;
}
.editor-markup-empty, .editor-markup-note { margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--muted, #667085); }
/* CONTRIBUTORS: a name, what they may do, and Remove on one wrapping line; the add row
   wraps to as many lines as a phone needs (390 px), never a horizontal scroll. */
.editor-contributor-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.editor-contributor-row .editor-markup-who { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.editor-contributor-row .editor-markup-refresh { margin-left: 0; }
.editor-contributor-add { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.6rem 0 0; border-top: 1px solid var(--line, #eef0f3); }
.editor-contributor-search, .editor-contributor-pick, .editor-contributor-access {
  font: inherit; font-size: 0.8rem; padding: 0.3rem 0.45rem; min-width: 0; max-width: 100%;
  border: 1px solid var(--line, #e4e7ec); border-radius: 8px; background: var(--surface, #fff); color: inherit;
}
.editor-contributor-search, .editor-contributor-pick { flex: 1 1 12rem; }
.editor-contributor-add .editor-markup-refresh { margin-left: 0; }
/* On a phone the author's drawers (suggestions, consultation, contributors) are three closed
   rows under a short editor: tighter rows, so the third costs the document what two did and
   the page being written stays a readable page (dmsDocumentActivityAcceptance, 390 px). */
@media (max-width: 700px) {
  .editor-markup > summary { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
  .editor-markup-refresh { padding: 0 0.45rem; }
}

/* The AI column IS the process library's panel — same markup, same classes, and
   library.css owns the look. A person moving between Processes and Documents is talking
   to one assistant, so this must not be a second panel that merely resembles the first.

   Only what is specific to standing beside an editor lives here: it is a column in a flex
   row rather than a grid track, and nothing closes it, so `.create-panel.closed` never
   applies. */
.editor-ai { flex: 0 0 clamp(300px, 26%, 420px); min-width: 0; }
.editor-ai > header { justify-content: flex-start; gap: 8px; }
.editor-ai .editor-ai-status { margin-left: auto; font-weight: 400; opacity: 0.7; font-size: 11px; }
/* The person's own message: the shared bubble, mirrored. The library panel has no such
   variant because it only ever shows one side of a conversation. */
.editor-ai .editor-ai-you {
  align-self: flex-end;
  border-radius: 12px 12px 4px 12px;
  background: #e6f0ff;
  color: #1c2b4a;
}
.editor-ai .editor-ai-system { background: transparent; padding-inline: 0; opacity: 0.75; font-size: 11px; }
.editor-ai .editor-ai-thinking { align-self: flex-start; margin: 0 18px 12px; opacity: 0.7; }
.editor-ai .library-ai-message + .library-ai-message { margin-top: 10px; }
.editor-ai .library-ai-composer textarea { height: 72px; }
/* Below 1000px library.css lifts `.create-panel` out of the page — fixed, full height,
   over the top of everything — because in the process library it is a drawer that opens
   over the table. Here it is a column beside the document and nothing opens or closes it,
   so that has to be undone deliberately rather than inherited by accident. */
@media (max-width: 1000px) {
  .editor-ai.create-panel {
    position: static; width: auto; z-index: auto; box-shadow: none;
  }
}

@media (max-width: 900px) {
  /* On a phone the document wins; the AI moves under it rather than squeezing it. */
  .editor-split { flex-direction: column; }
  .editor-ai { flex: 0 0 45vh; border-left: 0; border-top: 1px solid var(--line, #d9dce3); }
}

/* A document that is issued AND being revised. Not an error and not a warning: the issued
   version is still the one people follow, so it reads as a note on a normal state. */
.documents-row [data-state="under_revision"] {
  color: var(--brand, #3156d9);
}

/* Somebody changed the controlled copy in the customer's own SharePoint, or deleted it.
   This one IS a warning: the document people can reach is no longer the one that was
   approved, and it stays until an owner decides what to do about it. */
.documents-row [data-drift] { color: #8a5514; font-weight: 600; }
.documents-row [data-drift="missing"] { color: #8d2f2f; }

/* Legislation register — the same table, seven columns, a decision strip above it. */
.legislation-cells,
.table-head.documents-row > .legislation-cells {
  display: grid;
  grid-template-columns: 5.5rem minmax(14rem, 1fr) 6.5rem 9rem 8rem 8.5rem 6.5rem;
  gap: 0.75rem;
  align-items: center;
}
.legislation-row { width: 100%; font: inherit; text-align: left; background: none; border: 0; border-top: 1px solid var(--line, rgba(0, 0, 0, 0.08)); cursor: pointer; }
.legislation-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legislation-row span[data-currency="retired"] { color: var(--muted, #6b6b6b); text-decoration: line-through; }
.legislation-row span[data-currency="unsure"] { color: #b86e00; }
.legislation-row span[data-review="overdue"] { color: #b42318; font-weight: 600; }
.legislation-row span[data-review="soon"] { color: #b86e00; }
.legislation-applies { font: inherit; font-size: 0.85rem; padding: 0.2rem 0.4rem; border: 1px solid var(--line, #cfcfcf); border-radius: 8px; background: #fff; max-width: 100%; }
.legislation-watch { margin: 0 0 0.6rem; color: var(--muted, #6b6b6b); font-size: 0.9rem; }
.legislation-watch:empty { display: none; }
.legislation-changes { margin: 0 0 14px; padding: 10px 14px; border: 1px solid #f1e3a6; background: #fffdf3; border-radius: 10px; }
.legislation-changes h2 { font-size: 1rem; margin: 0 0 0.5rem; }
.legislation-change { padding: 0.6rem 0; border-top: 1px solid #f1e3a6; }
.legislation-change:first-child { border-top: 0; }
.legislation-change-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.legislation-change p { margin: 0.35rem 0; }
.legislation-change blockquote { margin: 0.35rem 0; padding: 0.3rem 0.7rem; border-left: 3px solid #e6d387; color: var(--muted, #6b6b6b); font-size: 0.9rem; }
.legislation-change small { display: block; color: var(--muted, #6b6b6b); }
.legislation-change-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.legislation-source { font-size: 0.9rem; }
.primary.small { font-size: 12px; padding: 2px 10px; }
.legislation-detail { display: grid; grid-template-columns: minmax(16rem, 1fr) minmax(20rem, 1.2fr); gap: 0.6rem 1.5rem; padding: 0.7rem 0.9rem 0.9rem; background: var(--surface-2, #fafafa); border-top: 1px dashed var(--line, rgba(0, 0, 0, 0.08)); }
.legislation-detail dl { margin: 0; display: grid; grid-template-columns: 7rem 1fr; gap: 0.25rem 0.6rem; font-size: 0.9rem; }
.legislation-detail dt { color: var(--muted, #6b6b6b); }
.legislation-detail dd { margin: 0; white-space: pre-wrap; }
.legislation-ours { display: grid; gap: 0.45rem; }
.legislation-ours label { display: grid; gap: 0.2rem; font-size: 0.85rem; color: var(--muted, #6b6b6b); }
.legislation-ours textarea, .legislation-ours input { font: inherit; color: inherit; padding: 0.35rem 0.5rem; border: 1px solid var(--line, #cfcfcf); border-radius: 8px; }
@media (max-width: 900px) { .legislation-detail { grid-template-columns: 1fr; } }

/* NEW DOCUMENT (c22): one wide prompt, like Home's. The same box — a rounded composer with the
   microphone and the button inside — and the upload a quiet link beneath it. Home's composer
   is role-workspaces.css .landing-composer; these follow it. */
.documents-create-dialog { max-width: 46rem; border-radius: 18px; }
.documents-create-dialog form { position: relative; gap: 1rem; padding: 2rem 2.2rem 1.6rem; }
.documents-create-dialog h2 { margin: 0; padding-right: 2.2rem; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; color: #101828; }
.documents-create-lead { color: #475467; font-size: 0.95rem; }
.documents-dialog-close { position: absolute; top: 1rem; right: 1rem; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--muted, #667085); font: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.documents-dialog-close:hover, .documents-dialog-close:focus-visible { background: var(--surface-hover, rgba(0, 0, 0, 0.05)); color: inherit; outline: none; }
.documents-composer { display: flex; align-items: flex-end; gap: 10px; border: 1.5px solid var(--brand-line, #8ecfcd); border-radius: 17px; background: #fff; padding: 10px 11px 10px 18px; box-shadow: 0 18px 48px rgba(23, 65, 64, 0.09); }
.documents-composer:focus-within { border-color: var(--brand, #007b77); }
.documents-composer textarea { box-sizing: border-box; flex: 1; min-width: 0; min-height: 44px; max-height: 160px; resize: none; border: 0; outline: 0; padding: 8px 0; background: transparent; color: #101828; font: inherit; font-size: 15px; line-height: 1.45; }
/* The example in the box is an example: "e.g." and in italics, so it never reads as a request
   already typed (video review, 2026-10-21: it was read as what had been asked). */
.documents-composer textarea::placeholder { color: var(--muted, #667085); font-style: italic; opacity: 1; }
.documents-composer-actions { display: flex; align-items: center; gap: 6px; }
.documents-composer-send { height: 38px; border: 0; border-radius: 10px; background: var(--brand, #007b77); color: #fff; padding: 0 17px; font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.documents-composer-send:disabled { opacity: 0.6; cursor: progress; }
.documents-composer-send:focus-visible { outline: 2px solid var(--brand, #007b77); outline-offset: 2px; }
.documents-create-thinking { margin-top: -0.4rem; }
.documents-create-thinking[hidden] { display: none; }
.documents-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.6rem; margin: 0.4rem 0 0.9rem; }
.documents-card { display: grid; gap: 0.15rem; text-align: left; font: inherit; cursor: pointer; padding: 0.7rem 0.85rem; border: 1px solid var(--line, rgba(0, 0, 0, 0.14)); border-radius: 10px; background: #fff; color: inherit; }
.documents-card:hover:not(:disabled), .documents-card:focus-visible { border-color: var(--accent, #007b77); background: var(--surface-hover, rgba(0, 0, 0, 0.02)); outline: none; }
.documents-card:disabled { opacity: 0.7; cursor: progress; }
.documents-card strong { font-size: 0.95rem; }
.documents-card small { color: var(--muted, #6b6b6b); }
.documents-cards:empty { display: none; }

/* WHERE IT APPLIES (c23): a button that says where, opening the organisation's tree. */
.documents-create-unit { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0; }
.documents-create-unit[hidden] { display: none; }
.documents-create-unit-label { font-weight: 600; font-size: 0.9rem; color: #344054; }
.documents-place-button { display: inline-flex; align-items: baseline; gap: 0.5rem; max-width: 100%; min-height: 40px; padding: 0.45rem 2rem 0.45rem 0.85rem; border: 1px solid #d0d5dd; border-radius: 10px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.7rem center; font: inherit; color: #101828; text-align: left; cursor: pointer; }
.documents-place-button:hover, .documents-place-button[aria-expanded="true"] { border-color: var(--brand-line, #8ecfcd); }
.documents-place-button:focus-visible { outline: 2px solid var(--brand, #007b77); outline-offset: 1px; }
.documents-place-chosen { font-weight: 600; }
.documents-place-path { color: var(--muted, #667085); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.documents-place-path[hidden] { display: none; }
/* In the flow, under the button: the dialog grows to hold it, and the tree scrolls inside it. */
.documents-place-panel { flex-basis: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 0.5rem; max-height: min(22rem, 55vh); padding: 0.6rem; border: 1px solid var(--line, #e4e7ec); border-radius: 12px; background: #fff; box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12); }
.documents-place-panel[hidden] { display: none; }
.documents-place-search { font: inherit; padding: 0.5rem 0.7rem; border: 1px solid #d0d5dd; border-radius: 8px; }
.documents-place-search:focus-visible { outline: 2px solid var(--brand, #007b77); outline-offset: 1px; }
.documents-place-tree, .documents-place-tree ul { list-style: none; margin: 0; padding: 0; }
.documents-place-tree { overflow: auto; min-height: 0; }
.documents-place-tree [role="treeitem"] { outline: none; }
.documents-place-row { display: flex; align-items: center; gap: 0.4rem; min-height: 38px; padding: 0.2rem 0.6rem 0.2rem calc(0.4rem + var(--depth, 0) * 1.1rem); border-radius: 8px; cursor: pointer; }
.documents-place-row:hover { background: var(--surface-hover, rgba(0, 0, 0, 0.04)); }
.documents-place-tree [role="treeitem"]:focus-visible > .documents-place-row { outline: 2px solid var(--brand, #007b77); outline-offset: -2px; }
.documents-place-row.chosen { background: color-mix(in srgb, var(--brand, #007b77) 10%, #fff); font-weight: 600; }
.documents-place-twisty { flex: none; width: 1.2rem; height: 1.6rem; display: grid; place-items: center; color: var(--muted, #667085); }
.documents-place-name { flex: 1; min-width: 0; }
/* Why "Where does it apply?" starts where it does (documents.js renderCreateUnits). */
.documents-create-unit-hint { flex-basis: 100%; display: block; color: var(--muted, #667085); font-size: 0.85em; }
.documents-create-unit-hint[hidden] { display: none; }

/* NEW DOCUMENT: TWO WAYS IN (the customer's call, 2026-10-30). Two large choices, each opening
   its own page of the dialog; a Back link returns to them. */
.documents-create-dialog { max-height: min(92vh, 60rem); overflow: auto; }
.documents-create-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.documents-create-choices[hidden], .documents-create-view[hidden], .documents-create-blocked[hidden] { display: none; }
.documents-create-choice { display: grid; align-content: start; gap: 0.4rem; min-height: 9.5rem; padding: 1.2rem 1.25rem; border: 1.5px solid #d0d5dd; border-radius: 14px; background: #fff; color: #101828; font: inherit; text-align: left; cursor: pointer; }
.documents-create-choice:hover, .documents-create-choice:focus-visible { border-color: var(--brand, #007b77); background: color-mix(in srgb, var(--brand, #007b77) 5%, #fff); outline: none; }
.documents-create-choice:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, #007b77) 30%, transparent); }
.documents-create-choice[hidden] { display: none; }
#create-choose-template { grid-column: 1 / -1; min-height: 0; }
.documents-create-choice strong { font-size: 1.1rem; }
.documents-create-choice > span:last-child { color: #475467; font-size: 0.9rem; line-height: 1.45; }
.documents-create-choice-icon { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 10px; background: color-mix(in srgb, var(--brand, #007b77) 12%, #fff); color: var(--brand, #007b77); font-size: 1.15rem; }
.documents-create-view { display: grid; gap: 1rem; min-width: 0; }
.documents-create-back { justify-self: start; border: 0; background: none; padding: 0.2rem 0; color: var(--brand, #007b77); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.documents-create-back:hover { text-decoration: underline; text-underline-offset: 3px; }
.documents-create-back:focus-visible { outline: 2px solid var(--brand, #007b77); outline-offset: 2px; border-radius: 4px; }
/* No document before its process: why, and for an administrator the way to fix it. */
.documents-create-blocked { display: grid; gap: 0.5rem; padding: 1rem 1.1rem; border: 1px solid #fedf89; border-radius: 12px; background: #fffaeb; color: #344054; }
.documents-create-blocked p { margin: 0; }
.documents-create-blocked [hidden] { display: none; }
.documents-create-blocked-link { display: inline-block; margin-top: 0.3rem; padding: 0.55rem 0.95rem; border-radius: 10px; background: var(--brand, #007b77); color: #fff; font-weight: 700; text-decoration: none; }
.documents-create-blocked-link:focus-visible { outline: 2px solid var(--brand, #007b77); outline-offset: 2px; }
/* What the document is about: a fieldset each, choices as chips that wrap. */
.documents-meta-field { display: grid; gap: 0.55rem; min-width: 0; margin: 0; padding: 0.75rem 0.9rem 0.85rem; border: 1px solid var(--line, #e4e7ec); border-radius: 12px; background: #fff; }
.documents-meta-field[hidden] { display: none; }
.documents-meta-field legend { padding: 0 0.3rem; font-weight: 600; font-size: 0.9rem; color: #344054; }
.documents-meta-standards { display: grid; gap: 0.5rem; }
.documents-meta-standard { display: grid; gap: 0.4rem; }
.documents-meta-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; padding-left: 1.6rem; }
.documents-meta-chips[hidden] { display: none; }
#create-upload-functions.documents-meta-chips { padding-left: 0; }
#create-upload-group[hidden] { display: none; }
/* A framework's criteria, in the groups its source lists them under (FSC: WHS, Focus Point, Hazard). */
.documents-meta-chips.documents-meta-grouped { display: grid; gap: 0.6rem; }
.documents-meta-group { display: grid; gap: 0.35rem; min-width: 0; }
.documents-meta-group-name { font-size: 0.8rem; font-weight: 600; color: #475467; }
.documents-meta-group-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; min-width: 0; }
/* A long criterion ("Construction Work In, Over or Adjacent to Water/Liquids …") wraps inside its chip on a phone. */
.documents-dialog label.documents-meta-chip { max-width: 100%; }
.documents-dialog label.documents-meta-chip span { min-width: 0; overflow-wrap: anywhere; }
/* A chip the page hides stays hidden. */
.documents-dialog label.documents-meta-chip[hidden] { display: none; }
.documents-dialog label.documents-meta-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.65rem; border: 1px solid #d0d5dd; border-radius: 999px; background: #fff; font-weight: 500; font-size: 0.85rem; cursor: pointer; }
.documents-dialog label.documents-meta-chip:has(input:checked) { border-color: var(--brand, #007b77); background: color-mix(in srgb, var(--brand, #007b77) 9%, #fff); }
.documents-dialog label.documents-meta-standard-name { padding: 0; border: 0; border-radius: 0; background: none; font-weight: 600; font-size: 0.9rem; }
.documents-dialog label.documents-meta-standard-name:has(input:checked) { background: none; }
.documents-meta-legislation { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.documents-meta-legislation[hidden] { display: none; }
.documents-meta-legislation li { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.35rem 0.6rem; border-radius: 8px; background: #f9fafb; font-size: 0.9rem; }
.documents-meta-remove { border: 0; background: none; color: #b42318; font: inherit; font-size: 0.85rem; cursor: pointer; }
.documents-upload { display: grid; gap: 0.9rem; padding: 1rem; border: 1px solid var(--line, #e4e7ec); border-radius: 14px; background: #fcfcfd; }
/* The checkbox sits beside its words (c24): `.documents-dialog label` is a grid, so this says otherwise. */
.documents-dialog label.documents-check { display: flex; align-items: center; gap: 0.55rem; font-weight: 500; }
.documents-dialog label.documents-check input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--brand, #007b77); }
/* A drop zone instead of the browser's "Choose File" (c24). The input inside stays the field. */
.documents-dialog label.documents-dropzone { position: relative; display: grid; justify-items: center; gap: 0.25rem; padding: 1.3rem 1rem; border: 1.5px dashed #b9c4d0; border-radius: 12px; background: #fff; text-align: center; font-weight: 500; cursor: pointer; }
.documents-dropzone:hover, .documents-dropzone:focus-within { border-color: var(--brand, #007b77); background: color-mix(in srgb, var(--brand, #007b77) 5%, #fff); }
.documents-dropzone:focus-within { outline: 2px solid var(--brand, #007b77); outline-offset: 2px; }
.documents-dropzone-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.documents-dropzone-icon { font-size: 1.5rem; line-height: 1; color: var(--brand, #007b77); }
.documents-dropzone-file { font-weight: 700; color: #101828; word-break: break-all; }
.documents-dropzone-text { color: #344054; }
.documents-dropzone-hint { color: var(--muted, #667085); font-size: 0.8rem; }
.documents-dropzone [hidden] { display: none; }
.documents-dialog label.documents-dropzone[data-attached] { border-style: solid; border-color: #12805c; background: #ecfdf3; }
/* A file held over the box (Bryan's review, 2026-11-11): the plain box rule above outranked the old drag rule, so
   nothing changed while dragging. Last, so it also shows over a box that already holds a file. */
.documents-dialog label.documents-dropzone[data-dragging] { border-style: solid; border-width: 2px; border-color: var(--brand, #007b77); background: color-mix(in srgb, var(--brand, #007b77) 14%, #fff); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand, #007b77) 18%, transparent); }
.documents-dropzone[data-attached] .documents-dropzone-icon { display: none; }
.documents-dropzone-attached { display: inline-flex; align-items: center; gap: 0.35rem; color: #0b6b4b; font-weight: 750; font-size: 1rem; }
.documents-dropzone-attached > span:first-child { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 999px; background: #12805c; color: #fff; font-size: 0.9rem; }
@media (max-width: 640px) {
  .documents-create-dialog { width: 100%; max-width: none; max-height: 100dvh; margin: 0; border-radius: 0; }
  .documents-create-choices { grid-template-columns: 1fr; }
  .documents-create-choice { min-height: 0; }
  .documents-meta-chips { padding-left: 0; }
  .documents-create-dialog form { padding: 1.4rem 1rem 1.2rem; }
  .documents-create-dialog h2 { font-size: 1.3rem; }
  .documents-composer { flex-wrap: wrap; padding: 8px 10px 8px 14px; }
  .documents-composer textarea { flex-basis: 100%; }
  .documents-composer-actions { margin-left: auto; }
  .documents-place-panel { max-height: 60vh; }
  .documents-place-button { width: 100%; }
}
/* The steering chips under the AI's opening line on a brand-new document. */
.editor-ai-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0; }

/* Accept / Reject on a pending tag chip, in the row's tag editor. Small and quiet: the
   chip is the subject, these are what you do to it. Replaces the strip that listed every
   proposal across the top of the register. */
.tag-decide { margin-left: 6px; border: 0; border-radius: 6px; background: rgba(0, 0, 0, 0.06); color: inherit; padding: 1px 6px; font: inherit; font-size: 10px; font-weight: 700; cursor: pointer; }
.tag-decide:hover:not(:disabled) { background: rgba(0, 0, 0, 0.12); }
.tag-decide:disabled { opacity: 0.5; cursor: default; }

/* A request that turns out to be a process: the answer, and the way forward, inline in the
   same hint line the type question uses. */
#create-reason[data-kind="process"],#create-reason[data-kind="procedure"]{display:grid;gap:10px}
/* "Write the procedure from …" and its siblings: the same pill as "Open …" beside them. */
.create-procedure-from,#create-design-process:not(.primary),#create-design-anyway{display:inline-block;padding:8px 12px;border:1px solid #cfd5e2;border-radius:10px;background:#fff;color:inherit;font:inherit;min-height:44px;cursor:pointer}
.create-procedure-from:hover:not(:disabled),#create-design-process:not(.primary):hover:not(:disabled){border-color:#9aa3b5}
.create-process-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
/* A choice with what it makes under it: the title and number it creates, and which process
   it is (two of one name were two identical buttons — video review, 2026-10-21). */
.create-process-option{display:grid;gap:2px;justify-items:start;max-width:100%}
.create-process-option-detail{display:grid;gap:0;font-size:0.82em;color:var(--muted,#5b6472);overflow-wrap:anywhere}
.create-process-option-number{font-family:var(--mono,ui-monospace,SFMono-Regular,Menlo,monospace)}
.create-process-option-number:empty{display:none}
.create-process-open{display:inline-block;padding:8px 12px;border:1px solid #cfd5e2;border-radius:10px;text-decoration:none;color:inherit;min-height:44px;line-height:26px}
.create-process-who,.create-process-error{color:var(--muted,#5b6472)}
/* "Start Writing" pressed on a procedure answer it cannot start: the way on, or who to ask, is shown. */
.create-process-actions[data-pointed]{outline:2px solid var(--accent,#1f6feb);outline-offset:4px;border-radius:8px}
.create-process-actions[data-pointed] .create-process-who{color:inherit;font-weight:600}
/* "You may already have this": the same shape as the process answer above — the sentence,
   then one button per document it found, then "Create a new one anyway". Without these
   the links ran together into one underlined line on the live register (2026-09-23). */
#create-reason[data-kind="existing-document"]{display:grid;gap:10px}
.create-existing-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.create-existing-open{display:inline-block;padding:8px 12px;border:1px solid #cfd5e2;border-radius:10px;text-decoration:none;color:inherit;min-height:44px;line-height:26px}

.documents-process-answer{display:grid;gap:10px;margin:10px 0 18px;padding:14px 16px;border:1px solid #e1e5ef;border-radius:12px;background:#fffbf2}

/* By type: one chip per type the register holds, with its count. */
.type-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.type-filter button {
  font: inherit; font-size: 13px; border: 1px solid var(--line, #e4e7ec); border-radius: 999px;
  padding: 4px 12px; background: #fff; color: var(--ink, #101828); cursor: pointer;
}
.type-filter button .count { color: var(--muted, #667085); margin-left: 6px; font-variant-numeric: tabular-nums; }
.type-filter button[aria-pressed="true"] { background: var(--brand, #007b77); border-color: var(--brand, #007b77); color: #fff; }
.type-filter button[aria-pressed="true"] .count { color: rgba(255, 255, 255, 0.85); }
.type-filter button:focus-visible { outline: 2px solid var(--brand, #007b77); outline-offset: 2px; }
/* Grouped by type: a heading row per type, in the tenant's order. */
.documents-group {
  display: flex; align-items: baseline; gap: 8px; padding: 14px 12px 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted, #667085);
  border-bottom: 1px solid var(--line, #e4e7ec);
}
.documents-group .count { font-weight: 500; font-variant-numeric: tabular-nums; }
/* Info: a definition list, label left, value right. */
.documents-info { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.documents-info dt { color: var(--muted, #667085); font-weight: 500; }
.documents-info dd { margin: 0; }
/* An empty error line takes no room; it appears only when there is something to say. */
.documents-dialog .error:empty { display: none; }
/* Delete (c21): the administrator's last menu item, and its type-to-confirm dialog. */
.documents-menu-items > button.danger { color: #b42318; }
.documents-menu-items > button.danger:hover, .documents-menu-items > button.danger:focus-visible { background: #fef3f2; }
/* Where Delete would be on a template that stays (published, or new documents start from it): why, in plain words. */
.documents-menu-items > .documents-menu-note { margin: 0; padding: 0.45rem 0.7rem; max-width: 16rem; color: var(--muted, #667085); font-size: 0.85em; line-height: 1.35; white-space: normal; }
/* A dialog about one document: its name in bold (the heading), its number under it, as the register row shows them (D2/D3, 2026-11-04). */
.documents-dialog-number { margin: -0.8rem 0 0; color: #5b6b82; font-size: 12px; font-variant-numeric: tabular-nums; }
/* Info (Bryan's review, 2026-11-12, item 21): wider so its rows are not squeezed, the number right under the title. */
.documents-dialog.documents-info-dialog { max-width: 40rem; }
.documents-info-dialog h2 { margin: 0; line-height: 1.25; }
.documents-info-dialog .documents-dialog-number { margin-top: -0.75rem; }
.documents-info dd > div + div { margin-top: 2px; }
.documents-delete-confirm { display: grid; gap: 6px; margin: 0 0 14px; font-size: 13px; color: #344054; }
.documents-delete-confirm input { font: inherit; padding: 9px 11px; border: 1px solid #d0d5dd; border-radius: 8px; letter-spacing: 0.08em; }
.documents-delete-confirm input:focus-visible { outline: 2px solid #b42318; outline-offset: 1px; }
.documents-dialog button.danger { background: #b42318; border: 1px solid #b42318; color: #fff; border-radius: 8px; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.documents-dialog button.danger:disabled { background: #fda29b; border-color: #fda29b; cursor: not-allowed; }

/* The DMS register uses the shared TheBridge shell and a flat, scannable list. */
body[data-documents-register] .library-shell > main { background: #fff; }
body[data-documents-register] .library-actions .search { width: clamp(280px, 32vw, 580px); }
body[data-documents-register] .library-actions .ghost, #legislation-more-actions > summary.ghost { height: 44px; }
.documents-heading p { margin: 4px 0 0; color: #5b6b82; font-size: 15px; }
.documents-heading h1 { color: #101828; }
.documents-status-tabs { display: flex; align-items: stretch; gap: 20px; margin: 23px 0 16px; border-bottom: 1px solid #dce5e4; }
.documents-status-tabs button { min-width: 95px; padding: 11px 9px 13px; border: 0; border-bottom: 3px solid transparent; background: none; color: #475467; font: inherit; font-size: 13px; cursor: pointer; }
.documents-status-tabs button[aria-current="page"] { border-color: var(--brand); color: var(--brand); font-weight: 700; }
.documents-status-tabs button:hover { color: var(--brand); }
.documents-status-tabs > span { align-self: center; margin-left: auto; color: #5b6b82; font-size: 11px; text-align: right; }
/* No tabs (a reader): no tab bar either — just the count, at the bar's height. */
.documents-status-tabs[data-tabs="off"] { min-height: 0; padding: 4px 0 6px; border-bottom: 0; }
/* The fields fold behind Reports' "Filters" button (report-filter.css draws the button, the
   chips and Clear filters); folded, the register starts straight under the tabs. */
.documents-filters { margin: 0 0 16px; }
.documents-filter-bar { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 14px; align-items: end; }
.documents-filter-bar[hidden] { display: none; }
.documents-filter, .tag-filter { display: grid; gap: 5px; min-width: 0; color: #34425a; font-size: 12px; }
.documents-filter select, .tag-filter select { width: 100%; height: 36px; min-width: 0; padding: 0 11px; border: 1px solid #cfdbdc; border-radius: 6px; background: #fff; color: #34425a; font: inherit; font-size: 12px; }
.documents-filter-bar .tag-filters { display: contents; }
.documents-review-alert { display: flex; align-items: center; gap: 13px; min-height: 50px; margin-bottom: 16px; padding: 0 16px; border-radius: 7px; background: #fff1f0; color: #b42318; font-size: 12px; }
.documents-review-alert[hidden], .documents-status-tabs button[hidden] { display: none !important; }
/* An archived row says when it left circulation (c20), quietly: never a next review. */
.documents-review-alert > span { font-size: 20px; }
.documents-review-alert button { border: 0; background: none; color: var(--brand); font: inherit; cursor: pointer; }
.documents-review-alert #documents-show-overdue { margin-left: 10px; }
.documents-review-alert #documents-dismiss-alert { margin-left: auto; color: #667085; font-size: 20px; }
.documents-table { overflow: visible; margin-top: 0; border: 1px solid #dce5e4; border-radius: 7px; background: #fff; }
.documents-table .documents-row { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; }
.documents-table .documents-cells,
.documents-table .table-head.documents-row > .documents-cells { display: grid; grid-template-columns: minmax(240px, 2.8fr) minmax(85px, .85fr) minmax(110px, 1fr) minmax(65px, .6fr); gap: 12px; align-items: center; }
.documents-table .table-head { min-height: 38px; height: auto; padding: 0 16px; background: #f3f6f7; color: #34425a; font-size: 11px; font-weight: 700; }
.documents-table .documents-link { min-height: 73px; padding: 10px 16px; }
.documents-table .documents-link > span { min-width: 0; color: #34425a; font-size: 12px; }
.documents-table .documents-link > .documents-identity { color: #101828; }
.documents-identity-line { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
/* The title first, bold and a size up; the register number small under it (customer video, 2026-10-21). */
.documents-number { display: block; color: #5b6b82; font-size: 11px; font-variant-numeric: tabular-nums; }
.documents-state-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 10px; font-weight: 650; }
/* One colour a state, from theme.css's --status-* pairs (Bryan's review video, 2026-11-06). */
.documents-state-badge[data-state="published"] { background: var(--status-published-bg, #d9f3e4); color: var(--status-published-fg, #13603f); }
.documents-state-badge[data-state="draft"] { background: var(--status-draft-bg, #e7ebf1); color: var(--status-draft-fg, #3f4d63); }
.documents-state-badge[data-state="in_review"] { background: var(--status-review-bg, #fff1d6); color: var(--status-review-fg, #7a4a00); }
.documents-state-badge[data-state="imported_unverified"] { background: var(--status-imported-bg, #efe8fb); color: var(--status-imported-fg, #5b3a96); }
.documents-state-badge[data-state="withdrawn"] { background: var(--status-withdrawn-bg, #fdecec); color: var(--status-withdrawn-fg, #8a1c1c); }
.documents-state-badge[data-state="archived"] { background: var(--status-archived-bg, #efe9e6); color: var(--status-archived-fg, #5e4d44); }
.documents-table .documents-title { color: #101828; font-size: 14px; font-weight: 700; white-space: normal; overflow: visible; }
.documents-identity small { display: block; margin-top: 3px; color: #5b6b82; font-size: 10px; }
.documents-identity .documents-drift { color: #b42318; }
.documents-mobile-meta { display: none !important; }
.documents-identity .documents-review[data-due="overdue"] { color: #b42318; font-weight: 650; }
.documents-identity .documents-review[data-due="approaching"] { color: #a75b16; font-weight: 650; }
/* Archiving or a change under way, and where it is (D1): said plainly on the row. */
.documents-identity .documents-under-way { color: #344054; font-weight: 600; }
.documents-identity .documents-under-way[data-kind="archive"] { color: #a75b16; }
.documents-archive-reason { display: grid; gap: 6px; margin: 0 0 12px; font-size: 13px; color: #344054; }
.documents-archive-reason textarea { font: inherit; padding: 9px 11px; border: 1px solid #d0d5dd; border-radius: 8px; resize: vertical; }
.documents-status-link { font-weight: 600; color: var(--brand, #007b77); }
/* Removal from the archive (Sam, 2026-11-03): what can't be undone, said before anything is typed. */
.documents-remove-undo { margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: #fef3f2; color: #912018; font-size: 13px; }
.documents-identity .documents-under-way[data-kind="removal"] { color: #b42318; }
.documents-menu > summary { width: 30px; height: 30px; }
.documents-tag-editor { padding-left: 16px; }
.documents-list-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 10px; color: #5b6b82; font-size: 11px; }

@media (max-width: 1000px) {
  body[data-documents-register] .library-head { flex-wrap: wrap; }
  body[data-documents-register] .library-actions { width: 100%; justify-content: flex-end; }
  .documents-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .documents-table .documents-cells,
  .documents-table .table-head.documents-row > .documents-cells { grid-template-columns: minmax(180px, 2.4fr) minmax(72px, .8fr) minmax(90px, 1fr) 55px; gap: 8px; }
}
@media (max-width: 700px) {
  body[data-documents-register] .library-head { flex-wrap: wrap; }
  body[data-documents-register] .library-actions { width: 100%; flex-wrap: wrap; }
  body[data-documents-register] .library-actions .search { display: flex; width: min(100%, 430px); flex: 1 1 220px; }
  .documents-heading p { font-size: 12px; }
  .documents-status-tabs { gap: 3px; margin-top: 15px; }
  .documents-status-tabs button { min-width: 70px; padding-inline: 4px; font-size: 11px; }
  .documents-status-tabs > span { font-size: 10px; }
  .documents-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .documents-filter-bar > .documents-filter { grid-column: 1 / -1; }
  .documents-filter, .tag-filter { font-size: 10px; }
  .documents-filter select, .tag-filter select { height: 34px; padding-inline: 5px; font-size: 10px; }
  .documents-review-alert { min-height: 44px; gap: 6px; padding: 7px 9px; font-size: 10px; }
  .documents-table { border: 0; background: transparent; }
  .documents-table .table-head { display: none; }
  #documents-rows { display: grid; gap: 8px; }
  .documents-table .documents-row { border: 1px solid #dce5e4; border-radius: 7px; background: #fff; }
  .documents-table .documents-cells { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
  .documents-table .documents-cells > span:nth-child(2), .documents-table .documents-cells > span:nth-child(3), .documents-table .documents-cells > span:nth-child(4) { display: none; }
  .documents-table .documents-link { min-height: 76px; padding: 10px; border: 0; }
  .documents-mobile-meta { display: block !important; }
  .documents-list-footer { flex-wrap: wrap; font-size: 10px; }
}

/* THE ORGANISATION'S HIERARCHY (feedback c19): a collapsible section per level, in order. */
.documents-level + .documents-level { border-top: 1px solid var(--line, rgba(0, 0, 0, 0.08)); }
.documents-level-head { display: flex; width: 100%; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0.6rem 0.9rem; border: 0; background: var(--surface-2, #fafafa); font: inherit; font-weight: 600; text-align: left; cursor: pointer; color: inherit; min-height: 44px; }
.documents-level-head::before { content: "▾"; display: inline-block; width: 1rem; color: var(--muted, #6b6b6b); }
.documents-level-head[aria-expanded="false"]::before { content: "▸"; }
.documents-level-title { flex: 1; }
.documents-level-count { font-weight: 400; color: var(--muted, #6b6b6b); font-size: 0.9em; white-space: nowrap; }
.documents-level-head:focus-visible { outline: 2px solid var(--brand, #007b77); outline-offset: -2px; }
.documents-level-none { margin: 0; padding: 0.6rem 0.9rem 0.6rem 1.9rem; color: var(--muted, #6b6b6b); }
.documents-level-gap { margin: 0; padding: 0.35rem 0.9rem 0.35rem 1.9rem; font-size: 0.85em; color: var(--warning-text, #8a5a00); background: var(--warning-surface, #fff8e6); }

/* Confirming what is being made: type, process group, and the number it will be given. */
#create-reason[data-kind="confirm"] { display: grid; gap: 10px; }
/* minmax(0, 1fr), min-width: 0: the select's min-content is its longest option, and in a wide
   font ("Asset (performance) management") that alone pushed the field, and the form's grid
   track with it, past a 390px dialog. The select shrinks to the field; its options still show. */
.create-group-field { display: grid; gap: 4px; grid-template-columns: minmax(0, 1fr); }
.create-group-field select { font: inherit; padding: 0.5rem 0.6rem; border: 1px solid var(--line, #cfcfcf); border-radius: 8px; min-height: 44px; max-width: 100%; min-width: 0; width: 100%; }
/* THE LISTS A NUMBER IS PICKED FROM (number-fields.js). The list is in the form's flow, so it never
   hangs off a phone-width dialog; 16px so a phone does not zoom in on the box. */
.create-number-fields { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.create-group-field.number-field input[type="search"] { font: inherit; font-size: max(1em, 16px); padding: 0.5rem 0.6rem; border: 1px solid var(--line, #cfcfcf); border-radius: 8px; min-height: 44px; max-width: 100%; min-width: 0; width: 100%; box-sizing: border-box; }
.number-field-list { list-style: none; margin: 0; padding: 4px 0; max-height: 220px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line, #cfcfcf); border-radius: 8px; background: var(--surface, #fff); }
.number-field-list li { padding: 0.5rem 0.6rem; min-height: 44px; box-sizing: border-box; display: flex; align-items: center; cursor: pointer; overflow-wrap: anywhere; }
.number-field-list li:hover, .number-field-list li[aria-selected="true"] { background: var(--hover, rgba(0, 0, 0, 0.06)); }
.number-field-list li.number-field-none { cursor: default; color: var(--muted, #666); }
#create-upload-number-slot { display: grid; gap: 10px; }
#create-upload-number-slot[hidden] { display: none; }
.create-number-fields[hidden], .number-field[hidden] { display: none; }
.create-number-preview { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; overflow-wrap: anywhere; color: var(--text, inherit); }
#create-confirm { justify-self: start; }

/* A LONG NUMBER WRAPS IN ITS OWN CELL. Fluence's numbers are built from the title
   (Fluence_APZ-AU_OHS_SOP_…_ENG) and have no spaces, so they ran over the Type column and the
   state badge (DMS e2e round 4). Display only: the identifier's characters are never changed,
   so a copied number is still exact. */
.documents-table .documents-identity { min-width: 0; }
.documents-identity-line { flex-wrap: wrap; min-width: 0; }
.documents-number { min-width: 0; overflow-wrap: anywhere; }

/* Held until the register's first answer (index.html data-list-settling, documents.js load). */
main[data-list-settling] #document-status-tabs,
main[data-list-settling] #documents-filters,
main[data-list-settling] .documents-table,
main[data-list-settling] .documents-list-footer { visibility: hidden; }

/* THE FIRST STEP'S QUESTIONS ON THE LOAD PAGE (load-step.js; Bryan's review, 2026-11-03): each of the
   step's sections a box like the document's own details above it, its people one compact row each. */
.documents-step-slot { display: grid; gap: 0.9rem; min-width: 0; }
.documents-step-slot[hidden] { display: none; }
.documents-step { display: grid; gap: 0.9rem; min-width: 0; }
.documents-step-section[hidden], .documents-step-field[hidden], .documents-step-table[hidden] { display: none; }
.documents-dialog .documents-step-field select, .documents-dialog .documents-step-field input, .documents-dialog .documents-step-field textarea,
.documents-step-cell select, .documents-step-cell input { width: 100%; min-width: 0; box-sizing: border-box; font: inherit; font-weight: 400; padding: 0.5rem 0.65rem; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; }
.documents-step-search { margin-bottom: 0.1rem; }
.documents-step-required { color: #b42318; }
.documents-step-required[hidden] { display: none; }
.documents-step-table { display: grid; gap: 0.5rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.documents-step-table legend { padding: 0; font-weight: 600; }
.documents-step-rows { display: grid; gap: 0.5rem; }
.documents-step-row { display: flex; align-items: flex-start; gap: 0.4rem; padding: 0.55rem 0.6rem; border: 1px solid var(--line, #e4e7ec); border-radius: 10px; background: #fcfcfd; }
.documents-step-cells { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.45rem; min-width: 0; }
.documents-dialog label.documents-step-cell { display: grid; gap: 0.2rem; font-weight: 500; font-size: 0.85rem; color: #475467; min-width: 0; }
.documents-step-who { grid-column: 1 / -1; }
.documents-step-who input[hidden] { display: none; }
.documents-dialog label.documents-step-check { display: flex; align-items: center; gap: 0.4rem; }
.documents-step-add { justify-self: start; font: inherit; padding: 0.4rem 0.8rem; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; cursor: pointer; }
.documents-step-link { border: 0; padding: 0; background: none; color: var(--brand, #007b77); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.documents-step-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.documents-step-group-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.documents-step-group-form[hidden] { display: none; }
.documents-step-group-form input { font: inherit; padding: 0.4rem 0.6rem; border: 1px solid #d0d5dd; border-radius: 8px; }
.documents-step-problem { margin: 0.2rem 0 0; color: #b42318; font-weight: 600; font-size: 0.9rem; }
.documents-step [aria-invalid="true"] { border-color: #b42318; outline: 2px solid color-mix(in srgb, #b42318 25%, transparent); }
/* DONE IN THE DOCUMENT (editor.html showDone; review, 2026-11-03 and 11-11): the step finished, and the way on (Home, or a step to open). */
/* SMALL, CENTRED, LOWER DOWN (Bryan's review, 2026-11-26, 04:36 and 13:15: "this could be down here... just above the text... it
   doesn't have to be as big... nice and central text"), and no second "Loading..." sign beside it while the page goes Home. */
.editor-done { display: grid; justify-items: center; text-align: center; gap: 0.6rem; margin: 22vh auto 2rem; width: min(26rem, calc(100% - 2rem)); box-sizing: border-box; padding: 0.9rem 1.2rem; border: 1px solid #abefc6; border-radius: 12px; background: #ecfdf3; }
html:has(#editor-done:not([hidden])) .bridgeconnect-loading { display: none !important; }
.editor-done[hidden] { display: none; }
.editor-finish-status[data-busy="1"] { display: flex; align-items: center; gap: 0.5rem; }
.editor-finish-status[data-busy="1"]::before { content: ""; flex: none; width: 1rem; height: 1rem; border: 2px solid #d0d5dd; border-top-color: #1570ef; border-radius: 50%; animation: editor-finish-spin 0.8s linear infinite; }
@keyframes editor-finish-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .editor-finish-status[data-busy="1"]::before { animation-duration: 2.4s; } }
.editor-done p { margin: 0; font-size: 0.98rem; font-weight: 600; color: #054f31; }
.editor-done-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 16px; border-radius: 8px; background: var(--brand, #007b77); color: #fff; font-weight: 700; text-decoration: none; }
.editor-done-link:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand, #007b77) 40%, #fff); outline-offset: 2px; }
/* The way on: a step to open, and Return to Home beside it, quieter. */
.editor-done-ways { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.editor-done-home { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid #abefc6; border-radius: 8px; background: #fff; color: #054f31; font-weight: 700; text-decoration: none; }
.editor-done-home[hidden] { display: none; }
.editor-done-home:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand, #007b77) 40%, #fff); outline-offset: 2px; }

/* A document's metadata in its editor (L5, 2026-11-04): what it says itself, then what was added. */
.documents-metadata-heading { flex-basis: 100%; margin: 0.3rem 0 0; color: var(--muted, #667085); font-size: 0.8rem; font-weight: 600; }
/* The standards suggested from reading it (Sam, 2026-11-04): ticked, with the reason and the passage each rests on. */
.documents-suggestions { flex-basis: 100%; display: grid; gap: 0.45rem; min-width: 0; }
.documents-suggestion { display: flex; align-items: flex-start; gap: 0.55rem; min-width: 0; font-weight: 400; }
.documents-suggestion input { margin-top: 0.2rem; flex: 0 0 auto; accent-color: var(--brand, #007b77); }
.documents-suggestion-words { display: grid; gap: 0.15rem; min-width: 0; overflow-wrap: anywhere; }
.documents-suggestion-words strong { font-weight: 600; font-size: 0.88rem; }
.documents-suggestion-badge { justify-self: start; padding: 0.05rem 0.45rem; border-radius: 999px; background: #fef0c7; color: #93370d; font-size: 0.72rem; font-weight: 600; }
.documents-suggestion-reason { color: #344054; font-size: 0.84rem; }
.documents-suggestion-passage { color: var(--muted, #667085); font-size: 0.8rem; font-style: italic; }
.documents-suggestion-actions { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; }
.documents-tag-editor .documents-metadata-fixed { background: #f2f4f7; }
/* Long words (an Act's title) wrap inside their chip, and the chips inside the editor: never past a phone's edge. */
.documents-tag-editor .tags { flex: 1 1 100%; min-width: 0; }
.documents-tag-editor .tag { max-width: 100%; overflow-wrap: anywhere; }
.documents-tag-editor .documents-tag-add { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.documents-tag-editor .documents-tag-add input { min-width: 0; flex: 1 1 8rem; }

/* MORE: the page's other actions in one menu beside New Document (Bryan's review video, 2026-11-06; documents.js
   syncActionsMenu). Ids, because oversight-door.js adds its own rule for its link at run time, after this sheet. */
.documents-actions-menu { position: relative; }
.documents-actions-menu[hidden] { display: none; }
.documents-actions-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 44px; border-radius: 8px; padding: 0 14px; border: 1px solid #d0d5dd; background: #fff; color: #344054; font-weight: 650; font-size: 12px; cursor: pointer; white-space: nowrap; }
.documents-actions-menu > summary::-webkit-details-marker { display: none; }
.documents-actions-menu > summary:hover, .documents-actions-menu[open] > summary { background: #f7f8fa; }
.documents-actions-menu > summary:focus-visible { outline: 2px solid var(--brand, #007b77); outline-offset: 1px; }
.documents-actions-chevron { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.documents-actions-menu[open] .documents-actions-chevron { transform: rotate(180deg); }
#documents-more-actions-items, #legislation-more-actions-items { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 15rem; display: grid; padding: 0.3rem; border: 1px solid var(--line, rgba(0, 0, 0, 0.14)); border-radius: 10px; background: #fff; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12); }
#documents-more-actions-items > a, #documents-more-actions-items > button,
#legislation-more-actions-items > a, #legislation-more-actions-items > button { display: flex; align-items: center; height: auto; min-height: 36px; padding: 0.45rem 0.7rem; border: 0; border-radius: 7px; background: none; color: #344054; font: inherit; font-size: 13px; font-weight: 500; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; }
#documents-more-actions-items > a:hover, #documents-more-actions-items > button:hover,
#documents-more-actions-items > a:focus-visible, #documents-more-actions-items > button:focus-visible,
#legislation-more-actions-items > button:hover, #legislation-more-actions-items > button:focus-visible { background: var(--surface-hover, rgba(0, 0, 0, 0.05)); outline: none; }
#documents-more-actions-items > a:focus-visible, #documents-more-actions-items > button:focus-visible,
#legislation-more-actions-items > button:focus-visible { box-shadow: inset 0 0 0 2px var(--brand, #007b77); }
#documents-more-actions-items > [hidden], #legislation-more-actions-items > [hidden] { display: none; }
@media (max-width: 700px) { #documents-more-actions-items, #legislation-more-actions-items { right: auto; left: 0; } }

/* MORE on the upload form: the other functions a document covers, folded (Bryan's review video, 2026-11-06). */
.documents-create-more[hidden] { display: none; }
.documents-create-more > summary { width: max-content; cursor: pointer; color: var(--brand, #007b77); font-size: 13px; font-weight: 650; }
.documents-create-more > summary:focus-visible { outline: 2px solid var(--brand, #007b77); outline-offset: 2px; border-radius: 4px; }
.documents-create-more[open] > summary { margin-bottom: 8px; }

/* The AI still writing a document's first draft (documents.js aiWritingText). */
.documents-ai-writing { display: block; color: var(--accent, #2563eb); font-style: italic; }

/* Loading cover over the editor until the document is drawn (Bryan, 2026-11-13, item 9). */
.editor-workspace { position: relative; }
.editor-frame.is-loading { visibility: hidden; }
.editor-loading { position: absolute; inset: 0; z-index: 2; display: flex; gap: 12px; align-items: center; justify-content: center; background: #f3f3f3; color: var(--muted, #475467); font-size: 1rem; }
.editor-loading[hidden] { display: none; }
.editor-loading-spinner { width: 22px; height: 22px; border: 3px solid #d0d5dd; border-top-color: var(--accent, #1f6feb); border-radius: 50%; animation: editor-loading-spin 0.9s linear infinite; }
@keyframes editor-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .editor-loading-spinner { animation: none; } }

/* Item 10 (2026-11-13): the acceptor decides the tracked changes from the review panel. */
.editor-review-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }

/* REQUIRED, SAID ON THE FORM (Bryan's review, 2026-11-15): a red asterisk on every field the New Document form needs,
   and each one still empty on Upload marked in red (documents.js showMissingUploadAnswers). */
.documents-required { color: #b42318; font-weight: 700; }
.documents-upload [data-missing="true"] input:not([type="checkbox"]):not([type="file"]),
.documents-upload [data-missing="true"] select { border-color: #b42318; outline: 2px solid color-mix(in srgb, #b42318 25%, transparent); }
.documents-upload fieldset[data-missing="true"], .documents-upload .documents-dropzone[data-missing="true"] { border-color: #b42318; box-shadow: 0 0 0 2px color-mix(in srgb, #b42318 25%, transparent); }
.documents-upload [data-missing="true"] > span:first-child, .documents-upload [data-missing="true"] > legend { color: #b42318; }
.documents-form-missing { margin: 0; color: #b42318; font-weight: 600; font-size: 0.9rem; }
.documents-form-missing[hidden] { display: none; }
/* "Why them?" on its own full-width line under the person, as on the task page's form (process-runtime.css;
   Bryan's review, 2026-11-15: "there's not a lot of room ... bring that right out to the end"). */
.documents-step-cells .documents-step-cell:has([data-step-cell="why"]) { grid-column: 1 / -1; }
/* Item 10 (Bryan, 2026-11-15): the acceptor's changes and comments, docked on the right of the document, one list in
   document order. Its own scroll, so a hundred comments never push the page off the screen. */
.editor-review-panel { flex: 0 0 clamp(260px, 24%, 360px); min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line, #e4e7ec); background: var(--surface, #fff); }
.editor-review-panel[hidden] { display: none; }
.editor-review-head { display: flex; align-items: center; gap: 8px; padding: 0.6rem 0.75rem 0.2rem; font-size: 0.85rem; }
.editor-review-head .editor-markup-refresh { margin-left: auto; }
.editor-review-panel .editor-review-actions { margin: 4px 0.75rem 8px; }
.editor-review-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 0.75rem 0.75rem; }
.editor-review-row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 0.35rem; }
.editor-review-row-actions .editor-markup-refresh { margin-left: 0; }
.editor-markup-row.is-deciding { opacity: 0.55; }
.editor-markup-row.is-clickable { cursor: pointer; }
.editor-markup-row.is-clickable:hover, .editor-markup-row.is-clickable:focus-visible { background: var(--bc-hover, rgba(0, 0, 0, 0.04)); }
@media (max-width: 900px) {
  .editor-review-panel { flex: 0 0 40vh; border-left: 0; border-top: 1px solid var(--line, #d9dce3); }
}

/* DOCUMENTS ON A PHONE (Sam's approved mobile design, 2026-11-21). The library keeps its cards (above);
   here: a 24px title, the status tabs as wrapping pills, no empty levels, 44px targets, More and each
   row's ⋯ as a bottom sheet of 48px rows over a scrim (a tap on the scrim closes it: documents.js),
   the filters as one column of 48px fields, and New Document as a sheet from the bottom. Desktop and
   tablet are untouched: everything here sits under 640px. */
/* The filter sheet's own Clear / Show row exists only on a phone (below). */
@media (min-width: 641px) { .documents-filter-sheet-actions { display: none; } }

@media (max-width: 640px) {
  /* The change request opens as a bottom sheet (approved mobile design). */
  dialog.documents-change-sheet { margin: auto 0 0; width: 100%; max-width: none; max-height: 90vh; border-radius: 16px 16px 0 0; box-sizing: border-box; }
  dialog.documents-change-sheet input, dialog.documents-change-sheet textarea { width: 100%; box-sizing: border-box; font-size: 16px; }
  dialog.documents-change-sheet .documents-dialog-actions button { flex: 1 1 0; min-height: 44px; }
  body[data-documents-register] .library-shell > main { padding: 20px 16px; }
  body[data-documents-register] .library-head h1 { font-size: 24px; line-height: 1.2; }
  body[data-documents-register] .library-actions .search { flex: 1 1 100%; width: 100%; }
  body[data-documents-register] .library-actions #open-create { flex: 1 1 auto; }
  .documents-status-tabs { flex-wrap: wrap; gap: 8px; border-bottom: 0; margin: 12px 0; }
  .documents-status-tabs button { min-width: 0; min-height: 44px; padding: 0 16px; border: 1px solid #d0d5dd; border-radius: 999px; background: #fff; font-size: 14px; }
  .documents-status-tabs button[aria-current="page"] { border-color: var(--brand, #007b77); background: var(--brand, #007b77); color: #fff; }
  .documents-status-tabs > span { flex-basis: 100%; margin-left: 0; text-align: left; font-size: 12px; }
  .documents-level[data-empty] { display: none; }
  .documents-menu > summary { width: 44px; height: 44px; }
  .documents-filter-bar { grid-template-columns: 1fr; gap: 12px; }
  .documents-filter, .tag-filter { font-size: 13px; }
  .documents-filter select, .tag-filter select { height: 48px; padding-inline: 12px; font-size: 16px; }
  #documents-more-actions[open] > #documents-more-actions-items,
  .documents-menu[open] > .documents-menu-items {
    position: fixed; inset: auto 0 0 0; z-index: 80; width: 100%; min-width: 0; max-width: none;
    /* No max-height or scroll: the white ::after panel covers the box, so a scrolled sheet would show rows over the scrim. */
    display: grid; gap: 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); border: 0; border-radius: 16px 16px 0 0; background: transparent; box-shadow: none;
  }
  #documents-more-actions[open] > #documents-more-actions-items::before,
  .documents-menu[open] > .documents-menu-items::before { content: ""; position: fixed; inset: 0; z-index: -2; background: rgba(16, 24, 40, 0.45); }
  #documents-more-actions[open] > #documents-more-actions-items::after,
  .documents-menu[open] > .documents-menu-items::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 16px 16px 0 0; background: #fff; box-shadow: 0 -8px 32px rgba(16, 24, 40, 0.18); }
  /* !important: the shell's coarse-pointer rule sets every button's min-height to 44px the same way (theme.css). */
  #documents-more-actions-items > a, #documents-more-actions-items > button,
  .documents-menu-items > a, .documents-menu-items > button { display: flex; align-items: center; min-height: 48px !important; padding: 0 12px; border-radius: 10px; font-size: 16px; white-space: normal; }
  .documents-menu-items > .documents-menu-note { max-width: none; }
  .documents-create-dialog { width: 100%; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  /* The filters open as a bottom sheet over a scrim, ended by Clear and "Show N Documents" (documents.js). */
  #documents-filter-fields:not([hidden]) {
    position: fixed; inset: auto 0 0 0; z-index: 80; display: grid; gap: 12px; max-height: 85dvh; overflow: auto;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; background: #fff; box-shadow: 0 0 0 100vmax rgba(16, 24, 40, 0.45);
  }
  .documents-filter-sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; position: sticky; bottom: 0; padding-top: 8px; background: #fff; }
  .documents-filter-sheet-actions button { height: 48px; border-radius: 10px; font-size: 16px; font-weight: 650; }
  .library-actions a.ghost { display: inline-flex; align-items: center; min-height: 44px; }
  /* LEGISLATION: the search, then the Documents tabs (All, Applies, Changes Being Assessed), then each act as a card;
     its detail opens as a sheet (legislation.js). */
  .legislation-tabs { margin-top: 0; }
  body[data-legislation-show="applies"] #legislation-changes, body[data-legislation-show="applies"] #legislation-dismissed { display: none; }
  body[data-legislation-show="changes"] .legislation-table, body[data-legislation-show="changes"] #legislation-filters { display: none; }
  .legislation-table .table-head { display: none; }
  .legislation-table .documents-row { display: block; margin: 0 0 10px; padding: 0; border: 1px solid #e4e7ec; border-radius: 12px; background: #fff; }
  .legislation-table .documents-menu-head { display: none; }
  .legislation-row.legislation-cells { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 16px; border-top: 0; min-height: 48px; }
  .legislation-row > span { white-space: normal; }
  .legislation-row .documents-title { grid-column: 1 / -1; grid-row: 1; font-size: 16px; font-weight: 600; }
  .legislation-row .legislation-ref { font-size: 13px; color: var(--muted, #5b6470); }
  .legislation-row :is(.legislation-type, .legislation-domain) { display: none; }
  .legislation-row .legislation-currency, .legislation-row .legislation-review { font-size: 13px; }
  .legislation-row .legislation-applies-cell { grid-column: 1 / -1; }
  .legislation-applies { min-height: 44px; width: 100%; font-size: 15px; }
  .legislation-detail { position: fixed; inset: auto 0 0 0; z-index: 80; display: grid; grid-template-columns: minmax(0, 1fr); max-height: 85dvh; overflow: auto;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); border: 0; border-radius: 16px 16px 0 0; background: #fff; box-shadow: 0 0 0 100vmax rgba(16, 24, 40, 0.45); }
  .legislation-detail dl { grid-template-columns: minmax(0, 1fr); }
  .legislation-detail .legislation-source { display: inline-flex; align-items: center; min-height: 44px; }
  .legislation-detail button { min-height: 44px; }
  .legislation-ours textarea, .legislation-ours input { font-size: 16px; min-height: 44px; }
}
/* The legislation tabs are the phone's; the desktop keeps its Applies to Us filter. */
@media (min-width: 641px) { .legislation-tabs { display: none; } }

/* THE NEW DOCUMENT STEPPER ON A PHONE (new-document-stepper.js): one step's fields at a time, Back and Next in a bar. */
.documents-stepper, .documents-stepper-nav { display: none; }
@media (max-width: 640px) {
  .documents-stepped > .documents-stepper { display: block; margin-bottom: 8px; }
  .documents-stepper-where { margin: 0 0 8px; font-size: 12.5px; font-weight: 650; color: var(--muted, #667085); }
  .documents-stepper-progress { display: flex; gap: 4px; }
  .documents-stepper-progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--line, #e4e7ec); }
  .documents-stepper-progress i.on { background: var(--brand, #007b77); }
  .documents-stepper-title { margin: 12px 0 4px; font-size: 20px; font-weight: 800; }
  .documents-stepped[data-stepper-at="1"] > [data-stepper-step]:not([data-stepper-step="1"]),
  .documents-stepped[data-stepper-at="2"] > [data-stepper-step]:not([data-stepper-step="2"]),
  .documents-stepped[data-stepper-at="3"] > [data-stepper-step]:not([data-stepper-step="3"]),
  .documents-stepped[data-stepper-at="4"] > [data-stepper-step]:not([data-stepper-step="4"]) { display: none !important; }
  .documents-stepped > .documents-stepper-nav { display: flex; gap: 8px; position: sticky; bottom: 0; z-index: 2; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line, #e4e7ec); }
  .documents-stepper-nav button { min-height: 48px; flex: 1 1 0; }
  .documents-stepper-nav .documents-stepper-next { flex: 2 1 0; }
  .documents-stepper-nav .documents-stepper-next[hidden] { display: none; }
  .documents-stepped[data-stepper-at="4"] > .documents-dialog-actions button { width: 100%; min-height: 48px; }
}

/* THE READ PAGE AND THE EDITOR BAR ON A PHONE (approved mobile design, 2026-11-21; editor-phone.js adds the pieces). */
.editor-back-word, .editor-head .editor-actions > button.editor-phone-more, .editor-phone-tabs, .editor-phone-panel { display: none; }
@media (max-width: 640px) {
  /* "‹ Documents" in words, 44px to tap. */
  .editor-head #editor-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; flex: 1 1 100%; font-weight: 700; text-decoration: none; color: var(--nav, #0b3d3b); }
  .editor-head .editor-back-word { display: inline; }
  .editor-head h1.editor-heading { flex: 1 1 100%; }
  /* The step's main action in a bar pinned to the bottom; every other action is in ⋯. */
  .editor-page .editor-shell { padding-bottom: calc(72px + env(safe-area-inset-bottom)); box-sizing: border-box; }
  .editor-head .editor-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; flex-wrap: wrap; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line, #e4e7ec); box-shadow: 0 -4px 12px rgba(16, 24, 40, 0.06); }
  .editor-head .editor-actions:not(:has(> :not([hidden]))) { display: none; }
  .editor-head .editor-actions > :not(.primary):not(.editor-phone-more):not(#external-language) { display: none; }
  /* An invited reviewer's language stays on a phone: a full-width row above the main action. */
  .editor-head .editor-actions > #external-language:not([hidden]) { display: flex; flex: 1 1 100%; gap: 8px; align-items: center; }
  .editor-head .editor-actions > #external-language input { flex: 1; min-height: 44px; min-width: 0; }
  .editor-head .editor-actions > .primary:not([hidden]) { display: inline-flex; flex: 1 1 auto; min-height: 48px; white-space: normal; align-items: center; justify-content: center; text-align: center; }
  .editor-head .editor-actions > button.editor-phone-more { display: inline-flex; flex: 0 0 48px; min-height: 48px; height: 48px; padding: 0; align-items: center; justify-content: center; font-size: 22px; border: 1px solid var(--line, #d0d5dd); border-radius: 8px; background: #fff; }
  .editor-head .editor-actions > button.editor-phone-more[hidden] { display: none; }
  dialog.editor-phone-sheet { margin: auto 0 0; width: 100%; max-width: none; border-radius: 16px 16px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; }
  dialog.editor-phone-sheet::backdrop { background: rgba(16, 24, 40, 0.45); }
  .editor-phone-sheet-rows { display: flex; flex-direction: column; }
  .editor-phone-sheet button { min-height: 48px; width: 100%; text-align: left; font: inherit; font-size: 16px; background: none; border: 0; border-bottom: 1px solid var(--line, #eaecf0); padding: 0 4px; }
  .editor-phone-sheet .editor-phone-sheet-cancel { text-align: center; border: 0; margin-top: 8px; color: var(--muted, #667085); }
  /* Reading: Document, Details, History. The page view takes the full width. */
  /* flex: none — the row scrolls sideways, and a scroll container's automatic minimum height is 0, so in the shell's
     full-height column it was the item that gave up height when the page was short: the tabs were cut off under the
     PDF's zoom bar (live at 390x844, 2026-11-23). The page view below is the one that shrinks. */
  .editor-phone-tabs:not([hidden]) { display: flex; flex: none; gap: 8px; padding: 8px 16px; overflow-x: auto; }
  .editor-phone-tabs button { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line, #d0d5dd); background: #fff; font: inherit; font-weight: 650; white-space: nowrap; }
  .editor-phone-tabs button[aria-selected="true"] { background: var(--nav, #0b3d3b); border-color: var(--nav, #0b3d3b); color: #fff; }
  .editor-phone-panel:not([hidden]) { display: block; padding: 8px 16px 16px; }
  .editor-phone-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; }
  .editor-phone-panel dt { color: var(--muted, #667085); }
  .editor-phone-panel dd { margin: 0; overflow-wrap: anywhere; }
  .editor-phone-history { list-style: none; margin: 0; padding: 0; }
  .editor-phone-history li { padding: 12px 0; border-bottom: 1px solid var(--line, #eaecf0); }
  .editor-phone-history li span { display: block; font-size: 13px; }
  .editor-phone-history li p { margin: 4px 0 0; }
  body[data-editor-tab="details"] .editor-split, body[data-editor-tab="history"] .editor-split { display: none; }
  .editor-pdf-review { width: 100%; max-width: none; }
  /* Editing: our 52px document bar (back, title, save state) under the shared top bar; the editor takes the rest. */
  .editor-head:has(~ .editor-split #editor-frame:not([hidden])) { flex-wrap: nowrap; align-items: center; min-height: 52px; padding-top: 0; padding-bottom: 0; gap: 8px; }
  .editor-head:has(~ .editor-split #editor-frame:not([hidden])) #editor-back { flex: 0 0 auto; }
  .editor-head:has(~ .editor-split #editor-frame:not([hidden])) .editor-back-word { display: none; }
  .editor-head:has(~ .editor-split #editor-frame:not([hidden])) h1.editor-heading { flex: 1 1 auto; min-width: 0; }
  .editor-head:has(~ .editor-split #editor-frame:not([hidden])) .editor-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1rem; }
  .editor-head:has(~ .editor-split #editor-frame:not([hidden])) .editor-number,
  .editor-head:has(~ .editor-split #editor-frame:not([hidden])) .editor-badge:not(#editor-autosave) { display: none; }
}

/* Legislation keeps its search on a phone. library.css hides header search boxes under 640px;
   Documents brings its own back (body[data-documents-register]), Legislation's page has no such
   mark, so on a phone there was no way to search the register (review of the mobile PRs, 25 Nov). */
@media (max-width: 700px) {
  .library-head:has(#legislation-search) { flex-wrap: wrap; }
  .library-head:has(#legislation-search) .library-actions { width: 100%; flex-wrap: wrap; }
  .library-actions .search:has(#legislation-search) { display: flex; flex: 1 1 100%; width: 100%; }
}
@media (max-width: 640px) {
  #legislation-search { font-size: 16px; }
}

/* The act's name and a × at the top of its detail sheet on a phone (legislation.js openDetail). */
.legislation-detail-head { display: none; }
@media (max-width: 640px) {
  .legislation-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
  .legislation-detail-head h3 { margin: 10px 0 0; font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
  .legislation-detail-close { flex: none; min-width: 44px; min-height: 44px; border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
  .legislation-applies, .register-sort-chip { font-size: 16px; }
}

/* Edit Metadata on a phone: thumb-sized controls (Remove ×, Add, Done were 11–48px by 12–23px) and 16px fields,
   and no 9.5rem left indent on a 390px screen (phone sweep, 25 Nov). */
@media (max-width: 640px) {
  .documents-tag-editor { padding: 0.6rem 0.9rem 0.8rem; }
  .documents-tag-editor .tag-remove { min-width: 44px; min-height: 44px; }
  .documents-tag-editor button, .documents-tag-add button { min-height: 44px; padding-inline: 14px; font-size: 14px; }
  .documents-tag-add { flex-wrap: wrap; width: 100%; }
  .documents-tag-add select, .documents-tag-add input { min-height: 44px; font-size: 16px; flex: 1 1 160px; min-width: 0; }
}
