/* tnbt admin — light, plain, utilitarian. System font, one accent colour. */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #dfe3e8;
  --text: #1c2430;
  --muted: #667085;
  --accent: #2458d6;
  --accent-soft: #eaf0fd;
  --ok: #1a7f37;   --ok-soft: #e6f4ea;
  --warn: #9a6700; --warn-soft: #fff4d6;
  --bad: #c62828;  --bad-soft: #fdecea;
  --run: #2458d6;  --run-soft: #eaf0fd;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
a { color: var(--accent); }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 48px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; }
.brand span, .login h1 span { color: var(--muted); font-weight: 400; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  padding: 6px 12px; border-radius: 6px; color: var(--text); text-decoration: none;
}
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); }

main { padding: 20px 24px 60px; }
.page { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; }
.card > h2 { margin-bottom: 10px; }

.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row.gap { gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.error { color: var(--bad); }
.note { color: var(--muted); font-size: 12px; }

/* forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--text); padding: 2px 0; }
input, select {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0;
}
input::placeholder { color: #a3aab5; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
button {
  font: inherit; cursor: pointer; padding: 7px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
}
button:hover { background: var(--bg); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: .6; cursor: default; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
a.btn {                                                   /* a link dressed as a button (a download) */
  display: inline-block; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--text); text-decoration: none; font-size: 13px; line-height: 18px;
}
a.btn:hover { background: var(--bg); }
button.danger-link { border-color: transparent; color: var(--bad); background: none; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin: 0; min-width: 0; }
legend { font-size: 12px; color: var(--muted); padding: 0 4px; }

.grid { display: grid; gap: 12px; }
.grid.params { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 12px; }
.grid.pickers { grid-template-columns: 160px 1fr 1fr; margin-top: 16px; }
.grid.add-form { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-items: end; margin-top: 10px; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); max-height: 220px; overflow: auto; }
.actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
#estimate { font-size: 12px; max-width: 520px; }

