/* QA Studio — app shell: left sidebar, sticky top bar, card grid. Light and dark themes. */
:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #e9ecff 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #eef7f4 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #f1f3f8;
  --sidebar: #ffffffcc;
  --fg: #0f172a;
  --muted: #5b6577;
  --faint: #646c7f; /* 4.7:1 or more on every light surface (small hints, chart axes) */
  --line: #e6e8f0;
  --line-strong: #d6dae5;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #eef0ff;
  --accent-ink: #3730a3;
  --on-accent: #ffffff;
  --ok: #047857; --ok-bg: #e7f7f0; --ok-line: #a7e3c9;
  --warn: #a15c00; --warn-bg: #fff6e5; --warn-line: #f6d79a;
  --bad: #be123c; --bad-bg: #fff0f3; --bad-line: #f8b4c4;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #6250d6;
  --grid: #eceef4;
  --console-bg: #0f1420; --console-fg: #d7deea; --console-muted: #7d889c;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / .05);
  --shadow: 0 1px 2px rgb(15 23 42 / .04), 0 4px 16px rgb(15 23 42 / .06);
  --shadow-lg: 0 10px 30px rgb(15 23 42 / .12);
  --ring: 0 0 0 3px rgb(79 70 229 / .22);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, Consolas, monospace;
  --sans: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --sidebar-w: 236px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0d14;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, #1a1d3a 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #0f2a24 0%, transparent 55%);
    --surface: #121722; --surface-2: #161c29; --surface-3: #1b2231; --sidebar: #0f131dcc;
    --fg: #e7ebf3; --muted: #9aa4b8; --faint: #818a9f; --line: #222a3a; --line-strong: #2d3649;
    --accent: #818cf8; --accent-2: #a78bfa; --accent-soft: #1d2142; --accent-ink: #c7cbff; --on-accent: #0b0d1a;
    --ok: #34d399; --ok-bg: #0f2a22; --ok-line: #1f5a45; --warn: #fbbf24; --warn-bg: #2b2110; --warn-line: #5c4512; --bad: #fb7185; --bad-bg: #2d131b; --bad-line: #64243a;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #9085e9;
    --grid: #1e2533; --console-bg: #0a0e16;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .3); --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25); --shadow-lg: 0 12px 34px rgb(0 0 0 / .45);
    --ring: 0 0 0 3px rgb(129 140 248 / .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d14;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #1a1d3a 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #0f2a24 0%, transparent 55%);
  --surface: #121722; --surface-2: #161c29; --surface-3: #1b2231; --sidebar: #0f131dcc;
  --fg: #e7ebf3; --muted: #9aa4b8; --faint: #818a9f; --line: #222a3a; --line-strong: #2d3649;
  --accent: #818cf8; --accent-2: #a78bfa; --accent-soft: #1d2142; --accent-ink: #c7cbff; --on-accent: #0b0d1a;
  --ok: #34d399; --ok-bg: #0f2a22; --ok-line: #1f5a45; --warn: #fbbf24; --warn-bg: #2b2110; --warn-line: #5c4512; --bad: #fb7185; --bad-bg: #2d131b; --bad-line: #64243a;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #9085e9;
  --grid: #1e2533; --console-bg: #0a0e16;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .3); --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25); --shadow-lg: 0 12px 34px rgb(0 0 0 / .45);
  --ring: 0 0 0 3px rgb(129 140 248 / .3);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed; color: var(--fg); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-3); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
aside.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; background: var(--sidebar); backdrop-filter: blur(12px); border-right: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.logo .mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 16px rgb(79 70 229 / .35); }
.logo .mark svg.i { width: 19px; height: 19px; stroke-width: 2.2; }
.logo b { display: block; font-size: 15px; letter-spacing: -.01em; }
.logo small { display: block; color: var(--muted); font-size: 11.5px; }
nav#tabs { display: grid; gap: 2px; }
nav#tabs .group { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 12px 10px 4px; font-weight: 600; }
nav#tabs button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: var(--radius-xs); color: var(--muted); font: 500 13.5px/1.2 var(--sans); cursor: pointer; transition: background .15s, color .15s; }
nav#tabs button:hover { background: var(--surface-3); color: var(--fg); }
/* An environment that is not configured yet: only Target & setup and Concepts open (app.js applyGate). */
nav#tabs button:disabled { opacity: 0.45; cursor: not-allowed; }
nav#tabs button:disabled:hover { background: none; color: var(--muted); }
nav#tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sidebar-foot .row { justify-content: space-between; }

