/* OHTL workbench. Its own look, separate from ohtl.org: a graphite sidebar frame with counts,
   cool grey sheets, system type, and signal yellow reserved for anything waiting on a person.
   Layout: fixed-width sidebar from 960px (top strip below that), content column up to 1240px. */

:root {
  --bg: #eceef1;
  --panel: #ffffff;
  --ink: #15181c;
  --ink-2: #4c5560;
  --ink-3: #85909b;
  --rule: #d8dce1;
  --rule-strong: #15181c;
  --side-bg: #1a1e23;
  --side-ink: #e6e9ec;
  --side-dim: #8b95a0;
  --band: #ffd200;        /* signal: waiting on David */
  --band-ink: #15181c;
  --ok: #17784a;
  --ok-bg: #dff1e7;
  --warn: #a2560a;
  --warn-bg: #fbeedd;
  --no: #85909b;
  --stage-1: #e4e7eb;
  --stage-2: #cdd9e8;
  --stage-3: #9fb8d6;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: clamp(16px, 2.5vw, 28px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101316; --panel: #171b1f; --ink: #e4e8ec; --ink-2: #a9b2bc; --ink-3: #6f7a85;
    --rule: #262c32; --rule-strong: #e4e8ec; --side-bg: #0a0c0e; --side-ink: #e4e8ec; --side-dim: #6f7a85;
    --band: #ffd200; --band-ink: #15181c;
    --ok: #6fd09c; --ok-bg: #14301f; --warn: #f0ae5c; --warn-bg: #36260f; --no: #6f7a85;
    --stage-1: #232930; --stage-2: #24364c; --stage-3: #345579;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101316; --panel: #171b1f; --ink: #e4e8ec; --ink-2: #a9b2bc; --ink-3: #6f7a85;
  --rule: #262c32; --rule-strong: #e4e8ec; --side-bg: #0a0c0e; --side-ink: #e4e8ec; --side-dim: #6f7a85;
  --band: #ffd200; --band-ink: #15181c;
  --ok: #6fd09c; --ok-bg: #14301f; --warn: #f0ae5c; --warn-bg: #36260f; --no: #6f7a85;
  --stage-1: #232930; --stage-2: #24364c; --stage-3: #345579;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 13.5px/1.45 var(--font); }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
code { font-family: var(--mono); font-size: .86em; }
::selection { background: #ffe680; color: #111; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--band); color: var(--band-ink); padding: .3rem .6rem; z-index: 10; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Frame */
.shell { display: grid; grid-template-columns: 1fr; min-height: 100%; }
.side { background: var(--side-bg); color: var(--side-ink); display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; padding: .5rem var(--gutter); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.mark { display: flex; align-items: baseline; gap: .4rem; color: var(--side-ink); text-decoration: none; margin-right: .5rem; }
.mark b { background: var(--band); color: var(--band-ink); font-weight: 900; letter-spacing: .08em; padding: .1rem .4rem; font-size: 13px; }
.mark span { font-family: var(--mono); font-size: 12px; color: var(--side-dim); }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .45rem; padding: .35rem .55rem; color: var(--side-dim); text-decoration: none; font-weight: 600; font-size: 13px; }
.nav a:hover { color: var(--side-ink); }
.nav a[aria-current="page"] { color: var(--side-ink); background: color-mix(in srgb, var(--side-ink) 10%, transparent); box-shadow: inset 3px 0 0 var(--band); }
.nav b { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--side-dim); }
.nav b.hot { background: var(--band); color: var(--band-ink); padding: 0 .3rem; font-weight: 700; }
.side :focus-visible { outline-color: var(--band); }
.snap { display: none; margin: 0; font-size: 11px; color: var(--side-dim); }
.snap dt { text-transform: uppercase; letter-spacing: .1em; margin-top: .9rem; }
.snap dd { margin: .15rem 0 0; color: var(--side-ink); }
.snap code { font-size: 11px; }
@media (min-width: 960px) {
  .shell { grid-template-columns: 210px 1fr; }
  .side { flex-direction: column; flex-wrap: nowrap; align-items: stretch; height: 100vh; padding: 1rem .75rem; }
  .mark { margin: 0 0 1rem .55rem; }
  .nav { flex-direction: column; }
  .nav a { justify-content: space-between; padding: .45rem .55rem; }
  .snap { display: block; margin-top: auto; padding: 0 .55rem; }
}

main { width: 100%; max-width: 1240px; padding: 1.25rem var(--gutter) 2rem; display: grid; gap: 1rem; }
main > * { min-width: 0; }

.head h1 { margin: .25rem 0 .2rem; font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
.head h1.long { font-size: 1.25rem; line-height: 1.3; max-width: 60rem; }
.head p { margin: 0; color: var(--ink-2); max-width: 70ch; }
.head .row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: .6rem; }
.kicker { margin: 0; font-size: 12px; color: var(--ink-2); }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--rule); padding: 1rem; min-width: 0; }
.panel h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin: 0 0 .75rem; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.count { font-variant-numeric: tabular-nums; background: var(--ink); color: var(--panel); padding: 0 .4rem; letter-spacing: 0; }
.hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--ink-3); font-size: 12px; }
.more { margin-left: auto; font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 12px; }
.split { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }

/* Summary tiles */
.tiles { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
.tile { background: var(--panel); padding: .8rem 1rem; display: flex; flex-direction: column; gap: .1rem; }
.tile b { font-size: 1.9rem; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tile b.sm { font-size: 1rem; font-weight: 700; }
.tile span { font-size: 12px; color: var(--ink-2); }
.tile.wait { background: var(--band); }
.tile.wait span, .tile.wait b { color: var(--band-ink); }
.tile.warn b { color: var(--warn); }
.tile.meta { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: .15rem .6rem; }

/* Tables */
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 11px; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--rule-strong); padding: .35rem .6rem .35rem 0; white-space: nowrap; }
td { border-bottom: 1px solid var(--rule); padding: .5rem .6rem .5rem 0; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--ink-2); font-size: 12px; margin-top: .1rem; }
td.t { white-space: nowrap; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
td.n, th.n { text-align: right; }
td.next { font-family: var(--mono); font-size: 12px; color: var(--ink-2); max-width: 46ch; overflow-wrap: anywhere; }
td.url { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; min-width: 24ch; }
td.ev { color: var(--ink-2); font-size: 13px; min-width: 30ch; }
td.sum { min-width: 32ch; }
tr.att td { background: color-mix(in srgb, var(--band) 14%, transparent); }
tr.att td:first-child { box-shadow: inset 4px 0 0 var(--band); padding-left: .6rem; }
.reg td.ttl { min-width: 28ch; }
.ok { color: var(--ok); font-weight: 600; font-size: 12px; }
.no { color: var(--no); font-size: 12px; }

/* State */
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: .12rem .45rem; border: 1px solid var(--ink); white-space: nowrap; line-height: 1.4; }
.pill.wait { background: var(--band); color: var(--band-ink); border-color: var(--band-ink); }
.pill.gap { background: var(--warn-bg); color: var(--warn); border-color: currentColor; }
.pill.done { background: var(--ok-bg); color: var(--ok); border-color: currentColor; }
.pill.idle { color: var(--ink-3); border-color: var(--rule); }
.pill.s-candidate { color: var(--ink-2); border-color: var(--rule); background: var(--stage-1); }
.pill.s-screen, .pill.s-preserve, .pill.s-read { background: var(--stage-2); border-color: transparent; }
.pill.s-extract, .pill.s-map, .pill.s-link { background: var(--stage-3); border-color: transparent; }
.pill.s-release { background: var(--ok-bg); color: var(--ok); }
.track { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: .5rem; }
.track i { width: 12px; height: 6px; background: var(--stage-1); }
.track i.done { background: var(--ink); }
.track i.here { background: var(--ink); outline: 1px solid var(--ink); outline-offset: 1px; }
.track i.here.wait { background: var(--band); outline-color: var(--band-ink); }
.reg .track { display: flex; margin: .35rem 0 0; }
.dp { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border: 1px solid currentColor; font-size: 11px; font-weight: 800; font-family: var(--font); }
.c { display: inline-block; font-size: 11px; font-weight: 700; padding: .05rem .4rem; margin: 0 .2rem .2rem 0; background: var(--stage-1); }
.c-met { background: var(--ok-bg); color: var(--ok); }
.c-not-met { background: var(--warn-bg); color: var(--warn); }
.c-unclear { background: var(--band); color: var(--band-ink); }

