/* source-glossary.css - the Sources workspace shell and its plain screens (web/modules/source-glossary.js).
   Theme tokens only. Colour encodes a statement state or a table state and nothing else; every colour has a second
   sign: the border style (solid, double, dashed, dotted) and the word printed inside the chip. */

[data-sg-host], .sg-workspace, .sg-workspace > * { min-width: 0; }
.sg-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.detail-dialog-content :is(.sg-group-details, section) > h3 { margin-bottom: var(--space-2); }
.detail-dialog-content > section, .sg-group-details > section {
  padding-top: var(--space-3); margin-top: var(--space-3); border-top: 1px solid var(--border-subtle);
}
.detail-dialog-content .sg-map-list-items { padding: 0; list-style: none; }
.detail-dialog-content .sg-map-list-items li, .sg-group-details > section > ul > li {
  padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--border-subtle);
}
.detail-dialog-content .sg-map-list-pair { font-weight: 600; }
.detail-dialog-content .sg-map-list-meta { color: var(--text-secondary); }
.detail-dialog-content .sg-map-list-items + h4, .detail-dialog-content .sem-fold + h4 { margin-top: var(--space-3); }
.detail-dialog-content .sg-table-data select { max-width: 100%; }

/* The header strip: seven server-stated counts. A count not read is drawn in the muted text, with its words. */
.sg-strip { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.sg-strip-item { display: grid; gap: 2px; padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.sg-strip-label { font-size: var(--fs-micro); color: var(--text-faint); font-weight: 600; }
.sg-strip-value { font-size: var(--fs-small); color: var(--text); }
.sg-strip-item[data-sg-count-state="not-read"] .sg-strip-value,
.sg-strip-item[data-sg-count-state="not-counted"] .sg-strip-value,
.sg-coverage div[data-sg-count-state="not-counted"] dd,
.sg-coverage div[data-sg-count-state="not-read"] dd { color: var(--text-dim); font-style: italic; }

.sg-pane { min-height: 120px; }
.sg-note { font-size: var(--fs-small); color: var(--text-dim); margin: var(--space-1) 0; }
.sg-comparison-rows { list-style: none; margin: var(--space-1) 0; padding: 0; }
.sg-comparison-rows > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); overflow-wrap: anywhere; }
/* Original database values stay within the card; wide tables scroll, complete cells wrap. */
.sg-table-data { grid-template-columns: minmax(0, 1fr); min-width: 0; max-width: 100%; }
.sg-table-data > *, .sg-table-data label, .sg-table-data select, .sg-table-data input { min-width: 0; max-width: 100%; }
.sg-table-data-scroll { max-height: 32rem; max-width: 100%; overflow: auto; }
.sg-table-data .semantic-table th { position: sticky; top: 0; z-index: 1; background: var(--surface-subtle); text-transform: none; letter-spacing: normal; font-size: var(--fs-small); }
.sg-table-data th small { display: block; color: var(--text-secondary); font-weight: 400; }
.sg-table-data td { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 6rem; max-width: 32rem; font-variant-numeric: tabular-nums; }
.sg-row-controls, .sg-row-settings { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.sg-row-controls details[open] { flex-basis: 100%; }
.sg-row-settings { align-items: end; margin-top: var(--space-1); }
.sg-row-controls summary, .sg-rows-provenance summary, .sg-catalog-details > summary { width: fit-content; padding: var(--space-1) 0; cursor: pointer; color: var(--text-secondary); font-size: var(--fs-small); }
.sg-rows-provenance { margin-top: var(--space-1); }
.sg-rows-disclosure { color: var(--warn-text); margin: 0 0 var(--space-2); font-size: var(--fs-small); }
.sg-row-controls label { display: grid; gap: 2px; font-size: var(--fs-small); }
.sg-row-controls input { width: 12rem; }
.sg-rows-range { margin: var(--space-2) 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.sg-absent { font-size: var(--fs-small); color: var(--text-faint); font-style: italic; }
.sg-why { display: block; font-size: var(--fs-micro); color: var(--text-dim); }
.sg-pre { white-space: pre-wrap; font-family: var(--mono); font-size: var(--fs-xs); background: var(--surface-sunken); padding: var(--space-3); border-radius: var(--radius-sm); max-height: 420px; overflow: auto; }

/* Statement states. Fact states have a solid or double border; a suggestion is dashed; a rejection dotted. */
.sg-state { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: var(--radius-pill); border: 1px solid var(--border); font-size: var(--fs-micro); font-weight: 600; line-height: 18px; white-space: nowrap; }
.sg-state[data-sg-state="declared"] { color: var(--brand); background: var(--brand-tint); border-color: var(--brand-border); border-style: solid; }
.sg-state[data-sg-state="module-reviewed"] { color: var(--info-text); background: var(--info-tint); border-color: var(--info-border); border-style: solid; }
.sg-state[data-sg-state="verified"] { color: var(--ok-text); background: var(--ok-tint); border-color: var(--ok-border); border-style: double; border-width: 3px; line-height: 14px; }
.sg-state[data-sg-state="suggested"] { color: var(--warn-text); background: var(--surface); border-color: var(--warn-border); border-style: dashed; }
.sg-state[data-sg-state="rejected"] { color: var(--down-text); background: var(--surface); border-color: var(--down-border); border-style: dotted; text-decoration: line-through; }
.sg-basis { margin-left: 4px; font-size: var(--fs-micro); color: var(--text-dim); }
.sg-stmt { display: inline; }
.sg-stmt[data-sg-state="suggested"] .sg-stmt-value { font-style: italic; }
.sg-stmt[data-sg-state="suggested"] .sg-stmt-value::before { content: "Suggested: "; font-style: normal; color: var(--warn-text); font-weight: 600; }
.sg-stmt[data-sg-state="rejected"] .sg-stmt-value { text-decoration: line-through; color: var(--text-dim); }

/* The legend, built from the same list as the chips it names. */
.sg-legend { margin: 0 0 var(--space-3); padding: var(--space-2) var(--space-3); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--surface-subtle); }
.sg-legend-title { font-size: var(--fs-micro); font-weight: 600; color: var(--text-faint); }
.sg-legend-list { list-style: none; margin: var(--space-1) 0 var(--space-2); padding: 0; display: grid; gap: var(--space-1); }
.sg-legend-list:last-child { margin-bottom: 0; }
.sg-legend-list li { display: flex; gap: var(--space-2); align-items: baseline; font-size: var(--fs-small); color: var(--text-body); }

/* Systems. */
.sg-systems { display: grid; gap: var(--space-3); }
.sg-system { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-3) var(--space-4); }
.sg-system[data-sg-system-state="awaiting"] { border-style: dashed; }
.sg-system-head { display: grid; gap: 2px; }
.sg-system-name { margin: 0; font-size: var(--fs-h3); }
.sg-system-meta { font-size: var(--fs-small); color: var(--text-dim); }
.sg-overview-facts, .sg-overview-numbers { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: var(--space-2) 0; }
.sg-overview-facts { align-items: center; font-size: var(--fs-small); color: var(--text-dim); }
.sg-overview-facts .sg-verdict { color: var(--text-body); background: var(--surface-sunken); padding: 2px 6px; border-radius: var(--radius-sm); }
.sg-overview-numbers > div { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: var(--space-2); }
.sg-overview-numbers dt { color: var(--text-dim); font-size: var(--fs-small); }
.sg-overview-numbers dd { margin: 0; font-size: var(--fs-h3); font-weight: 650; font-variant-numeric: tabular-nums; }
.sg-system-detail { margin-top: var(--space-2); border-top: 1px solid var(--border-subtle); }
.sg-system-detail > summary, .sg-study-counts > summary, .sg-access-note > summary { padding: var(--space-2) 0; cursor: pointer; font-size: var(--fs-small); font-weight: 600; }
.sg-system-detail > summary:focus-visible, .sg-study-counts > summary:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 2px; }
.sg-system-detail[open] > summary { margin-bottom: var(--space-2); }
.sg-awaiting { font-size: var(--fs-small); color: var(--text-body); font-style: italic; }
.sg-scopes { margin: var(--space-2) 0; padding-left: var(--space-4); font-size: var(--fs-small); color: var(--text-body); }
.sg-verdict { font-weight: 600; }
.sg-verdict[data-sg-verdict="partial"]::after, .sg-verdict[data-sg-verdict="incomplete"]::after { content: " (gaps)"; font-weight: 400; color: var(--text-dim); }
.sg-coverage { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-2); margin: var(--space-2) 0; }
.sg-coverage div { padding: var(--space-2); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.sg-coverage dt { font-size: var(--fs-micro); color: var(--text-faint); font-weight: 600; }
.sg-coverage dd { margin: 0; font-size: var(--fs-small); color: var(--text); }
.sg-system-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Forms. */
.sg-form { display: grid; gap: var(--space-2); max-width: 640px; padding: var(--space-2) 0; }
.sg-form .field { margin-bottom: 0; }
.sg-form input, .sg-form select, .sg-form textarea, .sg-filters select { font: inherit; font-size: var(--fs-small); padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.sg-choices { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); display: grid; gap: var(--space-1); }
.sg-choice { font-size: var(--fs-small); }
.sg-candidates { padding-left: var(--space-4); font-size: var(--fs-small); }
.sg-refused { color: var(--down-text); }
.sg-outcome:empty, .sg-question:empty { display: none; }
/* A refusal said inside an act's form (its outcome slot, above the form's buttons): a compact alert, read left to right,
   so the buttons it points to ("You can propose it": Propose it instead) stay in view beside it. The pane-wide state block
   (centred, 40 px above and below) is for a pane that has nothing else to show. */
.sg-outcome > .state-block { justify-items: start; text-align: left; gap: var(--space-1); padding: var(--space-3) var(--space-4); }
.sg-outcome > .state-block .state-title { font-size: var(--fs-h3); }

/* Tables. */
/* Catalog search stays with the list. The larger column belongs to the selected table. */
.sg-tables { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); min-width: 0; container: sg-catalog / inline-size; }
.sg-tables-top { display: grid; gap: var(--space-2); padding-bottom: var(--space-2); }
.sg-tables-top > button { justify-self: start; }
.sg-tables-body { display: grid; grid-template-columns: minmax(260px, 0.68fr) minmax(0, 1.32fr); gap: var(--space-4); align-items: start; }
.sg-tables-list, .sg-tables-card { min-width: 0; }
.sg-tables-list { container-type: inline-size; }
.sg-tables-card { position: sticky; top: var(--space-3); max-height: 92vh; overflow: auto; }
@container (max-width: 800px) { .sg-tables-body { grid-template-columns: minmax(0, 1fr); } .sg-tables-card { position: static; max-height: none; } }
.sg-directory-toggle { display: none; }
@container sg-catalog (max-width: 800px) {
  .sg-directory-toggle:not([hidden]) { display: inline-flex; }
  .sg-directory-toggle[aria-expanded="true"] { margin-bottom: var(--space-2); }
  .sg-directory-toggle[aria-expanded="false"]:not([hidden]) + #sg-directory-content { display: none; }
}
.sg-filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.sg-filters .field { margin-bottom: 0; min-width: 140px; }
.sg-group { margin-bottom: var(--space-3); }
.sg-table-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sg-table-row { display: flex; width: 100%; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 6px var(--space-2); text-align: left; background: var(--surface); border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--text); font: inherit; cursor: pointer; }
.sg-table-row:hover { border-color: var(--border-hover); }
.sg-table-row.is-selected { border-color: var(--brand-border); background: var(--brand-tint); }
.sg-table-name { font-family: var(--mono); font-size: var(--fs-small); }
.sg-table-meta { font-size: var(--fs-micro); color: var(--text-dim); flex: 1 1 100%; }

