/* Themes. Light is the base. Dark applies when the operating system prefers it, unless the user forced light; or when the user
   forced dark. The user's choice is the data-theme attribute on <html> (set by the script in index.html before the first
   paint, changed by the switch in the top bar); no attribute = follow the system.
   The two dark blocks below MUST stay identical: test/theme.test.js checks it, and checks the contrast of the main colour pairs. */
:root {
  color-scheme: light; /* native controls (inputs, scrollbars, date pickers) follow the theme */
  --bg: #f6f7f9; --card: #fff; --text: #14181f; --muted: #5d6779; --line: #e4e7ec;
  --accent: #2563eb; --on-accent: #fff; --pass: #15803d; --fail: #b91c1c; --run: #1d4ed8; --idle: #98a2b3;
  --pass-bg: #dcfce7; --fail-bg: #fee2e2; --run-bg: #dbeafe; --idle-bg: #eef0f3;
  --warn: #b45309; --slow: #f59e0b; --blocked: #b45309; --blocked-bg: #fef3c7;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1116; --card: #171b22; --text: #e8eaee; --muted: #97a0af; --line: #2a303b;
    --accent: #5b8def; --on-accent: #0b1220; --pass: #34d058; --fail: #f2615c; --run: #79a6f6; --idle: #6b7380;
    --pass-bg: #123a22; --fail-bg: #4a1b1b; --run-bg: #1b2d52; --idle-bg: #222833;
    --warn: #fbbf24; --slow: #fbbf24; --blocked: #fbbf24; --blocked-bg: #3d2f0c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116; --card: #171b22; --text: #e8eaee; --muted: #97a0af; --line: #2a303b;
  --accent: #5b8def; --on-accent: #0b1220; --pass: #34d058; --fail: #f2615c; --run: #79a6f6; --idle: #6b7380;
  --pass-bg: #123a22; --fail-bg: #4a1b1b; --run-bg: #1b2d52; --idle-bg: #222833;
  --warn: #fbbf24; --slow: #fbbf24; --blocked: #fbbf24; --blocked-bg: #3d2f0c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 15px; margin: 0 0 12px; }

/* the bar's background is full-width, its content sits in the same centred column as <main>, so on a wide screen the menu
   stays next to the page it navigates */
.topbar { padding: 12px 0; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-inner { max-width: 1160px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 700; font-size: 16px; color: var(--text); }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-right: 8px; }
.topbar nav { display: flex; gap: 18px; align-items: center; }
.topbar nav a:not(.btn) { color: var(--muted); font-weight: 500; }
.topbar nav a.active { color: var(--text); }
main { max-width: 1160px; margin: 0 auto; padding: 24px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 26px; font-weight: 650; margin-top: 2px; }
.kpi .note { color: var(--muted); font-size: 12px; }
.chart-wrap { position: relative; height: 200px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--bg); }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: var(--mono); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.name { font-weight: 600; color: var(--text); }
.err { color: var(--fail); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.passed { color: var(--pass); background: var(--pass-bg); }
.badge.failed { color: var(--fail); background: var(--fail-bg); }
.badge.running, .badge.queued { color: var(--run); background: var(--run-bg); }
.badge.never, .badge.skipped, .badge.disabled { color: var(--muted); background: var(--idle-bg); }
.badge.running::before { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--idle-bg); color: var(--muted); margin-left: 6px; font-weight: 500; }

.strip { display: inline-flex; gap: 2px; vertical-align: middle; }
.strip i { width: 6px; height: 18px; border-radius: 2px; background: var(--idle); display: block; }
.strip i.passed { background: var(--pass); } .strip i.failed { background: var(--fail); }
.strip.big i { width: 10px; height: 28px; border-radius: 3px; cursor: pointer; }

