/* Benchmark Curator. A dense working tool: three columns on wide screens,
   state carried by colored pills and dots, the XML in a monospace panel. */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --sunken: #eef1ef;
  --fg: #17201c;
  --muted: #5a6761;
  --line: #d8dfdb;
  --accent: #1f6a58;
  --accent-fg: #ffffff;
  --accent-soft: #e0eee9;
  --ok: #2c7a3f;       --ok-soft: #e3f2e6;
  --warn: #9a5a00;     --warn-soft: #fbefd9;
  --bad: #b3261e;      --bad-soft: #fbe5e3;
  --info: #2f5ea8;     --info-soft: #e3ebf8;
  --mark: #fff0a8;     --mark-fg: #2a2200;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101513; --surface: #161d1a; --sunken: #1c2420; --fg: #e1e7e4; --muted: #96a39d; --line: #2a3430;
    --accent: #6cc2a6; --accent-fg: #0d1512; --accent-soft: #1b2e27;
    --ok: #79c78a; --ok-soft: #1a2c1f; --warn: #e0a64e; --warn-soft: #33281a; --bad: #f08a80; --bad-soft: #3a1f1d;
    --info: #8fb1ec; --info-soft: #1c2638; --mark: #5c4d00; --mark-fg: #fff6c8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font); }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 1.75rem 0 .6rem; }
.mono, code, kbd, pre { font-family: var(--mono); }
.small { font-size: .82rem; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font-size: .72rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3em; color: var(--muted); background: var(--surface); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .55rem 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 650; color: var(--fg); text-decoration: none; letter-spacing: .01em; }
.topnav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topnav a { color: var(--fg); text-decoration: none; }
.topnav a:hover { color: var(--accent); }
.role { font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 .45em; }

/* controls */
button, .button { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: .3rem .7rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; }
button:hover:not(:disabled), .button:hover { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.danger-fill { background: var(--bad); border-color: var(--bad); color: var(--surface); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
button.danger, a.danger-link { color: var(--bad); }
input, select, textarea { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: .35rem .5rem; max-width: 100%; }
textarea { font-family: var(--mono); font-size: .85rem; }
form.inline { display: inline; }
.stack { display: grid; gap: .45rem; max-width: 26rem; }
.stack button { justify-self: start; margin-top: .5rem; }
.row-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.alert { color: var(--bad); background: var(--bad-soft); border-radius: 6px; padding: .5rem .7rem; }
.notice { background: var(--info-soft); border-radius: 6px; padding: .6rem .8rem; }
.copyable { width: min(44rem, 100%); font-family: var(--mono); font-size: .8rem; }

/* pages */
.narrow { max-width: 30rem; margin: 3rem auto; padding-inline: 16px; }
.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.page-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--sunken); }
td.num, th.num { text-align: right; }
td.actions { white-space: nowrap; }
.review-form { display: flex; gap: .35rem; flex-wrap: wrap; }
.review-form input { width: 11rem; }
.meter { display: inline-block; width: 5rem; height: .45rem; border-radius: 999px; background: var(--sunken); vertical-align: middle; overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--accent); }

/* state */
.pill { display: inline-block; font-size: .72rem; font-weight: 600; border-radius: 999px; padding: .05rem .55rem; white-space: nowrap; text-decoration: none; }
.pill.open { color: var(--muted); border: 1px solid var(--line); }
.pill.accepted { color: var(--ok); background: var(--ok-soft); }
.pill.disagrees { color: var(--warn); background: var(--warn-soft); }
.pill.proposed { color: var(--info); background: var(--info-soft); }
.pill.excluded { color: var(--muted); background: var(--sunken); }
.dot { width: .55rem; height: .55rem; border-radius: 50%; flex: none; border: 2px solid var(--line); }
.dot.accepted { background: var(--ok); border-color: var(--ok); }
.dot.disagrees { background: var(--warn); border-color: var(--warn); }
.dot.proposed { background: var(--info); border-color: var(--info); }

/* workspace */
.workspace-page { height: 100vh; display: flex; flex-direction: column; }
.workspace { flex: 1; min-height: 0; display: grid;
  grid-template-columns: var(--left-width, 16rem) 6px minmax(0, 1fr) 6px var(--right-width, minmax(0, 1fr)); }