/* Table chips: colour for the state, the border style and the word for the same. */
.sg-chip { font-size: var(--fs-micro); font-weight: 600; padding: 0 6px; line-height: 18px; border-radius: var(--radius-pill); border: 1px solid var(--border); white-space: nowrap; }
.sg-chip[data-sg-chip="verified"] { color: var(--ok-text); background: var(--ok-tint); border-color: var(--ok-border); border-style: double; border-width: 3px; line-height: 14px; }
.sg-chip[data-sg-chip="partly-verified"] { color: var(--ok-text); background: var(--surface); border-color: var(--ok-border); border-style: solid; }
.sg-chip[data-sg-chip="described"] { color: var(--info-text); background: var(--info-tint); border-color: var(--info-border); border-style: solid; }
.sg-chip[data-sg-chip="categorised"] { color: var(--info-text); background: var(--surface); border-color: var(--info-border); border-style: solid; }
.sg-chip[data-sg-chip="links-declared"] { color: var(--brand); background: var(--surface); border-color: var(--brand-border); border-style: solid; }
.sg-chip[data-sg-chip="suggestions-only"] { color: var(--warn-text); background: var(--surface); border-color: var(--warn-border); border-style: dashed; }
.sg-chip[data-sg-chip="not-described"] { color: var(--text-dim); background: var(--surface-muted); border-color: var(--border); border-style: dotted; }
.sg-chip[data-sg-chip="restricted"] { color: var(--text-dim); background: var(--surface-sunken); border-color: var(--border-strong); border-style: solid; }