.btn { font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; display: inline-block; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.1); background: var(--accent); }
.btn.danger { color: var(--fail); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

form .row { display: grid; gap: 4px; margin-bottom: 14px; }
form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { font-weight: 600; font-size: 13px; }
input[type=text], input[type=password], textarea, select { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--text); }
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 320px; resize: vertical; }
.hint { color: var(--muted); font-size: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip { font: inherit; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; }
.chip:hover { color: var(--text); }
.form-error { color: var(--fail); margin-bottom: 12px; white-space: pre-wrap; }
details summary { cursor: pointer; font-weight: 600; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 10px; overflow: auto; font-size: 12px; margin: 8px 0 0; }

dialog { width: min(820px, 94vw); max-height: 90vh; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); padding: 20px 22px; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.step-bar { height: 6px; border-radius: 3px; background: var(--accent); min-width: 2px; opacity: .8; }
.step-bar.failed { background: var(--fail); }
.shot { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
@media (max-width: 720px) { main { padding: 14px; } form .two { grid-template-columns: 1fr; } .hide-sm { display: none; } }

/* step builder */
.between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.seg-bar { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg { font: inherit; font-size: 12px; font-weight: 600; padding: 3px 12px; border: 0; background: var(--card); color: var(--muted); cursor: pointer; }
.seg.on { background: var(--accent); color: var(--on-accent); }
.steps { display: grid; gap: 8px; }
.step { display: grid; grid-template-columns: 24px 150px 1fr auto; gap: 8px; align-items: start; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.step .idx { color: var(--muted); font-size: 12px; padding-top: 9px; text-align: center; }
.step .fields { display: flex; flex-wrap: wrap; gap: 6px; }
.step .fields > input, .step .with-pick { flex: 1 1 200px; min-width: 0; }
.step .fields .label-input { flex: 1 1 140px; font-size: 12px; }
.with-pick { display: flex; gap: 4px; }
.with-pick input { flex: 1; min-width: 0; }
.secret-pick { width: 58px !important; padding: 8px 4px !important; }
.step-actions { display: flex; gap: 2px; padding-top: 3px; }
.icon { font: inherit; width: 26px; height: 28px; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; }
.icon:hover:not(:disabled) { background: var(--card); border-color: var(--line); color: var(--text); }
.icon:disabled { opacity: .3; cursor: default; }
details.import { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; }
.code-input { min-height: 160px !important; margin-top: 8px; }
label.inline { font-weight: 400; display: inline-flex; gap: 6px; align-items: center; }
.notice { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--run-bg); }
.notice .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ok { color: var(--pass); font-weight: 600; margin-top: 8px; }
ul.warn { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
code { font-family: var(--mono); font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
@media (max-width: 720px) { .step { grid-template-columns: 24px 1fr; } .step .fields, .step-actions { grid-column: 1 / -1; } }

/* submit guard */
.badge.blocked { color: var(--blocked); background: var(--blocked-bg); }
.tag.warn-tag { background: var(--fail-bg); color: var(--fail); }
.step.submits { border-color: #d97706; }
.submit-flag { flex: 0 0 auto; align-items: center; padding: 0 4px; font-size: 12px; white-space: nowrap; }

/* fillForm + variables */
.fields-table { flex: 1 1 100%; display: grid; gap: 6px; }
.form-field { display: grid; grid-template-columns: 86px minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 6px; align-items: start; }
.mode-pick { padding: 8px 4px !important; font-size: 12px; }
.vars { display: grid; gap: 6px; }
.var-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 6px; align-items: start; }
@media (max-width: 720px) { .form-field, .var-row { grid-template-columns: 1fr; } }

/* recording */
.record { margin-top: 8px; }
.rec-status { margin-top: 8px; }
.rec-live { color: var(--fail); font-weight: 600; animation: pulse 1.4s infinite; }
[hidden] { display: none !important; }

/* dataset */
.ds-scroll { overflow-x: auto; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; }
.ds-table { width: auto; min-width: 100%; }
.ds-table th, .ds-table td { padding: 4px; border-bottom: 0; vertical-align: top; }
.ds-table input { min-width: 150px; }
.ds-col { display: flex; align-items: center; gap: 2px; }
.ds-paste { min-height: 110px !important; margin-top: 8px; }
.ds-table th { vertical-align: middle; white-space: nowrap; }

/* run recording */
.run-video { width: 100%; max-height: 52vh; background: #000; border-radius: 8px; display: block; }
.recording { margin-bottom: 4px; }

/* schedule picker */
.sched { display: grid; gap: 8px; }
.sched-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sched-controls select, .sched-controls input[type=time], .sched-controls input[type=number] { width: auto; }
.sched-controls .narrow { width: 72px; }
.sched-summary { font-size: 14px; }
.time-chip { display: inline-flex; align-items: center; gap: 2px; }
.day-toggles { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* journey editor: summary strip, tabs, sticky save bar (layout A of design/b22-editor-layouts.html) */
.editor-page { padding-bottom: 76px; } /* room for the sticky bar */
.summary-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill { font: inherit; font-size: 12.5px; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; padding: 4px 11px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--text); cursor: pointer; }
.pill:hover { border-color: var(--accent); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.err { color: var(--fail); border-color: var(--fail); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { font: inherit; font-weight: 600; padding: 10px 16px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--idle-bg); color: var(--muted); }
.tab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fail); }
.panel { margin-bottom: 0; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 12px 0; z-index: 20; }
.savebar-inner { max-width: 1160px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 10px; } /* same column as the page */
.savebar .state { color: var(--muted); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.savebar .state.dirty { color: var(--warn); font-weight: 600; }
.savebar .state.err { color: var(--fail); font-weight: 600; }
.savebar .spacer { margin-left: auto; }
@media (max-width: 720px) { .savebar-inner { padding: 0 14px; } .tab { padding: 10px 12px; } }

/* theme switch (top bar): System -> Light -> Dark */

/* run page and flow popup: timeline, waterfall, flowchart */
#run-dialog, #flow-dialog { width: min(1100px, 94vw); }
ol.timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.tl-node { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 0 0 14px; }
.tl-node.click { cursor: pointer; }
.tl-node::before { content: ""; position: absolute; left: 14px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.tl-node:last-child::before { display: none; }
.tl-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--idle-bg); color: var(--muted); border: 2px solid var(--line); z-index: 1; }
.tl-node.passed .tl-dot { background: var(--pass-bg); color: var(--pass); border-color: var(--pass); }
.tl-node.failed .tl-dot { background: var(--fail-bg); color: var(--fail); border-color: var(--fail); }
.tl-node.blocked .tl-dot { background: var(--blocked-bg); color: var(--blocked); border-color: var(--blocked); }
.tl-node.skipped { opacity: .65; }
.tl-node.skipped .tl-dot { border-style: dashed; }
.tl-node.now .tl-body, .wf-row.now { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.tl-title { font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.tl-ico { width: 20px; text-align: center; flex: none; }
.tl-time { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; white-space: nowrap; }

.wf { margin-top: 14px; display: grid; gap: 4px; }
.wf-row { display: grid; grid-template-columns: minmax(120px, 260px) minmax(0, 1fr); gap: 10px; align-items: center; font-size: 12.5px; }
.wf-row.click { cursor: pointer; }
.wf-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-label b { color: var(--muted); font-weight: 600; margin-right: 6px; }
.wf-skip { color: var(--muted); font-style: italic; }
.track { position: relative; height: 22px; border-radius: 4px; background: repeating-linear-gradient(to right, var(--line) 0, var(--line) 1px, transparent 1px, transparent calc(100% / var(--ticks))); }
.bar { position: absolute; top: 3px; height: 16px; border-radius: 4px; background: var(--pass); min-width: 3px; }
.bar.failed { background: var(--fail); }
.bar.blocked { background: var(--blocked); }
.bar span { position: absolute; left: calc(100% + 6px); top: 0; line-height: 16px; color: var(--muted); white-space: nowrap; font-size: 11.5px; }
.bar.long span { left: auto; right: 6px; color: var(--on-accent); }
.wf .axis { color: var(--muted); font-size: 11.5px; }
.wf .axis .ticks { display: flex; justify-content: space-between; }

.flow-wrap { overflow: auto; max-height: 62vh; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.flow-wrap svg { display: block; margin: 0 auto; max-width: none; }
.flow-wrap.flow-error { color: var(--fail); }
@media (max-width: 720px) { .wf-row { grid-template-columns: minmax(90px, 40%) minmax(0, 1fr); } }
dialog .head > div { min-width: 0; overflow-wrap: anywhere; } /* a long address in the header wraps instead of widening the dialog */
.run-video { max-height: 40vh; }

/* dashboard list: runs slower than usual, legend, tags kept on one line */
.strip i.slow { background: var(--slow); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 4px 0; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 14px; border-radius: 2px; vertical-align: -2px; margin-right: 5px; background: var(--idle); }
.legend i.passed { background: var(--pass); } .legend i.slow { background: var(--slow); } .legend i.failed { background: var(--fail); }
td .name { display: flex; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
@media (max-width: 720px) { td .name { flex-wrap: wrap; white-space: normal; } }

/* categories and tags */
.tagchip { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid transparent; background: var(--run-bg); color: var(--run); cursor: pointer; white-space: nowrap; text-decoration: none; flex: none; }
.tagchip:hover { border-color: var(--run); text-decoration: none; }
.tagchip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tagchip.dim { opacity: .55; }
.tagchip.more { cursor: default; background: var(--idle-bg); color: var(--muted); }
.tagchip.more:hover { border-color: transparent; }
.tagchip .n { font-weight: 500; opacity: .8; }
.tagchip .x { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 0 0 2px; font-size: 13px; line-height: 1; }
td .name .tagchip { margin-left: 6px; }
.tagline { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.tagline .tag { margin-left: 0; }
.linkbtn { font: inherit; font-size: 12px; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0 4px; }
.listhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 2px 10px; }
.listhead h2 { margin: 0; font-size: 16px; }
.listhead .spacer { flex: 1; }
.filterbtn { display: inline-flex; gap: 6px; align-items: center; }
.filterbtn .ico { display: inline-flex; }
.filterbtn svg { width: 15px; height: 15px; }
.filterbtn[aria-expanded=true] { border-color: var(--accent); }
.filterbtn.on { background: var(--run-bg); color: var(--run); border-color: var(--run); }
.badgecount { font-size: 11px; font-weight: 700; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); text-align: center; }
.activechips { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-panel { display: grid; gap: 12px; }
.filter-panel input[type=text] { max-width: 320px; }
.filter-panel .actions-row { display: flex; align-items: center; gap: 10px; margin: 0; }
.filter-panel .spacer { flex: 1; }
.tagbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tagbar .lbl, .suggest .lbl { font-size: 12px; color: var(--muted); margin-right: 2px; }
tr.group td { background: var(--bg); padding: 8px 10px; cursor: pointer; user-select: none; }
tr.group:focus-visible td { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.group .gname { font-weight: 700; }
tr.group .caret { display: inline-block; width: 16px; color: var(--muted); }
.gstat { font-size: 12px; margin-left: 10px; font-weight: 600; }
.gstat.ok { color: var(--pass); } .gstat.bad { color: var(--fail); }
tr.in-group td:first-child { padding-left: 28px; }
.chipbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); }
.chipbox:focus-within { border-color: var(--accent); }
.chipbox input[type=text] { border: 0; flex: 1 1 120px; min-width: 100px; width: auto; padding: 4px; background: transparent; }
.chipbox input:focus { outline: none; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.hint.err { color: var(--fail); }

/* expected outcome per dataset row, time limits and the "degraded" result */
.badge.degraded { color: var(--blocked); background: var(--blocked-bg); }
.warn-text { color: var(--warn); }
.notice.warn-box { background: var(--blocked-bg); border: 1px solid var(--warn); }
.tag.warn-tag2 { background: var(--blocked-bg); color: var(--blocked); }
.gstat.warn { color: var(--warn); }
.bar.over { background: var(--slow); }
.tl-node.over .tl-time { color: var(--warn); }
.limit-input { max-width: 150px; }
.ds-expect { min-width: 170px; }
.ds-expect select { width: 100%; }
.ds-expect input { margin-top: 4px; font-size: 12px; }

/* storage */
.stack { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--idle-bg); margin: 8px 0 10px; }
.stack i { display: block; height: 100%; min-width: 2px; }
.seg-video, .seg-video-dot { background: var(--accent); } .seg-trace, .seg-trace-dot { background: var(--run); }
.seg-shot, .seg-shot-dot { background: var(--slow); } .seg-db, .seg-db-dot { background: var(--idle); }
.legend i[class$="-dot"] { height: 10px; width: 10px; border-radius: 50%; }
.storage-line { color: var(--muted); font-size: 12px; padding: 0 4px 24px; }
.legend i.seg-video-dot { background: var(--accent); } .legend i.seg-trace-dot { background: var(--run); }
.legend i.seg-shot-dot { background: var(--slow); } .legend i.seg-db-dot { background: var(--idle); }
.legend i[class$="-dot"] { height: 10px; width: 10px; border-radius: 50%; vertical-align: 0; }

/* long lists: grouping menu, "Show more" lines, pager */
.menuwrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 190px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); }
.menu button { display: flex; width: 100%; gap: 8px; align-items: center; text-align: left; font: inherit; background: none; border: 0; color: var(--text); padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--bg); }
.menu .tick { width: 14px; color: var(--accent); }
tr.more td { padding: 6px 10px 6px 28px; }
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 12px 4px 2px; font-size: 13px; }
.pager .info { color: var(--muted); margin-right: auto; }
.pager button { font: inherit; min-width: 32px; padding: 4px 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 6px; cursor: pointer; }
.pager button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pager button:disabled { opacity: .45; cursor: default; }
.pager select { width: auto; padding: 4px 8px; }

/* share dialog */
#share-dialog { width: min(560px, 94vw); }
.share-link { font-size: 12px; }

/* login page */
.login-card { max-width: 360px; margin: 64px auto; }

/* history dialog and import preview */
#history-dialog { width: min(700px, 94vw); }
.version { padding: 10px 0; border-top: 1px solid var(--line); }
.version:first-of-type { border-top: 0; }
.version .vhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.version ul, .import-item ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.version li { overflow-wrap: anywhere; }
.import-item { padding: 8px 0; border-top: 1px solid var(--line); }
.import-item:first-of-type { border-top: 0; }
.import-item .warn { color: var(--slow); }

/* settings */
.switch-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-weight: 600; cursor: pointer; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--accent); }

/* steps slower than their own usual time (orange; red stays for failed steps) */
.bar.slower1 { background: var(--slow); }
.bar.slower2 { background: repeating-linear-gradient(135deg, var(--slow) 0 5px, color-mix(in srgb, var(--slow) 55%, #000) 5px 10px); } /* much slower: striped, not only a colour */
.bar.over.long span, .bar.slower1.long span, .bar.slower2.long span { color: #1a1a1a; }
.tl-time.slower { color: var(--warn); font-weight: 600; }
.bar.slower2 { background: repeating-linear-gradient(135deg, var(--slow) 0 5px, color-mix(in srgb, var(--slow) 78%, #000) 5px 10px); }
.bar.slower2.long span { background: rgba(255, 255, 255, .82); padding: 0 5px; border-radius: 3px; right: 8px; }

/* environments: tabs under the menu, a ribbon in the environment's colour */
.envbar { background: var(--card); border-bottom: 1px solid var(--line); }
.envbar-inner { max-width: 1100px; margin: 0 auto; padding: 0 20px; display: flex; gap: 2px; align-items: flex-end; overflow-x: auto; }
.envtab { font-weight: 600; border-bottom: 3px solid transparent; color: var(--muted); padding: 11px 16px 9px; display: flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none; }
.envtab:hover { color: var(--text); text-decoration: none; }
.envtab.on { color: var(--text); border-bottom-color: var(--c); }
.envtab .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.envtab .count { font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--idle-bg); color: var(--muted); }
.envtab .count.bad { background: var(--fail-bg); color: var(--fail); }
.envtab.add { color: var(--accent); }
.ribbon { height: 4px; background: var(--c, var(--line)); }
.envchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--c); color: var(--text); vertical-align: middle; margin-left: 8px; }
.envchip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: block; }
.envrow { display: grid; grid-template-columns: 22px minmax(160px, 1fr) auto 110px auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.envrow input[type=text] { max-width: 260px; }
.envdot { width: 12px; height: 12px; border-radius: 50%; display: block; }
.swatches { display: inline-flex; gap: 5px; }
.swatches button { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatches button.on { border-color: var(--text); }
.iconbtn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.iconbtn:disabled { opacity: .4; cursor: default; }

/* what the site called during a step */
.calls { margin-top: 6px; font-size: 12px; }
.calls summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.call { display: flex; gap: 8px; align-items: baseline; padding: 1px 0; font-family: var(--mono); font-size: 11.5px; }
.call .m { min-width: 46px; color: var(--muted); }
.call .p { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.call .st { min-width: 56px; }
.call.bad .st, .call.bad .p { color: var(--fail); }
.call.warn .st, .call.warn .p, .call.warn .m { color: var(--warn); }
.net-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 100%; }
.tagchip.check { background: var(--idle-bg); color: var(--text); cursor: default; font-family: var(--mono); font-weight: 500; }
.check-pick { display: block; margin: 2px 0; }

.chip-text { font: inherit; background: none; border: 0; color: inherit; padding: 0; cursor: pointer; }
.chip-text:hover { text-decoration: underline; }

/* run page: the Steps / Network checks tabs, one row per call with Don't check / Warn / Fail */
.run-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 12px 0; }
.run-tab { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); padding: 8px 14px 7px; cursor: pointer; }
.run-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.run-tab .count { font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--run-bg); color: var(--run); margin-left: 6px; }
.net-step { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 4px; font-weight: 600; font-size: 13.5px; }
.net-step .n { width: 22px; height: 22px; border-radius: 50%; background: var(--idle-bg); display: inline-grid; place-items: center; font-size: 12px; color: var(--muted); flex: none; }
.net-row { display: grid; grid-template-columns: minmax(0, 1fr) 46px 70px auto; gap: 10px; align-items: center; padding: 7px 0 7px 30px; border-top: 1px solid var(--line); }
.net-row .path { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.net-row .path b { color: var(--muted); font-weight: 600; margin-right: 6px; }
.net-row .st { color: var(--pass); font-size: 12.5px; }
.net-row .ms { color: var(--muted); font-size: 12.5px; text-align: right; }
.net-choice { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.net-choice button { font: inherit; font-size: 12.5px; padding: 3px 11px; background: var(--card); color: var(--muted); border: 0; border-left: 1px solid var(--line); cursor: pointer; }
.net-choice button:first-child { border-left: 0; }
.net-choice button:disabled { opacity: .5; cursor: default; }
.net-choice button.on.off { background: var(--idle-bg); color: var(--text); font-weight: 600; }
.net-choice button.on.warn { background: var(--blocked-bg); color: var(--blocked); font-weight: 600; }
.net-choice button.on.fail { background: var(--fail-bg); color: var(--fail); font-weight: 600; }
.net-row.undecided .net-choice { box-shadow: 0 0 0 2px var(--run-bg); }
.net-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 6px; }
.net-save { display: flex; gap: 10px; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 720px) { .net-row { grid-template-columns: minmax(0, 1fr) auto; } .net-row .st, .net-row .ms { display: none; } }

/* editor: "+ Check" on a step, and its list of the calls seen on the latest run */
.addcheck { font: inherit; font-size: 12px; font-weight: 600; color: var(--accent); background: none; border: 1px dashed var(--accent); border-radius: 999px; padding: 1px 10px; cursor: pointer; }
.addcheck:hover, .addcheck[aria-expanded="true"] { background: var(--run-bg); }
.check-pop { flex: 0 0 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 8px 12px; } /* always a row of its own, under the chips */
.check-pop > * { max-width: 600px; }
.check-pop .poprow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.check-pop .poprow:first-of-type { border-top: 0; }
.check-pop .poprow .path { flex: 1; min-width: 160px; font-family: var(--mono); overflow-wrap: anywhere; }
.check-pop select, .check-pop input { width: auto; }

/* changelog */
.changelog-day h2 { margin: 0 0 10px; font-size: 15px; }
.change { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.changelog-day h2 + .change { border-top: 0; }
.ctag { justify-self: start; font-size: 11.5px; font-weight: 700; padding: 1px 9px; border-radius: 999px; }
.ctag.new { background: var(--run-bg); color: var(--run); }
.ctag.improved { background: var(--idle-bg); color: var(--muted); }
.ctag.fixed { background: var(--pass-bg); color: var(--pass); }
.change code { font-family: var(--mono); font-size: 12.5px; background: var(--idle-bg); padding: 0 5px; border-radius: 4px; }
@media (max-width: 720px) { .change { grid-template-columns: 1fr; gap: 2px; } }

/* Settings: sections of rows (the name, one short line under it, the control on the right) */
.sec h2 { font-size: 15px; margin: 0 0 2px; }
.sec .line, .srow .line { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.sec h2 + .srow { border-top: 0; }
.srow .name { font-weight: 600; }
.srow .ctl { display: flex; align-items: center; gap: 10px; }
.srow .ctl input[type=text], .srow .ctl select { width: 240px; max-width: 100%; }
.srow .ctl input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
@media (max-width: 560px) { .srow { grid-template-columns: 1fr; gap: 8px; } .srow .ctl input[type=text], .srow .ctl select { width: 100%; } }
/* when a journey runs next, under its schedule */
.next { display: block; color: var(--muted); font-size: 12px; }

/* a small "i" with a short explanation (hover or keyboard focus) */
.tip { position: relative; display: inline-flex; vertical-align: middle; margin-left: 6px; text-transform: none; letter-spacing: normal; font-weight: 400; }
.tip > button { font: inherit; font-size: 11px; font-weight: 700; line-height: 1; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: help; padding: 0; display: grid; place-items: center; }
.tip > button:hover, .tip > button:focus-visible { color: var(--accent); border-color: var(--accent); }
.tip .bubble { position: absolute; z-index: 5; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: 250px; padding: 8px 10px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: 12.5px; line-height: 1.4; box-shadow: 0 6px 20px rgba(0,0,0,.25); display: none; text-align: left; white-space: normal; }
.tip:hover .bubble, .tip:focus-within .bubble { display: block; }
.tip.right .bubble { left: auto; right: -8px; transform: none; }

/* a narrow screen (or a longer language): the menu goes on a second line instead of overflowing the page */
.topbar-inner { flex-wrap: wrap; gap: 8px 16px; }
.topbar nav { flex-wrap: wrap; gap: 8px 18px; }

/* Help: the manual */
.help { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .help { grid-template-columns: 1fr; } }
.toc { padding: 10px; margin: 0; }
.toc a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 13.5px; }
.toc a:hover { background: var(--idle-bg); }
.toc a.on { background: var(--run-bg); color: var(--run); font-weight: 600; }
.toc .toc-more { margin-top: 8px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; color: var(--muted); }
.manual { margin: 0; }
.manual h2 { margin-top: 0; }
.manual h3 { margin: 22px 0 6px; font-size: 15px; }
.manual p, .manual li { line-height: 1.55; }
.manual ol, .manual ul { padding-left: 22px; }
.manual code { font-family: var(--mono); font-size: 12.5px; background: var(--idle-bg); padding: 0 5px; border-radius: 4px; }
.manual-shot { display: block; max-width: 100%; height: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; }
.manual-tip { margin: 12px 0; padding: 9px 12px; border-left: 3px solid var(--accent); background: var(--run-bg); border-radius: 0 8px 8px 0; font-size: 13.5px; }
.manual-next { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); }

/* the guided tour */
.tour-veil { position: fixed; inset: 0; z-index: 60; }
.tour-spot { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(10, 14, 22, .55); outline: 2px solid var(--accent); pointer-events: none; transition: left .25s, top .25s, width .25s, height .25s; }
.tour-pop { position: fixed; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); transition: left .25s, top .25s; }
.tour-pop h3 { margin: 0 0 4px; font-size: 15px; }
.tour-pop p { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); }
.tour-foot { display: flex; flex-direction: column; gap: 10px; } /* the dots, then the buttons: the buttons never wrap, whatever the language */
.tour-buttons { display: flex; align-items: center; gap: 8px; }
.tour-buttons .btn { white-space: nowrap; }
.tour-spacer { flex: 1; }
.tour-dots { display: flex; gap: 4px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--idle); }
.tour-dots i.on { background: var(--accent); }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-pop { transition: none; } }

/* the sites of a secret, editable in its row */
.sites-input { width: 100%; min-width: 180px; max-width: 320px; }

/* agent access: the command to copy */
.block-code { display: block; margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: var(--idle-bg); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; white-space: pre-wrap; user-select: all; }
