/* ============================================================
   SCML Editor — modern UI theme
   A small design system (tokens → components), light + dark.
   Functional class/id hooks used by editor.js are preserved.
   ============================================================ */

/* The reset and the `[hidden]` override now come from common/shell.css. */

:root {
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", Menlo, monospace;

  /* Brand + semantic. Two accents: `--accent` for fills (white text passes AA on it) and
     `--accent-strong` for coloured text on light/tinted backgrounds (>= 4.5:1). Colour is never
     the only signal — text labels and icons carry the meaning too. */
  --accent: #0a6b3b;          /* shared brand accent (matches reader + template-editor) */
  --accent-hover: #08592f;
  --accent-strong: #0a6b3b;   /* text on white / soft */
  --on-accent: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 13%, var(--surface));
  --accent-ring: color-mix(in srgb, var(--accent) 55%, transparent);

  --danger: #c81e1e;
  --danger-strong: #991b1b;
  --danger-soft: color-mix(in srgb, var(--danger) 12%, var(--surface));
  --warn: #b45309;
  --warn-strong: #8a4708;
  --warn-soft: color-mix(in srgb, var(--warn) 16%, var(--surface));

  /* neutrals (all text tokens >= 4.5:1 on their background) */
  --bg: #eceff3;
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --header: color-mix(in srgb, var(--surface) 82%, var(--bg));
  --border: #dfe4ea;
  --border-strong: #c2cad4;
  --ink: #0f172a;
  --muted: #475569;
  --faint: #5c6675;

  --r-xs: 5px;
  --r-sm: 7px;
  --r: 10px;
  --r-lg: 14px;
  --r-full: 999px;

  --shadow-1: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-2: 0 6px 20px rgba(15, 23, 42, .10);
  --shadow-pop: 0 18px 56px rgba(15, 23, 42, .24);
  --ring: 0 0 0 3px var(--accent-ring);

  /* Canonical token bridge: the editor keeps its own, richer vocabulary (--ink / --faint / --r / …),
     but common/tokens.css + common/shell.css speak the shared names. Map the shared names onto this
     palette so the shared shell (header, buttons, small controls) renders in the editor's colours.
     These late-bind, so they follow the light/dark value of the token they reference automatically. */
  --text: var(--ink);
  --text-dim: var(--muted);
  --accent-ink: var(--on-accent);
  --radius: var(--r);
  --radius-sm: var(--r-sm);
  --muted-bg: var(--surface-2);
  --ok: var(--accent-strong);
  --ok-bg: var(--accent-soft);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #4ec38a;          /* shared brand accent (matches reader + template-editor) */
    --accent-hover: #6bd3a0;
    --accent-strong: #8fe3b8;   /* text on dark surfaces */
    --on-accent: #05130d;
    --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
    --accent-ring: color-mix(in srgb, var(--accent) 65%, transparent);
    --danger: #f87171;
    --danger-strong: #fca5a5;
    --danger-soft: color-mix(in srgb, var(--danger) 20%, var(--surface));
    --warn: #fbbf24;
    --warn-strong: #fcd34d;
    --warn-soft: color-mix(in srgb, var(--warn) 20%, var(--surface));
    --bg: #0a0e13;
    --surface: #121922;
    --surface-2: #0e141c;
    --header: #10161e;
    --border: #263140;
    --border-strong: #3a4757;
    --ink: #e7edf4;
    --muted: #aab6c4;
    --faint: #8b97a5;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, .55);
    --shadow-pop: 0 24px 64px rgba(0, 0, 0, .65);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #4ec38a;
  --accent-hover: #6bd3a0;
  --accent-strong: #8fe3b8;
  --on-accent: #05130d;
  --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --accent-ring: color-mix(in srgb, var(--accent) 65%, transparent);
  --danger: #f87171;
  --danger-strong: #fca5a5;
  --danger-soft: color-mix(in srgb, var(--danger) 20%, var(--surface));
  --warn: #fbbf24;
  --warn-strong: #fcd34d;
  --warn-soft: color-mix(in srgb, var(--warn) 20%, var(--surface));
  --bg: #0a0e13;
  --surface: #121922;
  --surface-2: #0e141c;
  --header: #10161e;
  --border: #263140;
  --border-strong: #3a4757;
  --ink: #e7edf4;
  --muted: #aab6c4;
  --faint: #8b97a5;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .55);
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, .65);
}

html, body { height: 100%; }
body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}

