/* Every value here is copied from the template: CV Assist Platform (standalone).html */
:root {
  --page: #080a10;
  --sider: #0b0d13;
  --card: #12151c;
  --panel: #0f1219;
  --border: #242a36;
  --line: #1e2330;
  --hair: #1b1f29;
  --edge: #2b313e;
  --text: #e8ecf4;
  --soft: #c3cbdb;
  --dim: #9aa3b4;
  --dim2: #8b93a5;
  --dim3: #6f7787;
  --dim4: #5d6472;
  --blue: #3f6ee8;
  --blue2: #6f93f5;
  --blue3: #7fa0f2;
  --green: #4ade80;
  --amber: #f0a852;
  --red: #f05252;
  /* the content area's backdrop */
  --grad: linear-gradient(180deg, #2f4ad3 0%, #1b2a6b 22%, #0e1533 52%, #0a0d1c 100%);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--page); }
body {
  display: flex;
  min-height: 100vh;
  width: 100%;
  font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a303d; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
a { color: var(--blue2); text-decoration: none; }
a:hover { color: #93b0ff; }

/* ── sidebar ───────────────────────────────────────────────────────────── */
.sider {
  width: 232px; flex: 0 0 232px; background: var(--sider);
  border-right: 1px solid var(--hair);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid #14171f;
}
.brand .word { display: flex; align-items: baseline; gap: 2px; font-weight: 700; letter-spacing: -0.02em; }
.brand .word span:first-child { font-size: 19px; color: #f2f5fb; }
.brand .word b { font-size: 19px; background: var(--text); color: var(--sider); border-radius: 4px; padding: 0 4px; }
.brand .word i { font-size: 9px; color: #7f8798; font-style: italic; letter-spacing: 0.16em; margin-left: 2px; }
.burger { width: 16px; height: 12px; display: flex; flex-direction: column; justify-content: space-between; opacity: 0.55; }
.burger i { height: 2px; background: #c9d1e0; }

.kicker-side { padding: 10px 12px 6px; font-size: 10px; letter-spacing: 0.14em; color: var(--dim4); text-transform: uppercase; }
.project {
  margin: 0 12px 10px; padding: 8px 10px; border: 1px solid #232936; border-radius: 8px;
  background: #11141c; display: flex; align-items: center; justify-content: space-between; cursor: pointer;
}
.project .name { font-size: 13px; font-weight: 600; }
.project .meta { font-size: 11px; color: var(--dim3); }
.project .caret { color: var(--dim3); font-size: 10px; }

.nav { flex: 1; overflow: auto; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px;
  font-size: 13px; cursor: pointer; color: var(--dim);
}
.nav a .dot { width: 7px; height: 7px; border-radius: 2px; background: #3a4152; }
.nav a .label { flex: 1; }
.nav a .badge { font-size: 11px; color: #6b7382; }
.nav a.on { background: var(--blue); color: #fff; font-weight: 600; }
.nav a.on .dot { background: #fff; }
.nav a.on .badge { color: rgba(255, 255, 255, 0.7); }

.sider-foot { border-top: 1px solid #14171f; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.sider-foot .state { flex: 1; font-size: 11px; color: var(--dim3); }
.tdk { opacity: 0.6; font-size: 11px; letter-spacing: 0.08em; color: var(--dim2); }

/* ── main ──────────────────────────────────────────────────────────────── */
/* flat: nothing competes with the primary button for brightness */
main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--page); }
.topbar {
  height: 56px; flex: 0 0 56px; background: var(--sider); border-bottom: 1px solid var(--hair);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
}
.topbar .title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }
.tchip {
  display: flex; align-items: center; gap: 8px; padding: 6px 11px; border: 1px solid #262c39;
  border-radius: 7px; font-size: 12px; color: var(--soft); background: #11141c; cursor: pointer;
}
.tchip .live { width: 8px; height: 8px; border-radius: 50%; background: #4c7cf5; }
.tchip.wide { min-width: 150px; justify-content: space-between; }
.tchip .caret { color: #6b7382; font-size: 10px; }

.content { flex: 1; overflow: auto; padding: 22px 24px 60px; }
.inner { max-width: 1560px; margin: 0 auto; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.crumb { font-size: 11px; color: #a8b6e8; letter-spacing: 0.04em; margin-bottom: 6px; }
.ptitle { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.phead-right { font-size: 12px; color: var(--soft); display: flex; align-items: center; gap: 9px; }

.rail { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.rail a {
  display: flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 8px; font-size: 12px;
  cursor: pointer; white-space: nowrap; border: 1px solid var(--border); background: var(--card); color: var(--soft);
}
.rail a .n { opacity: 0.55; font-variant-numeric: tabular-nums; }
.rail a .l { font-weight: 600; }
.rail a .v { opacity: 0.7; }
.rail a.on { border-color: var(--blue); background: rgba(63, 110, 232, 0.16); color: #dfe7fb; }

/* ── cards, tables, controls ───────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 14px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.card.tight { padding: 14px 16px; }
.card.accent { border-color: #2c53c9; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-title { font-size: 13px; font-weight: 600; }
.card-note { font-size: 11px; color: var(--dim2); }
.card-link { font-size: 11px; color: var(--blue2); cursor: pointer; }

.stat-label { font-size: 12px; color: var(--dim); margin-bottom: 10px; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.stat-value small { font-size: 16px; color: var(--dim3); font-weight: 700; }
.stat-note { font-size: 11px; color: var(--dim3); margin-top: 8px; }

.kicker { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim4); margin-bottom: 9px; }

.thead {
  display: grid; font-size: 10px; color: var(--dim3); letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0 4px 9px;
}
.trow {
  display: grid; font-size: 12px; padding: 11px 4px; border-top: 1px solid var(--line); align-items: center;
}
.trow.click { cursor: pointer; }
.trow.click:hover { background: rgba(255, 255, 255, 0.015); }
.trow .strong { font-weight: 600; }
.trow .soft { color: var(--dim); }
.trow .mono { color: var(--dim); font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.trow .num { font-variant-numeric: tabular-nums; }
.empty { font-size: 12px; color: var(--dim3); padding: 18px 4px; border-top: 1px solid var(--line); }

.btn {
  padding: 8px 13px; border: 1px solid var(--edge); border-radius: 7px; font-size: 12px;
  color: var(--soft); background: transparent; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: #3a4356; color: var(--text); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; padding: 8px 15px; }
.btn.primary:hover { background: #2c53c9; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

input, select, textarea {
  background: var(--panel); border: 1px solid var(--border); border-radius: 7px; padding: 9px 11px;
  font: inherit; font-size: 12px; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--blue); }
input[type=checkbox] { width: 13px; height: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--dim2); }
.kv {
  background: var(--panel); border: 1px solid var(--border); border-radius: 7px; padding: 9px 11px;
  font-size: 12px; display: flex; justify-content: space-between; gap: 10px;
}
.kv span:first-child { color: var(--dim2); }

.chip { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; display: inline-block; }
.chip.run { color: var(--blue3); background: rgba(63, 110, 232, 0.14); border: 1px solid rgba(63, 110, 232, 0.35); }
.chip.ok { color: var(--green); background: rgba(74, 222, 128, 0.12); border: 1px solid rgba(74, 222, 128, 0.3); }
.chip.warn { color: var(--amber); background: rgba(240, 168, 82, 0.12); border: 1px solid rgba(240, 168, 82, 0.3); }
.chip.err { color: var(--red); background: rgba(240, 82, 82, 0.12); border: 1px solid rgba(240, 82, 82, 0.3); }
.chip.idle { color: var(--dim2); background: rgba(139, 147, 165, 0.1); border: 1px solid rgba(139, 147, 165, 0.25); }

.track { height: 8px; background: var(--line); border-radius: 4px; }
.track.thin { height: 4px; border-radius: 3px; }
.track > i { display: block; height: 100%; background: var(--blue); border-radius: inherit; }

.tiles { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.tile { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); cursor: pointer; }
.tile.on { border-color: var(--blue); }
.tile img { width: 100%; height: 92px; object-fit: cover; display: block; background: #0b0e15; }
.tile .name { padding: 7px 8px 0; font-size: 10px; color: var(--dim3); font-family: ui-monospace, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .foot { padding: 6px 8px 8px; }

.log {
  background: var(--panel); border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px;
  font-family: ui-monospace, Menlo, monospace; font-size: 11px; line-height: 1.8; color: var(--dim2);
  height: 300px; overflow: auto; white-space: pre-wrap;
}
.log .lt { color: var(--dim4); }
pre.json { margin: 0; font-size: 11px; color: var(--dim2); white-space: pre-wrap; max-height: 260px; overflow: auto; }
/* aligned art: wrapping it turns a diagram into noise, so it scrolls instead */
pre.diagram { margin: 0; font-size: 11px; line-height: 1.55; color: var(--dim2);
  white-space: pre; overflow-x: auto; max-width: 100%; }

/* ── annotator ─────────────────────────────────────────────────────────── */
.anno { background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.anno-bar { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.anno-body { display: grid; grid-template-columns: 132px 1fr 288px; }
.strip { border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 8px; max-height: 640px; overflow: auto; }
.strip .sthumb { border: 1px solid var(--border); border-radius: 6px; padding: 4px; cursor: pointer; }
.strip .sthumb.on { border-color: var(--blue); }
.strip .sthumb img { width: 100%; height: 54px; object-fit: cover; border-radius: 4px; display: block; }
.strip .sthumb .row { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; font-size: 10px; color: var(--dim3); }
/* min-width:0 or the 1fr column grows to fit a zoomed canvas instead of scrolling */
.stage { padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #0d1017; min-width: 0; }
/* no max-width: at >100% zoom the canvas must overflow and the wrap must scroll,
   otherwise the drawn pixels and the mouse stop agreeing */
#canvas { display: block; border-radius: 6px; cursor: crosshair; image-rendering: pixelated; }
.rail-right { border-left: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 16px; }
.pal { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; cursor: pointer; margin-bottom: 7px; }
.pal.on { border-color: var(--blue); background: rgba(63, 110, 232, 0.12); }
.pal .swatch { width: 12px; height: 12px; border-radius: 3px; }
.pal .k { font-size: 10px; color: var(--dim3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.boxrow { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid var(--border); border-radius: 6px; }
.boxrow .x { font-size: 12px; color: var(--dim3); cursor: pointer; }

/* ── menus, tabs, keys, charts ─────────────────────────────────────────── */
.menu-host { position: relative; }
.menu {
  position: absolute; z-index: 15; top: calc(100% + 6px); min-width: 240px; max-height: 60vh; overflow: auto;
  background: #11141c; border: 1px solid var(--border); border-radius: 9px; padding: 6px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.menu.right { right: 0; }
.menu .item { padding: 8px 10px; border-radius: 6px; font-size: 12px; color: var(--soft); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.menu .item:hover { background: rgba(255, 255, 255, 0.04); }
.menu .item.on { background: rgba(63, 110, 232, 0.16); color: #dfe7fb; }
.menu .item .sub { margin-left: auto; font-size: 11px; color: var(--dim3); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); gap: 2px; }
.tabs .tab { padding: 10px 14px; font-size: 12px; color: var(--dim); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs .tab.on { color: var(--text); font-weight: 600; border-bottom-color: var(--blue); }

kbd {
  font: inherit; font-size: 10px; color: var(--soft); background: #171b24; border: 1px solid var(--edge);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; font-family: ui-monospace, Menlo, monospace;
}
.keys { display: flex; flex-direction: column; gap: 7px; font-size: 11px; color: var(--dim2); }
.keys div { display: flex; align-items: center; gap: 8px; }
.keys .k { min-width: 62px; display: flex; gap: 4px; }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.chart > i { flex: 1; background: var(--blue); border-radius: 2px 2px 0 0; min-height: 1px; display: block; }
.chart > i.alt { background: #2c53c9; }
.axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim3); margin-top: 6px; }
.chart-box { width: 100%; overflow-x: auto; }
svg.line { width: 100%; height: 130px; display: block; min-width: 380px; }
svg.line path.series { fill: none; stroke: var(--blue); stroke-width: 2; }
svg.line circle.dot { fill: var(--blue); }
svg.line .grid { stroke: var(--line); stroke-width: 1; }
svg.line .grid.faint { stroke: var(--hair); }
svg.line .axis-line { stroke: var(--edge); stroke-width: 1; }
svg.line .tick { fill: var(--dim3); font-size: 10px; font-family: inherit; }
svg.line .tick.y { text-anchor: end; }
svg.line .tick.x { text-anchor: middle; }
svg.line .tick.label { text-anchor: middle; fill: var(--dim2); font-size: 10px; }
/* ssl: where one round ended and the next began */
svg.line .marker { stroke: var(--amber, #f0a852); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.75; }
svg.line .tick.marker-label { fill: var(--amber, #f0a852); text-anchor: start; font-size: 9px; }

.split-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); }
.split-bar > i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--dim2); margin-top: 10px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.tile .pick {
  position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; border-radius: 4px;
  border: 1px solid #4a5265; background: rgba(10, 13, 20, 0.75); cursor: pointer;
}
.tile .pick.on { background: var(--blue); border-color: var(--blue); }
.tile { position: relative; }
.tile.sel { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }

.mtile { border: 1px solid var(--border); border-radius: 9px; padding: 14px; }
.mtile .l { font-size: 11px; color: var(--dim2); }
.mtile .v { font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; }
.mtile.bad { border-color: #55303a; background: rgba(240, 82, 82, 0.08); }
.mtile.bad .l { color: #f0908f; }
.mtile.warn { border-color: #4a3b28; background: rgba(240, 168, 82, 0.08); }
.mtile.warn .l { color: #f0c58a; }

.hint { font-size: 11px; color: var(--dim3); line-height: 1.6; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--dim2); word-break: break-all; }
.rowline { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.rowline span:last-child { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.rowline span:first-child { color: var(--dim2); }
.toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; }
.toolbar .grow { flex: 1; }
.check { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--soft); cursor: pointer; }
.check .box { width: 13px; height: 13px; border-radius: 3px; border: 1px solid #2f3746; flex: 0 0 13px; }
.check .box.on { background: var(--blue); border-color: var(--blue); }
.check .n { margin-left: auto; font-size: 11px; color: var(--dim3); }
.fields3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fields2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.zoom { display: flex; gap: 6px; }
.zoom .b {
  width: 30px; height: 30px; border-radius: 6px; background: #161b25; border: 1px solid var(--edge);
  color: var(--soft); font-size: 14px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.zoom .b.wide { width: auto; padding: 0 10px; font-size: 11px; }
.canvas-wrap { overflow: auto; max-height: 620px; width: 100%; border-radius: 6px; overscroll-behavior: contain; }

/* ── overlays ──────────────────────────────────────────────────────────── */
.modal-layer { position: fixed; inset: 0; z-index: 20; }
/* each layer sits above the one below it, so a preview covers its form */
.modal-layer + .modal-layer { z-index: 21; }
.backdrop { position: fixed; inset: 0; background: rgba(4, 6, 11, 0.72); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal { width: 560px; max-width: calc(100vw - 40px); max-height: calc(100vh - 80px); overflow: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.modal h3 { margin: 0; font-size: 14px; font-weight: 600; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.modal-x { background: none; border: 0; color: var(--dim2); font-size: 15px; line-height: 1;
  cursor: pointer; padding: 0 2px; border-radius: 6px; }
.modal-x:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
/* a form wide enough to read: three columns instead of two */
.modal.roomy .fields { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .modal.roomy .fields { grid-template-columns: 1fr 1fr; } }
.modal .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .fields .wide { grid-column: 1 / -1; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.toast { background: #161b25; border: 1px solid var(--border); border-left: 3px solid var(--blue);
  border-radius: 8px; padding: 10px 14px; font-size: 12px; max-width: 380px; }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }

/* a run that is working but cannot say how far along: motion, not a number */
.track.indeterminate { overflow: hidden; }
.track.indeterminate > i { width: 34%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -34%; } 100% { margin-left: 100%; } }

/* annotator: where the image was filed, as a hint about what should be in it */
.folder-hint { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.folder-hint-label { font-size: 11px; color: var(--dim3); }
.folder-hint-name { font-size: 12px; font-weight: 600; color: var(--blue2);
  background: rgba(63, 110, 232, 0.12); border: 1px solid rgba(63, 110, 232, 0.28);
  border-radius: 5px; padding: 1px 7px; cursor: help; }
.folder-hint-name.bg { color: var(--green); background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.28); }
.folder-hint-key { font-size: 10px; color: var(--dim2); border: 1px solid var(--edge);
  border-radius: 4px; padding: 0 5px; cursor: help; }

/* new dataset: one field per class, pre-filled from the folder names */
.class-list { display: flex; flex-direction: column; gap: 7px; }
.class-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.class-row input { flex: 1 1 auto; min-width: 0; }
.class-idx { min-width: 20px; text-align: center; font-size: 11px; color: var(--dim3);
  border: 1px solid var(--edge); border-radius: 4px; padding: 2px 0; cursor: help; }
.btn.class-del { padding: 2px 9px; line-height: 1.2; color: var(--dim2); }
.btn.class-del:hover { color: var(--red); }
.hint.bad { color: var(--red); }
input.bad { border-color: var(--red); }

/* Background, one ? away: floats over the page instead of opening the card. */
.explain { position: relative; display: inline-flex; align-items: center; margin-top: 8px;
  outline: none; }
.explain-mark { display: inline-grid; place-items: center; width: 15px; height: 15px;
  border: 1px solid var(--edge); border-radius: 50%; font-size: 9px; color: var(--dim3);
  cursor: help; user-select: none; }
.explain:hover .explain-mark, .explain:focus .explain-mark { border-color: var(--blue); color: var(--blue2); }
.explain-pop { position: absolute; bottom: calc(100% + 8px); left: -6px; z-index: 25;
  width: 320px; max-width: min(320px, calc(100vw - 40px)); padding: 11px 12px;
  background: var(--card); border: 1px solid var(--edge); border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5); font-size: 11.5px; line-height: 1.55;
  color: var(--dim); opacity: 0; visibility: hidden; transition: opacity .12s; pointer-events: none; }
.explain:hover .explain-pop, .explain:focus .explain-pop { opacity: 1; visibility: visible; }
/* near the top of a card it would be cut off, so it drops below instead */
.card-head .explain .explain-pop, .toolbar .explain .explain-pop {
  bottom: auto; top: calc(100% + 8px); }


/* driver.js popovers, in this app's colours rather than its default light card */
.driver-popover.cv-tour { background: var(--card); color: var(--soft);
  border: 1px solid var(--edge); border-radius: 10px; max-width: 360px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); }
.driver-popover.cv-tour .driver-popover-title { font-size: 13px; font-weight: 650; color: var(--text); }
.driver-popover.cv-tour .driver-popover-description { font-size: 12px; line-height: 1.55;
  color: var(--dim); }
.driver-popover.cv-tour .driver-popover-progress-text { font-size: 10px; color: var(--dim3);
  letter-spacing: 0.06em; }
.driver-popover.cv-tour .driver-popover-arrow-side-left { border-left-color: var(--card); }
.driver-popover.cv-tour .driver-popover-arrow-side-right { border-right-color: var(--card); }
.driver-popover.cv-tour .driver-popover-arrow-side-top { border-top-color: var(--card); }
.driver-popover.cv-tour .driver-popover-arrow-side-bottom { border-bottom-color: var(--card); }
.driver-popover.cv-tour button { background: var(--panel); color: var(--soft);
  border: 1px solid var(--edge); border-radius: 7px; padding: 5px 12px; font-size: 12px;
  text-shadow: none; }
.driver-popover.cv-tour button:hover { background: var(--line); color: var(--text); }
.driver-popover.cv-tour .driver-popover-next-btn { background: var(--blue); border-color: var(--blue); color: #fff; }
.driver-popover.cv-tour .driver-popover-close-btn { color: var(--dim3); font-size: 14px;
  width: 18px; height: 18px; line-height: 18px; top: 8px; right: 8px; border-radius: 4px; }
.driver-popover.cv-tour .driver-popover-close-btn:hover { color: var(--text); }

/* ── the flow rail: the four stages of the loop, on every page ─────────── */
.flow-host { padding: 12px 24px 0; }
.flow-host:empty { padding: 0; }
.flow-rail { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flow-step {
  display: flex; align-items: center; gap: 9px; padding: 7px 13px 7px 8px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--card);
  color: var(--dim); text-decoration: none; transition: border-color 0.12s;
}
.flow-step:hover { border-color: #3a4356; }
.flow-step .flow-n {
  width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 10px; font-weight: 700;
  background: #262c3a; color: var(--dim2);
}
.flow-step.done .flow-n { background: rgba(74, 222, 128, 0.16); color: var(--green); }
.flow-step.on { border-color: var(--blue); }
.flow-step.on .flow-n { background: var(--blue); color: #fff; }
.flow-step .flow-label { display: block; font-size: 11.5px; font-weight: 600; color: var(--soft); }
.flow-step.on .flow-label { color: var(--text); }
.flow-step .flow-sub { display: block; font-size: 10px; color: var(--dim3); margin-top: 1px; }
.flow-arrow { color: var(--dim4); font-size: 12px; }
.flow-loop {
  color: var(--blue2); font-size: 15px; text-decoration: none; padding: 4px 8px;
  border-radius: 7px;
}
.flow-loop:hover { background: rgba(63, 110, 232, 0.12); }

/* ── preset and approach cards (the training form's three questions) ───── */
.preset-row, .approach-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 8px; }
.preset {
  border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px;
  cursor: pointer; background: var(--panel); transition: border-color 0.12s;
}
.preset:hover { border-color: #3a4356; }
.preset.on { border-color: var(--blue); background: rgba(63, 110, 232, 0.07); }
.preset.ghost { cursor: default; opacity: 0.85; }
.preset-name { font-size: 12.5px; font-weight: 600; }
.preset-blurb { font-size: 11px; color: var(--dim2); margin-top: 5px; line-height: 1.45; }
.preset-speed { font-size: 10px; color: var(--dim3); margin-top: 7px; }

/* one disclosure holding every advanced parameter, grouped */
.btn.disclosure { width: 100%; text-align: left; color: var(--dim); }
.disclosure-body { margin-top: 12px; border: 1px solid var(--hair); border-radius: 9px; padding: 14px; }
.modal-footline { display: flex; align-items: center; gap: 10px; margin-top: 14px; justify-content: space-between; }

/* ── review: the three sources and their headline counts ───────────────── */
.review-src .review-count { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; margin: 2px 0 6px; }

/* collapsed key map in the annotator rail */
.keys-fold summary {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dim4); cursor: pointer; margin-bottom: 9px; list-style: none;
}
.keys-fold summary::before { content: "▸ "; }
.keys-fold[open] summary::before { content: "▾ "; }