/* ---- collapsible sidebar ---- */
.shell { transition: grid-template-columns .2s ease; }
.logo-text { flex: 1; min-width: 0; }
.side-toggle { flex: none; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; background: none; border: 0; border-radius: var(--radius-xs); color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.side-toggle:hover { background: var(--surface-3); color: var(--fg); }
.side-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.shell.collapsed { grid-template-columns: 68px 1fr; }
.shell.collapsed aside.sidebar { padding: 18px 10px; overflow: hidden; }
.shell.collapsed .logo { flex-direction: column; gap: 8px; padding: 4px 0; }
.shell.collapsed .logo-text,
.shell.collapsed .lbl,
.shell.collapsed .sidebar-foot { display: none; }
.shell.collapsed nav#tabs .group { font-size: 0; padding: 0; margin: 8px 6px; border-top: 1px solid var(--line); }
.shell.collapsed nav#tabs .group:first-child { display: none; }
.shell.collapsed nav#tabs button { justify-content: center; padding: 10px 0; }
.shell.collapsed .side-toggle svg.i { transform: scaleX(-1); }

.content { min-width: 0; display: flex; flex-direction: column; }
header.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
header.topbar h1 { font-size: 17px; margin: 0; letter-spacing: -.015em; }
header.topbar .sub { color: var(--muted); font-size: 12.5px; }
.spacer { flex: 1; }
main { width: 100%; max-width: 1480px; margin: 0 auto; padding: 24px 28px 48px; display: grid; gap: 20px; }
section[data-panel] { display: grid; gap: 20px; animation: fade .2s ease; }
section[hidden] { display: none !important; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 24px; margin: 0; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 80ch; }

/* ---- cards ---- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; display: grid; gap: 14px; min-width: 0; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.panel-head .ic.ok { background: var(--ok-bg); color: var(--ok); }
.panel-head .ic.warn { background: var(--warn-bg); color: var(--warn); }
.panel-head .ic.bad { background: var(--bad-bg); color: var(--bad); }
.panel h2 { font-size: 15px; margin: 0; letter-spacing: -.01em; }
.panel h3 { font-size: 11.5px; margin: 6px 0 0; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.panel p.help { margin: 0; color: var(--muted); font-size: 13px; max-width: 95ch; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }

/* ---- buttons ---- */
button.btn, select.btn { display: inline-flex; align-items: center; gap: 7px; font: 500 13px/1 var(--sans); padding: 9px 14px; border-radius: var(--radius-xs); border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .08s, box-shadow .15s, border-color .15s, background .15s; }
select.btn { padding: 8px 12px; }
button.btn:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 2px 8px rgb(79 70 229 / .12); }
button.btn:active:not(:disabled) { transform: translateY(1px); }
button.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--on-accent); box-shadow: 0 4px 14px rgb(79 70 229 / .3); }
button.btn.primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgb(79 70 229 / .4); }
button.btn.danger { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
button.btn.ghost { background: transparent; box-shadow: none; }
button.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: none; box-shadow: var(--ring); }
.divider { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }

/* ---- chips ---- */
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); white-space: nowrap; box-shadow: var(--shadow-sm); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.pill.ok::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.pill.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.pill.warn::before { background: var(--warn); }
.pill.bad { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
.pill.bad::before { background: var(--bad); }
.pill.run { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.pill.run::before { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.badge.ok { color: var(--ok); background: var(--ok-bg); } .badge.warn { color: var(--warn); background: var(--warn-bg); } .badge.fail { color: var(--bad); background: var(--bad-bg); }

/* ---- run controls ---- */
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .6s ease; }
.run-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- stat tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px; display: grid; gap: 4px; box-shadow: var(--shadow); overflow: hidden; }
.tile .top { display: flex; align-items: center; gap: 8px; }
.tile .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile .ic svg.i { width: 15px; height: 15px; }
.tile .k { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.tile .v { font-size: 25px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.tile .s { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tile.bad { border-color: var(--bad-line); } .tile.bad .v { color: var(--bad); } .tile.bad .ic { background: var(--bad-bg); color: var(--bad); }
.tile.warn { border-color: var(--warn-line); } .tile.warn .v { color: var(--warn); } .tile.warn .ic { background: var(--warn-bg); color: var(--warn); }

/* ---- tables ---- */
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { position: sticky; top: 0; background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.st-ok { color: var(--ok); } .st-warn { color: var(--warn); } .st-fail, .st-bad { color: var(--bad); }

/* ---- console ---- */
.logs { max-height: 280px; overflow: auto; font: 12px/1.6 var(--mono); display: grid; gap: 1px; background: var(--console-bg); color: var(--console-fg); border-radius: var(--radius-sm); padding: 12px 14px; border: 1px solid var(--line); }
.logs .muted, .logs span.muted { color: var(--console-muted); }
.logs .error { color: #ff8fa3; } .logs .warn { color: #ffd479; }
.logs:empty::before { content: "Nothing yet."; color: var(--console-muted); }

/* ---- forms ---- */
form.cfg { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 16px; }
form.cfg label { display: grid; gap: 5px; font-size: 13px; align-content: start; }
form.cfg label > span { color: var(--fg); font-weight: 500; font-size: 12.5px; }
form.cfg label > small { color: var(--faint); font-size: 11.5px; line-height: 1.4; }
/* The ? beside a Target setting and the note it opens (app.js HINTS). */
.hint-btn { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 6px; padding: 0; vertical-align: 1px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); color: var(--muted); font: 600 10.5px/1 var(--sans); cursor: pointer; }
.hint-btn:hover, .hint-btn[aria-expanded="true"] { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.hint-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* It floats over the fields below instead of pushing the row apart. */
.hint-pop { position: absolute; z-index: 30; top: 24px; left: 0; right: 0; min-width: 240px;
  font-size: 12px; line-height: 1.5; font-weight: 400; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius-xs); padding: 8px 10px; overflow-wrap: anywhere;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.14); }
form.cfg label, .hint-wrap, form.cfg fieldset { position: relative; }
.hint-pop[hidden] { display: none; }
.hint-pop p { margin: 0 0 6px; }
.hint-pop p:last-child { margin: 0; }
.hint-pop code { font-size: 11.5px; }
.hint-wrap { display: grid; align-content: end; }
/* Organization → environment picker (Target & setup). */
.org-pick { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.3fr) auto auto; gap: 12px 14px; align-items: end; }
.org-pick label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 500; min-width: 0; }
/* Dedicated QA organization, beside the dropdowns: the same box as a checkbox setting in a form. */
.org-pick label.check { display: flex; gap: 10px; align-items: center; padding: 8px 12px; min-height: 38px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--surface-2); white-space: nowrap; }
.org-pick .hint-wrap > .hint-pop { left: auto; right: 0; width: min(320px, 90vw); }
.org-pick-ids { margin: 8px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.org-pick-ids:empty { display: none; }
.org-pick-now { display: flex; gap: 8px; align-items: center; margin: 10px 0 12px; font-size: 13px; }
.org-pick-now .i { flex: none; color: var(--accent); }
@media (max-width: 1100px) { .org-pick { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .org-pick { grid-template-columns: 1fr; } }
.hint-wrap > .hint-pop { top: calc(100% + 4px); }
fieldset > .hint-pop { top: 30px; left: 14px; right: 14px; }
input, select, textarea { font: inherit; }
form.cfg input, form.cfg select, form.cfg textarea, .input { padding: 8px 11px; border-radius: var(--radius-xs); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--fg); width: 100%; transition: border-color .15s, box-shadow .15s, background .15s; }
form.cfg input:hover, form.cfg select:hover, form.cfg textarea:hover, .input:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line-strong)); }
form.cfg input:focus, form.cfg select:focus, form.cfg textarea:focus, .input:focus { background: var(--surface); border-color: var(--accent); box-shadow: var(--ring); outline: none; }
form.cfg textarea { font-family: var(--mono); font-size: 12px; resize: vertical; }
form.cfg input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
form.cfg label.check { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--surface-2); align-self: end; }
form.cfg fieldset { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; background: var(--surface-2); margin: 0; }
form.cfg fieldset legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 6px; }
form.cfg fieldset input { background: var(--surface); }
form.cfg .wide { grid-column: 1 / -1; }
.saved { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--ok); opacity: 0; transition: opacity .3s; }
.saved.show { opacity: 1; }