/* Skip link: off-screen until focused, then pinned top-left so keyboard users can jump past the header. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: .4rem .7rem;
  background: var(--accent-strong, #2b6);
  color: #fff;
  border-radius: 0 0 var(--r-sm) 0;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-xs); }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-size: .82rem;
  font-weight: 500;
  line-height: 1;
  padding: .5rem .8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease, transform .04s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--ring); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { font-size: .78rem; padding: .38rem .6rem; }
.btn-icon { padding: .45rem .55rem; }

/* ---------- Header ---------- */
header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 1rem;
  background: var(--header);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(6px);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--r);
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #1173d4));
  color: #fff;
  box-shadow: var(--shadow-1);
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text h1 { font-size: 1rem; margin: 0; letter-spacing: -.01em; }
.brand-text .sub { color: var(--muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status {
  margin-left: auto;
  font-size: .78rem;
  font-weight: 600;
  padding: .35rem .75rem;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.status.ok { color: var(--accent-strong); background: var(--accent-soft); border-color: transparent; }
.status.bad { color: var(--danger-strong); background: var(--danger-soft); border-color: transparent; }
/* Non-colour cue: a glyph so state is legible without relying on hue (colour-blind / low-vision). */
.status.ok::before { content: "\2713\00a0"; font-weight: 700; }
.status.bad::before { content: "\26a0\00a0"; font-weight: 700; }

.profile-picker {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--faint);
}
.profile-picker select {
  text-transform: none; font-weight: 500; letter-spacing: normal;
  padding: .28rem 1.4rem .28rem .5rem;
}

.lang-select {
  padding: .3rem .5rem; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font-size: .85rem;
}
.file-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.fa-group { display: flex; gap: .35rem; align-items: center; padding: .2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); }
/* The Security panel (signing + encryption controls, docked): stacked groups with a little breathing room. */
.security-body { padding: .6rem .7rem; display: flex; flex-direction: column; gap: .5rem; overflow: auto; }
/* The Settings panel (profile + output/projection controls, docked): stacked rows of labelled controls. */
.settings-body { padding: .6rem .7rem; display: flex; flex-direction: column; gap: .55rem; overflow: auto; font-size: .85rem; }
.settings-row { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; }
.settings-row > label { display: inline-flex; gap: .35rem; align-items: center; }
.settings-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.security-body .fa-group { flex-wrap: wrap; }
.security-body .menu-group-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-top: .2rem; }
.fa-group .btn { border-color: transparent; background: transparent; }
.fa-group .btn:hover { background: var(--surface); border-color: var(--border-strong); }
.fa-group .btn-primary { background: var(--accent); border-color: var(--accent); }
.fa-group .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.key-status { font-size: .68rem; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; padding-left: .35rem; }
.key-status.ready { color: var(--accent-strong); font-weight: 700; }
.theme-toggle-wrap { display: inline-flex; }
#theme-toggle .theme-light { display: none; }
#theme-toggle .theme-dark { display: inline; }
:root[data-theme="dark"] #theme-toggle .theme-light { display: inline; }
:root[data-theme="dark"] #theme-toggle .theme-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #theme-toggle .theme-light { display: inline; }
  :root:not([data-theme="light"]) #theme-toggle .theme-dark { display: none; }
}

/* ---------- Toolbar (the palette ribbon: tabs row + item row; styled in common/shell.css) ---------- */
/* The structure ribbon lives inside the Document panel (below its label), not the global app chrome, so it
   moves and hides with that window. */
#toolbar {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
/* The profile selector sits to the left of the ribbon on one row (top-aligned so it stays on the tab row
   when the ribbon wraps). */
.doc-ribbon { flex: 0 0 auto; display: flex; align-items: flex-start; background: var(--surface); border-bottom: 1px solid var(--border); padding-left: 1rem; }
.doc-ribbon > .doc-profile { flex: 0 0 auto; display: flex; align-items: center; padding-top: var(--space-2); }
.doc-ribbon > #toolbar { flex: 1 1 auto; min-width: 0; border-bottom: none; padding-left: var(--space-3, .6rem); }

/* ---------- Panes ---------- */
main {
  flex: 1;
  display: flex;
  min-height: 0;
}
/* The work area is a split tree built at runtime from a preset (common/layout.js): nested flex boxes
   (.split) with a draggable gutter between the two children of each split, and a .zone leaf holding one
   movable panel. A grip drags a panel to another zone (swap); the Panels menu toggles panels; the
   Layout menu switches presets. Preset, placement and sizes persist. */
#layout-root { flex: 1; display: flex; min-width: 0; min-height: 0; }
/* Bottom status bar: the app status tag (left) and a clickable validation flag (right) that opens the
   Validation panel. */
/* Style editor follows the app Channel: its Target select is hidden; a note shows for a channel that has
   no styling (e.g. fingerspelling), and the gallery is hidden then. */
