/* chatbot_qa UI — tokens first, then layout, then components.
   Palette from sages.com.pl (theme-color #31c5f4, ink #1b202c, link #116b9d); font as in sages-chatbot-admin. */
:root {
  --brand: #31c5f4;          /* Sages cyan: CTA, active nav, logo */
  --brand-hover: #60d9ff;
  --brand-ink: #1b202c;      /* text on cyan */
  --top-bg: #1b202c;
  --top-ink: #c3cad6;
  --top-line: #30394f;
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --hover: #f1f7fb;
  --line: #e6eaf0;
  --line-soft: #eef1f5;
  --ink: #1b202c;
  --ink-2: #30394f;
  --ink-3: #646d81;
  --ink-4: #8a93a6;
  --on-strong: #ffffff;      /* text on --user-bubble */
  --on-fail: #ffffff;
  --action: #116b9d;
  --action-hover: #0d5780;
  --action-soft: #e1f2f8;
  --pass: #18875c;
  --pass-bg: #e3f4ec;
  --fail: #b21e1e;
  --fail-bg: #fbeaea;
  --fail-line: #efc3c3;
  --fail-ink: #8a1c1c;
  --amber: #8a5a00;
  --amber-bg: #fff4cc;
  --amber-mark: #e5a800;
  --skip: #b4bcc8;
  --user-bubble: #116b9d;
  --radius-lg: 10px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(27, 32, 44, .05), 0 6px 22px rgba(36, 43, 59, .06);
  --shadow-pop: 0 24px 64px rgba(27, 32, 44, .24);
  --backdrop: rgba(27, 32, 44, .45);
  --font: "Be Vietnam Pro", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font);
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
/* Dark via data-theme on <html>: the top-bar switch, or the system setting until the switch is used. */
:root[data-theme="dark"] {
  --top-bg: #0f1218;
  --top-line: #262d3b;
  --bg: #13161d;
  --surface: #1b202c;
  --surface-2: #202633;
  --hover: #222a38;
  --line: #30394f;
  --line-soft: #262d3b;
  --ink: #e6eaf0;
  --ink-2: #c3cad6;
  --ink-3: #98a1b3;
  --ink-4: #737d91;
  --on-strong: #ffffff;
  --on-fail: #2a0d0f;
  --action: #60d9ff;
  --action-hover: #8ce4ff;
  --action-soft: #15334a;
  --pass: #4cc38a;
  --pass-bg: #133224;
  --fail: #f07272;
  --fail-bg: #3a1b1e;
  --fail-line: #6b2a2e;
  --fail-ink: #ffb4b4;
  --amber: #f2c94c;
  --amber-bg: #3a3014;
  --amber-mark: #f2c94c;
  --skip: #4b5568;
  --user-bubble: #155f88;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, .6);
  --backdrop: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--action); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; margin: 0; }
h1 { font-size: 30px; line-height: 1.15; }
h1 small { font-family: var(--font); font-size: 15px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; margin-left: 12px; }
h2 { font-size: 20px; font-weight: 600; margin: 44px 0 8px; }
h2 small { font-family: var(--font); letter-spacing: 0; }
h3 { font-size: 16px; font-weight: 600; }