/* status */
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--bg); color: var(--muted);
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.run { background: var(--run-soft); color: var(--run); }
.pill.dev, .pill.test { background: #f1e8fb; color: #6b3fa0; }
/* ready_with_defects: finished, with a defect finding — amber like a warning, outlined so it never reads as queued */
.pill.defects { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.dev-note { background: #f1e8fb; color: #6b3fa0; border-radius: 6px; padding: 6px 10px; margin: 0 0 8px; font-size: 13px; }
.log {
  margin: 10px 0 0; max-height: 240px; overflow: auto; padding: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap;
}
.tag { font-size: 10px; padding: 0 5px; border-radius: 4px; background: var(--bg); color: var(--muted); }
.tag.competitor { background: var(--accent-soft); color: var(--accent); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; }
td { border-bottom: 1px solid var(--line); padding: 7px 8px; vertical-align: middle; }
tr.off td { color: var(--muted); background: #fafbfc; }
tr.short td { background: var(--warn-soft); }
tr.pages > td { background: var(--bg); }
table.inner td { border-bottom: 0; padding: 4px 8px; }
input.reason { width: 100%; min-width: 220px; border-color: var(--warn); }
#run-detail { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
#run-detail table { margin-top: 8px; font-size: 13px; }

.subtabs { display: flex; gap: 4px; }
.subtab { border: 0; background: none; padding: 6px 10px; border-radius: 6px; color: var(--muted); }
.subtab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
details.add { margin-top: 12px; }
details.add summary { cursor: pointer; color: var(--accent); }
.add-inline { margin-top: 12px; }
.add-inline input { width: 280px; }

.savebar {
  position: sticky; bottom: 12px; margin-top: 16px; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--warn-soft); border: 1px solid #f0d58a; border-radius: 8px;
}
.errors { margin: 10px 0 0; padding: 10px 10px 10px 28px; background: var(--bad-soft); color: var(--bad); border-radius: 6px; }

/* login */
.login { min-height: 80vh; display: grid; place-items: center; }
.login .card { width: 340px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 20px; margin-bottom: 4px; }

@media (max-width: 800px) {
  .grid.pickers { grid-template-columns: 1fr; }
  .topbar { gap: 12px; padding: 0 12px; }
  main { padding: 12px; }
}

/* ───────────── data-processing */
.small { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.mono, textarea.mono { font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
textarea { font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; width: 100%; resize: vertical; background: #fff; }
textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.subtabs.big .subtab { font-size: 14px; padding: 8px 14px; }
section[data-pane] { display: flex; flex-direction: column; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; align-items: end; margin: 8px 0; }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin: 8px 0; }
.wrap { flex-wrap: wrap; }
.log.tall { max-height: 420px; }

/* lanes */
.lane { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 14px; background: #fcfcfd; }
.lane-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.lane-head .link { margin-left: auto; }
.flow { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.arrow { align-self: center; color: var(--muted); font-size: 18px; }
.node {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  min-width: 170px; max-width: 220px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer; position: relative;
}
.node:hover { border-color: var(--accent); background: var(--accent-soft); }
.node.source { background: var(--bg); cursor: default; min-width: 130px; border-style: dashed; }
.node.source:hover { border-color: var(--line); background: var(--bg); }
.node.add { align-items: center; justify-content: center; color: var(--accent); border-style: dashed; min-width: 120px; }
.node.off { opacity: .55; border-style: dashed; }
.node-n { position: absolute; top: 6px; right: 8px; font-size: 11px; color: var(--muted); }
.node-name { font-weight: 600; }
.node-sub { font-size: 12px; color: var(--muted); }
.node-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge.tagb { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.cond { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* drawer */
.drawer {
  position: fixed; top: 48px; right: 0; bottom: 0; width: min(760px, 100%); background: #fff;
  border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(20, 30, 50, .08); z-index: 20;
  display: flex; flex-direction: column;
}
.drawer.narrow { width: min(460px, 100%); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow-y: auto; padding: 4px 18px 40px; display: flex; flex-direction: column; gap: 8px; }
.drawer-body h3 { margin: 16px 0 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.drawer-body h3:first-of-type { border-top: 0; }
.note-banner { background: var(--warn-soft); color: var(--warn); padding: 8px 10px; border-radius: 6px; margin-top: 10px; }
/* pipeline-version picker (Data processing, Brief production) */
.pv-pick select { max-width: 420px; }
.pv-meta:empty { display: none; }
.pv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.node.pv-node { cursor: pointer; }
.node.pv-differs { border-color: var(--warn); }
.pv-block { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 14px; }
.pv-block pre.log { max-height: 320px; }
.vars { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
tr.viewing td { background: var(--warn-soft); }

/* tags */
.tag-filter { margin: 10px 0; }
.tag { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; background: #fff; }
.tag.off { background: #fafbfc; }
.tag.off .tag-head b { color: var(--muted); }
.tag-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; font-size: 14px; }
.tag-head b { font-size: 14px; }
.node-name { padding-right: 14px; }
.grid.two { align-items: center; }
.tag-body { padding: 4px 12px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
table.values td { padding: 4px 6px; vertical-align: top; }
.tag-value { border-top: 1px dashed var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.tag-value label.inline input { width: 200px; }
table.values textarea { width: 100%; }
textarea.bad-json { border-color: var(--bad); }
table.values input { width: 100%; }
table.values td:nth-child(2) { width: 170px; }
table.values td:nth-child(3) { width: 170px; }
.savebar.quiet { background: var(--bg); border-color: var(--line); }
ul.diff { margin: 4px 0 10px; }
.review-ct { margin-top: 8px; }

/* results */
.results { display: grid; grid-template-columns: 340px 1fr; gap: 14px; margin-top: 10px; min-height: 300px; }
.res-list { display: flex; flex-direction: column; gap: 2px; max-height: 720px; overflow-y: auto; border-right: 1px solid var(--line); padding-right: 8px; }
.res-item { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; text-align: left; border: 0; border-radius: 6px; padding: 6px 8px; }
.res-item .muted { grid-column: 2; }
.res-item.active { background: var(--accent-soft); }
.dots { grid-row: span 2; letter-spacing: 2px; font-size: 12px; }
.d-ok, .d-cached { color: var(--ok); }
.d-failed { color: var(--bad); }
.d-skipped, .d-none { color: #b5bcc6; }
.res-detail { min-width: 0; }
.item-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; flex-wrap: wrap; }
.item-head img, .item-head video { max-width: 260px; max-height: 360px; border-radius: 6px; border: 1px solid var(--line); background: #000; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0; font-size: 13px; min-width: 0; flex: 1; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
dl.kv.nested { font-size: 12px; padding-left: 8px; border-left: 2px solid var(--line); }
.out { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.out-head { display: flex; gap: 8px; align-items: center; cursor: pointer; flex-wrap: wrap; }
.pretty { margin-top: 8px; font-size: 13px; }
.pretty ol { margin: 4px 0; padding-left: 20px; }
@media (max-width: 900px) {
  .results { grid-template-columns: 1fr; }
  .grid.two { grid-template-columns: 1fr; }
}
.node-x { position: absolute; top: 4px; right: 22px; font-size: 11px; color: var(--muted); padding: 0 3px; border-radius: 3px; visibility: hidden; }
.node:hover .node-x { visibility: visible; }
.node-x:hover { background: var(--bad-soft); color: var(--bad); }
.node.dragging { opacity: .4; }
.node.drop-before { box-shadow: -4px 0 0 var(--accent); }
.node.drop-after { box-shadow: 4px 0 0 var(--accent); }
.badge.erase { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
pre.card-text { white-space: pre-wrap; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); padding: 10px; border-radius: 6px; margin: 4px 0; }
.bank { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-top: 10px; background: #fcfcfd; }
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 18px; margin-top: 8px; font-size: 13px; }
/* brief production */
.picker { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 10px; background: #fcfcfd; }
.picker h3 { margin: 4px 0; }
.pick-list { max-height: 280px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.pick { display: flex; gap: 8px; align-items: baseline; padding: 4px 2px; font-size: 13px; cursor: pointer; }
.pick:hover { background: var(--accent-soft); }
.files { margin: 8px 0; }
ul.flags { color: var(--warn); font-size: 13px; padding-left: 18px; }
ul.flags li.why-fail { color: var(--bad); }
ul.flags li.why-other { color: inherit; }
tr.detail-row > td { background: #fbfcfe; padding: 10px 14px 14px; border-left: 3px solid var(--accent); }
table.compact td, table.compact th { padding: 3px 8px; font-size: 12px; }
/* visualisation */
.filters { margin: 6px 0 12px; }
.filters input { min-width: 200px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 8px 0; }
.metric { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fcfcfd; }
.m-v { font-size: 26px; font-weight: 600; }
.m-k { font-size: 13px; font-weight: 600; }
.m-h { font-size: 11px; color: var(--muted); }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--accent-soft); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 8px 0; }
.thumb { display: flex; flex-direction: column; text-align: left; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; overflow: hidden; }
.thumb:hover { border-color: var(--accent); }
.t-img { height: 170px; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.t-img img { width: 100%; height: 100%; object-fit: cover; }
.nothumb { color: var(--muted); font-size: 12px; }
.t-cap { padding: 6px 8px; font-size: 12px; }
.bar { display: inline-block; height: 10px; background: var(--accent); border-radius: 2px; vertical-align: middle; opacity: .7; }
.refs { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .refs { grid-template-columns: 1fr; } }
blockquote { border-left: 3px solid var(--accent); margin: 6px 0; padding: 4px 12px; font-size: 15px; }
/* visualisation v2: small squares, paged */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, 150px); gap: 10px; margin: 8px 0; }
.tile { width: 150px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); cursor: pointer; overflow: hidden; }
.tile:hover { border-color: var(--accent); }
.sq { position: relative; width: 150px; height: 150px; background: #111; display: flex; align-items: center; justify-content: center; }
.sq-media { width: 150px; height: 150px; object-fit: cover; display: block; }
.sq .play { position: absolute; right: 6px; bottom: 6px; font-size: 11px; color: #fff; background: rgba(0,0,0,.55); border-radius: 10px; padding: 1px 6px; pointer-events: none; }
.sq .nothumb { color: #bbb; }
.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pager { display: flex; gap: 12px; align-items: center; margin: 6px 0; }
tr.subtotal td { background: var(--bg); border-top: 1px solid var(--line); }
tr.total td { background: var(--accent-soft); border-top: 2px solid var(--line); }
/* media boxes: a player, not a poster */
#s-detail .item-head video, #s-detail .item-head img { max-width: 320px; max-height: 420px; width: auto; }
.refs video, .refs img { max-width: 100%; width: 320px; max-height: 360px; object-fit: contain; background: #000; }
.quote-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; background: var(--card); }
.quote-card blockquote { margin: 8px 0; }
.quote-body { white-space: pre-wrap; color: var(--text); max-height: 7.5em; overflow: hidden; }
.q-detail { padding: 6px 0; }
details.advanced { border: 1px dashed var(--line); border-radius: 8px; padding: 6px 12px; margin: 10px 0; }
details.advanced > summary { cursor: pointer; font-weight: 600; font-size: 13px; }
details.advanced.active { border-color: var(--accent); background: var(--accent-soft); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 12px; max-height: 220px; overflow: auto; font-size: 13px; }
fieldset.section { border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px 12px; margin: 10px 0; }
fieldset.section > legend { font-weight: 600; font-size: 13px; padding: 0 6px; }
fieldset.section.off > :not(legend) { opacity: .4; }
.sub-picker { margin-top: 8px; }

/* bank plots: horizontal bars and heat tables, one sequential blue */
.hbars td { vertical-align: middle; }
.hb-track { position: relative; }
.hb { display: inline-block; height: 12px; background: #3987e5; border-radius: 0 4px 4px 0; vertical-align: middle; }
.hb-min { position: absolute; top: 3px; bottom: 3px; width: 2px; background: var(--text); opacity: .55; }
.heat th { font-weight: 500; font-size: 12px; white-space: nowrap; }
.heat td.hm { text-align: center; min-width: 58px; border: 2px solid var(--card); border-radius: 4px; }
.heat td.zero { color: var(--muted); }
.hm-sub { display: block; font-size: 11px; opacity: .85; }
.hm-wrap { margin-top: 14px; }
.gap-top { margin-top: 16px; }

/* pain bank + unverified suggestions */
.pain-row { border-top: 1px solid var(--line); padding: 8px 0; }
.suggested .hb { background: #9ec5f4; }
.pain-card { border-top: 1px solid var(--line); padding: 10px 0; }
.pain-card.off { opacity: .7; }
.pain-card blockquote mark { background: var(--warn-soft); color: inherit; padding: 0 1px; }
.pain-card ul { margin: 4px 0; padding-left: 18px; }
.review-queue { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 10px 14px; margin: 8px 0 12px; }
.review-queue .hint { color: var(--text); }
.review-item { border-top: 1px solid var(--line); padding: 8px 0; }
.review-item ul.flags { margin: 4px 0; }
.review-item code.ref, .pain-card code.ref { background: var(--bg); padding: 0 4px; border-radius: 4px; }
.pain-card dl.parts { margin: 2px 0 6px 10px; }
.pain-card details.history { margin-top: 4px; }
.pain-card details.history summary { cursor: pointer; color: var(--muted); }
.pain-card .hist { padding: 4px 0 4px 10px; border-left: 2px solid var(--line); margin: 4px 0; }
.pain-card .hist .diff { margin-top: 2px; }
/* two versions' pains side by side (Compare versions) */
details.pb-compare { border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; margin: 8px 0 12px; }
details.pb-compare > summary { cursor: pointer; }
.cmp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; border-top: 1px solid var(--line); padding: 8px 0; }
.cmp-row.head { border-top: 0; padding: 4px 0 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.cmp-row .empty { color: var(--muted); font-size: 12px; font-style: italic; align-self: center; }
.cmp-row dl.parts { margin: 2px 0 4px 10px; }
del.w { background: var(--bad-soft); color: var(--bad); }
ins.w { background: var(--ok-soft); color: var(--ok); text-decoration: none; }
code.eid { background: var(--bg); padding: 0 4px; border-radius: 4px; font-size: 11px; }
code.eid.a { background: var(--bad-soft); color: var(--bad); }
code.eid.b { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 700px) { .cmp-row { grid-template-columns: 1fr; } }
details.cell-runs { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 6px; }
details.cell-runs > summary { cursor: pointer; color: var(--muted); }
.cell-run { border-left: 2px solid var(--line); padding: 4px 0 4px 10px; margin: 8px 0; }
.cell-run p { margin: 2px 0; }
.cell-run ul { margin: 2px 0 4px; padding-left: 18px; }
.cell-run table.compact { margin: 4px 0; }
.pill.sm { padding: 0 7px; font-size: 11px; font-weight: 500; }
.pill.unsure { background: #eceff3; color: var(--muted); }
dialog.modal { border: 1px solid var(--line); border-radius: 8px; padding: 16px; width: min(520px, 92vw); }
dialog.modal::backdrop { background: rgba(28, 36, 48, .35); }
dialog.modal textarea { width: 100%; margin: 6px 0; font: inherit; }
dialog.modal.wide { width: min(840px, 94vw); max-height: 92vh; overflow: auto; }
dialog.modal.wide > form > label { margin: 8px 0; }
dialog.modal.wide fieldset.section { margin: 8px 0; }
dialog.modal.wide .parts-row label { flex: 1; min-width: 180px; }
.edit-row { margin: 4px 0; flex-wrap: nowrap; }
.edit-row input { flex: 1; min-width: 100px; }
.edit-row input.narrow { flex: 0 0 200px; }
#q-pb-notice { background: var(--ok-soft); color: var(--ok); border-radius: 6px; padding: 6px 10px; margin: 6px 0; }
#q-pb-notice .pill, #q-pb-notice code { color: var(--text); }

/* canvas-processing: the 3D map and the creative beside it */
.cp-map { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; margin-top: 8px; }
#cp-plot { height: 640px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
#cp-side { height: 640px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: #fff; }
#cp-side h3 { margin-top: 8px; }
.cp-media video, .cp-media img { width: 100%; max-height: 300px; object-fit: contain; background: #f0f2f5; border-radius: 4px; }
.cp-members { margin: 6px 0 0; padding-left: 20px; font-size: 12px; }
.cp-members a.here { font-weight: 600; color: var(--text); }
#cp-clusters tbody tr { cursor: pointer; }
#cp-clusters tbody tr:hover { background: var(--accent-soft); }
#cp-z { width: 280px; vertical-align: middle; }
#cp .chip { border-left: 4px solid; }
@media (max-width: 1000px) { .cp-map { grid-template-columns: 1fr; } #cp-side { height: auto; max-height: 640px; } }
.cp-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--text); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 4px; }
#cp .filters label.check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; width: auto; flex: 0 0 auto; }
#cp .filters input[type=checkbox], #cp .filters input[type=range] { min-width: 0; }
tr.bad td { background: var(--bad-soft); color: var(--bad); }
span.bad { color: var(--bad); }

/* entity map (em.js) */
:root { --canvas: #6b3fc0; --canvas-soft: #f1eafd; --coll: #4b5563; --coll-soft: #eef0f3; }
.em-intro { font-size: 13px; line-height: 1.5; margin: 6px 0 12px; }
.em-intro code { background: var(--bg); padding: 0 4px; border-radius: 3px; }
.em-stats .metric { text-align: left; cursor: pointer; font: inherit; color: inherit; }
.em-stats .metric:hover { border-color: var(--accent); }
.em-stats .metric.bad .m-v { color: var(--bad); }
.em-stats .metric.ok .m-v { color: var(--ok); }
.em-stats .metric.warn .m-h { color: var(--warn); }
.em-red { color: var(--bad); font-weight: 600; }
.em-flow { display: flex; gap: 6px; align-items: stretch; overflow-x: auto; padding: 6px 0 10px; }
.em-col { flex: 1 1 0; min-width: 170px; max-height: 540px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fcfcfd; display: flex; flex-direction: column; gap: 6px; }
.em-line { padding: 6px 4px 0; text-transform: none; letter-spacing: .02em; }
.em-col-head { position: sticky; top: -8px; background: #fcfcfd; z-index: 1; margin: -8px -8px 0; padding: 8px 12px 8px; }
.em-col-head { display: flex; flex-direction: column; gap: 2px; padding: 2px 4px 8px; border-bottom: 1px solid var(--line); }
.em-col[data-p="processing"] .em-col-head b { color: var(--accent); }
.em-col[data-p="canvas"] .em-col-head b { color: var(--canvas); }
.em-col[data-p="briefs"] .em-col-head b { color: var(--ok); }
.em-col[data-p="panel"] .em-col-head b { color: var(--warn); }
.em-col[data-p="collection"] .em-col-head b { color: var(--coll); }
.em-arrow { align-self: center; color: var(--muted); font-size: 22px; padding: 0 2px; }
.em-block { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; text-align: left; font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; cursor: pointer; }
.em-block:hover { border-color: var(--accent); }
.em-block.sel { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.em-block.up { border-color: var(--ok); background: var(--ok-soft); }
.em-block.down { border-color: var(--canvas); background: var(--canvas-soft); }
.em-block.unscanned { border-style: dashed; }
.em-block-name { font-weight: 600; font-size: 13px; }
.em-block-meta, .em-rel { flex-basis: 100%; }
.em-rel { color: var(--muted); }
.em-chip { display: inline-block; max-width: 100%; font-size: 11px; line-height: 1.5; padding: 1px 7px; border-radius: 10px; margin: 1px 2px 1px 0; border: 1px solid transparent; background: var(--bg); color: var(--text); white-space: normal; }
.em-chip[data-p="processing"] { background: var(--accent-soft); color: var(--accent); }
.em-chip[data-p="canvas"] { background: var(--canvas-soft); color: var(--canvas); }
.em-chip[data-p="briefs"] { background: var(--ok-soft); color: var(--ok); }
.em-chip[data-p="panel"] { background: var(--warn-soft); color: var(--warn); }
.em-chip[data-p="collection"] { background: var(--coll-soft); color: var(--coll); }
.em-chip b { font-weight: 600; }
.em-table td:first-child { max-width: 320px; }
.em-table td:nth-child(4) { max-width: 420px; }
.em-label { margin-top: 2px; }
tr.em-group > td { background: var(--bg); padding: 8px; border-top: 2px solid var(--line); }
tr.em-unused td:first-child { border-left: 3px solid var(--bad); }
tr.em-indirect td:first-child { border-left: 3px solid var(--line); }
.em-drawer { position: fixed; top: 60px; right: 16px; bottom: 16px; width: min(440px, 90vw); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: 0 8px 30px rgba(28, 36, 48, .18); z-index: 20; }
.em-drawer h3 { font-size: 15px; }
.em-drawer h4 { margin: 12px 0 4px; font-size: 13px; }
.em-drawer .kv { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; margin: 8px 0; font-size: 13px; }
.em-drawer .kv dt { color: var(--muted); }
.em-drawer .kv dd { margin: 0; }
.em-pre { white-space: pre-wrap; }
.em-drawer table code { word-break: break-all; }
.em-drawer table td { vertical-align: top; }
.em-values code { margin: 0 4px 4px 0; display: inline-block; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.em-values code.off { text-decoration: line-through; color: var(--muted); }
.em-scanlist { margin: 6px 0; padding-left: 18px; font-size: 13px; }
.em-scanlist li { margin: 2px 0; }
/* a v2 brief's text: the ORDER / reference sheet (markdown) and the DOSSIER sections */
/* a v2 brief: the meta and the creative on top, the sections below (as the v1 detail) */
.brief-text { margin: 8px 0 12px; }
.brief-top { margin-bottom: 6px; }
.brief-sections-head { margin: 14px 0 4px; }
.brief-sec > summary { font-size: 14px; padding: 2px 0; }
.brief-sec[open] > summary { margin-bottom: 6px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.brief-sec .brief-sec { margin-left: 4px; }
/* `break-word`, not `anywhere`: `anywhere` lets a table column shrink to one letter */
.md { font-size: 13px; line-height: 1.5; overflow-wrap: break-word; }
.md h3, .md h4, .md h5, .md h6 { margin: 12px 0 6px; }
.md p { margin: 6px 0; }
.md table.md { width: 100%; table-layout: auto; }
.md table.md td, .md table.md th { vertical-align: top; padding: 5px 8px; font-size: 12.5px; min-width: 5.5em; overflow-wrap: break-word; word-break: normal; white-space: normal; }
.md table.md td:first-child, .md table.md th:first-child { min-width: 4.5em; }
.md table.md tbody tr:nth-child(even) td { background: var(--bg); }
table.wording td { vertical-align: top; }
table.wording td:nth-child(-n+4) { white-space: nowrap; }
.brief-views { display: flex; gap: 6px; margin: 12px 0 6px; }
.brief-views .chip { font-size: 13px; padding: 4px 12px; cursor: pointer; }
.md code { background: var(--bg); padding: 0 4px; border-radius: 4px; }
.brief-sec h5 { margin: 10px 0 4px; font-size: 13px; }
.brief-sec p { margin: 4px 0; font-size: 13px; }
.hook-cand { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin: 6px 0; }
.hook-cand.chosen { border-color: var(--ok); background: var(--ok-soft); }
.hook-cand ul.spoken { margin: 2px 0 6px; padding-left: 18px; font-size: 13px; }
.em-versions select { max-width: 340px; }
.em-ver-note { margin-top: 4px; }
tr.em-hl td { background: var(--accent-soft); }
/* review marks (rv.js): a small button on every section and row of the Visualisation brief page */
.mark-btn { font-size: 11px; padding: 0 7px; border-radius: 999px; color: var(--muted); background: #fff; border: 1px dashed var(--line); line-height: 18px; }
.mark-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
summary .mark-btn { margin-left: auto; }
td.mark-cell { width: 1%; white-space: nowrap; }
.review-card .rv-verdict { margin: 8px 0 4px; }
.review-card .rv-verdict .chip { font-size: 13px; padding: 4px 12px; cursor: pointer; }
.review-card .rv-verdict input { min-width: 200px; }
table.rv-marks td { vertical-align: top; }
/* the Trace tab */
.trace-stage { margin-top: 8px; }
.trace-stage > summary { font-size: 14px; }
.trace-step { margin: 4px 0 4px 12px; border-left: 2px solid var(--line); padding-left: 8px; }
.trace-step > summary { font-size: 13px; }
.trace-step h4 { margin: 10px 0 4px; font-size: 13px; }
/* what a brief reports on itself (bd.js briefReportHTML): defects first in red, notes grey */
.brief-report { margin: 8px 0; }
.brief-report .findings h4 { margin: 6px 0 4px; }
.brief-report .findings ul { margin: 0 0 6px; padding-left: 18px; font-size: 13px; }
.finding.defect { color: var(--bad); }
.finding.note { color: var(--muted); }
table.form-changes tr.rejected td { background: var(--bad-soft); }

/* creative upload: the drop area (a label for the hidden file input) and the brief picker */
.drop {
  display: block; margin-top: 12px; padding: 22px; text-align: center; font-size: 13px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 8px; background: #fcfcfd; cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-pick { color: var(--accent); font-weight: 600; }
#cu-files { margin-top: 10px; }
input.cu-pick { width: 240px; }
#cu-filter { width: 220px; }
