/*
  NathenaX — a workbench, not a landing page.

  Density is the point: a QA engineer is comparing a step list against a live DOM,
  so panels carry their weight with borders and spacing rather than cards and
  shadows. Monospace appears only where the content is literally code: locators,
  selectors, generated specs, variable values.
*/

/*
  `hidden` must mean hidden.

  Every bar in the editor sets its own `display: flex`, which is an author rule
  and so beats the browser's `[hidden] { display: none }` — they tie on
  specificity and the author sheet wins. The result was invisible elements that
  still took up space and still swallowed clicks: a hidden selection bar held a
  39px band over the top of the step list, and the checkboxes underneath it
  could not be clicked at all. Any rule that hides by attribute has to outrank
  the layout rule that shows it, which is what `!important` is actually for.
*/
[hidden] { display: none !important; }

:root {
  --paper: #f1f2ef;
  --panel: #ffffff;
  --ink: #15181b;
  --muted: #5d6670;
  --faint: #878f98;
  --line: #dbdfd8;
  --line-soft: #e8eae5;

  --pass: #1f7a4d;
  --fail: #be3a2e;
  --heal: #a8700f;
  --live: #2f57c9;

  --tint: #eef1fb;
  --sel: #e4e9f9;

  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --rail: 272px;
  --side: 352px;
  --bar: 52px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16181a;
    --panel: #1c1f22;
    --ink: #e7eaec;
    --muted: #99a1aa;
    --faint: #717982;
    --line: #2d3237;
    --line-soft: #24282c;
    --pass: #43b483;
    --fail: #ef6a5e;
    --heal: #d2a43f;
    --live: #6b8ae8;
    --tint: #1f2530;
    --sel: #252d3b;
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); font-size: 12.5px; }

/* --- top bar -------------------------------------------------------------- */

/*
  The top bar.

  It was a fixed-height single row with `flex: none` on the actions, so the
  session controls and the buttons competed for the same pixels and simply drew
  on top of each other — overlapping from 1366px down, which is an ordinary
  laptop. Now it is a minimum height that can grow, every group may shrink, and
  the secondary actions fold into a menu before anything collides.
*/
.bar {
  min-height: var(--bar);
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 6px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: none;
}

/* The NathenaX mark: an N walked twice, solid and dashed. */
.mark {
  width: 19px;
  height: 20px;
  display: block;
  flex: none;
  /* The solid stroke takes the interface's ink colour, so one file serves both
     themes; the dashed stroke keeps the brand blue in either. */
  color: var(--ink);
}
.brand-name { letter-spacing: -0.015em; }
.brand-x { color: #1E90E0; }

.bar-target {
  display: flex;
  align-items: center;
  gap: 8px;
  /* `flex: 1` alone would not shrink below the URL input's intrinsic width,
     which is what pushed the action buttons off the end of the bar. */
  flex: 1 1 220px;
  min-width: 0;
  flex-wrap: wrap;
}

.bar-target #session-label {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

#session-url {
  flex: 1;
  min-width: 120px;
  max-width: 380px;
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  /* Pushed to the right, and allowed to wrap rather than overlap. */
  margin-left: auto;
  flex: 0 1 auto;
  flex-wrap: wrap;
}

/*
  The overflow group.

  One DOM home for the secondary actions, rendered two ways. Wide: the summary
  is hidden and the items are an inline row, so the bar looks as it always did.
  Narrow: the summary becomes a ⋯ button and the items become a dropdown panel.
  Nothing is cloned, so each button keeps its single id and its one handler.
*/
.bar-overflow {
  position: relative;
  display: flex;
  align-items: center;
  /*
    Not shrinkable.

    Allowing it to shrink below its content made the inline row overflow its own
    box — and with the items right-aligned, that overflow went *leftwards*,
    sliding the first button underneath Run. It stayed inside the bar, so it was
    invisible to an edge check and showed up only as an overlap, at every width
    including 2560px. `.bar-actions` wraps instead, which moves the whole group
    to a second line rather than sliding it under its neighbour.
  */
  flex: none;
}
/* Wide: the toggle is unnecessary and the items are simply a row. */
#bar-more { display: none; }
.bar-overflow-items {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--faint); flex: none;
}
.dot[data-state="on"] { background: var(--pass); }
.dot[data-state="rec"] { background: var(--fail); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .dot[data-state="rec"] { animation: none; } }

/* --- controls ------------------------------------------------------------- */

.input, .input-slim, .filter, .title-input, select, input[type="text"], input[type="search"] {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 6px 9px;
}

/*
  Action controls.

  The tool already speaks a status language all day — green passed, red failed,
  amber healed, blue live — so the buttons borrow that vocabulary rather than
  introducing a second one. Run is the green of a passing test; a destructive
  action is the red of a failing one; recording is the amber of something armed.
  An engineer who has learnt the step list has already learnt the toolbar.

  Three rules hold throughout:

    1. A button always has a visible edge. The old controls were a near-panel
       fill on a panel, which is why they disappeared.
    2. Hierarchy is carried by fill, not by size. Primary is filled, secondary
       outlined, destructive outlined until hover — so a delete is never one
       stray click away from looking like the obvious thing to press.
    3. Every state is distinguishable without colour alone: hover lifts the
       surface, active presses it 1px, disabled removes the pointer, selected
       carries an inset bar.
*/
.btn {
  --btn-fg: var(--ink);
  --btn-bg: var(--panel);
  --btn-edge: var(--line);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-edge);
  border-radius: 2px;          /* machined, not a card */

  /* 30px tall: a real target, without the toolbar growing into a banner. */
  padding: 7px 11px;
  min-height: 30px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 90ms linear, border-color 90ms linear, transform 60ms linear;
}

.btn:hover:not([disabled]) {
  --btn-bg: var(--tint);
  --btn-edge: var(--faint);
}
.btn:active:not([disabled]) {
  --btn-bg: var(--sel);
  transform: translateY(1px);
}

/* Primary: the one thing on a toolbar that is filled. */
.btn-primary {
  --btn-fg: #fff;
  --btn-bg: var(--live);
  --btn-edge: var(--live);
  font-weight: 560;
}
.btn-primary:hover:not([disabled]) {
  --btn-bg: var(--live);
  --btn-edge: var(--live);
  filter: brightness(1.1);
}
.btn-primary:active:not([disabled]) { filter: brightness(0.94); }

/* Go: running something. The green of a test that passed. */
.btn-go {
  --btn-fg: #fff;
  --btn-bg: var(--pass);
  --btn-edge: var(--pass);
  font-weight: 560;
}
.btn-go:hover:not([disabled]) {
  --btn-bg: var(--pass);
  --btn-edge: var(--pass);
  filter: brightness(1.1);
}

