/* source-glossary-use.css - "Use in the semantic layer" and a system's readiness (web/modules/source-glossary-use.js).
   Theme tokens only. Colour never carries a state alone: every state has a mark and a word, the readiness bars use
   a fill pattern per strength (solid, lighter, hatched, empty with a dotted outline), and paths say Accepted/Refused. */

.sg-use { display: grid; gap: var(--space-4); }
.sg-use-head { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; justify-content: space-between; }
.sg-use-title { margin: 0; font-size: var(--fs-h3); color: var(--text); }
.sg-use-sub { margin: var(--space-1) 0 0; font-size: var(--fs-small); color: var(--text-body); display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; }
.sg-use-h5 { margin: var(--space-3) 0 var(--space-1); font-size: var(--fs-small); color: var(--text); }
.sg-use-section { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.sg-use-section > .section-label { margin: 0; }
.sg-use-draft-note { margin: 0; }
.sg-use-next { display: block; font-size: var(--fs-small); color: var(--text); font-weight: 600; }
.sg-use-mark { display: inline-block; min-width: 1.1em; font-weight: 700; text-align: center; }

/* The plan's state badge: a mark, a word and a border style per state. */
.sg-use-badge { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); font-size: var(--fs-small); font-weight: 600; line-height: 22px; color: var(--text); background: var(--surface); }
.sg-use-badge[data-sg-use-plan-state="refused"] { color: var(--down-text); border-color: var(--down-border); border-style: dotted; border-width: 2px; }
.sg-use-badge[data-sg-use-plan-state="incomplete"] { color: var(--warn-text); border-color: var(--warn-border); border-style: dashed; }
.sg-use-badge[data-sg-use-plan-state="draft"] { color: var(--info-text); border-color: var(--info-border); background: var(--info-tint); }
.sg-use-badge[data-sg-use-plan-state="ready-for-signature"] { color: var(--ok-text); border-color: var(--ok-border); background: var(--ok-tint); border-style: double; border-width: 3px; }
.sg-use-badge[data-sg-use-plan-state="no-kind-fits"] { color: var(--text-dim); }

.sg-use-field { display: grid; gap: 2px; font-size: var(--fs-small); color: var(--text-secondary); }
.sg-use-field > span { font-size: var(--fs-micro); font-weight: 600; color: var(--text-faint); }
.sg-use-field select, .sg-use-field input { min-height: 30px; font: inherit; font-size: var(--fs-small); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 4px 8px; }
.sg-use-field select:focus-visible, .sg-use-field input:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--brand); }
.sg-use-actions { display: flex; gap: var(--space-2); align-items: flex-end; }

/* Lists of reasons, statements to confirm, inputs and checks. */
.sg-use-reasons, .sg-use-verifies, .sg-use-inputs, .sg-use-checks, .sg-use-refusals, .sg-use-gaps, .sg-use-gated, .sg-use-drafts, .sg-use-pairs, .sg-use-paths { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.sg-use-reasons li, .sg-use-inputs li, .sg-use-checks > li { font-size: var(--fs-small); color: var(--text-body); }
.sg-use-reasons code, .sg-use-refusals code, .sg-use-gaps code, .sg-use-top code { font-size: var(--fs-micro); color: var(--text-faint); }
.sg-use-verify { font-size: var(--fs-small); display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: baseline; }
.sg-use-inputs li[data-sg-use-input-state="missing"] b, .sg-use-inputs li[data-sg-use-input-state="differs"] b { text-decoration: underline; text-decoration-style: wavy; text-decoration-color: var(--warn-border); }
.sg-use-checks ul { margin: var(--space-1) 0 0; padding-left: var(--space-4); }

/* A button that reads as a link: the screen's way into another list or queue. */
.sg-use-link { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left; }
.sg-use-link:hover { color: var(--brand-2); }
.sg-use-link:focus-visible, .sg-use-num:focus-visible, .sg-use-row:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-xs); }
.sg-use-num { appearance: none; border: 1px solid var(--border); background: var(--surface-subtle); border-radius: var(--radius-xs); padding: 0 6px; font: inherit; font-weight: 700; color: var(--brand); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; line-height: 20px; }
.sg-use-num:hover { border-color: var(--brand-border); background: var(--brand-tint); }