.gutter { cursor: col-resize; background: var(--line); opacity: .5; touch-action: none; }
.gutter:hover, .gutter:focus-visible, .gutter.dragging { background: var(--accent); opacity: 1; outline: none; }
.workspace.resizing { user-select: none; cursor: col-resize; }
.checklist, .card, .evidence { min-width: 0; min-height: 0; overflow-y: auto; }
.checklist { background: var(--surface); padding: 1rem 12px 2rem 16px; }
.card { padding: 1rem 1.25rem 3rem; }
.evidence { background: var(--surface); display: flex; flex-direction: column; }
@media (max-width: 1100px) {
  .workspace-page { height: auto; display: block; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .gutter { display: none; }
  .checklist, .card, .evidence { overflow: visible; border: 0; }
  .evidence { border-top: 1px solid var(--line); }
}
.eyebrow { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; font-weight: 600; }
.record-id { font-size: 1.35rem; margin: .1rem 0 .2rem; font-variant-numeric: tabular-nums; }
.record-head p { margin: .2rem 0; }
.search-trigger { width: 100%; justify-content: space-between; margin: .9rem 0 .4rem; color: var(--muted); }
.section-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1.1rem 0 .3rem; }
.group-list { list-style: none; margin: 0; padding: 0; }
.group-list a { display: flex; align-items: center; gap: .5rem; padding: .28rem .45rem; border-radius: 6px; color: var(--fg); text-decoration: none; }
.group-list a:hover { background: var(--sunken); }
.group-list a.current { background: var(--accent-soft); font-weight: 600; }
.g-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-count { color: var(--muted); font-size: .78rem; }
.card-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-head h2 { margin: .1rem 0 0; font-size: 1.35rem; }
.stepper { display: flex; gap: .4rem; }
.banner { display: flex; gap: 1rem; align-items: center; justify-content: space-between; background: var(--warn-soft); color: var(--fg); border-radius: 8px; padding: .55rem .8rem; margin-bottom: .8rem; }
.empty { color: var(--muted); padding: .5rem 0; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.row { background: var(--surface); border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: .65rem .85rem; }
.row.state-accepted { border-left-color: var(--ok); }
.row.state-disagrees { border-left-color: var(--warn); }
.row.state-proposed { border-left-color: var(--info); }
.row.state-excluded { border-left-color: var(--line); }
.row:focus, .row.focused { outline: 2px solid var(--accent); outline-offset: 1px; }
.row-head { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; }
.leaf { font-weight: 650; }
.entry { font-size: .8rem; background: var(--sunken); border-radius: 4px; padding: 0 .4rem; }
.row-head .pill { margin-left: auto; }
.values { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .15rem .9rem; margin: .5rem 0 .3rem; }
.values > div { display: contents; }
.values dt { color: var(--muted); font-size: .8rem; padding-top: .1rem; }
.values dd { margin: 0; overflow-wrap: anywhere; }
.values dd.missing { color: var(--muted); }
dl.nested { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0 .7rem; margin: .1rem 0 .4rem;
  padding: .35rem .55rem; border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; }
dl.nested dt { color: var(--muted); }
dl.nested dd { margin: 0; overflow-wrap: anywhere; }
.values .by { font-size: .75rem; color: var(--muted); margin-left: .4rem; }
.description { font-size: .8rem; color: var(--muted); margin: .3rem 0; max-width: 70ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row:focus .description, .row.focused .description { -webkit-line-clamp: unset; }
.rationale { margin: .45rem 0 .2rem; padding: .45rem .6rem; background: var(--sunken); border-radius: 6px; max-width: 75ch; }
.rationale-head { margin: 0 0 .2rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.rationale-head .outcome { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: .4rem; }
.rationale-text { margin: .15rem 0; font-size: .88rem; }
.reasoning { font-size: .82rem; margin: .3rem 0; }
.reasoning summary { cursor: pointer; color: var(--muted); }
.reasoning p { margin: .3rem 0 .3rem 1rem; max-width: 72ch; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-top: .45rem; }
.row-actions .retire { margin-left: auto; }
.editor { margin-top: .6rem; padding: .6rem; background: var(--sunken); border-radius: 6px; display: grid; gap: .45rem; }
.editor .editor-buttons { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.editor textarea { min-height: 5rem; width: 100%; }
.editor input[type=text], .editor select { width: 100%; }
.editor .checks { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.editor .found { font-size: .8rem; color: var(--muted); }
.row-message { margin: .4rem 0 0; font-size: .85rem; color: var(--bad); }
.row-message.ok { color: var(--ok); }
.shortcuts { margin-top: 1.5rem; }

.tabs { display: flex; gap: .25rem; padding: .5rem .6rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: .35rem .6rem; }
.tab[aria-selected=true] { border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { font-size: .72rem; color: var(--muted); }
.panel { flex: 1; min-height: 0; overflow: auto; padding: .6rem .8rem 2rem; }
.xml-panel { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.xml-tools { display: flex; align-items: center; gap: .5rem; padding: .4rem .8rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.xml-tools button { padding: .1rem .5rem; }
.hl-count { font-variant-numeric: tabular-nums; min-width: 5.5rem; text-align: center; }
.xml-view { position: relative; flex: 1; min-height: 0; }
/* The marker rail sits beside the scroller, never over its scrollbar. */
.scroller { position: absolute; inset: 0 12px 0 0; overflow: auto; padding: .6rem .8rem 2rem; }
.rail { position: absolute; top: 0; right: 0; bottom: 0; width: 12px; background: var(--sunken); border-left: 1px solid var(--line); }
.rail .tick { position: absolute; left: 1px; right: 1px; height: 4px; min-height: 4px; border: 0; padding: 0; border-radius: 1px;
  background: var(--warn); cursor: pointer; }
.rail .tick.current { background: var(--accent); height: 6px; }
.rail .viewport { position: absolute; left: 0; right: 0; border: 1px solid var(--muted); border-radius: 2px; pointer-events: none; opacity: .5; }
mark.cite.current { outline: 2px solid var(--accent); }
pre.xml { margin: 0; font-size: .76rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
mark.cite { background: var(--mark); color: var(--mark-fg); border-radius: 2px; padding: 0 1px; }
.citations { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.citations .quote { margin: 0; font-size: .9rem; }
.citations p { margin: .15rem 0; }
.citations .path { overflow-wrap: anywhere; }

/* find records, coverage */
.search-page { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 0; min-height: calc(100vh - 3rem); }
.filters { background: var(--surface); border-right: 1px solid var(--line); padding: .6rem 12px 2rem 16px; }
.facet { margin: .1rem 0; }
.facet summary { cursor: pointer; padding: .3rem 0; font-weight: 600; }
.facet ul { list-style: none; margin: 0 0 .5rem; padding: 0; }
.facet li a { display: flex; gap: .5rem; justify-content: space-between; padding: .15rem .4rem; border-radius: 5px; color: var(--fg); text-decoration: none; font-size: .85rem; }
.facet li a:hover { background: var(--sunken); }
.facet li a.on { background: var(--accent-soft); font-weight: 600; }
.f-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-count { color: var(--muted); }
.results { min-width: 0; padding: 1rem 16px 3rem; }
.searchbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.searchbar input { flex: 1 1 18rem; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.chip { background: var(--accent-soft); color: var(--fg); border-radius: 999px; padding: .1rem .6rem; text-decoration: none; font-size: .82rem; }
.hits td.text { max-width: 36rem; }
.kv { display: inline-block; margin: 0 .7rem .2rem 0; }
.pager { display: flex; gap: .8rem; align-items: center; margin-top: .8rem; }
.status-strip { display: flex; gap: 1.5rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; margin: 0 0 1rem; font-size: .88rem; }
.coverage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1rem; }
.coverage-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; min-width: 0; }
.coverage-card h3 { margin: .1rem 0 .5rem; font-size: 1rem; }
table.coverage td, table.coverage th { padding: .25rem .4rem; font-size: .85rem; }
table.coverage td:first-child { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .search-page { grid-template-columns: minmax(0, 1fr); }
  .filters { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* scoreboard and triage */
.scoreboard td strong { margin-right: .4rem; }
.tabs-inline { display: flex; gap: 1.2rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: .8rem 0 1rem; }
.tabs-inline a { padding: .4rem 0; color: var(--fg); text-decoration: none; border-bottom: 2px solid transparent; }
.tabs-inline a.on { border-bottom-color: var(--accent); font-weight: 600; }
.triage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.triage-item { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 8px; padding: .65rem .85rem; }
.triage-form { margin-top: .4rem; }
.triage-form input[name=note] { flex: 1 1 14rem; }
.change-list { margin: 0 0 1rem; padding-left: 1.2rem; }
.change-list li { margin: .2rem 0; }

/* attribute finder */
.palette { position: fixed; inset: 0; background: rgb(0 0 0 / .35); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 0; z-index: 10; }
.palette-box { width: min(40rem, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 50px rgb(0 0 0 / .25); overflow: hidden; }
.palette-box input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: .8rem 1rem; font-size: 1rem; }
#palette-results { list-style: none; margin: 0; padding: .3rem 0; max-height: 55vh; overflow-y: auto; }
#palette-results li { padding: .4rem 1rem; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem 1rem; }
#palette-results li[aria-selected=true] { background: var(--accent-soft); }
#palette-results .p-label { font-weight: 600; }
#palette-results .p-shape { grid-column: 1; font-family: var(--mono); font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }
#palette-results .p-value { grid-row: 1 / span 2; grid-column: 2; font-size: .8rem; color: var(--muted); max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: center; }

/* Stacked layout: the evidence pane no longer has a column height to fill,
   so the XML view gets its own. Last in the file so it wins over .xml-view. */
@media (max-width: 1100px) {
  .xml-view { flex: none; height: 70vh; }
}