/* Record: armed, and visibly so. */
.btn-record {
  --btn-fg: var(--heal);
  --btn-edge: var(--heal);
}
.btn-record:hover:not([disabled]) {
  --btn-fg: #fff;
  --btn-bg: var(--heal);
  --btn-edge: var(--heal);
}
.btn-record[aria-pressed="true"] {
  --btn-fg: #fff;
  --btn-bg: var(--fail);
  --btn-edge: var(--fail);
}

/*
  Destructive: outlined until the pointer is on it.

  A filled red button is the most eye-catching thing on a panel, which is the
  opposite of what a delete should be. It states its intent in colour and
  commits to the fill only once the pointer has arrived.
*/
.btn-danger {
  --btn-fg: var(--fail);
  --btn-edge: color-mix(in srgb, var(--fail) 45%, var(--line));
}
.btn-danger:hover:not([disabled]) {
  --btn-fg: #fff;
  --btn-bg: var(--fail);
  --btn-edge: var(--fail);
}

/* Accent: a secondary action worth noticing, such as Paste here. */
.btn-accent {
  --btn-fg: var(--live);
  --btn-edge: color-mix(in srgb, var(--live) 45%, var(--line));
}
.btn-accent:hover:not([disabled]) {
  --btn-fg: #fff;
  --btn-bg: var(--live);
  --btn-edge: var(--live);
}

/* A selected control keeps the inset bar the tabs already use. */
.btn[aria-pressed="true"]:not(.btn-record),
.btn.is-on {
  --btn-bg: var(--sel);
  --btn-edge: var(--live);
  box-shadow: inset 2px 0 0 var(--live);
}

.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  /* Removing the hover entirely, so a disabled control never looks live. */
  --btn-bg: var(--panel);
  --btn-edge: var(--line-soft);
}

.btn-lg { font-size: 14px; padding: 9px 15px; min-height: 36px; }
.btn-small { font-size: 12px; padding: 4px 8px; min-height: 24px; gap: 4px; }
.btn-wide { flex: 1; }

/*
  The icon slot.

  A fixed width, so labels line up down a column of buttons whether or not each
  has an icon — the thing that otherwise makes an icon-and-label toolbar look
  ragged.
*/
.btn-ico {
  flex: none;
  width: 1em;
  text-align: center;
  font-size: 1.04em;
  opacity: 0.9;
}
.btn-primary .btn-ico, .btn-go .btn-ico { opacity: 1; }

/* An icon-only button stays square and keeps its label for screen readers. */
.btn-icon-only { padding: 7px; width: 30px; }
.btn-icon-only.btn-small { padding: 4px; width: 24px; }

/* Toolbar grouping: related actions read as a set, with air between sets. */
.btn-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-right: 10px;
  margin-right: 2px;
  border-right: 1px solid var(--line-soft);
}
.btn-group:last-child { border-right: 0; padding-right: 0; }

.input, .filter, input[type="text"], input[type="search"], select { width: 100%; }
.input-slim { width: auto; font-size: 13px; }

:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: 1px;
}

.icon-btn {
  font: inherit;
  font-size: 12px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 2px 7px;
  cursor: pointer;
}
.icon-btn:hover { color: var(--ink); background: var(--tint); }

/* --- layout --------------------------------------------------------------- */

.panes {
  flex: 1;
  display: grid;
  /* The splitters are grid tracks of their own, so a drag changes a width
     rather than overlaying anything. */
  grid-template-columns: var(--rail) 5px minmax(0, 1fr) 5px var(--side);
  min-height: 0;
}

/*
  Panel splitters.

  Deliberately narrow with a wider invisible hit area: a visible 5px bar reads as
  a divider rather than a control, while being 5px to click is annoying.
*/
.splitter {
  position: relative;
  cursor: col-resize;
  background: var(--line-soft);
  border: 0;
  padding: 0;
  transition: background 90ms linear;
}
.splitter::before {
  content: '';
  position: absolute;
  inset: 0 -4px;          /* the hit area, wider than the bar */
}
.splitter:hover, .splitter:focus-visible { background: var(--live); }
.splitter.is-dragging { background: var(--live); }

/* While dragging, nothing else should take the pointer or select text. */
body.is-resizing { cursor: col-resize; user-select: none; }
body.is-resizing iframe { pointer-events: none; }

.pane {
  min-height: 0;
  overflow-y: auto;
  background: var(--panel);
}
.pane-rail { border-right: 1px solid var(--line); }
.pane-side { border-left: 1px solid var(--line); }
/*
  The canvas does not scroll; the step list inside it does.

  `.pane` gives every pane `overflow-y: auto`, which left this one with two
  nested scrollers. The outer one grew to fit all the steps instead of letting
  the inner one scroll, so on a short window the list began below the fold —
  and `position: sticky` on the actions bar then stuck it to the *canvas*,
  floating it over the step rows and intercepting their clicks. One scroller,
  and the header and bars stay put because they simply never move.
*/
.pane-canvas {
  background: var(--paper);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 6px;
}
.pane-head-sub { border-top: 1px solid var(--line-soft); margin-top: 10px; }
.pane-head h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}
.head-actions { display: flex; gap: 4px; }
.filter { margin: 0 12px 10px; width: calc(100% - 24px); }

/* --- library tree --------------------------------------------------------- */

/*
  The library navigation.

  Readability here is structural, not decorative: a QA engineer scans this list
  dozens of times an hour looking for one test among many. Sections are separated
  by a rule and a label rather than only by whitespace, each kind carries a glyph
  so a flow is distinguishable from a test at a glance, and the selected row is
  marked three ways — fill, a left bar, and weight — so it survives being read
  quickly in either theme.
*/
.tree { padding: 0 0 8px; font-size: 13.5px; }

.tree-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 12px 10px 5px;
  margin-top: 4px;
  border-top: 1px solid var(--line-soft);
  font-weight: 650;
  user-select: none;
}
.tree-group:first-child { border-top: 0; margin-top: 0; }
.tree-group .tree-twisty {
  width: 12px;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.tree-item, .tree-suite {
  display: flex;
  align-items: center;
  gap: 8px;
  /* 30px rows: scannable without the list becoming a scroll marathon. */
  padding: 6px 10px;
  min-height: 30px;
  cursor: pointer;
  border-left: 3px solid transparent;
  color: var(--ink);
}
.tree-item:hover, .tree-suite:hover { background: var(--tint); }

.tree-item.is-on, .tree-suite.is-on {
  background: var(--sel);
  border-left-color: var(--live);
  font-weight: 600;
}
.tree-item.is-on .tree-ico, .tree-suite.is-on .tree-ico { color: var(--live); }

/* The glyph that says what kind of thing a row is. */
.tree-ico {
  flex: none;
  width: 14px;
  text-align: center;
  font-size: 11px;
  color: var(--faint);
}

.tree-item .name, .tree-suite .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-item .count, .tree-suite .count {
  color: var(--faint);
  font-size: 11px;
  font-family: var(--mono);
  flex: none;
}

/* A test inside a suite is indented, with a guide line to its parent. */
.tree-item.is-nested {
  padding-left: 26px;
  position: relative;
}
.tree-item.is-nested::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.tree-item.is-off .name { opacity: 0.5; text-decoration: line-through; }
.tree-item.is-missing .name { color: var(--fail); }

.tree-suite { font-weight: 550; }
.tree-suite .tree-twisty { width: 12px; font-size: 9px; color: var(--muted); }

.tree-add {
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 6px;
  margin-left: auto;
}
.tree-add:hover { color: var(--live); border-color: var(--live); background: var(--tint); }
.tree-note { padding: 0 10px 4px; font-size: 11px; }
.empty-nested { padding-left: 26px; }

.runs { padding: 0 6px 12px; }
.run-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 7px;
  font-size: 12.5px;
  cursor: pointer;
}
.run-row:hover { background: var(--tint); }
.run-row .when { color: var(--faint); margin-left: auto; font-family: var(--mono); font-size: 11px; }