/* ---- chrome: dark Sages bar with a cyan marker under the active section ---- */
.devbanner { background: var(--amber-bg); color: var(--amber); font-size: 13px; padding: 6px 32px; }
.previewbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--action-soft); color: var(--ink); border-bottom: 2px solid var(--action); font-size: 14px; padding: 8px 32px; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: stretch; gap: 28px;
  height: 60px; padding: 0 32px;
  background: var(--top-bg); color: var(--top-ink);
  border-bottom: 1px solid var(--top-line);
}
.topbar > * { align-self: center; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; color: var(--ink); }
.topbar .brand { color: #fff; }
.brand:hover { text-decoration: none; }
.brand svg { flex: none; }
.nav { display: flex; gap: 4px; align-self: stretch; }
.nav a { display: flex; align-items: center; padding: 0 12px; color: var(--top-ink); font-size: 14.5px; font-weight: 500; box-shadow: inset 0 -3px 0 transparent; transition: color .15s, box-shadow .15s; }
.nav a:hover { text-decoration: none; color: #fff; box-shadow: inset 0 -3px 0 var(--top-line); }
.nav a.on { color: #fff; box-shadow: inset 0 -3px 0 var(--brand); }
.topbar :focus-visible { outline-color: var(--brand); }
.topbar .btn:not(.primary) { background: transparent; border-color: var(--top-line); color: var(--top-ink); }
.topbar .btn:not(.primary):hover { border-color: var(--top-ink); color: #fff; }
.topbar .grow, .head .grow { flex: 1; min-width: 0; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 36px 32px 80px; }
.crumbs { color: var(--ink-3); font-size: 13.5px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); }
.head { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 28px; }
.head h1 + div, .head h1 + .meta { margin-top: 6px; }
.meta { color: var(--ink-3); font-size: 13.5px; }
.meta b { color: var(--ink); font-weight: 600; }
.section-note { color: var(--ink-3); font-size: 14px; margin: 0 0 14px; max-width: 72ch; text-wrap: pretty; }
.section-note.lead { margin: 8px 0 0; font-size: 15px; color: var(--ink-2); max-width: 110ch; text-wrap: balance; }
.count-note { margin: -4px 0 8px; text-align: right; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline { display: inline; }
.nowrap { white-space: nowrap; }

/* ---- controls -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; flex: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.subtabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.subtabs a { padding: 8px 14px; color: var(--ink-3); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a:hover { color: var(--ink); text-decoration: none; }
.subtabs a.on { color: var(--ink); border-bottom-color: var(--action); }
.btn.danger { color: var(--fail); border-color: var(--fail-line); }
.btn.danger:hover { border-color: var(--fail); }
button.btn.danger:not([disabled]):is(dialog *) { background: var(--fail); border-color: var(--fail); color: var(--on-fail); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
select.btn { padding-right: 30px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23646d81' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.filters select, .filters input, .field input, .field select, .field textarea, .sched input, .sched select,
.known-issue-form input {
  height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
.filters input[type=search] { min-width: 280px; flex: 1; max-width: 420px; }
.filters select:hover, .filters input:hover { border-color: var(--ink-3); }
.filters select, .filters input, .field input, .field select, .field textarea, .sched input, .sched select { color: var(--ink); }

/* ---- pills & verdicts ------------------------------------------------------ */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 4px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.pass { background: var(--pass-bg); color: var(--pass); }
.pill.fail { background: var(--fail); color: var(--on-fail); }
.pill.skip { background: var(--line-soft); color: var(--ink-3); }
.pill.error { background: var(--amber-bg); color: var(--amber); }
.pill.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-2); font-weight: 500; }
.pill.ghost::before, .pill.count::before { display: none; }
.pill.count { min-width: 30px; justify-content: center; padding: 0 8px; }
.pill.fail.count { background: var(--fail-bg); color: var(--fail); }
.pill.flaky { background: transparent; border: 1px dashed var(--amber); color: var(--amber); font-weight: 500; }
.pill.flaky::before { display: none; }
.delta { font-size: 13px; font-weight: 600; }
.delta.regressed { color: var(--fail); }
.delta.unconfirmed { color: var(--ink-2); }
.delta.improved { color: var(--pass); }
.delta.same, .delta.new { color: var(--ink-3); font-weight: 400; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 4px; background: var(--line-soft); color: var(--ink-2); font-size: 11.5px; font-weight: 500; vertical-align: 1px; }
.strip { display: inline-flex; gap: 3px; vertical-align: middle; }
.strip i { width: 8px; height: 18px; border-radius: 3px; background: var(--line); }
.strip i.pass { background: var(--pass); }
.strip i.fail { background: var(--fail); }
.strip i.skip { background: var(--skip); }
.strip i.opt { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.strip i.opt.pass { box-shadow: inset 0 0 0 2px var(--pass); }
.strip i.opt.fail { box-shadow: inset 0 0 0 2px var(--fail); }
.strip i.opt.skip { box-shadow: inset 0 0 0 2px var(--skip); }

/* ---- tables ---------------------------------------------------------------- */
.panel, table.t, table.matrix { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
table.t, table.matrix { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; }
table.t th, table.matrix th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-3); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.t td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.row, table.matrix tr.row { cursor: pointer; }
table.t tr.row:hover td, table.matrix tr.row:hover td { background: var(--hover); }
table.t td.num, table.t th.num { text-align: right; }
table.t td b { font-weight: 600; }
.code, code { font-family: var(--font-mono); font-size: 12.5px; }
.cond { color: var(--ink-2); font-size: 13px; white-space: pre-wrap; word-break: break-word; cursor: pointer; }
.cond.clip { max-height: 3em; overflow: hidden; position: relative; }
.cond.clip::after { content: ""; position: absolute; inset: auto 0 0 0; height: 1.5em; background: linear-gradient(transparent, var(--surface)); }

/* ---- home: client bands ---------------------------------------------------- */
.bands { display: flex; flex-direction: column; gap: 12px; }
.band {
  display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(130px, .6fr) minmax(260px, 2fr) repeat(2, minmax(90px, .45fr));
  gap: 28px; align-items: center;
  padding: 22px 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  color: inherit; transition: border-color .15s;
}
.band:hover { border-color: var(--action); text-decoration: none; }
.band .name { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.band .sub { color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }
.band .cycle { margin-top: 14px; }
.band .cycle .bar { height: 6px; }
.band .cycle .meta { margin-bottom: 6px; }
.stat { text-align: right; }
.stat .v { font-family: var(--font-display); font-size: 34px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.stat .v.fail { color: var(--fail); }
.stat .v.zero { color: var(--line); }
.stat .l { color: var(--ink-3); font-size: 13px; margin-top: 6px; }

/* suite health: current pass rate + its 90-day trend (one point = state at the end of a day) */
.rate .v { font-family: var(--font-display); font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1; color: var(--ink-3); }
.rate .v small { font-size: 20px; margin-left: 1px; }
.rate.g .v { color: var(--pass); }
.rate.a .v { color: var(--amber); }
.rate.r .v { color: var(--fail); }
.rate .l { color: var(--ink-2); font-size: 13px; margin-top: 6px; }
.rate .meta { font-size: 12.5px; }
.trend { margin: 0; min-width: 0; }
.trend-plot { position: relative; height: 96px; margin-right: 34px; }
.trend-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.trend .grid { stroke: var(--line-soft); stroke-width: 1; }
.trend .mk { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
.trend .mk.deploy { stroke: var(--action); stroke-dasharray: 6 3; opacity: .9; }
.trend .deploy-tick { position: absolute; top: -3px; width: 8px; height: 8px; margin-left: -4px; background: var(--action); transform: rotate(45deg); cursor: help; }
.trend .area { fill: var(--action-soft); opacity: .6; }
.trend .line { fill: none; stroke: var(--action); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .gl { position: absolute; right: -34px; transform: translateY(-50%); color: var(--ink-3); font-size: 11px; }
.trend .mk-dot, .trend .last-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; }
.trend .mk-dot { background: var(--surface); border: 2px solid var(--ink); }
/* display:none, not opacity: a hidden label at the right edge would still widen the page */
.trend a.mk-dot span { display: none; position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); padding: 1px 6px; border-radius: 4px; background: var(--ink); color: var(--surface); font-size: 11px; white-space: nowrap; pointer-events: none; }
.trend a.mk-dot:hover span, .trend a.mk-dot:focus-visible span { display: block; }
.trend a.mk-dot.on-last span { left: auto; right: -4px; transform: none; }
.trend .last-dot { background: var(--action); box-shadow: 0 0 0 3px var(--action-soft); pointer-events: none; }
.trend .mk-dot.on-last { width: 17px; height: 17px; margin: -8.5px 0 0 -8.5px; background: transparent; }
.trend-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }
.trend-axis { display: flex; justify-content: space-between; margin-right: 34px; color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.sample-strip { display: flex; align-items: center; gap: 8px; margin: 8px 34px 0 0; }
.sample-strip .meta { font-size: 11.5px; }
.sample-strip .cells { flex: 1; display: flex; gap: 2px; }
.sample-strip i { flex: 1; height: 8px; border-radius: 2px; background: var(--line-soft); }
.sample-strip i.g { background: var(--pass); }
.sample-strip i.a { background: var(--amber-mark); }
.sample-strip i.r { background: var(--fail); }
.health { margin: 4px 0 32px; padding: 22px 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.health-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.health-head h2 { margin: 0; }
.health-grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2.6fr); gap: 32px; align-items: start; }
.health-stats { display: flex; gap: 18px; margin: 14px 0 0; color: var(--ink-2); font-size: 13.5px; }
.health-stats b { font-family: var(--font-display); font-size: 18px; margin-right: 3px; color: var(--ink); }
.health-stats b.fail { color: var(--fail); }
.health .cycle { margin-top: 16px; }
.health .cycle .bar { height: 6px; }
.health .cycle .meta { margin-bottom: 6px; font-size: 12.5px; }
.health h3 { margin: 24px 0 8px; font-size: 15px; }
.seg a { display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 13.5px; color: var(--ink-2); }
.seg a:hover { color: var(--ink); text-decoration: none; }
.seg a.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(27, 32, 44, .12); }
table.t.compact td { padding-top: 8px; padding-bottom: 8px; }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.bar { height: 8px; background: var(--line-soft); border-radius: 999px; overflow: hidden; min-width: 120px; }
.bar b { display: block; height: 100%; background: var(--action); border-radius: 999px; transition: width .4s; }
.bar.v b { background: var(--pass); }

/* ---- scenario page --------------------------------------------------------- */
.two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
.two .turns { max-width: 860px; }
.criteria td.code { white-space: nowrap; }
.criteria .cond { max-width: 620px; }
.two > div > h2 { margin-top: 0; margin-bottom: 12px; }
.turns { list-style: none; margin: 0; padding: 4px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.turns li { display: flex; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.turns li:last-child { border-bottom: 0; }
.turns .n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--action-soft); color: var(--action); font-size: 12.5px; font-weight: 600; display: grid; place-items: center; }
.kind { font-size: 13px; color: var(--ink-2); }

.matrix th { font-size: 12.5px; vertical-align: bottom; }
.matrix th.a { text-align: center; padding: 12px 6px; }
.knum { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--ink); color: var(--surface); font-size: 12px; font-weight: 600; }
.matrix th.a.opt .knum, .opt-row .knum { background: var(--skip); }
.matrix td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.matrix td.c { text-align: center; padding: 12px 6px; }
.matrix tr.open > td { background: var(--action-soft); }
.cell { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font-size: 12.5px; font-weight: 700; }
.cell.pass { background: var(--pass-bg); color: var(--pass); }
.cell.fail { background: var(--fail); color: var(--on-fail); }
.cell.opt { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.cell.opt.fail { color: var(--fail); }
.cell.skip { background: var(--line-soft); color: var(--ink-3); }
.cell.none { color: var(--line); }
.matrix tr.detail > td { background: var(--surface-2); white-space: normal; padding: 22px 24px 26px; border-bottom: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px; animation: reveal .25s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* conversation, as the person saw it */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 11px 15px; border-radius: 18px; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.msg .who { font-size: 12px; margin-bottom: 4px; opacity: .7; }
.msg.user { align-self: flex-end; background: var(--user-bubble); color: var(--on-strong); border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.msg.bot a { font-weight: 500; }
.msg.bot ul { margin: 4px 0; padding-left: 20px; white-space: normal; }

.kv { font-size: 13.5px; margin: 0 0 18px; display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; word-break: break-word; }
.detail-grid h2 { font-size: 15px; margin: 18px 0 8px; }
.offs { margin: 0; padding: 0; list-style: none; font-size: 13.5px; }
.offs li { padding: 10px 12px; margin-bottom: 6px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--fail); border-radius: var(--radius-sm); }
.offs li b { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
.urls { margin: 6px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.urls li { color: var(--ink-2); word-break: break-all; padding: 2px 0; }

/* sources dialog */
.sources-btn { margin-top: 18px; }
.sources-btn .tag { margin-left: 2px; }
dialog.sources-dlg { width: min(760px, calc(100vw - 32px)); padding: 24px 28px; }
.sources-dlg .dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
dialog.wide { width: fit-content; max-width: calc(100vw - 32px); padding: 24px 28px; }
.wide .dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.wide .dlg-head h3 { margin: 0; }
.scn-nav { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.btn.disabled { opacity: .4; pointer-events: none; }
.wide .sched { margin-bottom: 14px; grid-template-columns: repeat(var(--cols, 1), minmax(0, 440px)); }
@media (max-width: 960px) { .wide .sched { grid-template-columns: minmax(0, 1fr); } }
.sources-dlg h3 { margin: 0; }
.sources-dlg > .meta { margin: 0 0 18px; }
.src-turn { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.src-q { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin-bottom: 10px; }
.src-q .knum { flex: none; background: var(--action); }
.src-list { margin: 0; padding: 0 0 0 32px; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.src-list li { word-break: break-all; }
.src-list .tag { word-break: normal; }

/* ---- runs ------------------------------------------------------------------ */
.counts { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 22px; }
.counts > div { flex: 1; min-width: 130px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.counts .big { display: block; font-family: var(--font-display); font-size: 32px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.counts .lbl { color: var(--ink-3); font-size: 13px; }
.counts .pass .big { color: var(--pass); }
.counts .fail .big { color: var(--fail); }
.counts .error .big { color: var(--amber); }
.prog { margin: -8px 0 24px; display: flex; align-items: center; gap: 12px; }
.prog .bar { flex: 1; }
.prog .meta { white-space: nowrap; }
.diff td.flip { font-weight: 600; }

/* ---- schedules ------------------------------------------------------------- */
.sched { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.sched .card { padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.sched .card.off { background: var(--surface-2); box-shadow: none; }
.sched .card.off > *:not(h3) { opacity: .6; }
.sched .card h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 18px; }
.sched .card h3 .tag { margin-left: 0; }
.sched .row { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; align-items: center; font-size: 14px; margin-bottom: 8px; }
.sched .row label { color: var(--ink-2); }
.sched input, .sched select { width: 100%; height: 36px; }
.sched .calc { color: var(--ink-2); font-size: 13.5px; }
.sched .calc b { color: var(--ink); font-size: 15px; }
.sched .foot { display: flex; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.switch { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-family: var(--font); font-size: 13.5px; font-weight: 400; color: var(--ink-2); letter-spacing: 0; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked { background: var(--pass); }
.switch input:checked::after { transform: translateX(16px); }
.preview { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.preview li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.preview li span { margin-left: auto; color: var(--ink-3); white-space: nowrap; }

/* ---- feedback, dialogs, empty states --------------------------------------- */
.flash { margin: 0 0 20px; padding: 12px 16px; border-radius: var(--radius); background: var(--action-soft); color: var(--action-hover); font-size: 14px; }
.flash.err { background: var(--fail-bg); color: var(--fail-ink); }
.empty { padding: 36px; text-align: center; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-lg); }
.note { margin: 20px 0; padding: 14px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 14px; }
dialog { width: min(560px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
dialog[open] { animation: reveal .2s ease-out; }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
dialog form { padding: 26px 28px 22px; }
dialog h3 { font-size: 20px; margin-bottom: 18px; }
.field { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; align-items: center; margin-bottom: 12px; }
.field label { color: var(--ink-2); font-size: 14px; }
.field input, .field select, .field textarea { width: 100%; }
.field .hint { grid-column: 2; margin-top: -4px; color: var(--ink-3); font-size: 12.5px; }
.field.stack { grid-template-columns: 1fr; }
.field.stack .hint { grid-column: 1; margin-top: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.login { max-width: 400px; margin: 14vh auto; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 12px; box-shadow: var(--shadow); }
.login .brand { margin-bottom: 24px; }
.login h1 { font-size: 24px; margin-bottom: 18px; }
.login .field { grid-template-columns: 1fr; gap: 6px; }

/* accounts & comments */
.who-am-i { color: var(--top-ink); font-size: 14px; }
.who-am-i.on, .who-am-i:hover { color: #fff; }
.theme-toggle { background: none; border: 1px solid var(--top-line); color: var(--top-ink); border-radius: var(--radius-sm); height: 30px; width: 34px; font-size: 15px; line-height: 1; }
.theme-toggle:hover { color: #fff; border-color: var(--top-ink); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.cbadge { display: inline-block; margin-left: 8px; color: var(--action); font-size: 12.5px; white-space: nowrap; }

.thread { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line-soft); max-width: 760px; }
.thread h3 { margin-bottom: 12px; }
.thread-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.comment { padding: 12px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line-soft); }
.comment.from-team { background: var(--action-soft); border-color: transparent; }
.comment-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.comment-head form { margin-left: auto; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form textarea { width: 100%; min-height: 84px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); resize: vertical; }
.comment-form .dlg-actions { margin-top: 8px; }
.linklike { border: 0; background: none; padding: 0; color: var(--ink-3); font-size: 13px; }
.linklike:hover { color: var(--fail); text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card-form { max-width: 520px; padding: 24px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-form h2 { margin: 0 0 16px; }
.card-form .field { grid-template-columns: 1fr; gap: 6px; }
.card-form .field .hint { grid-column: 1; }
.secret { margin: 0 0 20px; padding: 16px 20px; border-radius: var(--radius); background: var(--pass-bg); display: grid; gap: 6px; }
.big-code { font-size: 18px; letter-spacing: .04em; padding: 2px 8px; background: var(--surface); border-radius: var(--radius-sm); user-select: all; }
.ns-picker { margin: 4px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.ns-picker legend { padding: 0 6px; color: var(--ink-2); font-size: 14px; }
.ns-group { margin-bottom: 8px; }
.ns-group:last-child { margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; }
.check .code { color: var(--ink-3); font-size: 12px; }
.dlg-danger { display: flex; gap: 8px; padding: 14px 28px 22px; border-top: 1px solid var(--line-soft); }
.row-actions { text-align: right; }

@media (max-width: 960px) {
  table.t, table.matrix { display: block; overflow-x: auto; }
  .brand span.txt { display: none; }
  .nav a { padding: 8px 10px; }
  .counts > div { min-width: 96px; }
  h1 { font-size: 24px; }
  .stat .v { font-size: 28px; }
  .band { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; padding: 18px; }
  .band > div:first-child, .band .trend { grid-column: 1 / -1; }
  .health-grid { grid-template-columns: 1fr; }
  .stat { text-align: left; }
  .wrap, .topbar, .band, .head { min-width: 0; }
  .two, .detail-grid { grid-template-columns: 1fr; }
  .wrap { padding: 24px 16px 60px; }
  .topbar { gap: 12px; padding: 0 16px; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .devbanner, .previewbar { padding: 6px 16px; }
  .head { flex-wrap: wrap; align-items: flex-start; }
  .head .grow { flex-basis: 100%; }  /* title on its own line, actions below */
  .topbar { flex-wrap: wrap; height: auto; row-gap: 0; padding-top: 8px; overflow-x: visible; }
  .nav { order: 1; flex-basis: 100%; height: 44px; overflow-x: auto; }  /* sections on a second, scrollable row */
  tr.detail .exec { position: sticky; left: 0; max-width: calc(100vw - 66px); }  /* transcript stays in view when the table scrolls */
  .filters input[type=search] { min-width: 0; flex-basis: 100%; max-width: none; }
  .field, .sched .row, .kv { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- scenario: conversation first, criteria on demand --------------------- */
.question-card { max-width: 820px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); font-size: 16px; }
.q-line { display: flex; gap: 12px; align-items: flex-start; }
.q-line + .q-line { margin-top: 10px; }
.q-line .knum { flex: none; background: var(--action); }
.crit-sum { font-weight: 600; margin-right: 8px; font-size: 14px; }
.exec { max-width: 860px; animation: reveal .25s ease-out; }
.exec .chat { margin-bottom: 26px; }
.verdict-block h3 { font-size: 16px; margin-bottom: 10px; }
.crit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
details.crit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.crit.fail:not(.optional) { border-color: var(--fail-line); border-left: 3px solid var(--fail); }
details.crit > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; font-size: 14.5px; }
details.crit > summary::-webkit-details-marker { display: none; }
details.crit > summary::after { content: ""; margin-left: 4px; width: 8px; height: 8px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); transition: transform .15s; }
details.crit[open] > summary::after { transform: rotate(-135deg); }
details.crit > summary:hover { background: var(--surface-2); border-radius: var(--radius); }
.crit-mark { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700; }
.crit-mark.pass { background: var(--pass-bg); color: var(--pass); }
.crit-mark.fail { background: var(--fail); color: var(--on-fail); }
.crit.optional .crit-mark { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.crit.optional .crit-mark.fail { color: var(--fail); }
.crit-mark.skip { background: var(--line-soft); color: var(--ink-3); }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.check-list > li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; font-size: 14.5px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.check-list > li.fail { border-color: var(--fail-line); border-left: 3px solid var(--fail); }
.check-list > li > div { flex: 1; min-width: 0; padding-top: 1px; }
.crit-name { font-weight: 500; }
.crit-id { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.crit-body { padding: 4px 14px 14px 46px; font-size: 14px; }
.crit-def { color: var(--ink-2); margin-bottom: 6px; text-wrap: pretty; }
.crit-scope { color: var(--ink-3); font-size: 13px; margin-bottom: 4px; }
.crit-items { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.crit-items li { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px 8px; word-break: break-all; }
.crit-why .crit-items li { background: color-mix(in srgb, var(--surface) 60%, transparent); color: var(--ink); }
.crit-kind { font-weight: 500; color: var(--ink); }
.crit-cond { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.crit-why { margin-top: 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--fail-bg); color: var(--fail-ink); font-size: 13.5px; word-break: break-word; }
.crit-why.skip { background: var(--line-soft); color: var(--ink-2); }
.exec-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
details.defs { margin-top: 40px; }
details.defs > summary { cursor: pointer; font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 10px; }
details.defs .crit-list { max-width: 860px; }

/* environment filter above the test history */
.history-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 40px 0 6px; }
.history-head h2 { margin: 0; }
.env-filter { display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--line-soft); border-radius: 999px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 13.5px; color: var(--ink-2); }
.seg label:hover span { color: var(--ink); }
.seg input:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(27, 32, 44, .12); }
.seg input:focus-visible + span { outline: 2px solid var(--action); outline-offset: 1px; }

/* ---- scenario validity: out of the scheduled pool ------------------------- */
.validity { display: inline-flex; align-items: center; gap: 6px; height: 22px; margin-top: 6px; padding: 0 8px; border-radius: 4px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
a.validity:hover { text-decoration: none; filter: brightness(.96); }
.validity.expired { background: var(--amber-bg); color: var(--amber); box-shadow: inset 3px 0 0 var(--amber-mark); }
.validity.season { background: var(--line-soft); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.validity-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 8px; }
.validity-row .validity { margin-top: 0; }
.sched .calc .validity { margin: 2px 6px 2px 0; }
table.t tr.excluded td:first-child b { color: var(--ink-3); }

/* regression re-run under the conversation */
details.confirmation, details.fixtures { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: var(--surface-2); }
details.confirmation > summary, details.fixtures > summary { cursor: pointer; font-size: 14px; color: var(--ink-2); }
details.confirmation .chat { margin-top: 10px; }
details.fixtures .meta { margin-top: 8px; }

/* known issue marker on the scenario page */
.known-issue { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-left: 3px solid var(--ink-3); border-radius: var(--radius); background: var(--surface-2); }
.known-issue form { margin-left: auto; }
.known-issue-form { margin-top: 8px; }
.known-issue-form form { margin: 6px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.known-issue-form input { height: 32px; color: var(--ink); }
.known-issue-form input[name=issue] { width: 260px; }
.known-issue-form input[name=note] { flex: 1; min-width: 200px; }

/* ---- search ---------------------------------------------------------------- */
#search-results mark { background: var(--amber-bg); color: var(--ink); padding: 0 2px; border-radius: 2px; box-shadow: inset 0 -2px 0 var(--amber-mark); }
.cost-line { font-variant-numeric: tabular-nums; }
.tag.dead-link { background: var(--fail-bg); color: var(--fail-ink); }
table.t.cost td[rowspan] { vertical-align: top; border-bottom: 1px solid var(--line); }
.cycle .cap { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