/* The card. */
.sg-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-3) var(--space-4); }
.sg-card-name { margin: 0; font-family: var(--mono); font-size: var(--fs-h2); overflow-wrap: anywhere; }
.sg-card-location { margin: 0 0 var(--space-1); color: var(--text-secondary); font-size: var(--fs-small); overflow-wrap: anywhere; }
.sg-table-summary { margin: var(--space-2) 0; }
.sg-table-summary p { margin: var(--space-1) 0; }
.sg-summary-category { color: var(--brand-text, var(--brand)); font-size: var(--fs-small); font-weight: 600; }
.sg-card-views { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-3); border-bottom: 1px solid var(--border); }
.sg-card-views button { padding: var(--space-2); color: var(--text-secondary); background: transparent; border: 0; border-bottom: 2px solid transparent; cursor: pointer; font: inherit; font-size: var(--fs-small); font-weight: 600; }
.sg-card-views button[aria-selected="true"] { color: var(--brand); border-color: var(--brand); }
[data-sg-card-panel] { padding: var(--space-3) 0; min-width: 0; border-bottom: 1px solid var(--border); }
[data-sg-card-panel] .sg-table-data { display: grid; gap: var(--space-2); border: 0; padding: 0; }
.sg-field-preview { margin-top: var(--space-3); }
.sg-field-preview h4 { margin: 0 0 var(--space-1); font-size: var(--fs-small); }
.sg-field-preview ul { list-style: none; margin: 0; padding: 0; }
.sg-field-preview li { display: flex; justify-content: space-between; gap: var(--space-2); padding: var(--space-1) 0; border-bottom: 1px solid var(--border-subtle); }
.sg-field-preview li > * { min-width: 0; overflow-wrap: anywhere; }
.sg-field-preview li > span { color: var(--text-secondary); font-family: var(--mono); font-size: var(--fs-small); }
[data-sg-card-panel]:has([data-rows-ready]) .sg-field-preview { display: none; }
[data-sg-card-panel="columns"]:has([data-sg-all-columns]:not([hidden])) :is(.sg-columns-wrap, .sg-schema-help) { display: none; }
.sg-field-preview > [data-sg-show-schema] { font-size: var(--fs-small); font-weight: 600; }
.sg-table-data .sg-column-open code { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.sg-card .kv dd small, .sg-columns small { display: block; font-size: var(--fs-micro); color: var(--text-dim); }
.sg-keys, .sg-concepts { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
[data-sg-card-links] .sg-keys { margin-bottom: var(--space-3); }
[data-sg-table-category] .kv { grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr); }
[data-sg-table-category] dd, [data-sg-table-category] li { overflow-wrap: anywhere; }
[data-sg-table-category] .sg-state { max-width: 100%; white-space: normal; }
@container (max-width: 420px) {
  [data-sg-table-category] .kv { grid-template-columns: minmax(0, 1fr); }
  [data-sg-table-category] dt { padding-bottom: 0; border: 0; }
  [data-sg-table-category] dd { padding-top: var(--space-1); }
}
.sg-rel-group h6 { font-size: inherit; margin: var(--space-2) 0; }
.sg-rel-evidence { margin-top: var(--space-1); font-size: var(--fs-small); }
.sg-rel-evidence > summary { cursor: pointer; }
.sg-rel-evidence > .sg-rel-meta { display: block; }
.sg-rel-group { margin-bottom: var(--space-3); }
.sg-rel-group h5 { margin: var(--space-2) 0; font-size: var(--fs-small); }
.sg-rel-group[data-sg-list="suggestions"] { border-left: 2px dashed var(--warn-border); padding-left: var(--space-3); }
.sg-rel-group[data-sg-list="facts"] { border-left: 2px solid var(--border-strong); padding-left: var(--space-3); }
.sg-rel-group[data-sg-list="rejected"] { border-left: 2px dotted var(--down-border); padding-left: var(--space-3); }
.sg-rels { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.sg-rel { display: grid; gap: 2px; font-size: var(--fs-small); }
/* A link the map opened this card for (its relationship ids): outlined, the same ring as a focused control. */
.sg-rel[data-sg-rel-asked] { outline: 2px solid var(--brand-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.sg-rel-meta { font-size: var(--fs-micro); color: var(--text-dim); }
.sg-evidence { margin: 0; padding-left: var(--space-4); font-size: var(--fs-micro); color: var(--text-body); }
.sg-evidence li[data-sg-against] { color: var(--down-text); }

/* Reconciliation readiness. */
.sg-pairs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.sg-pair { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); background: var(--surface); }
.sg-pair[data-sg-state="suggested"] { border-style: dashed; border-color: var(--warn-border); }
.sg-pair[data-sg-state="verified"] { border-style: double; border-width: 3px; border-color: var(--ok-border); }
.sg-pair[data-sg-state="rejected"] { border-style: dotted; border-color: var(--down-border); }
.sg-pair-sides { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 700px) { .sg-pair-sides { grid-template-columns: 1fr; } }
.sg-pair-side { display: grid; gap: 2px; font-size: var(--fs-small); }
.sg-pair-label { font-size: var(--fs-micro); color: var(--text-faint); font-weight: 600; }
.sg-gates { display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: var(--fs-micro); }
.sg-gate { padding: 0 6px; border-radius: var(--radius-pill); border: 1px solid var(--border); }
.sg-gate[data-sg-gate="passed"] { color: var(--ok-text); border-color: var(--ok-border); }
.sg-gate[data-sg-gate="failed"] { color: var(--down-text); border-color: var(--down-border); border-style: dotted; }
.sg-readiness { font-size: var(--fs-small); }

.sg-gaps { margin: var(--space-1) 0 0; padding-left: var(--space-4); font-size: var(--fs-small); color: var(--text-body); }
.sg-gaps code { font-size: var(--fs-micro); color: var(--text-faint); }
.sg-pair-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0 0; }

/* Connection states. The group carries the colour and the border line (solid: on a path; dashed: beside; dotted:
   not linked); the mark and the word say the same without colour. */
.sg-conn { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--fs-micro); line-height: 18px; white-space: nowrap; color: var(--text-body); background: var(--surface); }
.sg-conn-mark { font-family: var(--mono); font-weight: 700; }
.sg-conn-why { white-space: normal; color: var(--text-dim); }
.sg-conn[data-sg-conn-group="reach"] { border-style: solid; border-color: var(--border-strong); }
.sg-conn[data-sg-conn-group="beside"] { border-style: dashed; border-color: var(--info-border); color: var(--info-text); }
.sg-conn[data-sg-conn-group="isolated"] { border-style: dotted; border-width: 2px; border-color: var(--warn-border); color: var(--warn-text); line-height: 16px; }
.sg-conn[data-sg-conn-group="unknown"] { border-style: dotted; color: var(--text-faint); }
.sg-table-row .sg-conn { margin-left: auto; }

/* Where a system's tables connect: one bar per state, its number beside it. */
.sg-connect { margin-top: var(--space-3); }
.sg-connect-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--space-3); }
.sg-connect-title { margin: 0 0 var(--space-1); font-size: var(--fs-micro); font-weight: 600; color: var(--text-faint); }
.sg-connect-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sg-connect-bars li { display: grid; grid-template-columns: minmax(0, 160px) minmax(60px, 1fr) 3ch; align-items: center; gap: var(--space-2); }
.sg-connect-bars .sg-conn { justify-self: start; }
.sg-bar { display: block; height: 8px; background: var(--surface-muted); border-radius: var(--radius-sm); overflow: hidden; }
.sg-bar-fill { display: block; height: 100%; background: var(--border-strong); }
.sg-bar-fill[data-sg-conn-group="beside"] { background: var(--info-border); }
.sg-bar-fill[data-sg-conn-group="isolated"] { background: var(--warn-border); }
.sg-bar-n { font-size: var(--fs-small); text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.sg-review-counts { margin-top: var(--space-2); }

/* The card's connection, modules and participant fact. */
.sg-card-connection { margin: var(--space-3) 0; }
.sg-levels { font-size: var(--fs-small); }
.sg-module-status { margin-left: var(--space-1); font-size: var(--fs-micro); color: var(--text-dim); }
.sg-module-status[data-sg-module-status="draft"] { color: var(--warn-text); font-style: italic; }

/* Blinding on a table line: a mark and its words; the colour repeats what the words say. */
.sg-blind { display: inline-flex; align-items: baseline; gap: 4px; margin-left: var(--space-1); padding: 0 6px; border: 1px dotted var(--border-strong); border-radius: var(--radius-sm); color: var(--text-body); white-space: nowrap; }
.sg-blind[data-sg-blind="unblinding"] { border-style: solid; border-color: var(--down-border); color: var(--down-text); }
.sg-blind-mark { font-family: var(--mono); font-weight: 700; }
/* Why a restricted line is hidden: a mark, words and a line style (solid for "may reveal treatment", dashed for "until its blinding is confirmed"). */
.sg-hidden { display: inline-flex; align-items: baseline; gap: 4px; margin-left: var(--space-1); padding: 0 6px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--text-body); white-space: nowrap; }
.sg-hidden[data-sg-hidden="unblinding"] { border-style: solid; border-color: var(--down-border); color: var(--down-text); }
.sg-wrow-button .sg-table-meta .sg-hidden { line-height: 14px; }

/* A count that opens the Tables tab filtered to what it counts. */
.sg-count-link { font: inherit; color: var(--brand); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.sg-count-link:hover { color: var(--text); }
.sg-count-link:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
/* The strip's "Can be drafted" count opens the readiness census: a link in the strip's own type size. */
.sg-strip-value.sg-count-link { font-size: var(--fs-small); text-align: left; justify-self: start; }
.sg-filters-clear { align-self: end; }
.sg-filter-options { align-self: end; }
.sg-filter-options > summary { width: fit-content; cursor: pointer; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: var(--fs-small); }
.sg-filter-options[open] { flex: 1 1 100%; }
.sg-filter-options > div { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) 0; }