/* The member table and the field table. */
.sg-use-scroll { overflow-x: auto; }
.sg-use-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.sg-use-table th, .sg-use-table td { text-align: left; vertical-align: top; padding: var(--space-2); border-bottom: 1px solid var(--border-subtle); }
.sg-use-table thead th { font-size: var(--fs-micro); color: var(--text-faint); font-weight: 600; border-bottom-color: var(--border); }
.sg-use-table tbody th { font-weight: 400; }
.sg-use-req { display: block; font-size: var(--fs-micro); color: var(--text-dim); }
.sg-use-supply { display: inline-flex; gap: 2px; align-items: baseline; padding: 0 6px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.sg-use-supply[data-sg-use-group="supplied"] { color: var(--ok-text); border-color: var(--ok-border); background: var(--ok-tint); }
.sg-use-supply[data-sg-use-group="confirm"] { color: var(--warn-text); border-color: var(--warn-border); border-style: dashed; }
.sg-use-supply[data-sg-use-group="none"] { color: var(--text-dim); border-style: dotted; }
.sg-use-slot { font-weight: 600; color: var(--text); }
.sg-use-slot-code { font-size: var(--fs-micro); color: var(--text-dim); }
/* A reason or gap code is never printed: it is the line's title. A line that has one shows a help cursor. */
.sg-use-reasons li[title], .sg-use-top li[title], .sg-use-gaps li[title], .sg-use-refusals li[title], .sg-use-path-tally li[title], .sg-use-gated li[title] { cursor: help; }
.sg-use-cands { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sg-use-cand-detail { font-size: var(--fs-micro); color: var(--text-dim); }
/* "Show the other N" under a member's first three candidates, and the count the plan itself left unnamed. */
.sg-use-cands-more { margin-top: var(--space-1); }
.sg-use-cands + .sg-use-cands-more + .sg-why, .sg-use-cands + .sg-why { display: block; }
.sg-use-count { font-weight: 600; }

/* Join paths: a chain of hops, the verdict as a word and a mark. */
.sg-use-path { padding: var(--space-2) var(--space-3); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.sg-use-path[data-sg-use-path-accepted="false"] { border-style: dashed; }
.sg-use-path-head { margin: 0 0 var(--space-1); font-size: var(--fs-small); }
.sg-use-verdict[data-sg-use-verdict="accepted"] { color: var(--ok-text); font-weight: 600; }
.sg-use-verdict[data-sg-use-verdict="refused"] { color: var(--down-text); font-weight: 600; }
.sg-use-chain { margin: 0 0 var(--space-1); padding-left: var(--space-5); display: grid; gap: 2px; font-size: var(--fs-small); }
.sg-use-refusals li { font-size: var(--fs-small); color: var(--text-body); }
.sg-use-path-figure { margin-top: var(--space-2); }
/* A member's paths said once in its cell ("46 paths searched, all refused"), and why the refused ones were refused, counted. */
.sg-use-path-sum { font-weight: 600; color: var(--text); }
.sg-use-path-tally { list-style: none; margin: 0 0 var(--space-2); padding: var(--space-2) var(--space-3); display: grid; gap: var(--space-1); border-left: 3px dotted var(--border-strong); font-size: var(--fs-small); color: var(--text-body); }
.sg-use-path-tally .sg-use-next { display: inline; }
/* A note that says the kind does not fit this table, or that counts are partial: a mark, a dashed frame and words. */
.sg-use-nofit { margin: 0; padding: var(--space-2) var(--space-3); border: 1px dashed var(--warn-border); border-radius: var(--radius-sm); color: var(--text); }
.sg-use-nofit .sg-use-next { display: inline; }
/* The statements that would add an optional member: set apart from what the plan needs by a dotted rule, never by colour alone. */
.sg-use-optional { display: grid; gap: var(--space-2); padding-top: var(--space-2); border-top: 1px dotted var(--border-strong); }
.sg-use-optional > .sg-note { margin: 0; }
.sg-use-verify [data-sg-use-verify-adds] { font-style: italic; }
/* What the plan assembled (binding draft, dataset, study, schema): long identifiers wrap instead of widening the panel. */
.sg-use-assembled dd { overflow-wrap: anywhere; }
.sg-use-assembled code { font-size: var(--fs-micro); }
.sg-use-section > .sg-note { margin: 0; }
.sg-use-rowkey { margin: 0; font-size: var(--fs-small); }
.sg-use-foot { display: grid; gap: 2px; font-size: var(--fs-small); color: var(--text-secondary); padding: var(--space-2) var(--space-3); border: 1px dashed var(--border); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.sg-use-try summary { cursor: pointer; font-size: var(--fs-small); font-weight: 600; color: var(--text); }
.sg-use-form { display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-top: var(--space-2); }
.sg-use-census { margin: 0; font-size: var(--fs-small); color: var(--text-body); }

/* Readiness: the next acts, the census, the bars. */
.sg-use-next-box { padding: var(--space-3) var(--space-4); border: 2px solid var(--brand-border); border-radius: var(--radius-md); background: var(--brand-tint); display: grid; gap: var(--space-2); }
.sg-use-top { margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); font-size: var(--fs-small); color: var(--text-body); }
.sg-use-headline { margin: 0; font-size: var(--fs-body); color: var(--text); }
.sg-use-big { font-size: var(--fs-h2); }
/* The headline number once it opens its list: the same size, drawn as the other numbers that open one. */
.sg-use-num.sg-use-big { line-height: 1.3; padding: 0 var(--space-2); }
.sg-use-states { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.sg-use-states li { display: inline-flex; gap: var(--space-1); align-items: center; padding: 2px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: var(--fs-small); }
/* The one value reading summary (readiness, system card, column list): words first, the bar repeats them. */
.sg-use-readings { display: grid; gap: var(--space-2); }
.sg-use-readings > .sg-note { margin: 0; }
.sg-use-part { white-space: nowrap; }
.sg-use-part[data-sg-use-part="fact"] { font-weight: 600; color: var(--text); }
.sg-use-n { font-weight: 700; color: var(--text); }
.sg-use-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.sg-use-bar-row { display: grid; gap: 4px; }
.sg-use-bar-label { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; font-size: var(--fs-small); }
.sg-use-bar { display: block; max-width: 100%; height: auto; }
.sg-use-bar-frame { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; }
.sg-use-bar-none { fill: var(--text-dim); font-size: 11px; }
.sg-use-bar-counts { margin: 0; font-size: var(--fs-micro); color: var(--text-secondary); }
.sg-use-bar-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-3); font-size: var(--fs-micro); color: var(--text-secondary); }
.sg-use-bar-legend li { display: inline-flex; gap: 4px; align-items: center; }
.sg-use-seg { stroke: var(--surface); stroke-width: 1; }
.sg-use-seg[data-fill="solid-strong"] { fill: var(--ok); }
.sg-use-seg[data-fill="solid"] { fill: var(--info); }
.sg-use-seg[data-fill="solid-light"] { fill: var(--brand-border); }
.sg-use-seg[data-fill="hatched"] { fill: url(#sg-use-hatch); stroke: var(--warn-border); }
.sg-use-seg[data-fill="empty"] { fill: var(--surface); stroke: var(--text-faint); stroke-dasharray: 2 2; }
.sg-use-hatch-bg { fill: var(--warn-tint); }
.sg-use-hatch-line { stroke: var(--warn); stroke-width: 2; }
.sg-use-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-2); margin: 0; }
.sg-use-dl div { padding: var(--space-2); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.sg-use-dl dt { font-size: var(--fs-micro); color: var(--text-faint); font-weight: 600; }
.sg-use-dl dd { margin: 0; font-size: var(--fs-small); color: var(--text); }

.sg-use-dl + .sg-use-h5 { margin-top: var(--space-2); }
.sg-use-scope { max-width: 420px; }

/* Source capture choices stay readable in the embedded study workspace. */
#standards-production .sp-source-choices {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-1) var(--space-3); min-width: 0; margin: var(--space-2) 0;
  padding: var(--space-2) var(--space-3); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  max-height: 24rem; overflow-y: auto;
}
#standards-production .sp-source-choices > legend { padding: 0 var(--space-1); font-weight: 600; }
#standards-production .sp-source-choices > label {
  display: flex; align-items: flex-start; gap: var(--space-2); min-width: 0;
  padding: var(--space-2) 0; margin: 0; line-height: var(--lh-snug); overflow-wrap: anywhere;
}
#standards-production .sp-source-choices input[type="checkbox"] { flex: none; margin-top: 2px; }

/* Pairs and drafts. */
.sg-use-pair-pick { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
.sg-use-pair-pick .sg-use-field { flex: 0 1 320px; }
.sg-use-pair { padding: var(--space-2) var(--space-3); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); display: grid; gap: var(--space-1); }
.sg-use-pair[data-sg-use-pair-state="proposed"], .sg-use-pair[data-sg-use-pair-state="review-again"] { border-style: dashed; }
.sg-use-pair-sides { margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; font-size: var(--fs-small); }
.sg-use-side { display: inline-flex; gap: 4px; align-items: baseline; }
.sg-use-gaps li, .sg-use-gated li { font-size: var(--fs-small); color: var(--text-body); }
.sg-use-gated li { padding-left: var(--space-1); border-left: 2px dotted var(--border-strong); }
.sg-use-draft { padding: var(--space-2); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); font-size: var(--fs-small); }
.sg-use-draft p { margin: var(--space-1) 0; }