/* ---- charts ---- */
.chart { position: relative; }
.chart svg:not(.i) { display: block; width: 100%; height: 200px; overflow: visible; }
.chart .legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; margin-bottom: 6px; }
.chart .legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.chart .tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow-lg); white-space: nowrap; display: none; z-index: 2; }
.chart .tip b { font-variant-numeric: tabular-nums; }

/* ---- misc ---- */
pre.json { margin: 0; max-height: 460px; overflow: auto; background: var(--console-bg); color: var(--console-fg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font: 12px/1.5 var(--mono); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.note { display: flex; gap: 10px; border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--fg); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.note[hidden] { display: none; }
#targetGate { margin-bottom: 14px; }
.note.info { border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: var(--accent-soft); }
.steps-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; counter-reset: s; }
.steps-list > div { counter-increment: s; position: relative; padding: 12px 14px 12px 48px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); font-size: 13px; color: var(--muted); }
.steps-list > div::before { content: counter(s); position: absolute; left: 14px; top: 12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--accent); background: var(--accent-soft); }
.steps-list b { color: var(--fg); display: block; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ---- feedback: busy buttons, unavailable buttons, spinner ---- */
.spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: spin .7s linear infinite; flex: none; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
button.btn.loading { position: relative; color: transparent !important; pointer-events: auto; cursor: progress; }
button.btn.loading > * { visibility: hidden; }
button.btn.loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; }
button.btn.primary.loading::after { border-color: rgb(255 255 255 / .35); border-top-color: #fff; }
button.btn.is-disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
button.btn.is-disabled:hover { border-color: var(--line-strong); box-shadow: none; }
button.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
.pill.busy { color: var(--accent-ink); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.pill.busy::before { display: none; }
.pill.busy .spin { width: 12px; height: 12px; }
.pill[hidden] { display: none; }
.note .spin { margin-top: 2px; color: var(--accent); }

/* ---- toasts ---- */
#toasts { position: fixed; top: 16px; right: 16px; z-index: 3500; display: grid; gap: 10px; width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); box-shadow: var(--shadow-lg); font-size: 13px; animation: t-in .22s cubic-bezier(.2, .9, .3, 1.2); }
.toast.out { animation: t-out .2s ease forwards; }
@keyframes t-in { from { opacity: 0; transform: translateX(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes t-out { to { opacity: 0; transform: translateX(24px); } }
.toast .t-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.toast .t-ic svg.i { width: 16px; height: 16px; }
.toast .t-body { flex: 1; min-width: 0; display: grid; gap: 2px; padding-top: 3px; overflow-wrap: anywhere; }
.toast .t-body b { font-size: 13px; }
.toast .t-body span { color: var(--muted); }
.toast .t-x { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 4px; border-radius: 6px; display: grid; place-items: center; }
.toast .t-x:hover { background: var(--surface-3); color: var(--fg); }
.toast.success { border-left-color: var(--ok); } .toast.success .t-ic { background: var(--ok-bg); color: var(--ok); }
.toast.error { border-left-color: var(--bad); } .toast.error .t-ic { background: var(--bad-bg); color: var(--bad); }
.toast.warn { border-left-color: var(--warn); } .toast.warn .t-ic { background: var(--warn-bg); color: var(--warn); }
.toast.progress .t-ic { color: var(--accent); }

/* ---- modal ---- */
.modal-wrap { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 16px; background: rgb(10 13 20 / .45); backdrop-filter: blur(3px); animation: fade .15s ease; }
.modal { width: min(480px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 22px; display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; animation: t-in .2s ease; }
.modal .m-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.modal .m-ic.bad { background: var(--bad-bg); color: var(--bad); }
.modal h3 { margin: 2px 0 6px; font-size: 16px; text-transform: none; letter-spacing: -.01em; color: var(--fg); }
.modal p { margin: 0; color: var(--muted); font-size: 13.5px; }
.modal .m-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ---- small screens: sidebar becomes a top strip ---- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  aside.sidebar { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: 10px 16px; gap: 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .logo small, .sidebar-foot, nav#tabs .group, .side-toggle { display: none; }
  .shell.collapsed { grid-template-columns: 1fr; }
  .shell.collapsed aside.sidebar { padding: 10px 16px; }
  .shell.collapsed .lbl { display: inline; }
  .shell.collapsed .logo-text { display: block; }
  .shell.collapsed .logo { flex-direction: row; gap: 10px; }
  .shell.collapsed nav#tabs button { padding: 9px 10px; }
  nav#tabs { display: flex; gap: 4px; }
  nav#tabs button { white-space: nowrap; }
  nav#tabs button[aria-selected="true"] { box-shadow: inset 0 -2px 0 var(--accent); }
  header.topbar { position: static; padding: 12px 16px; flex-wrap: wrap; }
  header.topbar .spacer { display: none; }
  .pill { white-space: normal; max-width: 100%; }
  .logo b { white-space: nowrap; }
  .xs.compact { min-width: 0; width: 100%; }
  main { padding: 16px 16px 40px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .tile { padding: 12px; } .tile .v { font-size: 20px; } .panel { padding: 16px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.survey-summary{margin:6px 0 10px;line-height:1.5}

/* ---- API tool ---- */
button.btn.sm { padding: 6px 10px; font-size: 12px; gap: 5px; }
button.btn.icon { padding: 7px; justify-content: center; }
.req-line { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.req-line .xs, .req-line > select { flex: none; }
.req-line .input { flex: 1; width: auto; min-width: 220px; font-family: var(--mono); font-size: 12.5px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius-xs); width: max-content; max-width: 100%; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; font: 500 12.5px/1 var(--sans); color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm); }
.seg .count:empty { display: none; }
.seg .count { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.kvrows { display: grid; gap: 6px; }
.kvrow { display: grid; grid-template-columns: 22px minmax(120px, 1fr) minmax(160px, 2fr) 34px; gap: 6px; align-items: center; }
.kvrow.nocheck { grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) 34px; }
.kvrow input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0 auto; }
.kvrow .input { font-family: var(--mono); font-size: 12px; padding: 7px 10px; }
.kvrow.off .input { opacity: .5; }
textarea.code { font-family: var(--mono); font-size: 12px; line-height: 1.5; resize: vertical; min-height: 240px; tab-size: 2; }
.kv dt.var { font-family: var(--mono); font-size: 12px; color: var(--accent); cursor: pointer; }
.kv dt.var:hover { text-decoration: underline; }
.kv dd.mono { font-size: 12px; }
.kv:empty::before { content: "None yet."; color: var(--faint); font-size: 12.5px; }
.hist { display: grid; gap: 4px; max-height: 420px; overflow: auto; }
.hist:empty::before { content: "No requests yet."; color: var(--faint); font-size: 12.5px; }
.hist button { display: grid; grid-template-columns: 58px 1fr auto; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-xs); padding: 7px 10px; cursor: pointer; font: 12px/1.3 var(--mono); color: var(--fg); min-width: 0; }
.hist button:hover { border-color: var(--accent); }
.hist .u { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-GET { color: var(--ok); } .m-POST { color: var(--warn); } .m-PUT, .m-PATCH { color: var(--accent); } .m-DELETE { color: var(--bad); }
td .tests { display: flex; gap: 4px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .kvrow { grid-template-columns: 22px 1fr 34px; }
  .kvrow .v { grid-column: 2; }
  .kvrow.nocheck { grid-template-columns: 1fr 34px; }
  .kvrow.nocheck .v { grid-column: 1; }
  .req-line .input { min-width: 0; flex-basis: 100%; order: 3; }
}
/* API tool: Data from Core and variable pickers */
.seg.lk-kinds { flex-wrap: wrap; width: auto; }
dd.var-val { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
dd.var-val .overridden { text-decoration: line-through; opacity: .6; }
#toolData .tbl { max-height: 460px; overflow: auto; }
#toolData td .tests { flex-wrap: nowrap; }
.panel [hidden] { display: none !important; }
/* API tool: Variables dialog */
.modal-wrap[hidden] { display: none; }
.modal.vars-modal { width: min(760px, 100%); grid-template-columns: 1fr; gap: 12px; max-height: calc(100vh - 32px); overflow: auto; }
.modal.vars-modal h3 { font-size: 11.5px; margin: 6px 0 0; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.modal.vars-modal .help { margin: 0; color: var(--muted); font-size: 13px; }
button.btn .count:empty { display: none; }
button.btn .count { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
/* Variables dialog with Data from Core beside it */
.modal.vars-modal { width: min(1280px, 100%); gap: 14px; }
.vm-head { position: sticky; top: -22px; z-index: 1; background: var(--surface); margin: -22px -22px 0; padding: 18px 22px 12px; border-bottom: 1px solid var(--line); }
.vm-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 22px; align-items: start; }
.vm-col { display: grid; gap: 12px; min-width: 0; align-content: start; }
#toolData { border-left: 1px solid var(--line); padding-left: 22px; scroll-margin-top: 70px; }
#toolData .tbl { max-height: 52vh; }
@media (max-width: 980px) {
  .vm-body { grid-template-columns: 1fr; }
  #toolData { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
}
.req-tabs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Concepts tab */
.doc-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.doc-toc a { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.doc-toc a:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
#docBody { display: grid; gap: 20px; margin-top: 20px; }
.doc-sec { scroll-margin-top: 90px; }
.gloss { display: grid; gap: 0; margin: 4px 0 0; }
.gloss > div { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 6px 18px; padding: 10px 0; border-top: 1px solid var(--line); }
.gloss > div:first-child { border-top: 0; }
.gloss dt { font-weight: 600; font-size: 13px; }
.gloss dd { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.gloss dd b { color: var(--fg); font-weight: 600; }
@media (max-width: 720px) { .gloss > div { grid-template-columns: 1fr; gap: 2px; } #docFilter { width: 100% !important; } }

/* Endpoints page: parameters under the path, the Test column (suite, latest result, Run). */
.ep-table td { vertical-align: top; }
.ep-table .ep-params { font-size: 11.5px; margin-top: 3px; max-width: 34ch; }
.ep-table .ep-note { font-size: 11.5px; margin: 4px 0 0; max-width: 34ch; }
.ep-table td .tests { max-width: 150px; }
.ep-table td.ep-hint { min-width: 170px; max-width: 300px; font-size: 12px; color: var(--muted); }
.ep-table td.ep-hint > div + div { margin-top: 4px; }
.ep-test { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 130px; }
.ep-test .ep-suite { font-weight: 600; font-size: 12.5px; }
.ep-test .ep-state { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.ep-table .ep-path { overflow-wrap: anywhere; max-width: 30ch; }

/* An account that may only look in this environment (account.js applyAccess): a bar says so, settings
   cannot be edited and the main actions are not offered (the server refuses them anyway). */
.view-only-bar { position: sticky; top: 0; z-index: 30; padding: 8px 16px; font-size: 13px; text-align: center;
  color: var(--warn); background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); }
:root[data-access="viewer"] [data-path] { pointer-events: none; opacity: 0.65; }
:root[data-access="viewer"] :is(#btnStart, #btnPause, #btnResume, #btnStop, #btnResumeRun, [data-restart],
  #btnCreateOrg, #btnSurveys, #btnContacts, #btnTaskStop, #btnWebhook, #btnClearSetup, #btnBootstrap, #btnLicense, #btnActivate,
  #btnInvEnable, #btnFull, #btnFullCancel, #btnEpRunAll, [data-add]) { display: none !important; }
/* A shared server (HQS_HOSTED): no screen to show a browser on. */
:root[data-hosted="1"] :is([data-u="record"], [data-u="run-headed"], [data-u="ed-run-headed"], [data-u="ed-record"], [data-u="install"], [data-restart]) { display: none !important; }