/* The card's blocks: generic store, carried by, hub, reconciliation roles. */
.sg-card-roles { margin: var(--space-3) 0; display: grid; gap: var(--space-2); }
.sg-card-block { border: 1px solid var(--border-subtle); border-left: 3px solid var(--border-strong); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); background: var(--surface-subtle); }
.sg-block-title { margin: 0 0 var(--space-1); font-size: var(--fs-small); }
.sg-block-stmt { margin: 0 0 var(--space-1); font-size: var(--fs-small); }
.sg-block-kv { margin: 0; }
.sg-roles, .sg-carriers { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.sg-carriers { padding-left: var(--space-3); border-left: 2px solid var(--border-subtle); font-size: var(--fs-small); color: var(--text-body); }
.sg-carriers li { line-height: 1.6; }

/* The card's columns: one value and its chip per cell; review notes fold under the row. Narrow, each row stacks. */
.sg-card { container-type: inline-size; }
.sg-column-notes td { padding-top: 0; border-top: 0; }
.sg-column-notes summary { font-size: var(--fs-micro); color: var(--text-dim); cursor: pointer; }
.sg-notes { display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--space-2); margin: var(--space-1) 0 0; font-size: var(--fs-micro); }
.sg-notes dt { color: var(--text-faint); font-weight: 600; }
.sg-notes dd { margin: 0; }
.sg-levels-caption { caption-side: top; text-align: left; font-size: var(--fs-small); color: var(--text-dim); padding-bottom: var(--space-1); }
@container (max-width: 760px) {
  .sg-columns thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sg-columns, .sg-columns tbody, .sg-columns tr, .sg-columns th, .sg-columns td { display: block; width: auto; }
  .sg-columns tr[data-sg-column] { padding: var(--space-2) 0 0; border-top: 1px solid var(--border-subtle); }
  .sg-columns tr[data-sg-column] th { border: 0; padding: 0 0 var(--space-1); }
  .sg-columns tr[data-sg-column] td { display: grid; grid-template-columns: 96px 1fr; gap: var(--space-2); border: 0; padding: 2px 0; }
  .sg-columns tr[data-sg-column] td::before { content: attr(data-label); font-size: var(--fs-micro); color: var(--text-faint); font-weight: 600; }
  .sg-column-notes td { padding: 0 0 var(--space-2); border: 0; }
}

/* The add-a-system answers: those that name an existing system sit under it. */
.sg-choices-inline { display: grid; gap: 2px; margin-top: var(--space-1); }
.sg-create-error:empty { display: none; }

.sg-empty { margin: var(--space-3) 0; }

/* A count that does not add up, said with a mark and words, never by colour alone. */
.sg-mismatch { display: inline; color: var(--down-text); font-weight: 600; }
.sg-counts-explained { max-width: 72ch; }

/* The tables pane at the size of thousands: a search box, the census that adds up, and a window of fixed-height rows. */
.sg-filter-search { flex: 1 1 260px; }
.sg-search-row { display: flex; gap: var(--space-2); }
.sg-search-row input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: var(--fs-small); padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.sg-census { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--space-2); margin: 0 0 var(--space-2); }
.sg-census div { padding: var(--space-1) var(--space-2); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.sg-census dt { font-size: var(--fs-micro); color: var(--text-faint); font-weight: 600; }
.sg-census dd { margin: 0; font-size: var(--fs-small); color: var(--text); font-variant-numeric: tabular-nums; }
.sg-filter-chip { display: inline-flex; gap: 4px; align-items: baseline; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); font-size: var(--fs-micro); color: var(--text-body); }
.sg-filter-remove { font: inherit; background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; }
.sg-window { height: 560px; max-height: 70vh; overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); background: var(--surface); position: relative; }
.sg-window:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 2px; }
.sg-window-spacer { position: relative; }
.sg-window-rows { list-style: none; margin: 0; padding: 0; position: absolute; top: 0; left: 0; right: 0; }
.sg-wrow { height: 56px; box-sizing: border-box; padding: 2px var(--space-1); }
.sg-wrow-button { height: 52px; flex-wrap: nowrap; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-rows: auto auto; column-gap: var(--space-2); row-gap: 0; align-content: center; }
.sg-wrow-button .sg-table-name { grid-column: 1; grid-row: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-wrow-button .sg-conn { grid-column: 2; grid-row: 1; margin-left: 0; }
.sg-wrow-button .sg-chip { grid-column: 3; grid-row: 1; }
.sg-wrow-button .sg-table-meta { grid-column: 1 / -1; grid-row: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-wrow-button .sg-table-meta .sg-state, .sg-wrow-button .sg-table-meta .sg-blind { line-height: 14px; }

/* The card's column names open the column view; the slots other modules mount into. */
.sg-column-open { font: inherit; background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; text-align: left; }
.sg-column-open:hover code { text-decoration: underline; }
.sg-column-open:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.sg-card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0; }
[data-sg-slot]:empty { display: none; }
.sg-extra { margin-top: var(--space-2); }

/* The isolated tables: islands grouped, each table with why it may stand alone. */
.sg-iso-section { margin-bottom: var(--space-4); }
.sg-iso-section h4 { display: flex; gap: var(--space-2); align-items: center; }
.sg-island { border: 1px dotted var(--warn-border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2); }
.sg-island-head { margin: 0 0 var(--space-1); font-size: var(--fs-small); font-weight: 600; color: var(--text-body); }
.sg-iso-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.sg-iso-line { display: grid; gap: 2px; padding: var(--space-2) 0; border-top: 1px solid var(--border-subtle); font-size: var(--fs-small); }
.sg-iso-reasons { margin: 0; padding-left: var(--space-4); color: var(--text-body); }
.sg-iso-meta { font-size: var(--fs-micro); color: var(--text-dim); }
.sg-reason-tally { margin: var(--space-1) 0; padding-left: var(--space-4); font-size: var(--fs-small); }
.sg-gated { margin: 0; padding-left: var(--space-4); font-size: var(--fs-small); color: var(--text-body); }
.recon-panel [data-source-structure] { padding: 0; }

/* A row of a table that is not linked carries "State a link" beside it, inside the same fixed height. */
.sg-wrow.has-act { display: flex; align-items: center; gap: var(--space-1); }
.sg-wrow.has-act .sg-wrow-button { flex: 1 1 auto; min-width: 0; }
.sg-row-act { flex: 0 0 auto; white-space: nowrap; }

/* The value readings of the chosen system: one bar per member; the numbers and words beside it say the same. */
.sg-vr { margin-top: var(--space-2); }
.sg-vr-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-1); }
.sg-vr-row { display: grid; grid-template-columns: minmax(120px, 200px) minmax(80px, 1fr) minmax(0, 2fr); gap: var(--space-2); align-items: center; font-size: var(--fs-small); }
.sg-vr-label { color: var(--text); font-weight: 600; }
.sg-vr-bar { display: flex; height: 10px; background: var(--surface-muted); border-radius: var(--radius-sm); overflow: hidden; }
.sg-vr-fill { display: block; height: 100%; }
.sg-vr-fill[data-sg-vr-part="fact"] { background: var(--ok-border); }
.sg-vr-fill[data-sg-vr-part="suggested"] { background: var(--info-border); background-image: repeating-linear-gradient(45deg, transparent 0 3px, var(--surface) 3px 5px); }
.sg-vr-fill[data-sg-vr-part="notKnown"] { background: var(--warn-border); background-image: repeating-linear-gradient(90deg, transparent 0 2px, var(--surface) 2px 4px); }
.sg-vr-n { color: var(--text-body); font-variant-numeric: tabular-nums; }
.sg-vr-of { color: var(--text-dim); }
@media (max-width: 720px) { .sg-vr-row { grid-template-columns: 1fr; } }