/* --- canvas --------------------------------------------------------------- */

.canvas-head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.title-input {
  border: none;
  background: none;
  padding: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  width: 100%;
}
.title-input:focus-visible { outline-offset: 3px; }

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.meta-row .input-slim { max-width: 220px; }

.chip {
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 1px 7px;
}
.chip.ok { color: var(--pass); border-color: currentColor; }
.chip.bad { color: var(--fail); border-color: currentColor; }

/* `min-height: 0` is what lets a flex child shrink below its content and
   scroll. Without it the list stretches to its full height and pushes the
   bottom of the sequence out of the pane. */
.steps { flex: 1 1 auto; min-height: 0; padding: 10px 20px 24px; overflow-y: auto; }
.canvas-foot { padding: 0 20px 18px; display: flex; }

/* Steps are a numbered sequence because they genuinely are one.
   Blocks are drawn with a guide rail and an explicit END marker: the IR nests,
   so a block can never be left unclosed — the marker is a reading aid, not state. */
.step-row {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 7px 10px 7px 8px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.step-row:hover { background: var(--tint); }
.step-row.is-on { background: var(--sel); }
.step-row.is-skipped { opacity: 0.5; }
.step-row.is-block { font-weight: 550; }
.step-row.has-error { box-shadow: inset 2px 0 0 var(--fail); }
.step-row.has-warning { box-shadow: inset 2px 0 0 var(--heal); }

.step-row .num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  min-width: 22px;
  text-align: right;
  flex: none;
}

.twisty {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  flex: none;
}
.twisty:hover { color: var(--ink); }

.step-row .kind {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0 5px;
  flex: none;
  white-space: nowrap;
}
.step-row[data-kind="if"] .kind,
.step-row[data-kind="for"] .kind,
.step-row[data-kind="forEach"] .kind,
.step-row[data-kind="while"] .kind { color: var(--live); border-color: currentColor; }
.step-row[data-kind="break"] .kind,
.step-row[data-kind="continue"] .kind { color: var(--heal); border-color: currentColor; }
.step-row[data-kind="flow"] .kind { color: var(--heal); border-color: currentColor; }
.step-row[data-kind="assert"] .kind { color: var(--pass); border-color: currentColor; }

.step-row .text { flex: 1; min-width: 0; }
.step-row .text .sub {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.step-problem {
  flex: none;
  font-size: 11px;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  color: #fff;
}
.step-problem.error { background: var(--fail); }
.step-problem.warning { background: var(--heal); }

/* The message the user actually reads sits under the step it belongs to. */
.step-note {
  font-size: 12px;
  padding-top: 4px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.step-note.error { color: var(--fail); }
.step-note.warning { color: var(--heal); }
.step-note .fix { color: var(--muted); }

.step-row .tools { display: flex; gap: 2px; opacity: 0; flex: none; }
.step-row:hover .tools, .step-row.is-on .tools { opacity: 1; }
.branch-head .tools { display: flex; gap: 2px; opacity: 0; margin-left: auto; }
.branch-head:hover .tools { opacity: 1; }
.step-row .tools button, .branch-head .tools button {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 1px 4px;
  font-size: 12px;
}
.step-row .tools button:hover, .branch-head .tools button:hover {
  color: var(--ink);
  background: var(--panel);
}

.step-row .state { width: 7px; height: 7px; border-radius: 50%; flex: none; background: transparent; }
.step-row .state[data-s="passed"] { background: var(--pass); }
.step-row .state[data-s="failed"] { background: var(--fail); }
.step-row .state[data-s="running"] { background: var(--live); }
.step-row .state[data-s="skipped"] { background: var(--faint); }

.block-body { }
.guide {
  border-left: 1px solid var(--line);
  margin-left: 30px;
  padding-left: 2px;
}

.branch-head {
  display: flex;
  align-items: center;
  padding: 6px 10px 5px 30px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}
.branch-key {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--live);
  font-weight: 600;
}
.branch-empty {
  font-size: 12px;
  color: var(--faint);
  margin: 0;
  padding: 5px 0 5px 12px;
  font-style: italic;
}
.branch-add { display: flex; gap: 5px; padding-top: 6px; padding-bottom: 4px; }
.add-here { margin: 4px 0 8px 12px; }

.block-end {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding-top: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  letter-spacing: 0.03em;
}
.block-end.is-collapsed { color: var(--faint); }

.empty { color: var(--faint); font-size: 13px; padding: 20px 4px; margin: 0; }

/* Variables live with the test they belong to, not in a side tab. */
.vars-strip { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.vars-strip > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  list-style: none;
}
.vars-strip > summary::before { content: "▸ "; }
.vars-strip[open] > summary::before { content: "▾ "; }
.vars-strip > summary::-webkit-details-marker { display: none; }
.vars-strip .row { margin-top: 8px; }
.vars-strip .vars { margin-top: 8px; }

/* --- side panel ----------------------------------------------------------- */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}
.tab {
  flex: 1;
  border: none;
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--muted);
  padding: 10px 4px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.is-on { color: var(--ink); border-bottom-color: var(--live); font-weight: 550; }

.tab-body { padding: 14px 12px 28px; }

.field { margin-bottom: 10px; }
.field label {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 3px;
}
.row { display: flex; gap: 6px; margin-bottom: 10px; }
.check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  margin-bottom: 7px;
  cursor: pointer;
}
.check input { margin: 0; }

.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.hint code { background: var(--tint); padding: 1px 4px; }

.result { margin-top: 10px; }
.result .verdict {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
}
.result .verdict.ok { border-color: var(--pass); color: var(--pass); }
.result .verdict.warn { border-color: var(--heal); color: var(--heal); }
.result .verdict.bad { border-color: var(--fail); color: var(--fail); }