/* The list behind a number: a window of rows over pages read by cursor. */
.sg-use-drawer { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-raised); box-shadow: var(--shadow-sm); }
.sg-use-drawer-head { display: flex; gap: var(--space-2); align-items: center; justify-content: space-between; }
.sg-use-search { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
.sg-use-search .sg-use-field { flex: 1 1 220px; }
.sg-use-window { max-height: calc(var(--sg-use-rows, 14) * 34px); overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); }
.sg-use-rows { list-style: none; margin: 0; padding: 0; }
.sg-use-rows li { height: 34px; }
.sg-use-row { appearance: none; width: 100%; height: 34px; display: flex; gap: var(--space-2); align-items: center; justify-content: space-between; padding: 0 var(--space-3); border: 0; border-bottom: 1px solid var(--border-subtle); background: var(--surface); font: inherit; font-size: var(--fs-small); color: var(--text); text-align: left; cursor: pointer; overflow: hidden; }
.sg-use-row:hover { background: var(--surface-subtle); }
.sg-use-row.is-static { cursor: default; }
.sg-use-row.is-static:hover { background: var(--surface); }
.sg-use-row-name { font-family: var(--mono); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-use-row-meta { font-size: var(--fs-micro); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 640px) {
  .sg-use-section, .sg-use-next-box, .sg-use-drawer { padding: var(--space-2) var(--space-3); }
  .sg-use-row { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; }
}