/* An act a module asked for, said above the pane with the way to its screen; the Review tab opened for one item. */
.sg-act-notice { margin: var(--space-2) 0; padding: var(--space-2) var(--space-3); border: 1px solid var(--info-border); border-left-width: 4px; border-radius: var(--radius-sm); background: var(--info-tint); color: var(--text); font-size: var(--fs-small); }
.sg-act-notice p { margin: 0 0 var(--space-1); }
.sg-act-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.sg-review-asked { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

/* The name search above the list: its own form, asked of the search route; its answer takes the list's place. */
.sg-name-search { margin-bottom: var(--space-3); }
.sg-name-search .field { margin-bottom: 0; }
.sg-name-search .sg-search-row { flex-wrap: wrap; }
.sg-name-results { margin-bottom: var(--space-3); }
.sg-name-hit { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-2); row-gap: 0; }
.sg-name-hit .sg-table-meta { grid-column: 1 / -1; }
.sg-name-hit[data-sg-name-hit="suggested"] { border: 1px dashed var(--warn-border); }
[data-sg-list-part][hidden] { display: none; }

/* Adding a system: where the database is (fields shown as not asked while the semantic layer does not take them),
   why a candidate looks the same (strongest first), and the next steps when an administrator must resolve. */
.sg-address { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin: 0; display: grid; gap: var(--space-2); }
.sg-address legend { font-size: var(--fs-small); font-weight: 600; color: var(--text); padding: 0 var(--space-1); }
.sg-address[data-sg-address="awaited"] { border-style: dashed; }
.sg-address-fields { display: grid; grid-template-columns: 2fr 1fr 2fr 2fr; gap: var(--space-2); }
@media (max-width: 700px) { .sg-address-fields { grid-template-columns: 1fr 1fr; } }
.sg-address-fields input { width: 100%; box-sizing: border-box; }
.sg-address-fields input:disabled { background: var(--surface-muted); color: var(--text-faint); border-style: dashed; cursor: not-allowed; }
.sg-address-error:empty { display: none; }
.sg-reasons { margin: 2px 0 var(--space-1); padding-left: var(--space-4); font-size: var(--fs-micro); color: var(--text-body); }
.sg-candidates li[data-sg-identity-match] { border-left: 3px double var(--ok-border); padding-left: var(--space-2); }
.sg-next-steps { margin: var(--space-1) 0; padding-left: var(--space-4); font-size: var(--fs-small); color: var(--text-body); display: grid; gap: var(--space-1); }
.sg-next-steps code { overflow-wrap: anywhere; }
.sg-module-id { margin-left: var(--space-1); font-size: var(--fs-micro); color: var(--text-dim); }
.sg-island[data-sg-island-kind="through-users"] { border-style: dashed; }

/* The header line: how long ago the person signed in (a decision needs a sign-in of the last 15 minutes). Past the window
   or not known, a mark and the words say so; the colour only repeats them. */
.sg-head { display: flex; justify-content: flex-end; margin-bottom: var(--space-1); }
.sg-signin { display: inline-flex; align-items: baseline; gap: 4px; margin: 0; font-size: var(--fs-micro); color: var(--text-dim); }
.sg-signin[data-sg-signin-state="lapsed"], .sg-signin[data-sg-signin-state="not-known"] { color: var(--warn-text); font-weight: 600; }
.sg-signin-mark { font-family: var(--mono); font-weight: 700; }

/* The Tables pane grouped by category: a heading row of the same fixed height as a table row, so the window is placed
   by arithmetic over headings and rows alike. */