/* Ledger feed */
.who { font-size: 12px; font-weight: 600; white-space: nowrap; }
.who::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: .35rem; vertical-align: 1px; }
.who.person::before { background: var(--band); outline: 1px solid var(--band-ink); }
.who.model::before { background: var(--ink); border-radius: 50%; }
.who.script::before { border: 1px solid var(--ink); }
.ty { font-size: 12px; color: var(--ink-2); }
.ty-decision { color: var(--ink); font-weight: 700; }
.ty-gap, .ty-correction { color: var(--warn); font-weight: 600; }
.rec { font-size: 11px; color: var(--ink-3); font-style: italic; }
.feed code { color: var(--ink-2); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .75rem; font-size: 12px; }
.filters > span { color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; margin: 0 .2rem 0 .4rem; }
.filters > span:first-child { margin-left: 0; }
.filters button { font: inherit; font-size: 12px; background: var(--panel); color: var(--ink); border: 1px solid var(--rule); padding: .2rem .55rem; cursor: pointer; }
.filters button b { color: var(--ink-3); font-weight: 600; margin-left: .2rem; }
.filters button:hover { border-color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.filters button[aria-pressed="true"] b { color: var(--panel); }
.filters .clear { margin-left: auto; color: var(--ink-2); }
.empty-note { color: var(--ink-2); margin: .5rem 0 0; }

/* Harness board */
.board { display: grid; grid-template-columns: repeat(8, minmax(150px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); overflow-x: auto; }
.col { background: var(--panel); padding: .6rem; min-width: 0; }
.col.empty { background: color-mix(in srgb, var(--panel) 55%, var(--bg)); }
.col h3 { display: flex; align-items: center; gap: .35rem; margin: 0; font-size: 12px; font-weight: 700; }
.col h3 span:first-child { flex: 1; }
.col h3 b { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.col h3 .dp { width: 1.1rem; height: 1.1rem; font-size: 10px; }
.col p { margin: .15rem 0 .5rem; font-size: 11px; color: var(--ink-3); line-height: 1.3; }
.col ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.col li { border: 1px solid var(--rule); padding: .4rem .45rem; font-size: 12px; line-height: 1.3; background: var(--panel); }
.col li a { text-decoration: none; font-weight: 600; }
.col li a:hover { text-decoration: underline; }
.col li small { display: block; color: var(--ink-3); font-size: 11px; margin-top: .15rem; }
.col li em { display: inline-block; margin-top: .3rem; font-style: normal; font-weight: 700; font-size: 11px; background: var(--band); color: var(--band-ink); padding: 0 .3rem; }
.col li.wait { border-color: var(--band-ink); box-shadow: inset 3px 0 0 var(--band); }

/* Queue items */
.qitem > header { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; align-items: flex-start; }
.qitem h2 { font-size: 1.05rem; text-transform: none; letter-spacing: 0; font-weight: 700; margin: .2rem 0; line-height: 1.3; max-width: 70ch; }
.qitem .sub { margin: 0; color: var(--ink-2); font-size: 13px; }
.qitem > .track { margin: .75rem 0 0; }
.qitem > .track i { width: 28px; height: 8px; }
.kv { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: .4rem 1rem; margin: 1rem 0; }
.kv dt { color: var(--ink-2); font-size: 12px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.plain, .gaps { margin: 0; padding: 0; list-style: none; }
.gaps li { padding: .35rem 0 .35rem 1rem; border-bottom: 1px solid var(--rule); position: relative; }
.gaps li::before { content: ""; position: absolute; left: 0; top: .8rem; width: 6px; height: 6px; background: var(--warn); }
.gaps li:last-child { border-bottom: 0; }

.did { font-family: var(--mono); font-size: 12px; }
.tasks details { margin-top: .2rem; }
.tasks summary { cursor: pointer; color: var(--ink-3); font-size: 12px; width: max-content; }
.tasks details p { margin: .3rem 0 0; color: var(--ink-2); max-width: 90ch; }
.tasks td.sum b { font-weight: 600; }

@media (max-width: 640px) {
  .nav a { padding: .35rem .4rem; }
  .kv { grid-template-columns: 1fr; gap: .1rem; }
  .kv dd { margin-bottom: .5rem; }
  .tile b { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Links back to the rest of ohtl.org, in the sidebar */
.nav.sub { border-top: 1px solid color-mix(in srgb, var(--side-ink) 15%, transparent); padding-top: .25rem; }
.nav.sub a { font-weight: 500; font-size: 12px; }
@media (max-width: 959px) { .nav.sub { border-top: 0; padding-top: 0; } }
@media (min-width: 960px) { .nav.sub { margin-top: 1rem; } }

/* Title box above the OHTL mark: white line and text on black, in both themes */
.title { display: block; background: #000; color: #fff; border: 1.5px solid #fff; padding: .35rem .55rem; font-size: 12px; font-weight: 700; line-height: 1.3; text-decoration: none; }
.title:hover { text-decoration: underline; text-decoration-color: #fff; }
@media (max-width: 959px) { .title { flex-basis: 100%; width: max-content; max-width: 100%; margin-top: .25rem; } }
@media (min-width: 960px) { .title { margin: 0 0 .6rem; } .mark { margin-top: 0; } }

/* Page footer: contact and legal links, under the content */
.work { display: flex; flex-direction: column; min-width: 0; }
.work > main { flex: 1; }
.foot { width: 100%; max-width: 1240px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; padding: 1rem var(--gutter) 1.5rem; border-top: 1px solid var(--rule); font-size: 12px; color: var(--ink-2); }
.foot .mail { user-select: all; color: var(--ink); }
.foot nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