.match {
  border: 1px solid var(--line);
  border-top: none;
  padding: 7px 9px;
  font-size: 12.5px;
  cursor: pointer;
}
.match:first-of-type { border-top: 1px solid var(--line); }
.match:hover { background: var(--tint); }
.match .html {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.match .flags { color: var(--faint); font-size: 11px; margin-top: 2px; }

.detail { margin-top: 14px; }
.detail h4 { font-size: 12px; margin: 14px 0 6px; color: var(--muted); }
.detail table { width: 100%; border-collapse: collapse; font-size: 12px; }
.detail td {
  padding: 3px 6px 3px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.detail td:first-child { color: var(--muted); width: 36%; }
.detail td.v { font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; }

.cand {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  margin-bottom: -1px;
  font-family: var(--mono);
  font-size: 11.5px;
}
.cand .rank { color: var(--faint); }
.cand .use {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 11px;
  border: none;
  background: none;
  color: var(--live);
  cursor: pointer;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 6px;
}

.vars { margin-bottom: 12px; }
.var-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.var-row .k { font-family: var(--mono); font-size: 12px; }
.var-row .v {
  flex: 1;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.var-row button { border: none; background: none; color: var(--faint); cursor: pointer; }
.var-row button:hover { color: var(--fail); }

.props .prop { margin-bottom: 11px; }
.props textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  padding: 6px 8px;
  min-height: 72px;
  resize: vertical;
}
.props .target-box {
  border: 1px solid var(--line);
  padding: 8px;
  font-size: 12px;
}
.props .target-box .nm { font-weight: 550; margin-bottom: 4px; }

.run-output {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
}
.run-line { display: flex; gap: 6px; }
.run-line .s { flex: none; width: 10px; }
.run-line.passed .s { color: var(--pass); }
.run-line.failed .s { color: var(--fail); }
.run-line.healed .s { color: var(--heal); }
.run-line .d { color: var(--muted); }
.run-verdict {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 13px;
}
.run-verdict.passed { border-color: var(--pass); color: var(--pass); }
.run-verdict.failed, .run-verdict.broken { border-color: var(--fail); color: var(--fail); }

/* --- dialogs -------------------------------------------------------------- */

.sheet {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 18px;
  width: min(460px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
}
.sheet-wide { width: min(820px, 94vw); }
.sheet::backdrop { background: rgba(10, 12, 14, 0.42); }
.sheet h3 { margin: 0 0 12px; font-size: 15px; }

.step-groups { margin-top: 12px; }
.step-groups h4 {
  font-size: 11px;
  color: var(--faint);
  margin: 12px 0 5px;
  font-weight: 600;
}
.step-opt {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  font: inherit;
  padding: 6px 9px;
  margin-bottom: -1px;
  cursor: pointer;
}
.step-opt:hover { background: var(--tint); }
.step-opt .d { color: var(--muted); font-size: 12px; }

.code {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 12px;
  overflow-x: auto;
  max-height: 52vh;
  margin: 0 0 12px;
  white-space: pre;
}

/* --- narrow screens ------------------------------------------------------- */

/*
  The breakpoint is 860px, not 1100px.

  Three panes side by side are the point of this editor, and at 1100px there is
  room for all three. Collapsing them into a vertical stack that early meant a
  perfectly ordinary 1100–1280px window — a desktop app that is not maximised —
  got the stacked layout, where the canvas was handed about 220px and the step
  list inside it ended up 34px tall with several hundred pixels of steps in it.
  The steps were there; there was simply nowhere to draw them.

  Below 860px stacking is the right call, but the editor is what the window is
  for, so it takes the space that is left and the other two panes are capped.
*/
@media (max-width: 860px) {
  .panes {
    grid-template-columns: minmax(0, 1fr);
    /*
      Three tracks, not five: the splitters below are `display: none`, which
      takes them out of grid flow entirely, so the three panes auto-place into
      rows 1-3. Naming five tracks here put the canvas in a 0px row and handed
      its space to the side panel — the step list came out 24px tall.
    */
    grid-template-rows: auto minmax(200px, 1fr) auto;
  }
  /*
    The editor gets the space; the other two panes get what is left.
    Generous caps here read as fair and are not — the rail and the side panel
    are reference material, and squeezing the step list to 34px to show more of
    them is the wrong trade on a small screen.
  */
  .pane-rail { max-height: 108px; border-right: none; border-bottom: 1px solid var(--line); }
  .pane-side { max-height: 20vh; border-left: none; border-top: 1px solid var(--line); }

  /* The view tabs sit beside the title instead of below it, which is a whole
     row of vertical space on a screen that has none to spare. */
  .canvas-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .canvas-head .title-input { flex: 1 1 160px; width: auto; }
  .canvas-head .view-switch { order: 2; margin: 0; }
  .canvas-head .meta-row { order: 3; flex: 1 1 100%; margin-top: 0; }
  .canvas-head .vars-strip { order: 4; flex: 1 1 100%; }

  /* The canvas header is reference too, once the window is this small. */
  .canvas-head { padding: 9px 14px 8px; }
  .canvas-head .title-input { font-size: 16px; }
  .editor-actions { padding: 6px 0 5px; gap: 5px; }
  /* Tighter buttons keep the action bar on one row instead of two, which is
     another 28px the step list gets to keep. */
  .editor-actions .btn { padding: 4px 8px; font-size: 12px; }
  .editor-actions .btn-add-step { min-width: 104px; }
  .cursor-bar { padding: 4px 8px; margin-bottom: 5px; font-size: 11.5px; }
  .steps { padding: 6px 14px 14px; }
  /* Dragging a vertical divider cannot mean anything in a stacked layout. */
  .splitter { display: none; }
  .bar { padding: 8px 12px; }
  .bar-target { order: 3; width: 100%; }
}

/* --- issues, conditions, recorder ------------------------------------------ */

.badge {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 10.5px;
  line-height: 15px;
  color: #fff;
  font-weight: 600;
}
.badge.bad { background: var(--fail); }
.badge.warn { background: var(--heal); }

.chip.warn { color: var(--heal); border-color: currentColor; }

.issues { display: flex; flex-direction: column; gap: 8px; }

.issue {
  border: 1px solid var(--line);
  border-left-width: 3px;
  padding: 9px 11px;
  cursor: pointer;
  font-size: 13px;
}
.issue:hover { background: var(--tint); }
.issue.error { border-left-color: var(--fail); }
.issue.warning { border-left-color: var(--heal); }

.issue-head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 4px; }
.issue-mark { font-size: 11px; flex: none; }
.issue.error .issue-mark { color: var(--fail); }
.issue.warning .issue-mark { color: var(--heal); }
.issue-where { font-weight: 600; }
.issue-msg { margin-bottom: 3px; }
.issue-fix { color: var(--muted); font-size: 12.5px; }
.issue-path { color: var(--faint); font-size: 11px; margin-top: 5px; }

.inline-problem {
  border: 1px solid var(--line);
  border-left-width: 3px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 12.5px;
}
.inline-problem.error { border-left-color: var(--fail); }
.inline-problem.warning { border-left-color: var(--heal); }
.inline-problem .fix { color: var(--muted); margin-top: 3px; }

.props-title { font-size: 13px; margin: 0 0 10px; }
.prop-label {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin: 8px 0 3px;
}

/* Condition builder: nesting is shown with a bracket, which is what makes the
   parenthesisation legible without writing the parentheses out. */
.cond { display: block; }
.cond-nested {
  border-left: 2px solid var(--line);
  padding-left: 9px;
  margin: 4px 0;
}
.cond-type { margin-bottom: 4px; }
.cond-list { margin: 6px 0; }
.cond-slot { position: relative; padding-right: 20px; }
.cond-remove {
  position: absolute;
  top: 2px;
  right: 0;
  border: none;
  color: var(--faint);
}
.cond-remove:hover { color: var(--fail); background: none; }
.cond-joiner {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--live);
  letter-spacing: 0.06em;
  margin: 6px 0 2px;
}
.cond-controls { margin-top: 6px; gap: 5px; }
.cond-preview {
  margin-top: 8px;
  padding: 7px 9px;
  background: var(--tint);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.branch-edit {
  border: 1px solid var(--line);
  padding: 9px;
  margin-bottom: 8px;
}
.branch-edit.is-focus { border-color: var(--live); }
.branch-edit-head {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

/* Recorder */
.rec-panel { }
.rec-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 4px;
}
.rec-clock { margin-left: auto; color: var(--muted); font-size: 13px; }
.dot[data-state="paused"] { background: var(--heal); }
.rec-controls { margin-top: 12px; flex-wrap: wrap; }

.rec-steps {
  border: 1px solid var(--line);
  margin: 6px 0 10px;
  max-height: 260px;
  overflow-y: auto;
}
.rec-step {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.rec-step:last-child { border-bottom: none; }
.rec-step .num { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.rec-step .kind {
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0 4px;
}
.rec-step .text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-step .sub { color: var(--muted); }

/* Dialog chrome */
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sheet-head h3 { margin: 0; }
.sheet-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.sheet-foot .hint { margin-right: auto; }
.group-note { margin: 0 0 6px; font-size: 11.5px; }

/* --- code view, data binding, AI and admin ---------------------------------- */

.view-switch { display: flex; gap: 0; margin-top: 12px; }
.view-tab {
  border: 1px solid var(--line);
  border-right: none;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 4px 14px;
  cursor: pointer;
}
.view-tab:last-child { border-right: 1px solid var(--line); }
.view-tab.is-on { background: var(--sel); color: var(--ink); font-weight: 550; }

/* Code view: the line numbers are the anchor for the step↔code mapping. */
.code-view { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 12px 20px 20px; }
.code-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.code-bar .grow { flex: 1; }

.code-warning {
  border: 1px solid var(--heal);
  border-left-width: 3px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.code-warning strong { display: block; margin-bottom: 4px; color: var(--heal); }

.code-wrap { flex: 1; min-height: 0; border: 1px solid var(--line); overflow: auto; background: var(--panel); }
.code-lines { margin: 0; padding: 8px 0; }
.code-line { display: flex; gap: 10px; padding: 0 10px; white-space: pre; }
.code-line:hover { background: var(--tint); }
.code-line.is-on { background: var(--sel); box-shadow: inset 2px 0 0 var(--live); }
.code-line .ln {
  color: var(--faint);
  min-width: 30px;
  text-align: right;
  user-select: none;
  flex: none;
}
.code-line .lt { flex: 1; }

.code-editor {
  width: 100%;
  height: 100%;
  min-height: 320px;
  border: none;
  background: var(--panel);
  color: inherit;
  padding: 10px;
  resize: none;
}

.diff-line { padding: 1px 8px; white-space: pre-wrap; font-family: var(--mono); font-size: 12px; }
.diff-line.added { background: color-mix(in srgb, var(--pass) 14%, transparent); color: var(--pass); }
.diff-line.removed { background: color-mix(in srgb, var(--fail) 12%, transparent); color: var(--fail); }

/* Data view */
.data-view { flex: 1; overflow-y: auto; padding: 14px 20px 24px; }
.data-view .row { align-items: flex-end; }
.data-view .grow { flex: 1; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin: 8px 0 12px;
  font-family: var(--mono);
}
.data-table th, .data-table td {
  border: 1px solid var(--line);
  padding: 4px 8px;
  text-align: left;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table th { background: var(--tint); font-weight: 600; }

.data-mapping { margin: 10px 0; }
.map-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.map-col { min-width: 120px; font-size: 12px; }
.map-arrow { color: var(--faint); }
.map-row .input { max-width: 200px; }

/* AI assistant */
.ai-prompt {
  width: 100%;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  padding: 8px;
  resize: vertical;
}
.ai-result { margin-top: 14px; }
.ai-block {
  border: 1px solid var(--line);
  border-left: 3px solid var(--live);
  padding: 9px 11px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
}

/* Administration */
.admin-h { font-size: 12px; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.admin-providers { margin-bottom: 8px; }

.prov-card { border: 1px solid var(--line); padding: 11px 13px; margin-bottom: 8px; }
.prov-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.prov-head .grow { flex: 1; }
.prov-key { font-size: 12px; color: var(--muted); }
.prov-status { font-size: 12.5px; margin-top: 6px; }
.prov-status.ok { color: var(--pass); }
.prov-status.bad { color: var(--fail); }

.admin-add { border: 1px solid var(--line); padding: 11px 13px; margin-bottom: 8px; }
.admin-add > summary { cursor: pointer; font-size: 13px; font-weight: 550; }
.admin-add .row { align-items: flex-end; }
.admin-add .grow { flex: 1; }

.agent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
}
.agent-row .check { margin: 0; min-width: 200px; }
.agent-desc { flex: 1; font-size: 12px; }

/* --- projects, accounts, suite execution ----------------------------------- */

#project-switch { max-width: 170px; flex: none; }
#user-chip { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

/* Execution dashboard */
.exec-progress { margin: 14px 0; }
.exec-counts { display: flex; gap: 12px; font-size: 12.5px; margin-bottom: 8px; flex-wrap: wrap; }
.exec-counts .count { color: var(--muted); }
.exec-counts b { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.exec-counts .pass b { color: var(--pass); }
.exec-counts .fail b { color: var(--fail); }
.exec-counts .run b { color: var(--live); }

.exec-bar { height: 4px; background: var(--line); margin-bottom: 14px; }
.exec-bar-fill { height: 100%; width: 0; background: var(--live); transition: width 200ms linear; }
@media (prefers-reduced-motion: reduce) { .exec-bar-fill { transition: none; } }

.exec-workers { margin-bottom: 10px; }
.worker {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.worker-id { font-family: var(--mono); font-size: 11.5px; min-width: 62px; color: var(--muted); }
.worker-browser {
  font-size: 10.5px;
  border: 1px solid var(--line);
  padding: 0 5px;
  color: var(--muted);
}
.worker-current { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worker-running .worker-current { color: var(--live); }

.exec-results { max-height: 260px; overflow-y: auto; font-size: 12.5px; }
.exec-result {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line-soft);
}
.exec-result .s { width: 12px; flex: none; font-family: var(--mono); }
.exec-result.passed .s { color: var(--pass); }
.exec-result.failed .s, .exec-result.broken .s { color: var(--fail); }
.exec-result.retry { color: var(--heal); }
.exec-result .text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exec-result .browser {
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0 4px;
}

.exec-failure {
  padding: 5px 0;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line-soft);
}

.exec-queue { margin-top: 6px; }
.queue-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.queue-row .num { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.queue-row .text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-state { font-size: 11px; padding: 0 6px; border: 1px solid var(--line); }
.queue-state.running { color: var(--live); border-color: currentColor; }
.queue-state.queued { color: var(--muted); }

.role-row {
  border: 1px solid var(--line);
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 13px;
}
.role-row .hint { margin-top: 4px; font-size: 11px; overflow-wrap: anywhere; }
.admin-users, .admin-envs, .admin-secrets { margin-bottom: 8px; }

/* --- recording setup, data grid, scripts, error recovery -------------------- */

.rec-setup {
  border: 1px solid var(--line);
  padding: 11px;
  margin-bottom: 12px;
}
.rec-setup .field { margin-bottom: 8px; }
.rec-setup .row { align-items: center; gap: 12px; }

/* The NathenaX Agent: a browser on the user's own computer. */
.agent-card {
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 0 10px;
  margin: 4px 0 10px;
}
.agent-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.agent-card .hint { margin: 4px 0 8px; }
.agent-actions { gap: 8px; flex-wrap: wrap; }
.agent-actions a.btn { text-decoration: none; }
.agent-code { margin-top: 8px; }
.agent-code .row { gap: 6px; }
.agent-code .input { flex: 1; min-width: 0; font-size: 12px; }

/* An editable spreadsheet over the stored JSON. */
.data-grid-wrap { margin: 12px 0; }
.data-grid-actions { align-items: center; }
.data-grid-actions .hint { margin-left: auto; }
.data-grid-scroll { overflow: auto; max-height: 340px; border: 1px solid var(--line); }

.data-grid { border-collapse: collapse; width: 100%; }
.data-grid th, .data-grid td {
  border: 1px solid var(--line);
  padding: 0;
  min-width: 110px;
}
.data-grid th { background: var(--tint); position: sticky; top: 0; z-index: 1; }

.grid-head-input, .grid-cell {
  width: 100%;
  border: none;
  background: none;
  color: inherit;
  padding: 5px 7px;
  font: inherit;
  font-size: 12.5px;
}
.grid-head-input { font-family: var(--mono); font-weight: 600; }
.grid-cell { font-family: var(--mono); }
.grid-cell:focus, .grid-head-input:focus { outline: 2px solid var(--live); outline-offset: -2px; }

.grid-x {
  border: none;
  background: none;
  color: var(--faint);
  cursor: pointer;
  padding: 0 5px;
}
.grid-x:hover { color: var(--fail); }
.data-grid .grid-rownum { min-width: 28px; width: 28px; text-align: center; }

/* JavaScript library */
.script-list { margin-bottom: 12px; }
.script-row {
  border: 1px solid var(--line);
  padding: 9px 11px;
  margin-bottom: 7px;
}
.script-sig { font-size: 12.5px; overflow-wrap: anywhere; }
.param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line-soft);
}
#script-code {
  width: 100%;
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  padding: 7px;
  resize: vertical;
}

/* Notifications: a stack, each owning one operation and its own dismiss. */
.notifications {
  position: fixed;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  width: min(620px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  pointer-events: none;   /* the gaps between notes stay click-through */
}
.note {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 3px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 28%);
}
.note-error   { border-left-color: var(--fail); }
.note-warning { border-left-color: var(--warn, #c98a2b); }
.note-success { border-left-color: var(--pass); }
.note-info    { border-left-color: var(--accent); }

.note-icon {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--bg);
}
.note-error   .note-icon { background: var(--fail); }
.note-warning .note-icon { background: var(--warn, #c98a2b); }
.note-success .note-icon { background: var(--pass); }
.note-info    .note-icon { background: var(--accent); }

.note-body { flex: 1; font-size: 13px; min-width: 0; }
.note-title { display: block; margin-bottom: 2px; }
.note-error .note-title { color: var(--fail); }
.note-detail {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;   /* a long endpoint or stack frame must not overflow */
}
.note-actions { display: flex; gap: 6px; flex: none; align-items: center; }
.btn-small { padding: 3px 8px; font-size: 12px; }
.note-close {
  flex: none;
  align-self: flex-start;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
}
.note-close:hover { color: var(--fg); }

/* Applications in the admin dialog */
.admin-apps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.app-card {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px; background: var(--panel-2);
}
.app-card-head { display: flex; align-items: baseline; gap: 10px; }
.app-envs { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 8px; }
.admin-add { margin-bottom: 14px; }
.admin-add > summary { cursor: pointer; color: var(--accent); padding: 4px 0; }

/* --- selection and bulk editing ------------------------------------------- */

.selection-bar {
  flex: none;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 7px 10px; margin-bottom: 8px;
  background: var(--panel-2); border: 1px solid var(--accent);
  border-left-width: 3px;
}
.sel-count { font-size: 12px; color: var(--accent); margin-right: 4px; }
.btn-danger { border-color: var(--fail); color: var(--fail); }
.btn-danger:hover { background: var(--fail); color: var(--bg); }

/*
  A checkbox is the one control in a step row that gets clicked repeatedly, and
  at its native 13px it is the smallest target in the whole editor. Scaled up
  and given negative margins, so the clickable area grows without changing the
  row's layout or alignment.
*/
.step-pick {
  flex: none;
  cursor: pointer;
  width: 16px;
  height: 16px;
  margin: -3px 4px -3px -3px;
  padding: 6px;
  box-sizing: content-box;
  accent-color: var(--accent);
}
.step-row.is-picked { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.step-row.is-skipped { opacity: 0.55; }
.step-off {
  flex: none; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); border: 1px solid var(--line); padding: 1px 5px;
}

/* --- context menu --------------------------------------------------------- */

.step-menu {
  position: fixed; z-index: 70; min-width: 190px;
  background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgb(0 0 0 / 35%); padding: 4px;
}
.menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; color: var(--fg);
  padding: 6px 10px; font-size: 13px; cursor: pointer;
}
.menu-item:hover:not(:disabled) { background: var(--panel-2); }
.menu-item:disabled { color: var(--muted); cursor: default; }
.menu-item.danger { color: var(--fail); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* --- the Add Step menu ---------------------------------------------------- */

.picker-body { display: flex; gap: 12px; min-height: 280px; }
.picker-cats {
  flex: none; width: 160px; display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--line); padding-right: 8px;
}
.picker-cat {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: none; border: 0; color: var(--fg);
  padding: 7px 8px; font-size: 13px; text-align: left; cursor: pointer;
}
.picker-cat:hover { background: var(--panel-2); }
.picker-cat.is-on { background: var(--panel-2); color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.picker-count { color: var(--muted); font-size: 11px; }
.step-groups { flex: 1; overflow-y: auto; max-height: 52vh; }

/* --- suites --------------------------------------------------------------- */

.tree-suite {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; cursor: pointer; font-size: 13px;
}
.tree-suite:hover { background: var(--panel-2); }
.tree-suite.is-on { background: var(--panel-2); color: var(--accent); }
.tree-item.is-nested { padding-left: 26px; }
.tree-item.is-off .name { opacity: 0.55; text-decoration: line-through; }
.tree-item.is-missing .name { color: var(--fail); }
.tree-add {
  background: none; border: 0; color: var(--muted);
  cursor: pointer; font-size: 14px; padding: 0 4px; margin-left: auto;
}
.tree-add:hover { color: var(--accent); }
.tree-note { padding: 0 8px 4px; font-size: 11px; }
.empty-nested { padding-left: 26px; }

.suite-panel { display: flex; flex-direction: column; gap: 10px; }
.suite-members { display: flex; flex-direction: column; gap: 3px; }
.suite-member {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; background: var(--panel-2); border: 1px solid transparent;
  font-size: 13px;
}
.suite-member .grip { cursor: grab; color: var(--muted); font-size: 11px; }
.suite-member.is-dragging { opacity: 0.4; }
.suite-member.is-drop { border-color: var(--accent); }
.suite-member.is-off { opacity: 0.6; }
.suite-member.is-missing { border-color: var(--fail); }

.chip-bad { border-color: var(--fail); color: var(--fail); }
.ref-warning ul { margin: 6px 0 6px 18px; }
.confirm-body { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.sheet-narrow { width: min(520px, 94vw); }

/* --- runs ----------------------------------------------------------------- */

.runs-table-wrap { overflow-x: auto; }
.runs-table { width: 100%; font-size: 12px; }
.runs-table th { text-align: left; white-space: nowrap; }
.run-tr:hover { background: var(--panel-2); }
.run-status { white-space: nowrap; }
.run-status.s-passed { color: var(--pass); }
.run-status.s-failed { color: var(--fail); }
.run-status.s-error, .run-status.s-timeout, .run-status.s-aborted { color: var(--warn, #c98a2b); }
.run-status.s-running, .run-status.s-starting { color: var(--accent); }
.run-status.s-cancelled, .run-status.s-queued { color: var(--muted); }
.row-actions { display: flex; gap: 4px; white-space: nowrap; }

.exec-result.stopped { color: var(--warn, #c98a2b); }

/* --- AI step generation --------------------------------------------------- */

.ai-preview { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.ai-step-list { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.ai-step-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 8px; background: var(--panel-2); font-size: 13px;
}
.browser-matrix { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }

/* --- the insertion cursor ------------------------------------------------- */

/*
  The cursor is drawn as a line in the step list, not implied by a selection.
  It answers one question — "where will the next step go?" — so it says so in
  words rather than relying on the user to read a thin rule correctly.
*/
.cursor-bar {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; margin-bottom: 8px;
  background: var(--tint);
  border: 1px solid color-mix(in srgb, var(--live) 40%, var(--line));
  border-left-width: 3px;
  border-radius: 2px;
  font-size: 12px;
}
.cursor-caret { color: var(--live); font-size: 11px; }
.cursor-where { color: var(--ink); }

.insert-cursor {
  display: flex; align-items: center; gap: 7px;
  padding: 2px 8px; margin: 1px 0;
  color: var(--live);
  font-size: 11px;
  border-top: 2px solid var(--live);
  background: linear-gradient(
    to bottom, color-mix(in srgb, var(--live) 16%, transparent), transparent 70%);
}
.insert-caret { font-size: 10px; }
.insert-label { letter-spacing: 0.02em; }

/* The link-style button used for small inline refreshes. */
.link-btn {
  background: none; border: 0; padding: 0 0 0 6px;
  color: var(--live); font: inherit; font-size: 11px;
  cursor: pointer; text-decoration: underline;
}
.link-btn:hover { filter: brightness(1.15); }

.exec-picklist {
  display: flex; flex-direction: column; gap: 3px;
  max-height: 190px; overflow-y: auto;
  padding: 7px 9px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 2px;
}

/* Declared variables. */
.var-defs { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.var-def {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 2px; font-size: 12px;
}
.var-def.is-required { border-left: 3px solid var(--live); }
.var-name { font-family: var(--mono); min-width: 110px; }
.var-type { color: var(--muted); min-width: 60px; }
.var-default { color: var(--muted); flex: 1; font-family: var(--mono); overflow-wrap: anywhere; }

/* --- the editor's own action row ------------------------------------------ */

/*
  Add Step stays reachable however long the step list is — but by sitting
  outside the scrolling list, not by floating over it. It was `position:
  sticky`, which in a canvas that scrolled made it hover above the step rows
  and quietly eat clicks aimed at the first few checkboxes. Now the list is the
  only thing that scrolls, so this bar is always visible without overlapping
  anything.
*/
.editor-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0 8px;
  margin-bottom: 2px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
}
.btn-add-step { min-width: 140px; }

/* --- the variable picker -------------------------------------------------- */

.var-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 52vh;
  overflow-y: auto;
  margin-top: 8px;
}
.var-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 8px 4px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  border-top: 1px solid var(--line-soft);
}
.var-group:first-child { border-top: 0; }
.var-group-name { font-weight: 650; }
.var-group .hint { text-transform: none; letter-spacing: 0; }

.var-row-pick {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  color: inherit;
  font: inherit;
  padding: 7px 8px;
  cursor: pointer;
}
.var-row-pick:hover { background: var(--tint); border-color: var(--live); }
.var-ref { flex: none; min-width: 170px; color: var(--live); }
.var-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12px; }

.var-pick-btn { flex: none; }
.row-tight { display: flex; align-items: center; gap: 6px; }
.row-tight > .input { flex: 1; min-width: 0; }

/* --- reusable flow parameters --------------------------------------------- */

.flow-params { margin-top: 10px; }
.flow-param {
  padding: 8px 0 10px;
  border-top: 1px solid var(--line-soft);
}
.flow-param.is-required { border-left: 3px solid var(--live); padding-left: 9px; }
.flow-param-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  margin-bottom: 5px;
}

/* --- POM: the Page Object Model -------------------------------------------- */

.pages-list { margin-top: 12px; }
.page-group { border: 1px solid var(--line); margin-bottom: 8px; }
.page-group > summary {
  cursor: pointer;
  padding: 7px 9px;
  background: var(--panel-2);
  list-style: none;
}
.page-group > summary::-webkit-details-marker { display: none; }
.page-group > summary .row { margin: 0; }

/* An element is a name and the selector it stands for, side by side: the
   selector is what a user comes here to check or correct. */
.element-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.element-row:hover { background: var(--tint); }
.element-row .mono { font-size: 11.5px; overflow-wrap: anywhere; }

/* A step that borrows a shared element says so, so it is clear the selector is
   not edited here. */
.target-box .nm .chip { margin-right: 4px; }
.hint.bad { color: var(--fail); }

/* --- retained execution history --------------------------------------------- */

.filter-bar { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.filter-bar .input-slim { flex: 1 1 0; min-width: 0; }

.history-list { display: flex; flex-direction: column; }
.history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.history-row:hover { background: var(--tint); }
.history-row .nm { display: block; }
.history-row .sub { display: block; font-size: 11.5px; color: var(--muted); }
.history-row .when { font-size: 11px; color: var(--faint); flex: none; }

/* Status reads as a word, not only as a colour. */
.pill {
  flex: none;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border: 1px solid currentColor;
}
.pill.is-passed { color: var(--pass); }
.pill.is-failed { color: var(--fail); }
.pill.is-broken, .pill.is-error { color: var(--heal); }
.pill.is-skipped, .pill.is-cancelled { color: var(--faint); }

/* `.sheet-wide` is already defined above; the history sheet reuses it. */
.history-detail { max-height: 62vh; overflow-y: auto; }
.case-group { border: 1px solid var(--line); margin-bottom: 6px; }
.case-group > summary { cursor: pointer; padding: 6px 9px; background: var(--panel-2); }
.step-results { padding: 6px 9px; }

.shot-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.shot { display: block; max-width: 180px; text-decoration: none; color: inherit; }
.shot img {
  display: block;
  width: 180px;
  height: auto;
  border: 1px solid var(--line);
  background: var(--panel);
}
.log-view {
  max-height: 240px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: pre-wrap;
}
.hint.ok { color: var(--pass); }
.req { color: var(--fail); }

/* --- the toolbar at narrower widths ----------------------------------------- */

/*
  Below 1500px the secondary actions collapse into the ⋯ menu.
  
  The threshold comes from measurement rather than convention: with everything
  inline, the bar needs a second row at 1366px — which is legible, but 127px of
  toolbar on a laptop is a poor trade for buttons that are one click away in a
  menu. Above this width the full row fits on one line.
*/
@media (max-width: 1500px) {
  #bar-more { display: inline-flex; }

  .bar-overflow-items {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 40;
    flex-direction: column;
    align-items: stretch;
    min-width: 170px;
    padding: 6px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 6px 20px rgb(0 0 0 / 0.14);
  }
  /* Closed by default; the toggle sets data-open. */
  .bar-overflow[data-open="false"] .bar-overflow-items { display: none; }
  .bar-overflow-items .btn { justify-content: flex-start; width: 100%; }
}

/* The session URL gives up width first — it is the longest field and the least
   damaged by being short. */
@media (max-width: 1180px) {
  #session-url { flex: 1 1 120px; min-width: 90px; }
}

/*
  Tighter: the labels on the primary buttons go, the icons stay, and the brand
  name with them. The buttons remain full-size targets, which is what matters
  for pressing them.

  The threshold is 980px rather than 760px because of what the bar costs the rest
  of the window: below about a thousand pixels the session controls wrap and the
  bar grows to two rows, and that height comes straight out of the step list —
  which at 820px left it 41px tall. A one-row bar is worth more than two words
  of label.
*/
@media (max-width: 980px) {
  .bar { gap: 6px 10px; padding: 6px 10px; }
  .bar-actions .btn-label { display: none; }
  .brand-name { display: none; }
}

/* Administration: users and role permissions */
.user-row { flex-wrap: wrap; gap: 8px; }
.user-row .user-name { min-width: 160px; display: inline-flex; gap: 6px; align-items: center; }
.user-row .user-email { flex: 1; min-width: 160px; }
.chip-off { color: var(--fail); }
.role-edit { margin-top: 6px; }
.role-edit > summary { cursor: pointer; color: var(--live); font-size: 12px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 16px; margin: 8px 0 10px; }
.perm-group-name { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.perm-group .check { display: flex; gap: 6px; align-items: center; font-size: 12px; margin: 2px 0; }

/* Save, at the foot of the step properties panel */
.props-save {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 16px; padding: 10px 0;
  background: var(--panel); border-top: 1px solid var(--line);
}

/* Applications: environments edited in place */
.app-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.app-env-table { display: grid; gap: 6px; margin: 4px 0 8px; }
.app-env-row { display: grid; grid-template-columns: minmax(90px, 0.7fr) 1.4fr 1.4fr auto; gap: 6px; align-items: center; }
.app-env-row .input { min-width: 0; font-size: 12px; padding: 5px 7px; }
.app-env-head span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.app-env-row.is-new .input { border-style: dashed; }
.run-target { border-bottom: 1px solid var(--line-soft); margin-bottom: 12px; padding-bottom: 4px; }
.run-target .props-save { position: static; }

/* Recording round 2: where a step runs, playing steps, pause/resume */
.step-where { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: baseline; }
.where-badge {
  font-size: 10px;
  line-height: 1.5;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  white-space: nowrap;
}
.where-dialog, .where-opens { color: var(--live); }
.step-row .state[data-s="broken"] { background: var(--fail); }
.rec-step { align-items: center; }
.rec-step .state { width: 7px; height: 7px; border-radius: 50%; flex: none; background: transparent; }
.rec-step .state[data-s="passed"] { background: var(--pass); }
.rec-step .state[data-s="failed"], .rec-step .state[data-s="broken"] { background: var(--fail); }
.rec-step .state[data-s="running"] { background: var(--live); }
.rec-step .icon-btn { flex: none; padding: 0 4px; }
.props-where { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.props-where .field { display: grid; gap: 3px; margin-bottom: 8px; font-size: 12px; }
#rec-pause .btn-ico, #rec-resume .btn-ico { font-size: 10px; }
.inspect-wait { display: grid; gap: 3px; margin: 4px 0 8px; font-size: 12px; }
.inspect-wait .input { max-width: 120px; }
.run-note { font-size: 12px; padding: 4px 0; }
.run-note.ok { color: var(--pass); }
.run-note.warn { color: var(--warn, #9a6a00); }
.run-report-link { display: inline-block; margin-top: 8px; text-decoration: none; }
.faker-mode { display: grid; gap: 4px; margin: 4px 0 10px; font-size: 12.5px; }
.faker-list .faker-item { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; }
.faker-pick-btn { white-space: nowrap; }