.sg-wrow-head { display: flex; align-items: flex-end; padding-bottom: var(--space-1); }
.sg-wrow-title { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A pair listed with a restricted side: its two names and why, nothing else. */
.sg-pair-names { margin: 0; font-size: var(--fs-small); color: var(--text); }
.sg-pair-actions .btn:disabled { cursor: not-allowed; }
.sg-choice-detail { display: grid; gap: var(--space-1); }

/* The strip: each count a label, one value and at most one short line; the whole sentences under "About these numbers". */
.sg-strip { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); }
.sg-strip-item { align-content: start; }
.sg-strip .sg-strip-value { font-size: var(--fs-h2); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.sg-strip-item[data-sg-count-state="not-read"] .sg-strip-value, .sg-strip-item[data-sg-count-state="not-counted"] .sg-strip-value { font-size: var(--fs-small); font-weight: 600; }
.sg-strip-note { font-size: var(--fs-micro); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-strip-about { margin-top: var(--space-1); font-size: var(--fs-small); color: var(--text-dim); }
.sg-strip-about summary { cursor: pointer; width: max-content; }
.sg-strip-about dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--space-3); margin: var(--space-2) 0 0; }
.sg-strip-about dl div { display: contents; }
.sg-strip-about dt { font-weight: 600; color: var(--text-body); }
.sg-strip-about dd { margin: 0; }
/* Each tab says in one line what it shows. */
.sg-tab-line { margin: var(--space-1) 0 0; font-size: var(--fs-small); color: var(--text-dim); }
/* A refusal: the words first; the code small and quiet beneath them. Not served yet is not an error of the person's. */
.sg-refused .sg-refusal-code, .sg-use-refused .sg-refusal-code, .sg-refusal-code { background: none; border: 0; padding: 0; font-family: inherit; font-size: var(--fs-micro); color: var(--text-faint); }
.sg-unserved { padding: var(--space-5) var(--space-4); }
.sg-unserved .state-title { font-size: var(--fs-h3); }
/* The filters of the Tables tab in one or two rows; the counts as one line of text; the legends closed under "Key". */
.sg-tables-top .sg-filters { margin-bottom: 0; gap: var(--space-2) var(--space-2); }
.sg-tables-top .sg-filters .field { min-width: 0; flex: 1 1 132px; max-width: 220px; }
.sg-tables-top .sg-filters label { font-size: var(--fs-micro); }
.sg-tables-top .sg-filters select { width: 100%; }
.sg-tables-top .sg-name-search { margin-bottom: 0; }
.sg-tables-top .sg-name-search .sg-note { display: none; }
.sg-tables-top .sg-census { display: flex; flex-wrap: wrap; gap: 2px var(--space-4); margin: 0; }
.sg-tables-top .sg-census div { display: inline-flex; align-items: baseline; gap: var(--space-1); padding: 0; border: 0; }
.sg-tables-top .sg-census dt { font-weight: 400; color: var(--text-dim); font-size: var(--fs-small); }
.sg-tables-top .sg-census dt::after { content: ":"; }
.sg-catalog-summary { display: inline; font-size: var(--fs-small); font-weight: 600; }
.sg-catalog-details { display: inline-block; margin-left: var(--space-2); }
.sg-catalog-details[open] { display: block; margin-left: 0; }
.sg-catalog-details .sg-census { margin: var(--space-1) 0; }
.sg-key > summary { cursor: pointer; font-size: var(--fs-small); color: var(--text-dim); width: max-content; }
.sg-key[open] > summary { margin-bottom: var(--space-2); }
.sg-tables-body .sg-window { height: 640px; max-height: 76vh; }
.sg-wrow-button .sg-table-name { font-weight: 600; }
.sg-card-empty { padding: var(--space-6) var(--space-4); }
/* Where a system lives: the five kinds as choices with one line of help each, then the chosen kind's fields. */
.sg-form.sg-add-form, .sg-where .sg-form { max-width: 960px; }
.sg-location { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); margin: 0; display: grid; gap: var(--space-3); background: var(--surface-subtle); }
.sg-location > legend { font-size: var(--fs-h3); font-weight: 700; color: var(--text); padding: 0 var(--space-1); }
.sg-kind-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-2); }
.sg-kind-choice { display: grid; grid-template-columns: auto 1fr; column-gap: var(--space-2); align-items: start; padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.sg-kind-choice:has(input:checked) { border-color: var(--brand-border); background: var(--brand-tint); }
.sg-kind-choice .sg-why { grid-column: 2; }
.sg-kind-fields[hidden], .sg-export[hidden] { display: none; }
.sg-inline-fields { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: end; }
.sg-inline-fields .field { flex: 1 1 200px; margin-bottom: 0; }
.sg-inline-fields .sg-wide-field { flex: 3 1 360px; }
.sg-inline-fields input, .sg-inline-fields select { width: 100%; box-sizing: border-box; }
.sg-location-name { max-width: 360px; }
.sg-export { display: grid; gap: var(--space-2); padding-top: var(--space-2); border-top: 1px dashed var(--border); }
.sg-export-statement .sg-pre { max-height: 240px; }
.sg-location-error:empty { display: none; }
.sg-problems { margin: var(--space-1) 0; padding-left: var(--space-4); font-size: var(--fs-small); }
/* Its places, registrations, the tables removed from the glossary, and how structure arrives. */
.sg-where { margin-top: var(--space-3); }
.sg-places, .sg-linked, .sg-removed, .sg-arrives-list, .sg-releases { margin: var(--space-1) 0; padding-left: var(--space-4); display: grid; gap: var(--space-1); font-size: var(--fs-small); color: var(--text-body); }
.sg-places .btn, .sg-linked .btn, .sg-removed .btn { margin-left: var(--space-1); }
.sg-arrives { margin: var(--space-2) 0; }
.sg-actions-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; }
.sg-removal { max-width: none; margin: var(--space-2) 0; padding: var(--space-3); border: 1px solid var(--down-border); border-radius: var(--radius-sm); background: var(--surface); }
.sg-removed-banner { border-color: var(--warn-border); background: var(--warn-tint); }
.sg-danger-quiet { color: var(--down-text); }
.sg-releases li[data-sg-release-pin] { color: var(--warn-text); font-weight: 600; }
.sg-system .sg-system-actions { margin: var(--space-2) 0; }
.sg-counts-fold > summary { font-size: var(--fs-small); color: var(--text-dim); }
/* A table's name in full on the first line of its row; where it connects, its state chip and its words on the second. */
.sg-tables-body .sg-wrow-button .sg-table-name { grid-column: 1 / -1; grid-row: 1; }
.sg-tables-body .sg-wrow-button .sg-table-meta { grid-column: 1; grid-row: 2; }
.sg-tables-body .sg-wrow-button .sg-conn { grid-column: 2; grid-row: 2; }
.sg-tables-body .sg-wrow-button .sg-chip { grid-column: 3; grid-row: 2; }
@container (max-width: 470px) {
  .sg-tables-body .sg-wrow-button { grid-template-columns: minmax(0, 1fr) fit-content(48%); }
  .sg-tables-body .sg-wrow-button:has(.sg-conn) .sg-table-name { grid-column: 1; }
  .sg-tables-body .sg-wrow-button .sg-conn { grid-column: 2; grid-row: 1; justify-self: end; }
  .sg-tables-body .sg-wrow-button .sg-chip { grid-column: 2; grid-row: 2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; justify-self: end; }
}
.sg-tables-top .sg-name-search .sg-search-row { flex-wrap: nowrap; max-width: 720px; }
.sg-compact-row { display: none; }
.sg-tables-list:not(:has([data-sg-catalog-details][open])) .sg-wrow-button {
  grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto;
}
.sg-tables-list:not(:has([data-sg-catalog-details][open])) .sg-wrow-button .sg-table-name { grid-column: 1 / -1; }
.sg-tables-list:not(:has([data-sg-catalog-details][open])) .sg-compact-row {
  display: block; grid-column: 1; grid-row: 2; font-size: var(--fs-micro); color: var(--text-secondary);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.sg-compact-row .sg-life-chip { margin-right: var(--space-1); }
.sg-tables-list:not(:has([data-sg-catalog-details][open])) .sg-wrow :is(.sg-table-meta, .sg-conn, .sg-chip, .sg-row-act, .sg-row-tick) { display: none; }
.sg-strip .sg-strip-value { font-size: var(--fs-h3); }
/* Round 5: the Map tab drawn flat or in 3D. "Draw as" above the one map drawn; the chosen drawing is pressed: a bar
   under it and bold words beside the tint, so it never rests on colour alone. */
.sg-map-tab { display: grid; gap: var(--space-2); min-width: 0; scroll-margin-top: var(--space-2); }
.sg-draw-as { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.sg-draw-as-label { margin-right: var(--space-1); font-size: var(--fs-small); font-weight: 600; color: var(--text-secondary); }
.sg-draw-as .btn[aria-pressed="true"] { border-color: var(--brand-border); background: var(--brand-tint); color: var(--brand); font-weight: 700; box-shadow: inset 0 -2px 0 var(--brand); }
.sg-map-host { min-width: 0; }
/* Round 5: a table's lifecycle. "x Deprecated" in a solid box on the down tint, "? Deprecation proposed" dashed and in
   italics: the mark, the word and the line style say it; the colour only repeats them. */
.sg-life { display: inline-flex; align-items: baseline; gap: 3px; padding: 0 6px; font-size: var(--fs-micro); font-weight: 600; line-height: 18px; white-space: nowrap; color: var(--text-body); border: 1px solid var(--down-border); border-radius: var(--radius-sm); background: var(--down-tint); }
.sg-life[data-sg-life="proposed"] { border-style: dashed; border-color: var(--warn-border); background: transparent; font-style: italic; }
.sg-life-mark { font-family: var(--mono); font-weight: 700; }
.sg-wrow-button .sg-table-meta .sg-life { line-height: 14px; margin-right: 2px; }
.sg-name-hit .sg-life { justify-self: end; }
.sg-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.sg-life-banner { border-color: var(--down-border); background: var(--surface); }
.sg-life-banner.is-proposal { border-style: dashed; border-color: var(--warn-border); border-left-width: 4px; }
.sg-life-banner .sg-note { margin: 0 0 var(--space-1); }
/* The act panels: the same form on the card and beside the 3D scene. */
.sg-life-panel, .sg-move-form { max-width: none; margin: var(--space-2) 0; padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.sg-life-panel[data-sg-life-act="deprecate"] { border-color: var(--down-border); }
.sg-life-panel[data-sg-life-act="propose"], .sg-life-panel[data-sg-life-act="propose-active"] { border-style: dashed; border-color: var(--warn-border); }
.sg-life-panel .section-label, .sg-move-form .section-label { margin: 0; }
.sg-life-lead { color: var(--text-body); }
.sg-life-preview { padding: var(--space-2) var(--space-3); border-left: 3px solid var(--border-strong); background: var(--surface-subtle); border-radius: var(--radius-sm); }
.sg-life-preview .sg-note { margin: 0 0 var(--space-1); }
.sg-life-dependents { margin: 0; padding-left: var(--space-4); font-size: var(--fs-small); color: var(--text-body); display: grid; gap: 2px; }
.sg-life-dependents code { overflow-wrap: anywhere; }
.sg-life-successor .sg-note { margin-top: 0; }
.sg-life-panel textarea, .sg-move-form textarea, .sg-move-form select { width: 100%; box-sizing: border-box; }
/* "Take back my statement" beside a statement the reader may take back: quiet, and inside a table cell on its own line. */
.sg-take-back { margin-left: var(--space-1); padding-top: 0; padding-bottom: 0; }
.sg-columns td .sg-take-back { display: block; margin: 2px 0 0; }
.sg-rel-acts { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 2px 0 0; }
/* The Tables tab: a box per row to choose it for a move, and the bar that moves the chosen ones. */
.sg-wrow.has-tick { display: flex; align-items: center; gap: var(--space-1); }
.sg-wrow.has-tick .sg-wrow-button { flex: 1 1 auto; min-width: 0; }
.sg-row-tick { flex: 0 0 28px; display: inline-flex; align-items: center; justify-content: center; height: 44px; cursor: pointer; }
.sg-row-tick input { width: 16px; height: 16px; margin: 0; cursor: pointer; }
.sg-row-tick input:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 2px; }
.sg-bulk:empty { display: none; }
.sg-bulk-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); margin: 0 0 var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--brand-border); border-left-width: 4px; border-radius: var(--radius-sm); background: var(--brand-tint); }
.sg-bulk-count { margin: 0; font-size: var(--fs-small); color: var(--text); }
.sg-bulk-over { flex: 1 1 100%; margin: 0; color: var(--warn-text); font-weight: 600; }
.sg-bulk-bar .btn:disabled { cursor: not-allowed; }
[data-sg-bulk-form]:empty, [data-sg-bulk-done]:empty, [data-sg-bulk-bar-slot]:empty { display: none; }
.sg-move-done { border-color: var(--ok-border); background: var(--ok-tint); }
/* A card's history: each revision, who recorded it and when, then what changed, old to new, with the new standing. */
.sg-history { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.sg-history-row { padding: var(--space-2) var(--space-3); border-left: 3px solid var(--border-strong); background: var(--surface-subtle); border-radius: var(--radius-sm); }
.sg-history-head { margin: 0 0 var(--space-1); font-size: var(--fs-small); color: var(--text-body); }
.sg-history-changes, .sg-history-decisions { margin: 0; padding-left: var(--space-4); display: grid; gap: 2px; font-size: var(--fs-small); color: var(--text-body); }
.sg-history-decisions { margin-top: var(--space-1); color: var(--text-dim); }
.sg-history-fold > summary { font-size: var(--fs-small); }
/* Names added to a system's scope that wait for the next discovery: a ghost mark and dashed line, never a card. */
.sg-waiting { list-style: none; margin: var(--space-1) 0; padding: 0; display: grid; gap: var(--space-1); font-size: var(--fs-small); }
.sg-waiting li { padding: 2px var(--space-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.sg-waiting-mark { font-family: var(--mono); color: var(--text-faint); }
/* The Reconcile tab: the pairs with a table the reader may not see, once, apart from the kind chosen. */
.sg-restricted-pairs { margin: 0 0 var(--space-3); padding: var(--space-2) var(--space-3); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-subtle); }
.sg-restricted-pairs .section-label { margin: 0 0 var(--space-1); }
.sg-restricted-pair-list { margin: var(--space-1) 0; padding-left: var(--space-4); display: grid; gap: var(--space-1); font-size: var(--fs-small); }
.sg-restricted-pair-list .sg-table-meta { display: inline; }
/* "Count now" under the strip's "Can be drafted" count. */
.sg-count-now { justify-self: start; margin-top: 2px; padding-top: 0; padding-bottom: 0; }
/* Second pass: inside the 3D map's act section (the map's head steps aside once a panel stands in it) the section is the
   frame: the panel draws no second box, and still names its act and closes itself. */
.sg-life-panel.is-headed, .sg-move-form.is-headed, .sg-removal.is-headed { margin: 0; padding: 0; border: 0; background: none; }
.sg-life-panel.is-headed .sg-life-preview { padding: var(--space-1) var(--space-2); }
.sg-act-notice.is-headed { margin: var(--space-1) 0 0; padding: 0; border: 0; background: none; }
.sg-link-panel.is-headed > .sg-note { margin: var(--space-1) 0 0; }
/* Why the panel opened another act than the one asked (the table changed since it was drawn), and an act with nothing to
   act on: said in a quiet line with a mark, never a blank panel. */
.sg-life-note { margin: 0; padding-left: var(--space-2); border-left: 3px solid var(--warn-border); color: var(--text-body); }
.sg-life-nothing .sg-note { margin: 0 0 var(--space-1); }
.sg-done-head code { overflow-wrap: anywhere; }
/* Round 6 (ruling R6-8): where an editor's controls would be, for a reader whose role does not edit the glossary, one quiet
   line says why (data-sg-may-edit="no"); and the line that says who deprecates a table at once. Never a blank. */
.sg-edits-withheld, .sg-life-who { padding-left: var(--space-2); border-left: 3px solid var(--border-strong); color: var(--text-body); }
.sg-card-actions + .sg-life-who, .sg-life-who + .sg-edits-withheld { margin-top: 0; }
/* Round 6, second pass. A deprecation or proposal that waits for a review says why with a warning edge; a proposal an
   adjudicator rejected is a quiet banner (the table is in use), drawn solid with a strong edge: never colour alone. */
.sg-life-wait { padding-left: var(--space-2); border-left: 3px solid var(--warn-border); color: var(--text-body); }
.sg-life-banner.is-rejected { border-color: var(--border-strong); border-left-width: 4px; }
/* The link form's records to pick from (route 33's otherRecords): one radio each, its ids and why under it. */
.sg-link-candidate-list { list-style: none; margin: var(--space-1) 0; padding: 0; display: grid; gap: var(--space-1); font-size: var(--fs-small); }
.sg-link-candidate-list li { padding: var(--space-1) var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sg-link-candidate-list li[data-sg-link-candidate-taken] { border-style: dashed; color: var(--text-dim); }
.sg-link-candidate-list .sg-why { display: block; margin-left: var(--space-4); }
.sg-link-candidate-list code { overflow-wrap: anywhere; }
.sg-link-typed { margin: var(--space-2) 0; }
/* The Reconcile tab's list of crosswalks, under the pairs (the extras module draws its rows). */
.sg-crosswalks { margin: var(--space-3) 0 0; }
.sg-crosswalks .section-label { margin: 0 0 var(--space-1); }

.sg-map-toolbar, .sg-network-head, .sg-network-actions, .sg-inspect-heading, .sg-directory-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.glossary-page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.glossary-page-head h1 { margin: var(--space-1) 0; }
.glossary-page-head a { font-size: var(--fs-small); }
.glossary-page-tools { position: relative; font-size: var(--fs-small); }
.glossary-page-tools summary { color: var(--text-secondary); cursor: pointer; padding: var(--space-2) 0; }
.glossary-page-tools > div { position: absolute; right: 0; top: 100%; z-index: 4; width: max-content; max-width: 78vw; display: grid; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); }
.glossary-page > [data-study-access-slot]:empty { display: none; }
[data-sg-study-glossary] { gap: var(--space-2); }
[data-sg-study-glossary] > :empty, [data-network-read-status]:empty, .sg-network-directory [role="status"]:empty { display: none; }
[data-sg-study-glossary]:has(.sg-map-tab) { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
[data-sg-study-glossary]:has(.sg-map-tab) > * { grid-column: 1 / -1; }
[data-sg-study-glossary]:has(.sg-map-tab) > [data-sg-tabs] { grid-column: 1; grid-row: 1; }
[data-sg-study-glossary]:has(.sg-map-tab) > .sg-study-counts:not([open]) { grid-column: 2; grid-row: 1; }
[data-sg-study-glossary] > [data-sg-tabs] { order: -1; display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border); padding-bottom: var(--space-2); }
.sg-glossary-primary, .sg-glossary-related { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.sg-glossary-primary button { padding: var(--space-2) var(--space-3); background: transparent; color: var(--text-secondary); border: 0; border-bottom: 2px solid transparent; font: inherit; font-weight: 600; cursor: pointer; }
.sg-glossary-primary button[aria-pressed="true"] { color: var(--brand); border-color: var(--brand); }
.sg-glossary-related { margin-left: auto; }
.sg-glossary-related button { padding: var(--space-2); background: transparent; border: 0; color: var(--text-secondary); font: inherit; font-size: var(--fs-small); cursor: pointer; }
.sg-glossary-related button[aria-current], .sg-glossary-related button:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.sg-map-options { min-width: 0; max-width: 100%; }
.sg-map-options > summary { width: fit-content; padding: var(--space-2); font-size: var(--fs-small); color: var(--brand); cursor: pointer; }
.sg-map-options-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sg-network { container-type: inline-size; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.sg-network-head, .sg-inspect-heading { justify-content: space-between; padding: var(--space-3) var(--space-4); }
.sg-network-head { border-bottom: 1px solid var(--border); }
.sg-network-head h3, .sg-inspect-heading h4, .sg-directory-title h4 { margin: 0; line-height: 1.25; }
.sg-network h5, .sg-inspect-heading p, .sg-network-head p, .sg-source-facts dt { font-size: var(--fs-small); }
.sg-network-head p, .sg-inspect-heading p { color: var(--text-secondary); margin: var(--space-1) 0 0; }
.sg-network-search { display: flex; align-items: stretch; gap: var(--space-1); flex: 0 1 370px; min-width: 0; }
.sg-network-search input { flex: 1; min-width: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: var(--space-2); font: inherit; font-size: var(--fs-small); }
.sg-network-search button { flex-shrink: 0; }
.sg-network-body { --sg-scene-height: clamp(430px, 62vh, 710px); display: grid; grid-template-columns: minmax(0, 1fr) clamp(330px, 34%, 455px); }
.sg-network-scene { position: relative; min-width: 0; height: var(--sg-scene-height); }
.sg-network-scene.is-fallback { display: grid; align-content: center; justify-items: center; padding: var(--space-4); text-align: center; }
.sg-network-rail { min-width: 0; border-left: 1px solid var(--border); }
.sg-network-directory, .sg-network-detail { box-sizing: border-box; max-height: var(--sg-scene-height); overflow: auto; overflow-wrap: anywhere; scrollbar-gutter: stable; }
.sg-network-directory { padding: var(--space-4); }
.sg-directory-title { margin-bottom: var(--space-2); }
.sg-directory-title span { font-variant-numeric: tabular-nums; font-size: var(--fs-small); color: var(--text-secondary); }
.sg-source-directory, .sg-directory-links { list-style: none; padding: 0; margin: 0; }
.sg-source-directory li, .sg-directory-links li { border-bottom: 1px solid var(--border-subtle); }
.sg-directory-row, .sg-directory-link { display: grid; width: 100%; min-height: 44px; align-items: center; text-align: left; gap: var(--space-2); padding: var(--space-2); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; font-size: var(--fs-small); cursor: pointer; overflow-wrap: anywhere; }
.sg-directory-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.sg-directory-row small, .sg-directory-link small { display: block; color: var(--text-secondary); font-size: var(--fs-small); }
.sg-directory-row i { font: inherit; font-size: var(--fs-h3); color: var(--brand); }
.sg-directory-row:hover, .sg-directory-link:hover { background: var(--brand-tint); }
.sg-directory-link { gap: 0; color: var(--brand); }
.sg-connection-stops { position: relative; display: grid; gap: 2px; }
.sg-connection-stops > span:not(.visually-hidden) { position: relative; padding-left: 18px; }
.sg-connection-stops > span:not(.visually-hidden)::before { content: ''; position: absolute; left: 0; top: .45em; width: 7px; height: 7px; border-radius: 50%; background: var(--sg-source-color); border: 1px solid var(--text-secondary); }
.sg-connection-stops > span:first-child::after { content: ''; position: absolute; left: 4px; top: calc(.45em + 9px); height: calc(100% - 7px); border-left: 1px solid var(--border-strong); }
.sg-directory-link small { padding-left: 18px; }
.sg-network-directory h5 { margin: var(--space-4) 0 var(--space-1); }
.sg-database-mark { display: inline-block; position: relative; width: 17px; height: 17px; flex: none; margin: 2px; box-sizing: border-box; background: var(--sg-source-color); border: 1px solid var(--text-secondary); border-radius: 50% / 20%; }
.sg-database-mark::before, .sg-database-mark::after { content: ''; position: absolute; left: -1px; right: -1px; height: 5px; border-bottom: 1px solid var(--text-secondary); border-radius: 50%; }
.sg-database-mark::before { top: -1px; }
.sg-database-mark::after { top: 5px; }
.sg-inspect-heading { display: grid; justify-content: stretch; gap: var(--space-2); padding-bottom: var(--space-2); }
.sg-inspect-back { display: flex; align-items: center; gap: var(--space-1); justify-self: start; padding: var(--space-1) 0; border: 0; color: var(--brand); background: transparent; cursor: pointer; font: inherit; font-size: var(--fs-small); }
.sg-inspect-back span { font-size: var(--fs-h3); line-height: 1; }
.sg-inspect-title { display: flex; align-items: center; gap: var(--space-2); }
.sg-inspect-heading p { margin: 2px 0 0; }
.sg-inspect-columns, .sg-inspect-content { padding: 0 var(--space-4) var(--space-3); font-size: var(--fs-small); }
.sg-inspect-columns { display: grid; gap: var(--space-3); }
.sg-inspect-columns > div + div { padding-top: var(--space-2); border-top: 1px solid var(--border-subtle); }
.sg-source-facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin: var(--space-1) 0 var(--space-3); }
.sg-source-facts dt { color: var(--text-secondary); }
.sg-source-facts dd { color: var(--text); font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; }
.sg-network-detail h5 { margin: var(--space-1) 0; }
.sg-network-detail ul { padding-inline-start: var(--space-4); margin: var(--space-1) 0; }
.sg-network-detail .sg-peer-list { padding: 0; list-style: none; }
.sg-network-detail .sg-inspect-tables { list-style: none; padding: 0; margin: var(--space-2) 0; }
.sg-inspect-tables li { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: 0 var(--space-2); padding: var(--space-1) 0; border-bottom: 1px solid var(--border-subtle); }
.sg-inspect-tables a { font-family: var(--mono); overflow-wrap: anywhere; }
.sg-inspect-tables small { color: var(--text-secondary); }
.sg-inspect-scope { color: var(--text-secondary); margin: 0; }
.sg-network-detail [data-network-members], .sg-network-detail [data-network-evidence-tables] { margin-bottom: var(--space-3); }
.sg-inspect-fold { margin-top: var(--space-2); }
.sg-inspect-fold > summary { color: var(--brand); cursor: pointer; padding-block: var(--space-1); }
.sg-list-more > summary { font-size: var(--fs-small); }
.sg-network-peer { display: inline; text-align: left; padding: var(--space-1) 0; color: var(--brand); background: transparent; border: 0; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.sg-network [data-network-read-status]:not(:empty), .sg-network .sg-note { padding: var(--space-2) var(--space-3); }
.sg-search-options > summary { width: fit-content; color: var(--text-secondary); cursor: pointer; }
.sg-search-options[open] .sg-search-filters { margin-top: var(--space-2); }
@container (max-width: 740px) {
  .sg-network-body { grid-template-columns: minmax(0, 1fr); }
  .sg-network-rail { border-left: 0; border-top: 1px solid var(--border); }
  .sg-network-scene { height: clamp(245px, 34vh, 340px); }
  .sg-network-scene.is-fallback { height: auto; min-height: 120px; }
  .sg-network-directory, .sg-network-detail { max-height: none; overflow: visible; }
}
@media (max-width: 720px) {
  [data-sg-study-glossary]:has(.sg-map-tab) { grid-template-columns: auto minmax(0, 1fr); row-gap: var(--space-1); }
  [data-sg-study-glossary]:has(.sg-map-tab) > [data-sg-tabs] { display: contents; }
  [data-sg-study-glossary]:has(.sg-map-tab) .sg-glossary-primary { grid-column: 1 / -1; grid-row: 1; border-bottom: 1px solid var(--border); }
  [data-sg-study-glossary]:has(.sg-map-tab) .sg-glossary-related { grid-column: 1; grid-row: 2; }
  [data-sg-study-glossary]:has(.sg-map-tab) > .sg-study-counts:not([open]) { grid-column: 2; grid-row: 2; }
  .sg-glossary-related { margin-left: 0; }
  .sg-network-search { flex-basis: 100%; }
}
@media (max-width: 480px) {
  .glossary-page-head { flex-wrap: nowrap; }
  .glossary-page-tools { flex: none; }
  .glossary-page .sg-network-search, .glossary-page .sg-draw-as-label { display: none; }
}