.se-target-wrap[hidden], .se-nostyle[hidden], #se-gallery[hidden] { display: none; }
.se-nostyle { font-size: .8rem; color: var(--muted, #777); font-style: italic; }

/* Header channel field + the "Options" popover (Locale, Zone, and the preview toggles). */
.hdr-field { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted, #666); }
.hdr-field > select { font-size: .8rem; }
.opts-panel { min-width: 16rem; max-width: 24rem; padding: .5rem .6rem; display: flex; flex-direction: column; gap: .55rem; }
.opts-panel .opts-row { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.opts-panel label { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; }
.opts-panel .opts-row:empty { display: none; }
/* The quick tour sits at the bottom of the options panel, set off by a divider — a low-key entry point,
   not a standing toolbar button (it is mostly a first-run affordance). */
.opts-panel .opts-row-tour { border-top: 1px solid var(--border); padding-top: .5rem; margin-top: .1rem; }

.statusbar { flex: 0 0 auto; display: flex; align-items: center; gap: .6rem; padding: .2rem .8rem; min-height: 1.7rem;
  border-top: 1px solid var(--border, #ddd); background: var(--surface, #fff); }
.statusbar-spacer { flex: 1 1 auto; }
.statusbar-flag { font: inherit; font-size: .72rem; line-height: 1.4; border: 1px solid var(--border, #ddd);
  border-radius: 999px; padding: .05rem .6rem; cursor: pointer; background: var(--surface, #fff); color: var(--muted, #777); }
.statusbar-flag:hover { border-color: var(--muted, #777); }
.statusbar-flag.ok { color: var(--ok, #0a6b3b); border-color: color-mix(in srgb, var(--ok, #0a6b3b) 45%, transparent); }
.statusbar-flag.bad { color: var(--warn, #b45309); border-color: color-mix(in srgb, var(--warn, #b45309) 45%, transparent);
  background: var(--warn-bg, color-mix(in srgb, var(--warn, #b45309) 12%, transparent)); }
.split { display: flex; flex: 1 1 0; min-width: 0; min-height: 0; }
.split-row { flex-direction: row; }
.split-col { flex-direction: column; }
/* `flex` lets a lone root zone (the Full-focus preset) fill #layout-root; inside a split the gutter sets
   explicit inline flex on each child, which overrides this default. */
.zone { display: flex; flex: 1 1 0; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; background: var(--surface); }
.region { display: flex; flex-direction: column; min-height: 0; }
.region.scroll { overflow-y: auto; }
.gutter { flex: 0 0 auto; position: relative; background: var(--border); z-index: 5; touch-action: none; }
.gutter-v { width: 5px; cursor: col-resize; }
.gutter-h { height: 5px; cursor: row-resize; }
.gutter::after { content: ""; position: absolute; inset: -3px; } /* a fatter invisible hit area */
.gutter:hover, .gutter.dragging { background: var(--accent); }
body.splitting { user-select: none; }
body.splitting iframe { pointer-events: none; } /* let a drag cross the preview iframe */
.panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; flex: 1 1 auto; }
.panel > section { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.panel > section + section { border-top: 1px solid var(--border); }
.panel-grip { cursor: grab; color: var(--muted); user-select: none; padding: 0 .15rem; line-height: 1; }
.panel-grip:hover { color: var(--ink); }
.panel-grip:active { cursor: grabbing; }
body.panel-dragging { user-select: none; }
body.panel-dragging iframe { pointer-events: none; } /* so a drop target under the preview still gets the drop */
.zone.drop-target { outline: 2px dashed var(--accent); outline-offset: -4px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.profilebar-spacer { flex: 1 1 auto; }

.pane-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .9rem;
  font-size: .72rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.pane-label.sticky { position: sticky; top: 0; z-index: 2; }
/* An on-demand panel's empty state: shown in the panel body when it has no content yet, so the slot
   still reads as "this panel, currently empty" (its header/picker stay visible above). */
.panel-empty { margin: 0; padding: 1rem .9rem; color: var(--muted); font-size: .82rem; font-style: italic; }
.pl-title { text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); }
.pane-label .hint { color: var(--accent-strong); font-weight: 600; }
.badge-core {
  font-family: var(--mono); font-size: .68rem; color: var(--accent-strong);
  background: var(--accent-soft); padding: .12rem .45rem; border-radius: var(--r-full);
}
.view-controls { margin-left: auto; display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: center; }
.view-controls label { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .76rem; }
.switch { cursor: pointer; }
.package-toggles { display: inline-flex; gap: .7rem; align-items: center; }
.package-toggle { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); cursor: pointer; white-space: nowrap; }

/* Reasoning panel (only shown when a legal package is active) */
#reasoning { list-style: none; margin: 0; padding: 0; }
#reasoning li { font-size: .8rem; padding: .28rem .15rem; border-bottom: 1px solid var(--border); }
#reasoning li:last-child { border-bottom: 0; }
.reason-held::before { content: "✓ "; color: var(--accent-strong); font-weight: 700; }
.reason-off { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.reason-scope { color: var(--muted); font-style: italic; }
.reason-summary { font-weight: 700; margin-top: .1rem; }

/* form controls (shared) */
select, input[type="text"], input:not([type]) {
  font: inherit;
  font-size: .8rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: .3rem .45rem;
  transition: border-color .12s ease, box-shadow .12s ease;
}
select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.view-controls select { padding: .25rem 1.4rem .25rem .5rem; max-width: 12rem; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- Inspector (annotations + panels) ---------- */
.inspector {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: var(--surface-2);
}

#annotations { margin: 0; padding: 0; list-style: none; font-size: .82rem; }
#annotations li {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: .55rem;
  align-items: center;
  padding: .4rem .7rem .4rem .9rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s ease;
}
#annotations li:hover { background: var(--accent-soft); }
.ann-type {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: .1rem .4rem;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.ann-text { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
button.icon { border: 0; background: none; color: var(--faint); cursor: pointer; font-size: .95rem; padding: .1rem .25rem; border-radius: var(--r-xs); line-height: 1; transition: color .12s ease, background .12s ease; }
button.icon:hover { color: var(--accent); background: var(--surface); }
button.icon[title="remove"]:hover { color: var(--danger); }

/* details panels */
.inspector details { border-top: 1px solid var(--border); background: var(--surface); }
.inspector summary {
  padding: .55rem .9rem;
  cursor: pointer;
  font-size: .76rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.inspector summary::-webkit-details-marker { display: none; }
.inspector summary::before {
  content: "›";
  display: inline-block;
  font-size: 1rem;
  color: var(--faint);
  transition: transform .15s ease;
}
.inspector details[open] > summary::before { transform: rotate(90deg); }
.inspector summary .hint { margin-left: auto; color: var(--accent-strong); font-weight: 600; }
.panel-actions { padding: .5rem .9rem .7rem; }

#resources, #recipients, #bundle { margin: 0; padding: 0; list-style: none; font-size: .8rem; }
#resources li, #recipients li, #bundle li {
  display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center;
  padding: .35rem .7rem .35rem .9rem; border-top: 1px solid var(--border);
}
#bundle-panel .panel-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.bundle-role { display: inline-flex; gap: .35rem; align-items: center; color: var(--muted); font-size: .76rem; }
.res-id, .rcpt-id-label { font-family: var(--mono); color: var(--accent-strong); font-size: .76rem; }
.res-mime, .rcpt-key { color: var(--muted); font-size: .74rem; }
.rcpt-add { display: flex; gap: .4rem; align-items: center; margin: .5rem .9rem; flex-wrap: wrap; }
.rcpt-add input { flex: 1 1 8rem; }
.rcpt-full { display: flex; align-items: center; gap: .4rem; margin: 0 .9rem .7rem; font-size: .76rem; color: var(--muted); }

#advanced #json {
  width: 100%;
  height: 11rem;
  border: 0;
  border-top: 1px solid var(--border);
  padding: .75rem .9rem;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--surface-2);
  color: var(--ink);
}

/* ---------- Right pane: preview + validation ---------- */
#preview { flex: 1; border: 0; background: var(--surface); width: 100%; }

#hints { margin: 0; padding: 0; list-style: none; }
.hint-item {
  display: grid; grid-template-columns: auto 1fr; gap: .55rem; align-items: start;
  padding: .55rem .9rem; background: var(--warn-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
  font-size: .8rem; color: var(--warn-strong);
}
.hint-icon { line-height: 1.3; }

#findings { flex: 1; overflow: auto; margin: 0; padding: 0; list-style: none; font-size: .84rem; }
#findings li {
  padding: .5rem .9rem;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: .55rem;
  align-items: baseline;
}
#findings .sev {
  font-weight: 700; font-size: .64rem; text-transform: uppercase; letter-spacing: .04em;
  padding: .1rem .4rem; border-radius: var(--r-full);
}
#findings .error .sev { color: var(--danger-strong); background: var(--danger-soft); }
#findings .warning .sev { color: var(--warn-strong); background: var(--warn-soft); }
#findings .advice .sev { color: var(--warn-strong); background: var(--warn-soft); }
#findings .info .sev { color: var(--muted); background: var(--surface-2); }
#findings .code { font-family: var(--mono); color: var(--muted); font-size: .76rem; }
#findings .msg { color: var(--ink); }
#findings .clean { color: var(--muted); padding: .8rem .9rem; display: block; }
#findings .clean::before { content: "✓ "; color: var(--accent-strong); font-weight: 700; }

/* ---------- Dialogs ---------- */
#dialog-root {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, #0b0f14 55%, transparent);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Above the running-fragment modal overlay (z 1000) so a builder dialog opened from within the header/
     footer editor appears on top of it — not behind, where clicks would fall through to the modal. */
  z-index: 1200;
  padding: 1rem;
  animation: fade .12s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
#dialog-root[hidden] { display: none; }
.dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.15rem 1.25rem;
  min-width: 21rem;
  max-width: min(90vw, 34rem);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  gap: .7rem;
  animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
.dialog-title { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }
.dialog-row { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; }
.dialog-row-check { flex-direction: row; align-items: center; gap: .45rem; }
.dialog-row-check .dialog-label { color: var(--ink); font-size: .85rem; }
.dialog-label { color: var(--muted); font-size: .78rem; }
.dialog-row input, .dialog-row select, .dialog-row textarea {
  font: inherit; padding: .45rem .55rem; border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
}
.dialog-row input:focus, .dialog-row select:focus, .dialog-row textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.dialog-row textarea { resize: vertical; font-family: var(--mono); font-size: .8rem; }
.dialog-row input[type="checkbox"] { align-self: flex-start; }
.dialog-row select[multiple] { font-family: var(--mono); padding: .3rem; }
.span-edit { display: flex; align-items: center; gap: .5rem; }
.span-preview { flex: 1; color: var(--muted); font-family: var(--mono); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface-2); padding: .35rem .5rem; border-radius: var(--r-sm); }
.span-edit button { font: inherit; font-size: .78rem; padding: .35rem .6rem; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); cursor: pointer; }
.span-edit button:hover { background: var(--surface-2); }
.dialog-error { color: var(--danger); font-size: .8rem; min-height: 1em; }
/* Formula (Content-MathML) field: textarea + "?" reference, live validity + rendered preview. */
.formula-bar { display: flex; gap: .4rem; align-items: flex-start; }
.formula-bar .formula-input { flex: 1; }
/* The dataset data-grid field (editable table + CSV paste). */
.grid-field { display: flex; flex-direction: column; gap: .4rem; }
.grid-table { border-collapse: collapse; }
.grid-table td { border: 1px solid var(--border, #ccc); padding: 0; }
.grid-table input { border: 0; background: transparent; color: inherit; font: inherit; width: 6.5em; padding: .2em .35em; }
.grid-table input:focus { outline: 2px solid var(--accent-ring, #59f); outline-offset: -2px; }
.grid-table input.grid-hcell { font-weight: 600; background: var(--muted-bg, #eef1f4); }
.grid-bar { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.grid-btn { font: inherit; padding: .15em .5em; cursor: pointer; }
.grid-csv { width: 100%; font-family: ui-monospace, monospace; }
.grid-hint { margin: .3rem 0 0; font-size: .78rem; color: var(--muted); }
.grid-scroll { max-height: 45vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
.grid-sizebar { display: flex; gap: .8rem; align-items: center; margin-bottom: .4rem; }
.grid-numlabel { display: inline-flex; gap: .3rem; align-items: center; font-size: .82rem; color: var(--muted); }
.grid-num { width: 3.4rem; font: inherit; }
.dialog-hint { display: block; margin: .15rem 0 .1rem; font-size: .76rem; line-height: 1.35; color: var(--muted); }
.dialog-advanced { margin: .2rem 0; }
.dialog-advanced > summary { cursor: pointer; font-size: .82rem; color: var(--muted); padding: .15rem 0; }
.dialog-advanced[open] > summary { margin-bottom: .3rem; }
.formula-help-toggle { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--accent-strong); font-weight: 700; line-height: 1; cursor: pointer; }
.formula-help-toggle:hover { border-color: var(--accent); color: var(--accent); }
.formula-status { font-size: .78rem; min-height: 1.1em; color: var(--muted); overflow-wrap: anywhere; }
.formula-status.ok { color: var(--ok); }
.formula-status.bad { color: var(--danger-strong); }
.formula-preview { font-size: 1.15rem; overflow-x: auto; }
.formula-preview:not(:empty) { padding: .35rem .5rem; background: var(--accent-soft); border-radius: var(--r-sm); }
.formula-help { border: 1px solid var(--border); border-radius: var(--r-sm); padding: .5rem .6rem; background: var(--surface); max-height: 16rem; overflow: auto; font-size: .78rem; }
.formula-help-hint { display: block; color: var(--muted); margin-bottom: .4rem; }
.formula-help-table { border-collapse: collapse; width: 100%; }
.formula-help-table th { text-align: left; color: var(--muted); font-weight: 600; padding: .15rem .4rem; border-bottom: 1px solid var(--border); }
.formula-help-table td { padding: .15rem .4rem; vertical-align: top; }
.formula-help-table td.mono { font-family: var(--mono); }
.formula-example { font-family: var(--mono); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); color: var(--accent-strong); cursor: pointer; padding: .1rem .3rem; font-size: .76rem; }
.formula-example:hover { border-color: var(--accent); color: var(--accent); }
.formula-help-sub { display: block; margin-top: .5rem; color: var(--muted); font-weight: 600; }
.formula-consts { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .25rem; }
.formula-const code { font-family: var(--mono); background: var(--accent-soft); padding: 0 .25rem; border-radius: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .3rem; }
.dialog-actions button { font: inherit; font-weight: 500; padding: .5rem .9rem; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); cursor: pointer; transition: background .12s ease; }
.dialog-actions button:hover { background: var(--surface-2); }
.dialog-actions button[type="submit"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.dialog-actions button[type="submit"]:hover { background: var(--accent-hover); }

/* Structure-builder dialog styles now live in common/shell.css (shared by both editors). */

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  main { grid-template-columns: 1fr; grid-auto-rows: minmax(0, 1fr); }
  .pane + .pane { border-left: 0; }
  .brand-text .sub { display: none; }
  header { gap: .6rem; }
}

/* ---------- Block surface (structured editor) ---------- */
.blocks {
  flex: 1 1 auto;
  min-height: 30%;
  overflow: auto;
  padding: 1.1rem 1.25rem 3rem;
  background: var(--surface);
  font-size: 15px;
  line-height: 1.6;
  counter-reset: scml-note; /* footnote markers number 1,2,3… in document order */
}
/* The semantic context bar (.context-bar / .bc-*) is shared — see common/shell.css. */


/* right-click context menu (edit/remove a mark, unwrap a section) */
.ctx-menu {
  position: fixed; z-index: 40;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); box-shadow: var(--shadow-pop);
  padding: .25rem; min-width: 10rem;
  display: flex; flex-direction: column;
}
.ctx-menu button {
  font: inherit; font-size: .82rem; text-align: left;
  padding: .4rem .6rem; border: 0; background: none; color: var(--ink);
  border-radius: var(--r-xs); cursor: pointer; white-space: nowrap;
}
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--accent-soft); color: var(--accent-strong); }
.ctx-head { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: color-mix(in srgb, var(--ink) 55%, transparent); padding: .35rem .6rem .25rem; }
.ctx-danger { color: var(--danger-strong); }
/* A group row that flies out to the right: label left, caret right. */
.ctx-menu button.ctx-has-sub { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.ctx-caret { opacity: .55; }

/* Signing & timestamp panel — grouped into steps: sign, verify, long-term. Body padding matches the
   summary's (.9rem) so nothing hugs the panel edge. */
#signing-panel .sign-body { display: flex; flex-direction: column; gap: .65rem; padding: .35rem .9rem 1rem; }
.sign-section { display: flex; flex-direction: column; gap: .5rem; }
.sign-section + .sign-section { padding-top: .7rem; border-top: 1px solid var(--border); }
.sign-section-head { margin: 0 0 .1rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-strong); }
.sign-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.sign-tsa { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; }
.sign-tsa > label { display: flex; flex-direction: column; gap: .25rem; color: var(--muted); }
.sign-tsa input { font: inherit; font-size: .82rem; padding: .35rem .5rem; border: 1px solid var(--border-strong); border-radius: var(--r-xs); background: var(--surface); color: var(--ink); }
.sign-tsa input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
/* The chosen level's one-line "what to do" note: a light accent rule, not a heavy box. */
.sign-level-desc { margin: 0; font-size: .8rem; line-height: 1.45; color: var(--text-dim); border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-xs) var(--r-xs) 0; padding: .4rem .6rem; }
.sign-level-desc:empty { display: none; }
#signing-panel .sign-do { margin: 0; color: var(--accent-strong); font-weight: 500; }
/* Nested foldouts (usage rights, manual timestamp, long-term & archive). */
.sign-sub { border: 1px solid var(--border); border-radius: var(--r-xs); padding: .35rem .6rem; background: var(--surface-2); }
.sign-sub > summary { font-size: .8rem; cursor: pointer; color: var(--text-dim); }
.sign-sub[open] > summary { margin-bottom: .4rem; }
.sign-sub .sign-row { margin-top: .1rem; }
.sign-rights-body { display: flex; flex-direction: column; gap: .2rem; }
.sign-rights-body label { font-size: .82rem; display: flex; align-items: center; gap: .35rem; }
[hidden].sign-row, [hidden].sign-tsa { display: none; }

/* ---------- Accessibility ---------- */
/* Respect users who ask for less motion: drop transitions/animations, keep focus rings. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Honour a stronger-contrast request: harden borders and give focus a solid outline. */
@media (prefers-contrast: more) {
  :root {
    --border: var(--border-strong);
    --muted: var(--ink);
  }
  .btn, .fa-group, .tb-group, select, input, .dialog, #findings li { border-color: var(--border-strong); }
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; box-shadow: none; }
  .status, .ann-type, .badge-core, #findings .sev { border: 1px solid currentColor; }
}

/* Forced-colours (Windows High Contrast): let the OS palette drive, keep structure visible. */
@media (forced-colors: active) {
  .btn, .fa-group, .tb-group, .dialog, #annotations li, #findings li { border: 1px solid CanvasText; }
  :focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
  .brand-mark { background: Canvas; color: CanvasText; border: 1px solid CanvasText; }
}

/* ---- Style editor (role gallery) ---- */
/* While styling, hide the document authoring chrome so the gallery gets the full height. A class on
   body (not the [hidden] attribute) is needed: header/#toolbar/main set their own `display`, which
   wins over the UA `[hidden]{display:none}` rule. */
/* The style editor is a dockable panel: it fills its slot as a column (toolbar on top, the scrolling role
   gallery below), like any other panel. */
#style-editor { color: var(--ink); background: var(--bg); display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
#style-editor > .se-bar { flex: 0 0 auto; flex-wrap: wrap; }
#style-editor > .se-gallery { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.se-bar:has(.zone-picker) > .pl-title { display: none; }
/* Clear ("×") button that unsets a control (colour swatches have no empty state of their own). */
.se-clear { flex: 0 0 auto; margin-left: 4px; padding: 0 6px; line-height: 1.4; border: 1px solid var(--line, #ccc);
  border-radius: var(--r-xs, 3px); background: transparent; color: var(--muted, #777); cursor: pointer; font-size: 1rem; }
.se-clear:hover { color: var(--ink); border-color: var(--ink); }
.se-control.se-unset > input[type="color"] { opacity: 0.4; }

/* ---- Style workbench: two-column control grid (label | value) ----
   Every option control aligns a right-set label against a value cell, so an expanded group reads as an
   ordered list instead of a ragged inline stack. Block controls (border, box-shadow, running templates,
   column widths) opt out and stack the value under the label. */
.se-options { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px 12px; }
.se-control { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center;
  column-gap: 12px; padding: 3px 0; margin: 0; }
.se-control > .se-lab { color: var(--muted); text-align: right; font-size: .82em; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.se-control > .se-val { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.se-control > .se-val > input[type="text"] { flex: 1 1 8em; min-width: 0; }
.se-control > .se-val > select:not(.se-unit) { max-width: 100%; }
.se-control .se-num { width: 4.2em; }
.se-control input[type="color"] { width: 30px; height: 26px; padding: 0; }
/* Block controls stack: label on its own line, value below at full width; the "×" floats top-right. */
.se-control.se-control-block, .se-control.se-colwidths { display: block; position: relative; }
.se-control.se-control-block > .se-lab { display: block; text-align: left; margin-bottom: 4px; }
.se-control.se-control-block > .se-val { display: block; }
/* Row remove ("×") that deletes a property and returns it to the group's add-menu (set-first). */
.se-control > .se-rowdel { align-self: center; border: 1px solid transparent; background: transparent;
  color: var(--muted); border-radius: var(--r-xs, 3px); width: 22px; height: 22px; line-height: 1; cursor: pointer;
  opacity: 0; }
.se-control.se-control-block > .se-rowdel, .se-control.se-colwidths > .se-rowdel { position: absolute; top: 0; right: 0; }
.se-control:hover > .se-rowdel, .se-control > .se-rowdel:focus-visible { opacity: 1; }
.se-control > .se-rowdel:hover { color: var(--ink); border-color: var(--line, #ccc); }
/* Add-menu: the group's unset properties, folded into one control. */
.se-addrow { padding: 6px 0 2px; }
.se-add { font-size: .8em; color: var(--accent, #2b4a6f); background: transparent; border: 1px dashed var(--line-strong, #bbb);
  border-radius: var(--r-xs, 4px); padding: 5px 9px; cursor: pointer; }
.se-add:hover { border-color: var(--accent, #2b4a6f); }

/* Honest group headers: name + set-count, with a dot when the group carries settings. */
.se-group-summary { display: flex; align-items: center; gap: 8px; }
.se-grp-name { font-weight: 600; }
.se-grp-count { font-size: .72em; color: var(--muted); font-variant-numeric: tabular-nums; }
.se-grp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent, #2b4a6f); margin-left: auto; }

/* The "Advanced" fold gathers the untouched long-tail groups behind one disclosure. */
.se-advanced { margin-top: 4px; }
.se-advanced > .se-group-summary .se-grp-name { color: var(--muted); font-weight: 500; }
.se-adv-body { padding-left: 6px; }

/* ---- Box-model widget: four edge inputs on a nested box (margin / padding / page margins) ---- */
.se-sided-head { display: flex; align-items: center; gap: 8px; }
.se-sided-toggle { margin-left: auto; }
.se-boxmodel .se-sided-title { font-size: .82em; color: var(--muted); }
/* The family "×" (remove margin/padding/border), revealed on hover like the per-row remove. */
.se-fam-del { opacity: 0; }
.se-sided:hover .se-fam-del, .se-fam-del:focus-visible { opacity: 1; }
.se-fam-del:hover { color: var(--ink); border-color: var(--line, #ccc); }
.se-box-stage { display: flex; align-items: center; gap: 12px; padding: 16px 4px 8px; flex-wrap: wrap; }
/* Border widget: the box sits beside a small column of shared options (unit / style / colour). */
.se-borderbox .se-box-stage { align-items: flex-start; }
.se-box-controls { display: flex; flex-direction: column; gap: 6px; min-width: 8rem; }
.se-box-controls .se-subfield { display: flex; align-items: center; gap: 6px; margin: 0; }
.se-box-controls .se-subcap { font-size: .72em; color: var(--muted); min-width: 3.2em; text-align: right; }
/* Per-side border: the edges are selectable, and the selected one is highlighted; the controls edit it. */
.se-borderbox.se-boxmodel .se-box-edge { cursor: pointer; }
.se-box-edge.sel { border-color: var(--accent, #2b4a6f); box-shadow: 0 0 0 2px var(--accent-soft, #e8eef5); }
.se-box-side { font-size: .72em; font-weight: 600; color: var(--accent-strong, #0a6b3b); text-transform: capitalize; }
.se-box-warn { margin: 6px 2px 0; padding: 5px 8px; font-size: .74em; line-height: 1.35; border-radius: var(--r-xs, 4px);
  color: var(--warn-strong, #9a6b12); background: var(--warn-soft, #f7edd6); border: 1px solid var(--warn-strong, #9a6b12); }
.se-box { position: relative; flex: 0 0 auto; width: 172px; height: 96px; border: 1px solid var(--line-strong, #bbb);
  border-radius: 6px; background: var(--bg); }
.se-box-inner { position: absolute; inset: 26px 34px; border: 1px dashed var(--line-strong, #bbb); border-radius: 4px;
  display: flex; align-items: center; justify-content: center; font-size: .68em; color: var(--muted); }
.se-box-edge { position: absolute; width: 42px; height: 22px; text-align: center; padding: 1px 2px;
  border: 1px solid var(--line-strong, #bbb); border-radius: 3px; background: var(--bg); color: var(--ink);
  font: inherit; font-size: 12px; -moz-appearance: textfield; }
.se-box-edge::-webkit-outer-spin-button, .se-box-edge::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.se-box-t { top: 2px; left: 50%; transform: translateX(-50%); }
.se-box-b { bottom: 2px; left: 50%; transform: translateX(-50%); }
.se-box-l { left: 2px; top: 50%; transform: translateY(-50%); }
.se-box-r { right: 2px; top: 50%; transform: translateY(-50%); }
.se-box-unit { flex: 0 0 auto; }

/* ---- Outline / navigation panel (R7) ---- */
.outline { list-style: none; margin: 0; padding: 0; }
.outline-item {
  display: flex; gap: 0.4rem; align-items: baseline; padding: 0.2rem 0.35rem;
  border-radius: 5px; cursor: grab; font-size: 0.8rem;
}
.outline-item:hover { background: var(--accent-soft); }
.outline-item.dragging { opacity: 0.5; }
.outline-item.drop-target { box-shadow: inset 0 2px 0 var(--accent); }
.outline-tag {
  flex: none; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--muted); min-width: 4.5rem;
}
.outline-heading > .outline-text { font-weight: 600; }
.outline-text { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A validation finding that names an annotation is clickable — it jumps to and flashes the block. */
#findings li.locatable, #annotations li.locatable { cursor: pointer; }
#findings li.locatable:hover, #annotations li.locatable:hover,
#annotations li.locatable:focus-visible { background: var(--accent-soft); border-radius: var(--r-xs); outline: none; }
/* Reverse highlight: rows whose span covers the caret in the editor. A left rule marks the stack. */
#annotations li.ann-active { background: var(--accent-soft); border-radius: var(--r-xs); box-shadow: inset 3px 0 0 var(--accent-strong); }
@keyframes finding-flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.finding-flash { animation: finding-flash 1.4s ease-out; border-radius: var(--r-xs); }
@media (prefers-reduced-motion: reduce) { .finding-flash { animation: none; outline: 2px solid var(--accent); } }

/* ---- Accessibility check panel (R7) ---- */
.a11y { list-style: none; margin: 0; padding: 0; }
.a11y-ok { color: var(--muted); font-size: 0.8rem; padding: 0.2rem 0.35rem; }
.a11y-issue {
  color: var(--warn-strong); font-size: 0.8rem; padding: 0.3rem 0.5rem;
  border-left: 3px solid var(--warn); background: var(--warn-soft);
  border-radius: 0 5px 5px 0; margin-bottom: 0.25rem;
}
#a11y-panel.has-issues > summary { color: var(--warn-strong); font-weight: 600; }

/* ---- What-You-See-Is-What-You-Sign confirmation (R7) ---- */
.wysiwys-overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, #000 45%, transparent); padding: 1.5rem;
}
.wysiwys-box {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3); padding: 1.1rem 1.2rem; width: min(720px, 96vw);
  max-height: 92vh; display: flex; flex-direction: column; gap: 0.7rem;
}
.wysiwys-box h2 { margin: 0; font-size: 1.05rem; }
.wysiwys-note { margin: 0; color: var(--muted); font-size: 0.85rem; }
.wysiwys-frame {
  flex: 1 1 auto; min-height: 260px; width: 100%; border: 1px solid var(--border);
  border-radius: 6px; background: #fff;
}
.wysiwys-confirm { display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.85rem; }
.wysiwys-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
/* The running-fragment editor reuses the block surface inside the modal box. */
.running-toolbar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.running-var-label { display: flex; gap: 0.4rem; align-items: center; font-size: 0.85rem; color: var(--muted); }
#running-blocks {
  flex: 1 1 auto; min-height: 240px; max-height: 60vh; overflow: auto;
  border: 1px solid var(--border); border-radius: 6px; padding: 0.9rem 1rem 2rem;
}
