/* ============================================================
   EasyFile Component Library
   Version: 1.1

   Requires: design-tokens.css loaded first.
   All classes reference --ef-* and --nav-* custom properties.

   Changelog:
     1.1 - Scope content theme to #main-content (not body).
           Header/sidebar get explicit color: var(--nav-text).
     1.0 - Initial release.
   ============================================================ */


/* ── RESET & BASE ──────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--ef-font);
  font-size: var(--ef-text-14);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Content theme scoped to main area — header/sidebar use --nav-* tokens */
#main-content {
  color: var(--ef-text);
  background: var(--ef-bg);
}

a {
  color: var(--ef-color-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}


/* ── ACCESSIBILITY ─────────────────────────────────────────── */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  background: var(--ef-color-primary);
  color: #fff;
  padding: var(--ef-space-8) var(--ef-space-16);
  font-size: var(--ef-text-13);
  border-radius: 0 0 var(--ef-radius-6) 0;
}
.skip-link:focus {
  left: 0;
}


/* ── APP SHELL ─────────────────────────────────────────────── */

.app {
  display: grid;
  /* Single content column - no app-level left sidebar (nav lives in the top bar). The header still spans the
     full row (grid-column: 1 / -1) and the main content fills the width. A slim footer row carries the running
     product version. */
  grid-template-columns: 1fr;
  grid-template-rows: 48px 1fr auto;
  height: 100vh;
}

/* ── FOOTER ────────────────────────────────────────────────── */
/* Slim, unobtrusive version banner pinned below the scrollable main content. */
.app-footer {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 var(--ef-space-24);
  height: 24px;
  background: var(--ef-surface);
  border-top: 1px solid var(--ef-border);
}

.app-footer-version {
  font-size: 11px;
  color: var(--ef-text-muted, var(--ef-text-secondary, #6b7280));
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}


/* ── HEADER ────────────────────────────────────────────────── */

.header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: 0 var(--ef-space-16);
  height: 48px;
  z-index: 100;
  border-bottom: 1px solid var(--nav-border);
  box-shadow: var(--header-shadow);
}

.h-left  { display: flex; align-items: center; gap: var(--ef-space-12); }
.h-right { display: flex; align-items: center; gap: var(--ef-space-4); }
.h-sep   { width: 1px; height: 20px; background: var(--nav-divider); }

.brand {
  display: flex;
  align-items: center;
  gap: var(--ef-space-8);
  color: var(--nav-brand);
  font-weight: 700;
}
.brand svg       { width: 22px; height: 22px; color: var(--nav-accent); }
.brand-name      { font-size: 14px; letter-spacing: 1.2px; }

.h-tenant  { color: var(--nav-text); font-size: var(--ef-text-13); font-weight: 500; }
.env-badge {
  font-size: var(--ef-text-11);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 8px;
  border-radius: var(--ef-radius-14);
  background: var(--nav-env-bg);
  color: var(--nav-env-text);
}

/* Header icon button */
.hb {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ef-radius-6);
  color: var(--nav-text);
  transition: all 150ms;
  position: relative;
}
.hb:hover         { background: var(--nav-hover); color: var(--nav-text-active); }
.hb:focus-visible { outline: 2px solid var(--ef-color-focus); outline-offset: 2px; }
.hb svg           { width: 18px; height: 18px; }

/* Notification dot */
.notif {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--ef-red);
  border-radius: 50%;
  border: 1.5px solid var(--nav-bg);
}

/* User avatar */
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ef-color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}


/* ── SIDEBAR ───────────────────────────────────────────────── */

.sidebar {
  grid-row: 2;
  width: 220px;
  background: var(--nav-bg-2);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--nav-border);
  transition: width 200ms;
  z-index: 50;
  overflow-y: auto;
}

.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .nlbl,
.sidebar.collapsed .nsec,
.sidebar.collapsed .sf-txt { display: none; }
.sidebar.collapsed .ni { justify-content: center; padding: 0; }

.nlist { list-style: none; padding: var(--ef-space-8) var(--ef-space-8) 0; flex: 1; }

/* Nav item */
.ni {
  display: flex;
  align-items: center;
  gap: var(--ef-space-8);
  padding: 0 var(--ef-space-12);
  height: 36px;
  border-radius: var(--ef-radius-6);
  color: var(--nav-text);
  font-size: var(--ef-text-13);
  font-weight: 450;
  transition: all 150ms;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
}
.ni:hover  { background: var(--nav-hover); color: var(--nav-text-active); }
.ni.active { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 600; }
.ni.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 6px; bottom: 6px;
  width: 3px;
  background: var(--nav-accent);
  border-radius: 0 2px 2px 0;
}
.ni svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }

/* Nav section (e.g., Favorites) */
.nsec {
  padding: var(--ef-space-8) var(--ef-space-8) 0;
  margin-top: var(--ef-space-4);
  border-top: 1px solid var(--nav-divider);
}
.nsec-title {
  font-size: var(--ef-text-11);
  font-weight: 600;
  color: var(--nav-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--ef-space-4);
  opacity: 0.7;
}
.nsec-items .ni { height: 32px; font-size: var(--ef-text-12); padding-left: var(--ef-space-16); }

/* Sidebar footer */
.sf { padding: var(--ef-space-8); border-top: 1px solid var(--nav-divider); display: flex; align-items: center; justify-content: space-between; }
.sf-btn {
  display: flex;
  align-items: center;
  gap: var(--ef-space-4);
  color: var(--nav-text);
  font-size: var(--ef-text-12);
  padding: var(--ef-space-4) var(--ef-space-8);
  border-radius: var(--ef-radius-6);
  transition: all 150ms;
}
.sf-btn:hover { color: var(--nav-text-active); background: var(--nav-hover); }
.sf-btn svg   { width: 14px; height: 14px; }


/* ── MAIN CONTENT AREA ─────────────────────────────────────── */

/* min-height:0 is LOAD-BEARING, not tidiness: a grid item defaults to min-height:auto, which refuses to shrink
   below its content, so a tall page grew the 1fr row past the viewport and pushed the footer down the page
   instead of scrolling inside .main - the version banner drifted on scroll and "bounced" at the bottom of a
   nested scroller (admin right panel). Same fix already used by .dv-layout and the AI panel. */
.main { grid-row: 2; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }

.pg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--ef-space-24);
  height: 48px;
  min-height: 48px;
  background: var(--ef-surface);
  border-bottom: 1px solid var(--ef-border);
}
.pg-actions { display: flex; align-items: center; gap: var(--ef-space-8); }

.content { flex: 1; padding: var(--ef-space-24); overflow-y: auto; }


/* ── BREADCRUMBS ───────────────────────────────────────────── */

.bc     { display: flex; align-items: center; gap: var(--ef-space-8); font-size: var(--ef-text-13); }
.bc-link { color: var(--ef-text-muted); text-decoration: none; }
.bc-link:hover { color: var(--ef-color-primary); text-decoration: none; }
.bc-sep { color: var(--ef-text-muted); opacity: 0.5; }
.bc-cur { font-weight: 600; color: var(--ef-text); }


/* ── BUTTONS ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ef-space-8);
  font-weight: 500;
  border-radius: var(--ef-radius-6);
  transition: all 150ms;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--ef-color-focus); outline-offset: 2px; }
.btn:disabled      { opacity: 0.4; cursor: not-allowed; }
.btn svg           { width: 15px; height: 15px; }

/* Sizes */
.btn-sm { height: 28px; padding: 0 var(--ef-space-8);  font-size: 12px; }
.btn-md { height: 34px; padding: 0 var(--ef-space-12); font-size: var(--ef-text-13); }
.btn-lg { height: 42px; padding: 0 var(--ef-space-16); font-size: var(--ef-text-14); }

/* Variants */
.btn-primary   { background: var(--ef-color-primary); color: #fff; }
.btn-primary:hover { background: var(--ef-color-primary-hover); }

.btn-secondary { background: var(--ef-surface); color: var(--ef-text); border: 1px solid var(--ef-border); }
.btn-secondary:hover { background: var(--ef-surface-2); }

/* Ghost: a LOW-EMPHASIS button that still reads as a BUTTON, not body text (owner: "buttons are sometimes just
   plain text"). A faint resting border + normal (not muted) text distinguish it from data; hover fills it. This is
   the row-action look (Edit/Delete in tables) — light-weight but unmistakably a control. */
.btn-ghost     { background: transparent; color: var(--ef-text); border: 1px solid var(--ef-border); }
.btn-ghost:hover { background: var(--ef-surface-2); color: var(--ef-text); border-color: var(--ef-color-primary); }
/* GLYPH / ICON-CONTROL ghost buttons stay BORDERLESS — a box around a lone × / ↑↓ / +/− / zoom glyph in a tight
   tree or toolbar reads as clutter; the glyph carries the affordance. The resting border is for TEXT row-actions
   (Edit/Delete/Take) only. Exempted: an svg/.btn-ico only-child (auto-detected), the explicit .btn-ghost-icon
   opt-out (glyph-text buttons CSS can't length-detect: qt-del ×, move ↑↓, +Rule/+Condition/+Action), and the
   Designer/preview zoom + tree toolbars whose buttons are all icon-scale controls. */
.btn-ghost.btn-icon,
.btn-ghost.btn-ghost-icon,
.btn-ghost.qt-del,
.btn-ghost:has(> svg:only-child),
.btn-ghost:has(> .btn-ico:only-child),
.wi-plan-zoom .btn-ghost,
.preview-toolbar .btn-ghost,
.qt-tools .btn-ghost,
.qt-rule-tools .btn-ghost { border-color: transparent; }
.btn-ghost.btn-icon:hover, .btn-ghost.btn-ghost-icon:hover, .btn-ghost.qt-del:hover,
.btn-ghost:has(> svg:only-child):hover,
.wi-plan-zoom .btn-ghost:hover, .preview-toolbar .btn-ghost:hover,
.qt-tools .btn-ghost:hover, .qt-rule-tools .btn-ghost:hover { border-color: transparent; background: var(--ef-surface-2); }

.btn-danger    { background: var(--ef-color-danger); color: #fff; }
.btn-danger:hover { background: var(--ef-color-danger-hover); }

.btn-icon {
  background: transparent;
  color: var(--ef-text-muted);
  width: 34px; height: 34px;
  padding: 0;
  border-radius: var(--ef-radius-6);
}
.btn-icon:hover { background: var(--ef-surface-2); color: var(--ef-text); }


/* ── BADGES & STATUS ───────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--ef-space-4);
  height: 22px;
  padding: 0 var(--ef-space-8);
  font-size: var(--ef-text-11);
  font-weight: 600;
  border-radius: var(--ef-radius-14);
  letter-spacing: 0.1px;
}
.bdot { width: 6px; height: 6px; border-radius: 50%; }

.b-grn { background: var(--ef-green-bg);  color: var(--ef-green-text); }  .b-grn .bdot { background: var(--ef-green); }
.b-ylw { background: var(--ef-yellow-bg); color: var(--ef-yellow-text); } .b-ylw .bdot { background: var(--ef-yellow); }
.b-red { background: var(--ef-red-bg);    color: var(--ef-red-text); }    .b-red .bdot { background: var(--ef-red); }
.b-blu { background: var(--ef-blue-bg);   color: var(--ef-blue-text); }   .b-blu .bdot { background: var(--ef-blue); }
.b-gry { background: var(--ef-surface-2); color: var(--ef-text-muted); }  .b-gry .bdot { background: var(--ef-text-muted); }

/* Fields tab: system / source-linked row pills (badge-shaped, no dot) */
.field-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  margin-left: var(--ef-space-8);
  padding: 0 var(--ef-space-8);
  font-size: var(--ef-text-11);
  font-weight: 600;
  border-radius: var(--ef-radius-14);
  letter-spacing: 0.1px;
  white-space: nowrap;
}
.field-pill-system { background: var(--ef-surface-2); color: var(--ef-text-muted); }
.field-pill-source { background: var(--ef-blue-bg);   color: var(--ef-blue-text); }
.field-pill-warn   { background: var(--ef-yellow-bg); color: var(--ef-yellow-text); }

/* Fields tab: the List-options editor (one row per option: input + up / down / remove). */
.field-list-options { border: 1px solid var(--ef-border); border-radius: var(--ef-radius-4); padding: var(--ef-space-12); }
.field-list-option-row { display: flex; gap: var(--ef-space-8); align-items: center; margin-bottom: var(--ef-space-8); }
.field-list-option-row .fi { flex: 1; min-width: 0; }
.field-list-source { margin-top: var(--ef-space-8); padding: var(--ef-space-8) var(--ef-space-12); background: var(--ef-surface-2); border-radius: var(--ef-radius-4); }

/* Grid trailing Open-item action column (owner: explicit open in addition to double-click). Compact, right-aligned,
   doesn't grow; the button only reads as an action on the row it's in. */
.wi-grid-open { width: 1%; white-space: nowrap; text-align: right; }
.wi-grid-open-btn { padding: 2px var(--ef-space-8); }

/* Work-item header state badge. ONE badge for "you cannot change this", whatever the reason (owned by someone else,
   or opened without taking it) - a prominent amber lock so the non-actionable state is unmistakable rather than a
   faint muted note. The separate neutral "Preview" badge is gone: preview IS read-only, and two names for one state
   made an internal distinction the user's problem. */
.wi-view-readonly-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--ef-space-4);
  margin-left: var(--ef-space-8);
  height: 22px;
  padding: 0 var(--ef-space-8);
  font-size: var(--ef-text-11);
  font-weight: 700;
  border-radius: var(--ef-radius-14);
  background: var(--ef-yellow-bg);
  color: var(--ef-yellow-text);
  letter-spacing: 0.1px;
  white-space: nowrap;
}

/* Work-item view: "This item is complete." (a link can open a finished item, read-only) and the Copy-link fallback
   field shown when the clipboard is unavailable. Tokens only, so both themes follow. */
.wi-view-complete-banner {
  margin: var(--ef-space-8) var(--ef-space-12) 0;
  padding: var(--ef-space-8) var(--ef-space-12);
  border-radius: var(--ef-radius-6);
  background: var(--ef-green-bg);
  color: var(--ef-green-text);
  font-size: var(--ef-text-13);
  font-weight: 600;
}
.wi-view-copy-fallback {
  display: flex;
  align-items: center;
  gap: var(--ef-space-8);
  margin: var(--ef-space-8) var(--ef-space-12) 0;
}
.wi-view-copy-fallback .fi { flex: 1; min-width: 0; }

/* Work-item LINK states on the dashboard (/workflows/{wf}/items/{id}): the pre-interactive skeleton and the single
   "isn't available" state, which is identical for every cause (missing, no access, moved, out of range). */
.wi-link-state { max-width: 560px; margin: var(--ef-space-32) auto; text-align: center; }
.wi-link-state .ef-grid-state-cta { justify-content: center; }

/* Fields tab: Order-column drag-to-reorder handle + row drag states (ports the column-manager drag affordance) */
.field-drag-handle {
  display: inline-block;
  margin-right: var(--ef-space-4);
  color: var(--ef-text-muted);
  cursor: grab;
}
.dt tbody tr.dragging  { opacity: 0.5; }
.dt tbody tr.drag-over { background: var(--ef-blue-bg); }

/* Fields tab: group-separator rows (System fields vs Data fields). A non-selectable band header inside the
   grid body that labels the two field groups (owner 2026-07-17). Not draggable / not a drop target. */
.dt tbody tr.fields-group-head > td {
  background: var(--ef-surface-2);
  padding: var(--ef-space-6) var(--ef-space-12);
  border-top: 1px solid var(--ef-border);
}
.dt tbody tr.fields-group-head .fields-group-title {
  font-size: var(--ef-text-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ef-text);
  margin-right: var(--ef-space-8);
}
.dt tbody tr.fields-group-head .admin-hint { margin: 0; }

/* Tag */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 var(--ef-space-8);
  font-size: var(--ef-text-11);
  font-weight: 600;
  border-radius: var(--ef-radius-6);
  background: var(--ef-blue-bg);
  color: var(--ef-blue-text);
  border: 1px solid rgba(37, 99, 235, 0.12);
}

/* Delta indicator */
.delta {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: var(--ef-radius-14);
  font-size: var(--ef-text-11);
  font-weight: 600;
}
.delta-pos { background: var(--ef-green-bg); color: var(--ef-green-text); }


/* ── CARDS ─────────────────────────────────────────────────── */

.card {
  background: var(--ef-surface);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-10);
  box-shadow: var(--ef-shadow-1);
}
.pad { padding: var(--ef-space-24); }


/* ── DATA TABLE ────────────────────────────────────────────── */

.dt              { width: 100%; border-collapse: collapse; }
.dt thead        { background: var(--ef-surface-2); }
.dt th {
  padding: var(--ef-space-8) var(--ef-space-12);
  font-size: var(--ef-text-12);
  font-weight: 600;
  color: var(--ef-text-muted);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.dt td {
  padding: var(--ef-space-8) var(--ef-space-12);
  font-size: var(--ef-text-13);
  border-bottom: 1px solid var(--ef-border);
}
.dt tbody tr     { height: 40px; transition: background 100ms; }
.dt tbody tr:hover { background: var(--ef-surface-2); }

/* Table helpers */
.cl       { color: var(--ef-color-primary); font-weight: 500; }
.cl:hover { text-decoration: underline; }
.cm       { color: var(--ef-text-muted); }
.cr       { text-align: right; }

/* Custom checkbox */
.cb {
  width: 15px; height: 15px;
  border: 1.5px solid var(--ef-border);
  border-radius: 3px;
  appearance: none;
  cursor: pointer;
  transition: all 150ms;
  display: grid;
  place-content: center;
}
.cb:checked {
  background: var(--ef-color-primary);
  border-color: var(--ef-color-primary);
}
.cb:checked::after {
  content: '';
  width: 7px; height: 4px;
  border: 1.5px solid #fff;
  border-top: none;
  border-right: none;
  transform: rotate(-45deg);
  margin-top: -1px;
}


/* ── TABS ──────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: var(--ef-space-24);
  border-bottom: 1px solid var(--ef-border);
}
.tab {
  height: 38px;
  display: flex;
  align-items: center;
  font-size: var(--ef-text-12);
  font-weight: 600;
  color: var(--ef-text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 150ms;
  padding: 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tab:hover  { color: var(--ef-text); }
.tab.active { color: var(--ef-color-primary); border-bottom-color: var(--ef-color-primary); }

/* TAB → PANEL BOUNDARY (owner: "there's no boundary for what the tab controls"). Opt-in via .ef-tabview on a
   wrapper around a .tabs strip + its [role=tabpanel]: the panel gets side+bottom borders + padding so the tab
   strip clearly "opens into" the content it controls, instead of both floating free. Opt-in (not blanket on every
   tabs+panel) so it applies to card/modal sub-tabs — NOT the full-page Designer nav, where a box would be wrong. */
.ef-tabview > .tabs {
  padding: 0 var(--ef-space-16);
  gap: var(--ef-space-16);
}
.ef-tabview > [role="tabpanel"],
.ef-tabview > .event-tab-panel {
  border: 1px solid var(--ef-border);
  border-top: none;
  border-radius: 0 0 var(--ef-radius-10) var(--ef-radius-10);
  padding: var(--ef-space-16);
  background: var(--ef-surface);
}


/* ── FORM CONTROLS ─────────────────────────────────────────── */

.fg { display: flex; flex-direction: column; gap: 3px; }
.fl { font-size: var(--ef-text-12); font-weight: 600; color: var(--ef-text); }

.fi {
  height: 34px;
  padding: 0 var(--ef-space-12);
  background: var(--ef-surface);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  font-size: var(--ef-text-13);
  color: var(--ef-text);
  transition: all 150ms;
  font-family: var(--ef-font);
}
.fi::placeholder { color: var(--ef-text-muted); }
.fi:focus {
  outline: none;
  border-color: var(--ef-color-primary);
  box-shadow: 0 0 0 2px var(--ef-color-focus);
}

.fi-err { border-color: var(--ef-color-danger) !important; }
.f-err  { font-size: var(--ef-text-11); color: var(--ef-red-text); font-weight: 500; }

/* COLOR FIELD (EfColorField) — a clickable pill (swatch + hex + caret) that reads as an editable control, not a
   bare little square. The native <input type=color> is layered transparent over the whole pill so a click
   anywhere opens the OS picker (and the picker anchors to the pill); it stays focusable/labelled for keyboard+AT. */
.ef-color {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--ef-space-8);
  height: 34px;
  padding: 0 var(--ef-space-8) 0 var(--ef-space-4);
  background: var(--ef-surface);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  cursor: pointer;
  transition: all 150ms;
  min-width: 116px;
}
.ef-color:hover { border-color: var(--ef-color-primary); }
.ef-color:focus-within { border-color: var(--ef-color-primary); box-shadow: 0 0 0 2px var(--ef-color-focus); }
.ef-color.is-disabled { opacity: 0.5; cursor: not-allowed; }
/* The native input covers the whole pill but is invisible — it provides the click target + OS picker anchor. */
.ef-color-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  opacity: 0;
  cursor: inherit;
}
/* The swatch/value/caret are DECORATION painted over the transparent native input; they must NOT intercept the
   click (the input, though earlier in source order, would otherwise sit under these static spans). pointer-events:
   none lets every click fall through to the input, so clicking anywhere on the pill opens the OS picker. */
.ef-color-swatch, .ef-color-value, .ef-color-caret { pointer-events: none; }
.ef-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: var(--ef-radius-4);
  border: 1px solid var(--ef-border);
  flex-shrink: 0;
}
.ef-color-value { font-family: var(--ef-font-mono, ui-monospace, monospace); font-size: var(--ef-text-12); color: var(--ef-text); letter-spacing: 0.3px; }
.ef-color-caret { margin-left: auto; font-size: 9px; color: var(--ef-text-muted); flex-shrink: 0; }

.form-select {
  height: 32px;
  padding: 0 var(--ef-space-24) 0 var(--ef-space-8);
  background: var(--ef-surface);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  font-size: var(--ef-text-12);
  color: var(--ef-text);
  appearance: none;
  cursor: pointer;
}
.form-select:focus {
  outline: none;
  border-color: var(--ef-color-primary);
  box-shadow: 0 0 0 2px var(--ef-color-focus);
}

.filter-input {
  width: 220px;
  height: 34px;
  padding: 0 var(--ef-space-12);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  font-size: var(--ef-text-13);
  color: var(--ef-text);
  background: var(--ef-surface);
}
.filter-input:focus {
  outline: none;
  border-color: var(--ef-color-primary);
  box-shadow: 0 0 0 2px var(--ef-color-focus);
}

/* Toggle switch */
.toggle {
  width: 34px; height: 18px;
  border-radius: 9px;
  background: var(--ef-border);
  cursor: pointer;
  position: relative;
  transition: background 200ms;
}
.toggle.on { background: var(--ef-color-primary); }
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 200ms;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.toggle.on::after { transform: translateX(16px); }

/* ACCESSIBLE toggle switch (.ef-switch). The `.toggle` above is a bare styled <div> - it has no input, so it
   cannot be focused, reached by keyboard, read by a screen reader, or bound. This wraps a REAL checkbox and
   styles it, so it keeps native semantics (Space toggles, label click works, forms/binding see a checkbox)
   while reading as a switch. Used where a setting is applied immediately rather than on a Save. */
.ef-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--ef-space-8);
  cursor: pointer;
}

.ef-switch input {
  /* Visually hidden, NOT display:none - it must stay focusable and announced. */
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}

.ef-switch-track {
  flex: 0 0 auto;
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: var(--ef-border);
  position: relative;
  transition: background 200ms;
}

.ef-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 200ms;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.ef-switch input:checked + .ef-switch-track { background: var(--ef-color-primary); }
.ef-switch input:checked + .ef-switch-track::after { transform: translateX(16px); }

/* Focus must be visible on the TRACK, since the input itself is hidden - otherwise keyboard users get no
   indication of where they are. */
.ef-switch input:focus-visible + .ef-switch-track {
  outline: 2px solid var(--ef-color-focus);
  outline-offset: 2px;
}

.ef-switch input:disabled + .ef-switch-track { opacity: 0.5; cursor: not-allowed; }
.ef-switch:has(input:disabled) { cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  .ef-switch-track,
  .ef-switch-track::after { transition: none; }
}


/* ── KPI CARDS ─────────────────────────────────────────────── */

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--ef-space-16); }
.kpi      { padding: var(--ef-space-16) var(--ef-space-24); }
.kpi-h    { display: flex; align-items: center; gap: var(--ef-space-8); margin-bottom: var(--ef-space-4); }
.kpi-dot  { width: 8px; height: 8px; border-radius: 50%; }
.kpi-lbl  { font-size: var(--ef-text-12); font-weight: 500; color: var(--ef-text-muted); }
.kpi-val  { font-size: var(--ef-text-24); font-weight: 700; letter-spacing: -0.5px; }
.kpi-sub  { font-size: var(--ef-text-12); margin-top: 2px; }
.kpi-spark { height: 36px; margin: var(--ef-space-4) 0; }
.kpi-foot { font-size: var(--ef-text-11); color: var(--ef-text-muted); margin-top: var(--ef-space-4); }


/* ── STATUS BAR ────────────────────────────────────────────── */

.sbar { height: 6px; border-radius: 3px; display: flex; overflow: hidden; background: var(--ef-surface-2); margin: var(--ef-space-8) 0; }
.sseg { transition: width 300ms; }

.legend { display: flex; gap: var(--ef-space-16); flex-wrap: wrap; font-size: var(--ef-text-11); color: var(--ef-text-muted); }
.li     { display: flex; align-items: center; gap: 4px; }
.ld     { width: 7px; height: 7px; border-radius: 50%; }


/* ── PROGRESS BAR ──────────────────────────────────────────── */

.pbar  { height: 6px; background: var(--ef-surface-2); border-radius: 3px; overflow: hidden; }
.pfill { height: 100%; background: var(--ef-color-primary); border-radius: 3px; transition: width 600ms; }


/* ── BAR CHART ─────────────────────────────────────────────── */

.mchart  { display: flex; align-items: flex-end; gap: 5px; height: 80px; padding: var(--ef-space-4) 0; }
.cbg     { display: flex; gap: 2px; align-items: flex-end; flex: 1; }
.cbar    { flex: 1; border-radius: 2px 2px 0 0; min-height: 3px; transition: height 600ms; }
.cbar.cur  { background: var(--ef-color-primary); }
.cbar.prev { background: var(--ef-color-primary-light); }
.clabels { display: flex; justify-content: space-around; font-size: var(--ef-text-11); color: var(--ef-text-muted); }


/* ── ACTIVITY FEED ─────────────────────────────────────────── */

.ae { display: flex; gap: var(--ef-space-12); padding: var(--ef-space-8) 0; border-bottom: 1px solid var(--ef-border); }
.ae:last-child { border-bottom: none; }
.aa { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: #fff; }
.ab { flex: 1; min-width: 0; }
.at { display: flex; justify-content: space-between; align-items: center; }
.an { font-size: var(--ef-text-12); font-weight: 600; }
.ar { font-size: var(--ef-text-12); color: var(--ef-color-primary); }
.atm { font-size: var(--ef-text-11); color: var(--ef-text-muted); }
.ad { font-size: var(--ef-text-11); color: var(--ef-text-muted); margin-top: 1px; }


/* ── INSPECTOR PANEL ───────────────────────────────────────── */

.inspector      { width: 300px; min-width: 300px; background: var(--ef-surface); border-left: 1px solid var(--ef-border); display: flex; flex-direction: column; overflow-y: auto; }
.inspector-tabs { padding: 0 var(--ef-space-16); }
/* Show-Plan is a header-toolbar button (a modal trigger); an obvious icon-led button, not a faint ghost link.
   Keep it from being squeezed by long submit labels. */
.wi-view-show-plan { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
.wi-view-show-plan-ico { font-size: 14px; line-height: 1; }
/* Route-target picker options (single-item WorkItemView + bulk WorkItemActionBar route/send-to-user picker,
   EUI#113): a vertical radio list with comfortable click targets. Was referenced but never defined. */
.wi-route-picker-options { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 12px; }
.wi-route-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 2px; }
.wi-route-opt input { margin: 0; }
/* The plan flowchart is WIDE (left→right timeline), so widen the modal box well past the 440px default and let the
   plan fill it (EfModal has a fixed-width .modal-box; widen via :has on the plan-body marker, the existing pattern).
   The body + canvas fill the available width/height so the gray canvas is the modal size, not a tiny inset. */
/* Plan modal genuinely needs to be wider than the lg tier (the flowchart) — a deliberate content override,
   expressed through the tier variables so it composes with the stable-height frame rather than fighting it. */
.modal-box:has(.wi-view-plan-modal-body) { --modal-w: min(1100px, 94vw); --modal-h: min(78vh, 720px); --modal-maxh: 92vh; }
.wi-view-plan-modal-body { width: 100%; }
.wi-view-plan-modal-body .wi-plan { width: 100%; }
.wi-view-plan-modal-body .wi-plan-canvas { height: min(70vh, 640px); width: 100%; }
.inspector-body { padding: var(--ef-space-16); flex: 1; overflow-y: auto; }
/* The Fields tab's Save bar (#95 / legacy #21). STICKY to the bottom of .inspector-body (the scroll container), so
   on a long field list the primary Save is always in view - before this the class was styled by no rule at all and
   the button scrolled out of sight under twenty-plus fields. The surface background + top border keep the fields
   that scroll beneath it from showing through. Wraps at narrow widths so the dirty/invalid note never overflows. */
.wi-view-fields-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ef-space-8);
  padding: var(--ef-space-8) 0;
  background: var(--ef-surface);
  border-top: 1px solid var(--ef-border);
}
/* Work-item open: loading row (spinner + text) and the in-place error state container. */
.wi-view-loading { display: flex; align-items: center; gap: var(--ef-space-8); padding: var(--ef-space-24); }
.wi-view-loading .ef-grid-state { margin: 0 auto; }

/* Small text utilities (were referenced across VotingPanel / WorkItemView / IconsTab but never defined -
   Bootstrap-style names that leaked in). Defined here so muted/small text renders correctly on those surfaces. */
.text-muted { color: var(--ef-text-muted); }
.text-sm { font-size: var(--ef-text-12); }

/* ── VOTING PANEL (VotingPanel.razor) ───────────────────────────────────────
   The voter-facing surface: cast/change options, live tally bars, deadline, voter list, resolved banner.
   These classes were referenced by the panel but had NO CSS, so the whole surface rendered unstyled. */
.wi-voting { margin-bottom: var(--ef-space-16); }
.wi-voting-head { font-size: var(--ef-text-14); font-weight: 700; margin: 0 0 var(--ef-space-12); }
.wi-voting-you { font-size: var(--ef-text-13); margin: 0 0 var(--ef-space-8); }
.wi-voting-options { display: flex; flex-wrap: wrap; gap: var(--ef-space-8); margin: 0 0 var(--ef-space-8); padding: 0; border: 0; min-width: 0; }
.wi-voting-legend { width: 100%; float: left; font-size: var(--ef-text-12); font-weight: 600; color: var(--ef-text-muted); padding: 0; margin-bottom: var(--ef-space-4); }
/* A vote option button; the caller's current choice is emphasized with the primary tint. */
.wi-vote-btn.is-chosen {
  background: var(--ef-color-primary);
  color: #fff;
  border-color: var(--ef-color-primary);
}
.wi-vote-comment { margin-bottom: var(--ef-space-8); }
/* Resolved banner: green tint for a winner, red tint for a no-winner outcome. */
.wi-voting-banner {
  padding: var(--ef-space-8) var(--ef-space-12);
  border-radius: var(--ef-radius-6);
  font-size: var(--ef-text-13);
  margin-bottom: var(--ef-space-12);
}
.wi-voting-banner.is-won   { background: var(--ef-green-bg); color: var(--ef-green-text); border: 1px solid rgba(22,163,74,0.15); }
.wi-voting-banner.is-nowin { background: var(--ef-yellow-bg); color: var(--ef-yellow-text); border: 1px solid rgba(217,119,6,0.15); }
/* Live tally: option name + a proportional bar + the weighted count. */
.wi-voting-tally { display: flex; flex-direction: column; gap: var(--ef-space-4); margin-top: var(--ef-space-8); }
.wi-voting-tally-row { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr auto; align-items: center; gap: var(--ef-space-8); font-size: var(--ef-text-12); }
.wi-voting-tally-name { font-weight: 600; }
.wi-voting-tally-bar { height: 8px; background: var(--ef-surface-2); border-radius: var(--ef-radius-4); overflow: hidden; }
.wi-voting-tally-bar > span { display: block; height: 100%; background: var(--ef-blue); border-radius: var(--ef-radius-4); transition: width 200ms; }
.wi-voting-tally-count { font-variant-numeric: tabular-nums; color: var(--ef-text-muted); white-space: nowrap; }
.wi-voting-voters { margin-top: var(--ef-space-12); font-size: var(--ef-text-12); }
.wi-voting-voters > summary { cursor: pointer; color: var(--ef-text-muted); }
.wi-voting-voters ul { list-style: none; padding: var(--ef-space-8) 0 0; margin: 0; display: flex; flex-direction: column; gap: var(--ef-space-4); }

/* Metadata rows */
.mr { display: flex; padding: 6px 0; align-items: center; }
.mk { width: 80px; flex-shrink: 0; font-size: var(--ef-text-12); color: var(--ef-text-muted); font-weight: 500; }
.mv { font-size: var(--ef-text-12); flex: 1; }

/* Inspector action buttons */
.iact { display: flex; flex-direction: column; gap: var(--ef-space-8); padding: var(--ef-space-12) 0; border-top: 1px solid var(--ef-border); margin-top: var(--ef-space-8); }
.iab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ef-space-8);
  height: 36px; width: 100%;
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  font-size: var(--ef-text-12);
  font-weight: 500;
  color: var(--ef-text);
  background: var(--ef-surface);
  transition: all 150ms;
  cursor: pointer;
}
.iab:hover { background: var(--ef-surface-2); }
.iab svg   { width: 15px; height: 15px; }
.iab.warn-icon svg { color: var(--ef-red-text); }

/* Inspector section header */
.ish    { display: flex; align-items: center; padding: var(--ef-space-8) 0; border-top: 1px solid var(--ef-border); margin-top: var(--ef-space-8); }
.ish h4 { font-size: var(--ef-text-12); font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--ef-text-muted); }


/* ── DOCUMENT VIEWER ───────────────────────────────────────── */

/* The viewer must fill the content area's full height. `.content` is a plain BLOCK (flex:1 in the .main column),
   so `flex:1` on .dv-layout was inert — nothing gave the row a height and it collapsed to the toolbar + the
   iframe's min-height, leaving a dead band below the document. Promote ONLY the viewer-hosting .content to a
   flex column (via :has, so the cards/grid views are untouched) so .dv-layout's flex:1 resolves to the full
   available height and the viewer fills it. */
.content:has(> .dv-layout) { display: flex; flex-direction: column; }
.dv-layout { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.dv-main   { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.dv-toolbar {
  display: flex;
  align-items: center;
  gap: var(--ef-space-4);
  padding: 0 var(--ef-space-12);
  height: 38px; min-height: 38px;
  background: var(--ef-surface);
  border-bottom: 1px solid var(--ef-border);
}
/* The right-side work-item action cluster (Show Plan + submit/route buttons). It SCROLLS horizontally when the
   buttons overflow the toolbar width, so a work item with many buttons stays fully reachable by mouse/touch — not
   only by keyboard Tab (the toolbar itself is a fixed-height flex-nowrap row inside .dv-main's overflow:hidden, so
   without this the overflow buttons were clipped). min-width:0 lets the cluster actually shrink so overflow-x can
   engage; the buttons flex-shrink:0 so they keep their size and scroll instead of squishing. */
.dv-toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--ef-space-4);
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  /* Thin, unobtrusive scrollbar — the cluster is short. */
  scrollbar-width: thin;
}
.dv-toolbar-actions > .wi-view-submit,
.dv-toolbar-actions > .wi-view-show-plan { flex-shrink: 0; }
.tg   { display: flex; align-items: center; gap: var(--ef-space-4); }
.tdiv { width: 1px; height: 18px; background: var(--ef-border); margin: 0 var(--ef-space-4); }
.ttxt { font-size: var(--ef-text-12); color: var(--ef-text-muted); padding: 0 var(--ef-space-4); }
.tsel {
  height: 26px;
  padding: 0 20px 0 6px;
  font-size: var(--ef-text-12);
  background: var(--ef-surface);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-4);
  color: var(--ef-text);
  appearance: none;
  cursor: pointer;
}

.dv-vp {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--ef-space-24);
  background: var(--ef-bg);
  overflow: auto;
}

/* CUSTOM WORK-ITEM PAGE: the tenant page owns its chrome, so it renders full-bleed (no padding, no centering) and
   the layout drops the inspector column (.dv-layout-full leaves .dv-main to fill the row). */
.dv-layout-full .dv-vp { padding: 0; align-items: stretch; justify-content: stretch; }
.wi-custom-page {
  flex: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.doc-page {
  background: #fff;
  box-shadow: var(--ef-shadow-2);
  border-radius: 2px;
  width: 580px;
  min-height: 750px;
  padding: 40px;
  color: #1e293b;
}
.dv-bbar {
  display: flex;
  align-items: center;
  padding: 0 var(--ef-space-12);
  height: 32px; min-height: 32px;
  background: var(--ef-surface);
  border-top: 1px solid var(--ef-border);
}


/* ── FILTER BAR & PAGINATION ───────────────────────────────── */

.fbar {
  display: flex;
  align-items: center;
  gap: var(--ef-space-8);
  padding: var(--ef-space-8) var(--ef-space-24);
  background: var(--ef-surface);
  border-bottom: 1px solid var(--ef-border);
}

.fd {
  height: 34px;
  padding: 0 var(--ef-space-24) 0 var(--ef-space-8);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  font-size: var(--ef-text-12);
  color: var(--ef-text);
  background: var(--ef-surface);
  appearance: none;
  cursor: pointer;
}

.pgn       { display: flex; align-items: center; justify-content: space-between; padding: var(--ef-space-8) var(--ef-space-12); font-size: var(--ef-text-11); color: var(--ef-text-muted); }
.pgn-pages { display: flex; gap: 2px; }
.pb {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--ef-radius-4);
  font-size: var(--ef-text-11);
  color: var(--ef-text-muted);
  cursor: pointer;
  transition: all 100ms;
}
.pb:hover  { background: var(--ef-surface-2); }
.pb.active { background: var(--ef-color-primary); color: #fff; }


/* ── LOADING STATES ────────────────────────────────────────── */

.spinner {
  border: 2px solid var(--ef-surface-2);
  border-top-color: var(--ef-color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Shared inline loading row (spinner + muted text) — the one idiom for "content is loading" across panels/tabs,
   replacing scattered bare-text "Loading…" lines. Reduced-motion users get a static ring (no spin). */
.inline-loading { display: flex; align-items: center; gap: var(--ef-space-8); padding: var(--ef-space-16) 0; color: var(--ef-text-muted); font-size: var(--ef-text-13); }
.inline-loading .spinner { width: 16px; height: 16px; flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.skel {
  background: var(--ef-surface-2);
  border-radius: var(--ef-radius-6);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.skel-t { height: 12px; margin-bottom: var(--ef-space-8); }
.skel-h { height: 20px; width: 55%; margin-bottom: var(--ef-space-12); }
/* An in-cell skeleton bar for EfDataGrid loading rows. */
.skel-cell { display: block; height: 12px; width: 70%; }

/* ── DATA-GRID STATES (EfDataGrid empty / loading / error) ─────
   The design-system empty-state pattern: centered icon + title + description + optional CTA. The error variant
   reuses the same layout in a danger tint so a failed load is visibly distinct from a genuinely empty result. */
.ef-grid-card { overflow: hidden; }
.ef-grid-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ef-space-8);
  padding: var(--ef-space-32) var(--ef-space-24);
  text-align: center;
}
.ef-grid-state-icon { width: 48px; height: 48px; color: var(--ef-text-muted); }
.ef-grid-state-title { font-size: var(--ef-text-14); font-weight: 600; color: var(--ef-text); }
.ef-grid-state-desc { font-size: var(--ef-text-12); color: var(--ef-text-muted); max-width: 42ch; }
.ef-grid-state-cta { margin-top: var(--ef-space-8); }
.ef-grid-error .ef-grid-state-icon { color: var(--ef-red); }
.ef-grid-error .ef-grid-state-title { color: var(--ef-red-text); }


/* ── TOASTS ────────────────────────────────────────────────── */

.toast-c {
  position: fixed;
  top: 60px; right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--ef-space-8);
}
.toast {
  width: 340px;
  padding: var(--ef-space-12);
  background: var(--ef-surface);
  border-radius: var(--ef-radius-10);
  box-shadow: var(--ef-shadow-2);
  border-left: 4px solid;
  display: flex;
  gap: var(--ef-space-8);
  animation: tin 300ms ease-out;
}
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast-body { flex: 1; }
.toast-tl   { font-size: var(--ef-text-12); font-weight: 600; }
.toast-msg  { font-size: var(--ef-text-11); color: var(--ef-text-muted); margin-top: 1px; }
.toast-x {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ef-text-muted);
  cursor: pointer;
  border-radius: 3px;
  font-size: 14px;
}
.toast-x:hover { background: var(--ef-surface-2); }

@keyframes tin  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.toast.out      { animation: tout 150ms ease-in forwards; }
@keyframes tout { to { opacity: 0; transform: translateX(16px); } }


/* ── MODALS ────────────────────────────────────────────────── */

.modal-ov {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mfin 200ms;
}
.modal-box {
  background: var(--ef-surface);
  border-radius: var(--ef-radius-14);
  box-shadow: var(--ef-shadow-2);
  /* Size TIERS (see EfModal.Size). Width is intentional per purpose — NOT patched per surface with :has() hacks. */
  width: var(--modal-w, 440px);
  max-width: calc(100vw - var(--ef-space-32));
  /* Height is STABLE within a tier: the box height is fixed to its tier, and the BODY scrolls. Switching tabs
     changes the body content but NEVER resizes the dialog (the jump the owner flagged). */
  height: var(--modal-h, auto);
  max-height: min(var(--modal-maxh, 80vh), calc(100vh - var(--ef-space-32)));
  display: flex;
  flex-direction: column;
  animation: mbin 200ms;
}
/* sm — confirms + short single-purpose forms. Height follows content (these don't tab). */
.modal-sm { --modal-w: 440px; --modal-maxh: 80vh; }
/* md — single-column editors (create-queue, user edit). Content height, capped. */
.modal-md { --modal-w: 640px; --modal-maxh: 85vh; }
/* lg — TABBED / multi-column editors (event, action, condition, queue settings). A FIXED height so tab-to-tab
   content differences scroll inside a stable frame instead of jumping the whole dialog. */
.modal-lg { --modal-w: 920px; --modal-h: min(78vh, 720px); --modal-maxh: 92vh; }
.modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ef-space-16) var(--ef-space-24);
  border-bottom: 1px solid var(--ef-border);
}
.modal-hdr h2 { font-size: var(--ef-text-14); font-weight: 700; }
.modal-bd     { padding: var(--ef-space-16) var(--ef-space-24); overflow-y: auto; flex: 1; }
.modal-ft {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--ef-space-8);
  padding: var(--ef-space-12) var(--ef-space-24);
  border-top: 1px solid var(--ef-border);
}

@keyframes mfin { from { opacity: 0; }            to { opacity: 1; } }
@keyframes mbin { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }


/* ── UTILITY: LINK ─────────────────────────────────────────── */

.plink     { display: inline-flex; align-items: center; gap: 4px; font-size: var(--ef-text-12); font-weight: 600; color: var(--ef-color-primary); }
.plink svg { width: 12px; height: 12px; }


/* ── LAYOUT HELPERS ────────────────────────────────────────── */

.g16 { display: flex; flex-direction: column; gap: var(--ef-space-16); }
.r2  { display: grid; grid-template-columns: 6fr 4fr; gap: var(--ef-space-16); }
.sh  { display: flex; align-items: center; justify-content: space-between; }
.sh h3 { font-size: var(--ef-text-14); font-weight: 700; }


/* ── SHOWCASE (Admin/Design System page) ───────────────────── */

.showcase-sec { margin-bottom: var(--ef-space-24); }
.showcase-hdr {
  font-size: var(--ef-text-12);
  font-weight: 700;
  color: var(--ef-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--ef-space-12);
  padding-bottom: var(--ef-space-8);
  border-bottom: 1px solid var(--ef-border);
}
.sc-row { display: flex; align-items: center; gap: var(--ef-space-8); flex-wrap: wrap; margin-bottom: var(--ef-space-8); }
.sc-lbl { font-size: var(--ef-text-11); color: var(--ef-text-muted); min-width: 70px; font-weight: 500; }


/* ── PAGE VIEW SYSTEM ──────────────────────────────────────── */

.pv        { display: none; flex: 1; overflow-y: auto; }
.pv.active { display: flex; flex-direction: column; }
.pv.dv-page.active { display: flex; flex-direction: row; }


/* ── ADMIN (P7.3) ──────────────────────────────────────────── */

/* The admin shell: a left section-nav + the active section panel, laid out inside the main content slot. */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--ef-space-24);
  align-items: start;
}
/* The admin section-nav reuses the global .sidebar class for the shared .ni/.nlbl nav-item styling, but it
   lives inside the .admin-layout GRID (a 220px + 1fr track layout), NOT the app-shell grid. Neutralize the
   app-shell-only .sidebar properties that misplace it here: grid-row:2 (the admin grid has no second row, so it
   yanked the nav out of its column) and the auto width (which collapsed the 220px track). Fill the grid column
   and let the height be content-driven so it sits beside the section panel. */
.admin-nav {
  grid-row: auto;
  width: 100%;
  align-self: stretch;
  /* Anchor the version footer to the bottom of the WINDOW, not the bottom of the nav's content. The nav is a
     flex column (from .sidebar) and the footer uses margin-top:auto, but the nav box is otherwise content-tall,
     so a taller section panel left the footer riding up under the last item. Make the nav fill the viewport
     (sticky below the 48px header, minus the .content space-24 top/bottom padding) so margin-top:auto pushes
     the footer to the window bottom; a very long nav still scrolls within. */
  position: sticky;
  top: 0;
  min-height: calc(100vh - 48px - (2 * var(--ef-space-24)));
  max-height: calc(100vh - 48px - (2 * var(--ef-space-24)));
}
.admin-nav-head {
  font-size: var(--ef-text-11);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ef-text-muted);
  padding: var(--ef-space-8) var(--ef-space-12);
}
/* A3: the admin sidebar is now THREE labelled groups (My Account / Management / System), each a group label
   + its own .nlist of .ni items, with a version footer pinned at the bottom. */
.admin-nav-group { margin-top: var(--ef-space-4); }
.admin-nav-group:first-of-type { margin-top: 0; }
.admin-nav-group-label {
  font-size: var(--ef-text-11);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ef-text-muted);
  padding: var(--ef-space-8) var(--ef-space-12) var(--ef-space-4);
}
.admin-nav-group .nlist { padding-top: 0; flex: 0 0 auto; }
.admin-content { min-width: 0; }
.admin-section-title {
  font-size: var(--ef-text-18);
  font-weight: 600;
  margin: 0 0 var(--ef-space-16);
}

/* Forms inside admin sections. */
.fg            { margin-bottom: var(--ef-space-16); }

/* A checkbox/radio ROW: control and label side by side.
   flex-direction MUST be reset. `.fg` (in FORM CONTROLS above) sets `flex-direction: column` for stacked
   label-over-input fields, and `.fg-inline` is the same specificity (one class), so without this the column
   direction won from the earlier rule and every admin checkbox rendered with its label CENTERED BELOW the box -
   visible on Queue Allocation and Out of Office. align-items:center then centred them horizontally, which is why
   it read as deliberately centred rather than broken. */
.fg-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--ef-space-8);
}

/* The box must not stretch or shrink: as a flex ITEM it would otherwise take its width from the container, which
   is what made the boxes look detached from their labels. */
.fg-inline input[type="checkbox"],
.fg-inline input[type="radio"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
}

/* Clickable label, sitting on the text baseline rather than stretching to the row. */
.fg-inline label {
  margin: 0;
  cursor: pointer;
  /* Wrap onto a second line without pushing the checkbox off-centre. */
  align-self: center;
}
.admin-hint {
  font-size: var(--ef-text-12);
  color: var(--ef-text-muted);
  margin-top: var(--ef-space-4);
}
.admin-pending-note { margin-top: var(--ef-space-12); }
.admin-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--ef-text-12); }
.admin-filter-row { display: flex; gap: var(--ef-space-16); flex-wrap: wrap; margin-bottom: var(--ef-space-16); }
.admin-filter-row .fg { flex: 1 1 240px; }
.admin-autoassign { margin-bottom: var(--ef-space-16); }

/* SEMANTIC ALERT banner (.ef-alert + a severity modifier). Used in 7 places - the Designer Summary tab's
   container-change impact check, Directory Sync's report, the System Settings email pointer - and was NEVER
   DEFINED, so every one of them rendered as a plain black-on-white div. That defeats the whole point: a
   "could not check impact" ERROR and an "all clear" SUCCESS looked identical, directly undercutting the
   FAIL-LOUD intent the code comments state.
   Defined here rather than rewriting the markup to .admin-banner because these live in the Designer as well as
   admin, and the severity names here (danger/warning/success/info) are the conventional ones - .admin-banner's
   variants are admin-scoped and confusingly named (-warn is RED, -caution is yellow). */
.ef-alert {
  padding: var(--ef-space-12) var(--ef-space-16);
  border-radius: var(--ef-radius-6);
  border: 1px solid transparent;
  font-size: var(--ef-text-13);
  margin-bottom: var(--ef-space-12);
}

/* Severity carries BOTH a background and a border colour: background alone is easy to miss on a dense page,
   and colour is never the only signal (each call site also carries its own leading text). */
.ef-alert-danger  { background: var(--ef-red-bg);    color: var(--ef-red-text);    border-color: var(--ef-red); }
.ef-alert-warning { background: var(--ef-yellow-bg); color: var(--ef-yellow-text); border-color: var(--ef-yellow); }
.ef-alert-success { background: var(--ef-green-bg);  color: var(--ef-green-text);  border-color: var(--ef-green); }
.ef-alert-info    { background: var(--ef-blue-bg);   color: var(--ef-blue-text);   border-color: var(--ef-blue); }

/* Screen-reader-only text. Already USED in the markup (icon-only column headers, "no value" cells) but never
   defined, so it was rendering VISIBLY - the very text meant to exist only for assistive tech. The clip-rect
   technique keeps it in the accessibility tree, unlike display:none or visibility:hidden. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* An inline explanatory note - why a control is inert, what a state means. Distinct from .admin-hint (quiet
   supporting text) because this one has to be NOTICED: it explains an interaction that would otherwise look
   broken. */
.ef-note {
  padding: var(--ef-space-12) var(--ef-space-16);
  border-radius: var(--ef-radius-6);
  font-size: var(--ef-text-13);
  margin-bottom: var(--ef-space-16);
  border: 1px solid transparent;
}

.ef-note-warn {
  background: var(--ef-yellow-bg);
  color: var(--ef-yellow-text);
  border-color: var(--ef-yellow);
}

/* ── QUEUE ALLOCATION ──────────────────────────────────────── */

/* The queue switch and the member roll-up share a row: the setting on the left, its consequence on the right. */
.qa-toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ef-space-16);
}

.qa-toggle-label { font-weight: 600; }

.qa-member-counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ef-space-16);
  font-size: var(--ef-text-12);
  color: var(--ef-text-muted);
}

/* tabular-nums so the counts do not shift as they change. */
.qa-member-counts strong { color: var(--ef-text); font-variant-numeric: tabular-nums; }

/* Name over login: the login is a secondary identifier, so it is quieter and smaller. */
.qa-member-name { display: flex; flex-direction: column; gap: 1px; }
.qa-member-label { font-weight: 500; }
.qa-member-login { font-size: var(--ef-text-11); color: var(--ef-text-muted); }

.qa-member-ooo { font-size: var(--ef-text-12); font-variant-numeric: tabular-nums; }
/* Away NOW reads as a live condition; a future window is just information. */
.qa-ooo-active { color: var(--ef-yellow-text); font-weight: 500; }
.qa-ooo-upcoming { color: var(--ef-text-muted); }
.qa-ooo-none { color: var(--ef-border); }
/* #95 / legacy #16: every window on its own line with its Clear, then the Set button. */
.qa-member-ooo { display: flex; flex-direction: column; align-items: flex-start; gap: var(--ef-space-4); }
.qa-ooo-period { display: inline-flex; align-items: center; gap: var(--ef-space-4); }

/* The out-of-office ranges editor (OooRangesEditor): start / end / remove on one row, wrapping when narrow. */
.ooo-ranges { display: flex; flex-direction: column; gap: var(--ef-space-8); }
.ooo-range-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--ef-space-8); }
.ooo-range-row .fg { flex: 1 1 140px; margin-bottom: 0; }
.ooo-range-err { flex-basis: 100%; }

/* Right-aligned panel-header actions row (A11/A15: selects or an add button pushed to the top-right of a
   section, parity with the reference admin panel headers). */
.admin-panel-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--ef-space-8); flex-wrap: wrap; margin-bottom: var(--ef-space-16); }
.admin-panel-actions .fi { width: auto; min-width: 200px; }

/* Data-table per-row action cluster. */
.dt-actions { display: flex; gap: var(--ef-space-8); }

/* Red icon-only revoke button (A12 active-sessions: a red circled-x replaces the text "Revoke" button). */
.admin-revoke-btn { color: var(--ef-red-text); display: inline-flex; align-items: center; padding: var(--ef-space-4); }
.admin-revoke-btn:hover { background: var(--ef-red-bg); }

/* A12: the blue "You" badge marking the signed-in admin's own session row. */
.admin-you-badge { margin-left: var(--ef-space-8); }

/* Secret field tag (WF#13). */
.admin-secret-tag {
  display: inline-block;
  margin-left: var(--ef-space-8);
  padding: 1px 6px;
  border-radius: var(--ef-radius-4);
  font-size: var(--ef-text-11);
  background: var(--ef-yellow-bg);
  color: var(--ef-yellow-text);
  vertical-align: middle;
}

/* Checklist (group members / participation). */
.admin-checklist { display: flex; flex-direction: column; gap: var(--ef-space-8); max-height: 320px; overflow-y: auto; }
.admin-checklist-item { display: flex; align-items: center; gap: var(--ef-space-8); }

/* Directory-search results (admin Users "look up user"). A <ul> with NO rule, so it kept the browser default:
   bullet points and a left indent beside each result BUTTON. The sibling .admin-checklist never showed this
   because display:flex suppresses list markers - this one had nothing at all.
   list-style + padding-left must BOTH be reset: removing the marker alone leaves the indent behind. */
.admin-picker-results {
  list-style: none;
  margin: var(--ef-space-4) 0 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
}
/* Full-width rows so the whole result is a click target, not just the text. */
.admin-picker-results > li { display: flex; }
.admin-picker-results > li > * { flex: 1; justify-content: flex-start; text-align: left; }

/* Users edit modal: the user's Groups (name link + source badge per row, then the checklist when changing them).
   Separated from the account fields above by a rule, as the Enhanced-UI modal did. Tokens only. */
.user-groups { border-top: 1px solid var(--ef-border); padding-top: var(--ef-space-12); }
.user-groups-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ef-space-8); }
.user-groups-list {
  list-style: none;
  margin: var(--ef-space-4) 0 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ef-space-8);
  max-height: 240px;
  overflow-y: auto;
}
.user-groups-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--ef-space-8); }
.user-groups .admin-checklist { margin-top: var(--ef-space-8); max-height: 240px; }

/* Groups: the toolbar filter box + the 5-tab Edit-Group modal (Details / Members / Links / Workflow Permissions
   / Queue Permissions). The permission matrices need a wider box than the default 440px modal, so widen it when
   the modal carries the .group-edit container (mirrors the wizard's .nw-steps widening below). Tokens only. */
.group-filter { width: 240px; max-width: 100%; }
/* (Removed .modal-box:has(.group-edit) width hack — the group-edit modal now passes Size="md".) */
.group-tab-panel { padding-top: var(--ef-space-12); }
.group-tab-panel.hidden { display: none; }
.group-tab-panel .fi { width: 100%; }
.group-tab-panel .admin-checklist { margin-top: var(--ef-space-8); }
.group-danger {
  margin-top: var(--ef-space-16);
  padding-top: var(--ef-space-12);
  border-top: 1px solid var(--ef-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* Workflow-permission cards: one bordered card per workflow, the 4 flags in a responsive grid. */
.group-wfperm-list { display: flex; flex-direction: column; gap: var(--ef-space-8); max-height: 420px; overflow-y: auto; }
.group-wfperm-card { border: 1px solid var(--ef-border); border-radius: var(--ef-radius-6); padding: var(--ef-space-8); }
.group-wfperm-name { font-weight: 600; font-size: var(--ef-text-13); margin-bottom: var(--ef-space-4); }
.group-perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--ef-space-4) var(--ef-space-12); }
/* Queue-permission matrix: workflow selector + enabled/disabled filter, then a horizontally-scrollable 7-flag grid. */
.group-qperm-controls { display: flex; gap: var(--ef-space-8); align-items: flex-end; margin-bottom: var(--ef-space-12); }
.group-qperm-controls .fg { margin-bottom: 0; }
.group-qperm-bulk { display: flex; gap: var(--ef-space-8); margin-bottom: var(--ef-space-8); }
.group-qperm-scroll { overflow-x: auto; max-height: 360px; overflow-y: auto; }
.group-qperm-table { font-size: var(--ef-text-12); width: 100%; }
.group-qperm-col { text-align: center; white-space: nowrap; }
.group-qperm-qname { font-weight: 500; }
.group-qperm-rowactions { white-space: nowrap; }
.btn-link {
  background: none;
  border: none;
  padding: 0 2px;
  color: var(--ef-color-primary);
  cursor: pointer;
  font-size: var(--ef-text-12);
  font-family: var(--ef-font);
}
.btn-link:hover { text-decoration: underline; }

/* A feature-package slot placeholder (kept in the DOM, hidden, as a named seam). */
.admin-slot { display: none; }

/* OOO auto-handling config panel (fills the reserved out-of-office slot, OOO technical-specs 9). The real
   per-scope toggle form: a bordered card with a scope picker, the two toggles, and the effective-value hint.
   Tokens only. */
.ooo-autohandling { margin-bottom: var(--ef-space-16); }
.ooo-autohandling-panel {
  padding: var(--ef-space-16);
  background: var(--ef-surface);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-10);
  box-shadow: var(--ef-shadow-1);
}
.ooo-autohandling-heading {
  font-size: var(--ef-text-13);
  font-weight: 700;
  color: var(--ef-text);
  margin: 0 0 var(--ef-space-4);
}
.ooo-autohandling-body {
  font-size: var(--ef-text-12);
  color: var(--ef-text-muted);
  margin: 0 0 var(--ef-space-16);
}
.ooo-autohandling-context {
  font-size: var(--ef-text-12);
  color: var(--ef-text);
  margin: 0 0 var(--ef-space-12);
}
.ooo-autohandling-scope {
  display: flex;
  gap: var(--ef-space-16);
  flex-wrap: wrap;
  margin-bottom: var(--ef-space-16);
}
.ooo-autohandling-scope .fg { flex: 1 1 220px; margin-bottom: 0; }
/* Dim the auto-allocation label while the toggle is disabled (release off) — supplements the disabled state
   with a non-color cue per the accessibility skill (color independence). */
.ooo-autohandling-disabled-label { opacity: 0.55; }
.ooo-autohandling .admin-hint { margin-top: 0; margin-bottom: var(--ef-space-16); }
.ooo-autohandling .admin-panel-actions { margin-bottom: 0; }

/* Settings / license / integration cards. */
.admin-settings-card,
.admin-license-card,
.admin-impersonation-card,
.admin-placeholder { padding: var(--ef-space-16); margin-bottom: var(--ef-space-16); }
.admin-placeholder-title { font-size: var(--ef-text-14); font-weight: 600; margin: 0 0 var(--ef-space-8); }

/* AI config section (A7): a status banner, an enabled toggle row, and read-only status rows. */
.admin-banner {
  padding: var(--ef-space-12) var(--ef-space-16);
  margin-bottom: var(--ef-space-16);
  border-radius: var(--ef-radius-4);
  font-size: var(--ef-text-13);
  background: var(--ef-yellow-bg);
  color: var(--ef-yellow-text);
}
.admin-banner-ok      { background: var(--ef-green-bg);  color: var(--ef-green-text); }
.admin-banner-warn    { background: var(--ef-red-bg);    color: var(--ef-red-text); }
.admin-banner-caution { background: var(--ef-yellow-bg); color: var(--ef-yellow-text); }
.admin-banner-muted   { background: var(--ef-surface-2); color: var(--ef-text-muted); }
/* Test-connection result banner: a bolded outcome word + the detail message on its own line. */
.admin-banner strong { display: block; margin-bottom: var(--ef-space-4); }
.ai-config-toggle { display: inline-flex; align-items: center; gap: var(--ef-space-8); font-size: var(--ef-text-13); }
.ai-config-status { display: flex; align-items: center; font-size: var(--ef-text-13); color: var(--ef-text); }

/* FIELD GROUPING — a bordered sub-section with a title and a one-line description of WHY the settings inside belong
   together. A flat run of `.fg` rows gives an operator no way to tell which knobs relate to which, so the whole page
   has to be read top-to-bottom; grouping lets them jump to the part they came for.

   Named `.settings-group` because it is NOT AI-specific: `.ai-config-group` was the original name and is kept as an
   alias so that page and its data-testids stay untouched. Prefer `.settings-group` in new code.
   (For a Designer surface, `.designer-fieldset` + <legend> is the established equivalent - use that there rather
   than introducing a second look on the same screen.) */
.settings-group,
.ai-config-group { border: 1px solid var(--ef-border); border-radius: var(--ef-radius-6); padding: var(--ef-space-16); margin-bottom: var(--ef-space-16); }
.settings-group-title,
.ai-config-group-title { font-size: var(--ef-text-13); font-weight: 600; margin: 0 0 var(--ef-space-4); color: var(--ef-text); }
.settings-group-desc,
.ai-config-group-desc { font-size: var(--ef-text-12); color: var(--ef-text-muted); margin: 0 0 var(--ef-space-12); }
.settings-group .fg:last-child,
.ai-config-group .fg:last-child { margin-bottom: 0; }

/* SMALL SHARED UTILITIES, replacing inline styles that were repeated across pages. Each of these existed as a
   `style="..."` attribute in three or more files; an ad-hoc inline value is invisible to a theme change and drifts
   (three files had three slightly different "add a little top margin" values). */

/* A card whose only child is a data table: the table's own borders must not poke out past the card's radius. */
.card-table { overflow: hidden; }

/* A table wider than its container - scrolls itself rather than stretching the page. */
.table-scroll { overflow-x: auto; }

/* A bounded scroll area for a long list inside a modal, so the modal's footer stays reachable. */
.list-scroll { max-height: 14rem; overflow: auto; }

/* "Nudge below the control above" - the spacing between a field and a secondary affordance under it. */
.mt-xs { margin-top: var(--ef-space-4); }
.mt-sm { margin-top: var(--ef-space-8); }

/* A flex row whose ends are pushed apart (title left, action right). */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--ef-space-8); }

/* The required-field marker. Was seven separate inline `color:var(--ef-color-danger)` spans in one file. */
.required-mark { color: var(--ef-color-danger); }

/* Fixed table column widths, so a th does not carry a hard-coded pixel style. */
.col-narrow { width: 100px; }
.col-med    { width: 140px; }
.col-wide   { width: 200px; }
/* The dangerous-knob group: an unlock header row, and a locked body dimmed until unlocked. */
.ai-config-lock-row { display: flex; align-items: center; gap: var(--ef-space-8); font-size: var(--ef-text-13); margin-bottom: var(--ef-space-12); }
.ai-config-locked-body.is-locked { opacity: .55; }

/* Key/value config list (license fields, integration config). */
.admin-config-list { margin: 0; }
.admin-config-row { display: grid; grid-template-columns: 160px 1fr; gap: var(--ef-space-12); padding: var(--ef-space-4) 0; }
.admin-config-row dt { color: var(--ef-text-muted); font-size: var(--ef-text-12); }
.admin-config-row dd { margin: 0; font-size: var(--ef-text-13); word-break: break-word; }

/* License status banner. */
.admin-license-status {
  padding: var(--ef-space-12) var(--ef-space-16);
  border-radius: var(--ef-radius-6);
  margin-bottom: var(--ef-space-24);
  font-size: var(--ef-text-13);
}
.admin-license-status.is-licensed   { background: var(--ef-green-bg);  color: var(--ef-green-text); }
.admin-license-status.is-unlicensed { background: var(--ef-yellow-bg); color: var(--ef-yellow-text); }

/* Integrations list. */
.admin-integration-list { display: flex; flex-direction: column; gap: var(--ef-space-16); }
.admin-integration-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--ef-space-8); }
.admin-integration-name { font-size: var(--ef-text-14); font-weight: 600; margin: 0; }
.admin-integration-caps { display: flex; gap: var(--ef-space-8); }

/* Analytics dashboard (analytics slice 1). The former "coming soon" placeholder styles are retired with the
   placeholder itself. Deliberately CSS-only bars rather than a charting dependency: slice 1's shapes (backlog by
   queue, age bands, throughput by day) are all "label + value + share", which a table with a bar column renders
   accessibly, copyably, and with no new package to keep patched. */
/* The KPI row REUSES the existing .kpi-* primitives (.kpi-lbl/.kpi-val, --ef-text-24) rather than redefining a
   parallel set - these were duplicating them and hard-coding 1.75rem instead of the token. Only the grid differs:
   auto-fill, because the tile count comes from the dashboard spec rather than being a fixed four. */
/* auto-fit (not auto-fill) so 2-3 tiles stretch to fill the row instead of leaving phantom empty columns, and a
   220px floor because a formatted duration ("2.1 days") overflowed the old 180px track. */
.an-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--ef-space-16); margin-bottom: var(--ef-space-24); }
/* The label/value/note stack is ordered visually, not in source order: the eye should hit the NUMBER first, so the
   caption sits above it in small muted caps and the unit note below. space-between keeps the number's baseline
   aligned across tiles even when one caption wraps to two lines. */
.an-tile { display: flex; flex-direction: column; gap: var(--ef-space-4);
  justify-content: space-between; min-height: 104px; }
.an-tile .kpi-lbl { text-transform: uppercase; letter-spacing: 0.04em; font-size: var(--ef-text-11); }
/* tabular-nums so a row of KPI figures aligns; the rest of the type comes from .kpi-val. */
.an-tile-value { font-variant-numeric: tabular-nums; line-height: 1.1; }
/* An unmeasured KPI is muted so it cannot be mistaken for a real figure. */
.an-tile-nodata { color: var(--ef-text-muted); font-weight: 500; }
.an-tile-note { font-size: var(--ef-text-11); color: var(--ef-text-muted); }

.an-panel { margin-bottom: var(--ef-space-16); }
.an-panel-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--ef-space-8); margin-bottom: var(--ef-space-8); }
.an-panel-title { font-size: var(--ef-text-14); font-weight: 600; margin: 0; }
.an-panel-warn { font-size: var(--ef-text-11); color: var(--ef-color-warn-text, var(--ef-text-muted));
  border: 1px solid var(--ef-border); border-radius: var(--ef-radius-6); padding: 1px var(--ef-space-8); cursor: help; }

.an-table { width: 100%; }
/* tabular-nums so digits line up column-wise - a mis-aligned metric column reads as sloppy data. */
.an-table .an-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;
  font-weight: 600; }
/* The bar is a supporting visual, not the data: 40% starved the label column so queue names truncated. The track
   behind it gives each bar a consistent extent, so a short bar reads as "small share" rather than "missing bar". */
.an-table .an-barcol { width: 28%; }
.an-bartrack { display: block; background: var(--ef-surface-2);
  border-radius: var(--ef-radius-6); overflow: hidden; }
.an-bar { display: block; height: 8px; border-radius: var(--ef-radius-6);
  background: var(--ef-color-primary); min-width: 2px; }

/* Impersonation banner (P7.3) - a persistent page-level alert when acting as another user. */
/* Impersonation banner — matches the EUI look (owner 2026-07-19: "just like EUI"): a full-width RED strip with
   white text pinned above the app shell, not the prior yellow warning bar. Keeps IR2's richer content (names the
   initiating admin) + the accessible stop control (role="alert" on the element). */
.impersonation-banner {
  display: flex;
  align-items: center;
  gap: var(--ef-space-8);
  padding: var(--ef-space-4) var(--ef-space-16);
  background: #d32f2f;
  color: #fff;
  font-size: var(--ef-text-13);
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 9999;
}
.impersonation-banner svg { width: 16px; height: 16px; flex: none; }
.impersonation-text { flex: 1; }
.impersonation-stop-form { margin: 0; }
/* Outlined-on-red stop button, matching EUI's "End Impersonation" affordance. */
.impersonation-stop {
  margin-left: auto;
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-size: var(--ef-text-12);
}
.impersonation-stop:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }

/* Release notes (rendered markdown). */
.rn-content   { max-width: 760px; }
.rn-h2        { font-size: var(--ef-text-18); font-weight: 600; margin: var(--ef-space-24) 0 var(--ef-space-8); }
.rn-h3        { font-size: var(--ef-text-14); font-weight: 600; margin: var(--ef-space-16) 0 var(--ef-space-4); }
.rn-text      { font-size: var(--ef-text-13); margin: var(--ef-space-8) 0; }
.rn-list      { margin: var(--ef-space-8) 0; padding-left: var(--ef-space-24); }
.rn-list li   { font-size: var(--ef-text-13); margin: var(--ef-space-4) 0; }
.rn-divider   { border: none; border-top: 1px solid var(--ef-border); margin: var(--ef-space-24) 0; }
.rn-content code,
.admin-mono code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; background: var(--ef-surface-2); padding: 1px 4px; border-radius: var(--ef-radius-4); }

/* WHAT'S NEW - the customer-facing tab. Same markdown renderer and the same .rn-* elements, restyled for reading
   rather than scanning: a release heading (h2) becomes a section marker, each feature (h3) a titled block, and the
   prose gets real line-height and measure. Deliberately typographic, not card-based - the source is written as
   short feature narratives, and boxing each one would fragment a page meant to be read top to bottom. */
.rn-whats-new { max-width: 680px; }

/* The release marker (e.g. "5.0 - August 2026"). Newest first in the source; the accent bar makes each release
   boundary obvious when more are added below it. */
.rn-whats-new .rn-h2 {
  font-size: var(--ef-text-14);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ef-color-primary);
  margin: var(--ef-space-32) 0 var(--ef-space-16);
  padding-left: var(--ef-space-12);
  border-left: 3px solid var(--ef-color-primary);
}
.rn-whats-new .rn-h2:first-child { margin-top: var(--ef-space-8); }

/* One feature. Larger than the technical notes' h3 because here it is the primary unit of the page. The scale has
   no 16 (11/12/13/14/18/24), and 18 is the notes' own h2 - so use 18 here and demote the release marker to 14,
   which keeps the hierarchy without inventing a token. */
.rn-whats-new .rn-h3 {
  font-size: var(--ef-text-18);
  font-weight: 600;
  color: var(--ef-text);
  margin: var(--ef-space-24) 0 var(--ef-space-8);
}

/* Reading copy: bigger and looser than the notes' dense 13px. */
.rn-whats-new .rn-text {
  font-size: var(--ef-text-14);
  line-height: 1.65;
  color: var(--ef-text);
  margin: 0 0 var(--ef-space-12);
}

.rn-whats-new .rn-list li { font-size: var(--ef-text-14); line-height: 1.6; margin: var(--ef-space-8) 0; }
.rn-whats-new .rn-divider { margin: var(--ef-space-32) 0 var(--ef-space-16); }


/* ── RESPONSIVE ────────────────────────────────────────────── */

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .r2       { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .sidebar              { width: 56px; }
  .sidebar .nlbl,
  .sidebar .nsec,
  .sidebar .sf-txt      { display: none; }
  .sidebar .ni          { justify-content: center; padding: 0; }
  /* Work-item view: REFLOW the viewer/inspector split to a vertical stack instead of HIDING the inspector.
     Hiding it (the old `.inspector{display:none}`) removed the entire Fields/Comments/History column - including
     the editable indexes + Save - so on a tablet you could open an item but not edit it. Stacked: the document
     viewer on top, the inspector below at full width (its side border becomes a top border), the whole layout
     scrolls. */
  .dv-layout   { flex-direction: column; overflow-y: auto; }
  .dv-main     { overflow: visible; }
  .inspector   { width: 100%; min-width: 0; border-left: 0; border-top: 1px solid var(--ef-border); }
}

/* ── Designer (P7.4) - tokens only ─────────────────────────────────────────── */

/* A labelled checkbox row reused across the designer tabs/slots (a checkbox + its inline label). */
/* Checkbox row: a stable, self-contained control row. `align-items: flex-start` + a matched line-height keeps the
   box aligned to the FIRST line of a wrapping label (they used to drift — "checkboxes tend to float"). Consecutive
   rows sit tight as a group (4px), with the normal control gap (12px) only AFTER the last one before the next
   control — so a cluster of toggles reads as one group instead of evenly-spaced floaters. */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--ef-space-8);
  font-size: var(--ef-text-13);
  line-height: 16px;
  min-height: 16px;
  margin-bottom: var(--ef-space-4);
  cursor: pointer;
}
/* The last checkbox in a run gets the full control gap before whatever follows. */
.checkbox-row:not(:has(+ .checkbox-row)) { margin-bottom: var(--ef-space-12); }
/* RADIO too, not just checkbox. The work-item route picker (WorkItemView's destination-queue radiogroup) uses
   .checkbox-row with radios, and a checkbox-only selector left those unsized: browser-default size next to the
   16px checkboxes everywhere else, and - without flex-shrink:0 - squeezed by a long queue name. */
.checkbox-row input[type="checkbox"],
.checkbox-row input[type="radio"] { width: 16px; height: 16px; flex-shrink: 0; margin: 0; }

.designer-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--ef-space-24);
  align-items: start;
}
/* Same fix as .admin-nav: this section-nav carries the global .sidebar class for the shared nav-item styling
   but lives in the .designer-layout grid (single row), so neutralize .sidebar's app-shell grid-row:2 + width
   that would otherwise yank it into a phantom second row and collapse the 200px track. */
.designer-nav {
  grid-row: auto;
  width: 100%;
  align-self: stretch;
}
.designer-nav-head {
  font-size: var(--ef-text-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--nav-text);
  padding: var(--ef-space-16);
  border-bottom: 1px solid var(--nav-divider);
}

/* The vertical icon+label section rail (ports the Enhanced-UI .nav-panel/.nav-item treatment): a full-width
   column of rows, each an icon (16px) + label, with a blue-tint background + 3px left-border accent on the
   active row. Rendered directly in Designer.razor (not via the shared EfTabs underline strip). */
.designer-nav-list {
  display: flex;
  flex-direction: column;
}
.designer-nav-item {
  display: flex;
  align-items: center;
  gap: var(--ef-space-8);
  width: 100%;
  padding: var(--ef-space-8) var(--ef-space-16);
  font-size: var(--ef-text-13);
  color: var(--nav-text);
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: all 150ms;
}
.designer-nav-item:hover {
  background: var(--nav-hover);
  color: var(--nav-text-active);
}
.designer-nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  border-left-color: var(--nav-accent);
  font-weight: 600;
}
.designer-nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
}
.designer-nav-actions { padding: var(--ef-space-12) var(--ef-space-8); }
/* Import/Export row: sits below the save/publish actions. The Import control is a <label> styled as a button that
   wraps a visually-hidden <InputFile> (a native file input can't be a Blazor button, so the label triggers it). */
.designer-nav-io { display: flex; gap: var(--ef-space-8); margin-top: var(--ef-space-8); }
.designer-import-label { cursor: pointer; display: inline-flex; align-items: center; }
.designer-import-label input.designer-import-input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Workflow-list "Import workflow" (import-as-new): same hidden-input-in-a-label pattern as the Designer's Import. */
.wf-import-label { cursor: pointer; display: inline-flex; align-items: center; }
.wf-import-label.is-busy { opacity: 0.6; pointer-events: none; }
/* The workflow name is the row's identity, so it carries the weight rather than reading like the other cells. */
.wf-name { font-weight: 600; }
.wf-import-label input.wf-import-input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.designer-content { min-width: 0; }
.designer-tab > .card { margin-bottom: var(--ef-space-16); }
.designer-validation { border: 1px solid var(--ef-danger, #ce614e); margin-bottom: var(--ef-space-16); }
.designer-validation ul { margin: var(--ef-space-8) 0 0; padding-left: var(--ef-space-16); }
/* Workflow edit lock. The notices sit above the panel: what happened, then the one or two things to do. In the
   read-only scope (js/designer-readonly.js) editors are READONLY, not disabled, so their text stays selectable for
   copying; tint them so they do not read as editable. */
.designer-readonly-scope[data-readonly="true"] .fi[readonly],
.designer-readonly-scope[data-readonly="true"] textarea[readonly] { background: var(--ef-surface-2); cursor: text; }
.designer-edit-lock {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--ef-space-8) var(--ef-space-12);
  background: var(--ef-yellow-bg); color: var(--ef-yellow-text); border: 1px solid var(--ef-yellow); margin-bottom: var(--ef-space-16);
}
.designer-edit-lock > span { flex: 1 1 24rem; }
.designer-edit-lock-lost { border-color: var(--ef-danger, #ce614e); }
.designer-import-label.disabled { opacity: 0.6; pointer-events: none; cursor: default; }
.ai-plan-readonly-note, .ai-plan-status-note { margin: 0 0 var(--ef-space-8); color: var(--ef-text-muted); }
.ai-plan-live-note { margin: 0 0 var(--ef-space-8); color: var(--ef-text); font-weight: 600; }

/* The designer footer stat bar (Queues * Fields * Rules + Draft/Saved badge). */
.designer-footer {
  display: flex;
  align-items: center;
  gap: var(--ef-space-12);
  padding: var(--ef-space-8) var(--ef-space-24);
  border-top: 1px solid var(--ef-border);
  font-size: var(--ef-text-13);
}
.designer-stat-sep { color: var(--ef-text-muted); }
.designer-stat-spacer { flex: 1; }

.designer-slot { margin-bottom: var(--ef-space-16); }
.designer-slot-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--ef-space-12); }
.designer-slot-actions { margin-top: var(--ef-space-12); }

/* A subtle informational banner (non-alarming): used where an authoring surface saves but is not yet wired at
   runtime (e.g. the advanced-start condition, saved but not evaluated at kickoff). Primary-tinted, not danger. */
.designer-info-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--ef-space-8);
  padding: var(--ef-space-8) var(--ef-space-12);
  margin-bottom: var(--ef-space-12);
  background: var(--ef-color-primary-bg);
  border: 1px solid var(--ef-color-primary-light);
  border-radius: var(--ef-radius-6);
  font-size: var(--ef-text-13);
  color: var(--ef-text);
}
.designer-info-banner-icon { color: var(--ef-color-primary); font-size: var(--ef-text-18); line-height: 1.2; }
.designer-subhead { font-size: var(--ef-text-13); font-weight: 600; margin: var(--ef-space-12) 0 var(--ef-space-8); }
.designer-list { list-style: none; padding: 0; margin: 0; }
.designer-row { display: flex; align-items: center; gap: var(--ef-space-8); margin-bottom: var(--ef-space-8); }

/* Designer form-layout primitives (used by the config slots + the queue-event/timer editor). These were
   referenced by markup but previously undefined, so the timer and voting-config forms rendered as unstyled
   stacks. Token-based + theme-aware. */
/* A bordered config section with a styled legend — groups related controls in the dense slot/editor forms. */
.designer-fieldset {
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-10);
  padding: var(--ef-space-16);
  margin: 0 0 var(--ef-space-16);
}
.designer-fieldset > legend {
  font-size: var(--ef-text-12);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ef-text-muted);
  padding: 0 var(--ef-space-8);
}
/* A horizontal row of field groups (wraps on narrow widths). */
.inline-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--ef-space-16);
  margin-bottom: var(--ef-space-12);
}
.inline-fields > .fg { margin-bottom: 0; }
/* A width-constrained input — numbers, color swatches, small selects that shouldn't stretch full-width. */
.fi-narrow { max-width: 200px; }
input[type="color"].fi-narrow { max-width: 56px; padding: var(--ef-space-4); }
/* A responsive multi-column grid of checkbox rows (voter rosters, weekday pickers). */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--ef-space-4) var(--ef-space-16);
}
/* Inline validation-summary list (voting-config slot): compact bulleted errors in the .f-err treatment. */
.voting-error-list { margin: var(--ef-space-4) 0 0; padding-left: var(--ef-space-16); }
.voting-error-list li { margin-bottom: var(--ef-space-4); }

/* A vertical radio group + its individual selectable rows (timer cadence). */
.radio-stack { display: flex; flex-direction: column; gap: var(--ef-space-4); }
.radio-row {
  display: flex;
  align-items: center;
  gap: var(--ef-space-8);
  padding: var(--ef-space-4) 0;
  font-size: var(--ef-text-13);
  cursor: pointer;
}

/* Preset-icon picker (Icons tab). A responsive grid of selectable icon tiles + the selected-icon chip row.
   Tokens only; the tile shows the icon glyph (when an icon font is present) plus the token short-name. */
.icon-chip-list { list-style: none; padding: 0; margin: 0 0 var(--ef-space-8); display: flex; flex-wrap: wrap; gap: var(--ef-space-8); }
.icon-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--ef-space-4);
  padding: var(--ef-space-4) var(--ef-space-8);
  background: var(--ef-color-primary-bg);
  color: var(--ef-color-primary);
  border: 1px solid var(--ef-color-primary-light);
  border-radius: var(--ef-radius-14);
  font-size: var(--ef-text-12);
}
.icon-chip-name { font-weight: 600; }
.icon-chip-remove { height: 20px; padding: 0 var(--ef-space-4); color: inherit; }
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: var(--ef-space-8);
  max-height: 320px;
  overflow-y: auto;
  padding: var(--ef-space-4);
}
.icon-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--ef-space-4);
  min-height: 64px;
  padding: var(--ef-space-8);
  background: var(--ef-surface);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  color: var(--ef-text);
  cursor: pointer;
  transition: all 150ms;
}
.icon-grid-item:hover { background: var(--ef-surface-2); border-color: var(--ef-color-primary-light); }
.icon-grid-item.selected { background: var(--ef-color-primary-bg); border-color: var(--ef-color-primary); color: var(--ef-color-primary); }
.icon-grid-item > i { font-size: var(--ef-text-18); line-height: 1; }
.icon-grid-item[disabled] { cursor: default; opacity: 0.65; }
.icon-grid-label { font-size: var(--ef-text-11); text-align: center; word-break: break-word; }

/* Icon library editor preview: a fixed-size box showing the currently-composed icon glyph (Icons tab + the
   per-button assignment picker in QueueEventEditor). */
.icon-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  font-size: var(--ef-text-18);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  background: var(--ef-surface);
}

/* Per-button icon assignment (QueueEventEditor): a scrollable checkbox list of the workflow's library icons the
   author toggles into the button's IconNames. */
.icon-assign-list {
  display: flex;
  flex-direction: column;
  gap: var(--ef-space-4);
  max-height: 180px;
  overflow-y: auto;
  padding: var(--ef-space-4);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
}
.icon-assign-row { display: flex; align-items: center; gap: var(--ef-space-8); font-size: var(--ef-text-13); padding: 3px 4px; cursor: pointer; }
.icon-assign-row > i { width: 18px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .icon-grid-item { transition-duration: 0.01ms; }
}

/* Floating AI assistant (Designer-only). Matches the EasyFile treatment (EF components.css .ai-fab / .ai-panel):
   a 44px primary circle, 0.4 opacity at rest -> 1.0 on hover/open, sparkles glyph, bottom-right; the panel floats
   just above it (resizable). Replaces the old docked 3rd column. */
.ai-fab {
  position: fixed; bottom: 52px; right: var(--ef-space-12); z-index: 45;
  width: 44px; height: 44px; padding: 0; border: none; border-radius: 50%;
  background: var(--ef-color-primary, var(--ef-primary)); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--ef-shadow-3, 0 4px 12px rgba(0,0,0,0.2));
  opacity: 0.4; transition: transform 150ms, box-shadow 150ms, opacity 150ms, background 150ms;
}
.ai-fab:hover, .ai-fab:focus-visible { opacity: 1; transform: scale(1.08); box-shadow: var(--ef-shadow-4, 0 8px 24px rgba(0,0,0,0.28)); outline: none; }
.ai-fab-glyph { font-size: 20px; line-height: 1; }
.ai-fab-label { display: none; }   /* the circle uses the glyph only (EF treatment); label kept for a11y/SR only */

.ai-float-panel {
  position: fixed; bottom: 100px; right: var(--ef-space-12); z-index: 500;
  width: 420px; height: 560px;
  min-width: 320px; min-height: 320px; max-width: 90vw; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
  background: var(--ef-surface, #fff); border: 1px solid var(--ef-border); border-radius: var(--ef-radius-8, 8px);
  box-shadow: var(--ef-shadow-4, 0 8px 32px rgba(0,0,0,0.28));
  overflow: hidden; resize: both;
}
.ai-float-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--ef-space-8) var(--ef-space-12);
  border-bottom: 1px solid var(--ef-border); background: var(--ef-surface-alt, var(--ef-bg)); flex-shrink: 0;
}
.ai-float-panel-title { font-size: var(--ef-text-14); font-weight: 600; }
.ai-float-panel-head-btns { display: flex; align-items: center; gap: var(--ef-space-4); }
.ai-float-close, .ai-float-dock {
  border: none; background: transparent; cursor: pointer; font-size: 18px;
  line-height: 1; color: var(--ef-text-muted); padding: 0 var(--ef-space-4);
}
.ai-float-close { font-size: 20px; }
.ai-float-close:hover, .ai-float-close:focus-visible,
.ai-float-dock:hover, .ai-float-dock:focus-visible { color: var(--ef-text); outline: none; }

/* DOCKED rail (owner 2026-07-10): the panel becomes a full-height column pinned to the right edge, its width set
   inline (persisted) or defaulting to 420px. A drag handle on its inner (left) edge resizes it. */
.ai-float-panel.ai-rail-docked {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; height: auto; max-height: none; max-width: 60vw; min-width: 320px;
  border-radius: 0; border-top: none; border-right: none; border-bottom: none;
  resize: none;
}
.ai-rail-resize {
  position: absolute; top: 0; left: 0; bottom: 0; width: 6px; cursor: ew-resize; z-index: 2;
  background: transparent;
}
.ai-rail-resize:hover, body.ai-resizing .ai-rail-resize { background: var(--ef-color-primary, var(--ef-primary)); opacity: 0.5; }
/* While dragging: kill text selection + force the resize cursor everywhere so the drag feels solid. */
body.ai-resizing { cursor: ew-resize !important; user-select: none !important; }
/* The body holds the AiPanel. It scrolls as ONE column (min-height:0 lets it shrink inside the flex panel), so a
   tall plan-approval card + the prompt box below the transcript are always REACHABLE. Previously only the
   transcript scrolled while the plan card / Approve button overflowed past the panel's overflow:hidden bottom and
   became un-clickable (the "stuck, can't interact" bug). */
.ai-float-panel-body { flex: 1; min-height: 0; display: flex; padding: var(--ef-space-12); overflow: hidden; }
/* The AiPanel fills the body and is the SINGLE vertical scroll region in the float panel; the transcript keeps a
   bounded height so it doesn't starve the plan card of space. The standalone .ai-panel elsewhere is unaffected. */
.ai-float-panel-body .ai-panel { flex: 1; min-height: 0; overflow-y: auto; }
.ai-float-panel-body .ai-transcript { flex: none; max-height: 260px; min-height: 80px; }

/* The wizard "Describe your workflow" box: a proper design area, not a one-line field. */
.nw-desc-box { min-height: 180px; resize: vertical; }

.ai-panel { display: flex; flex-direction: column; gap: var(--ef-space-12); }
.ai-panel-disabled { color: var(--ef-text-muted); font-size: var(--ef-text-13); }
.ai-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ef-space-8); flex-wrap: wrap; }
.ai-panel-title { font-size: var(--ef-text-14); font-weight: 700; margin: 0; }
.ai-panel-head-actions { display: flex; align-items: center; gap: var(--ef-space-8); }
.ai-panel-scope { display: flex; align-items: center; gap: var(--ef-space-8); }
.ai-panel-scope .form-select { width: auto; }
/* Small square chrome buttons in the head (compact toggle, clear). Muted at rest, primary tint when active. */
.ai-icon-btn {
  border: 1px solid var(--ef-border); background: var(--ef-surface, #fff); color: var(--ef-text-muted);
  cursor: pointer; border-radius: var(--ef-radius-6, 6px); width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; line-height: 1;
  transition: color 120ms, background 120ms, border-color 120ms;
}
.ai-icon-btn:hover:not(:disabled), .ai-icon-btn:focus-visible { color: var(--ef-text); border-color: var(--ef-text-muted); outline: none; }
.ai-icon-btn.is-on { color: var(--ef-color-primary); border-color: var(--ef-color-primary); }
.ai-icon-btn:disabled { opacity: 0.4; cursor: default; }

/* "New messages" pill: floats over the transcript's lower edge when content arrived while scrolled up. */
.ai-new-msgs {
  align-self: center; border: none; cursor: pointer;
  background: var(--ef-color-primary, var(--ef-primary)); color: #fff;
  border-radius: 999px; padding: var(--ef-space-4) var(--ef-space-12);
  font-size: var(--ef-text-12); font-weight: 600; box-shadow: var(--ef-shadow-2, 0 2px 8px rgba(0,0,0,0.18));
  margin-top: calc(-1 * var(--ef-space-8));
}
.ai-new-msgs:hover, .ai-new-msgs:focus-visible { filter: brightness(1.06); outline: none; }

/* Token-usage footer: quiet, right-aligned, monospace-ish counters. */
.ai-tokens {
  display: flex; flex-direction: column; gap: 1px; align-items: flex-end;
  font-size: var(--ef-text-11); color: var(--ef-text-muted);
  border-top: 1px dashed var(--ef-border); padding-top: var(--ef-space-4);
  font-variant-numeric: tabular-nums;
}

/* Plan summary-first: the details toggle + collapsed high-risk preview. */
.ai-plan-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--ef-space-8); margin-bottom: var(--ef-space-8); }
.ai-plan-count { font-size: var(--ef-text-12); color: var(--ef-text-muted); font-weight: 600; }
.ai-plan-details-toggle {
  border: none; background: transparent; cursor: pointer; color: var(--ef-color-primary);
  font-size: var(--ef-text-12); font-weight: 600; padding: 0; text-decoration: underline;
}
.ai-plan-details-toggle:hover, .ai-plan-details-toggle:focus-visible { filter: brightness(1.1); outline: none; }
.ai-plan-highrisk-preview { list-style: none; margin: 0 0 var(--ef-space-8); padding: 0; display: flex; flex-direction: column; gap: var(--ef-space-4); }
.ai-plan-highrisk-preview li { display: flex; align-items: center; gap: var(--ef-space-8); font-size: var(--ef-text-13); }

/* Reference documents section (owner 2026-07-10): a collapsible attach-docs panel. */
.ai-refdocs { border: 1px solid var(--ef-border); border-radius: var(--ef-radius-6, 6px); }
.ai-refdocs-toggle {
  width: 100%; text-align: left; border: none; background: transparent; cursor: pointer;
  font-size: var(--ef-text-12); font-weight: 600; color: var(--ef-text);
  padding: var(--ef-space-8); display: flex; align-items: center; gap: var(--ef-space-8);
}
.ai-refdocs-toggle:hover, .ai-refdocs-toggle:focus-visible { color: var(--ef-color-primary); outline: none; }
.ai-refdocs-body { padding: 0 var(--ef-space-8) var(--ef-space-8); display: flex; flex-direction: column; gap: var(--ef-space-8); }
.ai-refdocs-hint { font-size: var(--ef-text-11); color: var(--ef-text-muted); margin: 0; }
.ai-refdocs-uploading { font-size: var(--ef-text-12); color: var(--ef-color-primary); }
.ai-refdocs-error { font-size: var(--ef-text-12); color: var(--ef-color-danger, #dc2626); margin: 0; }
.ai-refdocs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--ef-space-4); }
.ai-refdocs-item { display: flex; align-items: center; gap: var(--ef-space-8); font-size: var(--ef-text-12); }
.ai-refdocs-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ai-refdocs-meta { color: var(--ef-text-muted); font-size: var(--ef-text-11); white-space: nowrap; }
.ai-refdocs-del {
  border: none; background: transparent; cursor: pointer; color: var(--ef-text-muted);
  font-size: 16px; line-height: 1; padding: 0 var(--ef-space-4);
}
.ai-refdocs-del:hover, .ai-refdocs-del:focus-visible { color: var(--ef-color-danger, #dc2626); outline: none; }

/* COMPACT view: denser turns, activity, tighter gaps (owner request for long conversations). */
.ai-panel-compact { gap: var(--ef-space-8); }
.ai-panel-compact .ai-turn { padding: var(--ef-space-4) var(--ef-space-8); font-size: var(--ef-text-12); max-width: 92%; }
.ai-panel-compact .ai-turn-role { display: none; }
.ai-panel-compact .ai-activity-item { font-size: var(--ef-text-11); }
.ai-panel-compact .ai-transcript { gap: var(--ef-space-4); }
.ai-panel-error {
  font-size: var(--ef-text-12);
  color: var(--ef-red-text);
  background: var(--ef-red-bg);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  padding: var(--ef-space-8) var(--ef-space-12);
  margin: 0;
}

/* Build-complete banner (prominent end-of-build success + Continue for a chunked build). */
.ai-build-done {
  display: flex;
  align-items: flex-start;
  gap: var(--ef-space-8);
  background: var(--ef-green-bg, #f0fdf4);
  border: 1px solid var(--ef-green, #16a34a);
  border-radius: var(--ef-radius-6);
  padding: var(--ef-space-12);
  margin: var(--ef-space-8) 0 0;
}
.ai-build-done-check { color: var(--ef-green, #16a34a); font-weight: 700; font-size: var(--ef-text-16); line-height: 1.2; }
.ai-build-done-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ai-build-done-title { font-size: var(--ef-text-13); font-weight: 600; }
.ai-build-done-sub { font-size: var(--ef-text-12); color: var(--ef-text-muted); }
.ai-build-done-actions { display: flex; gap: var(--ef-space-8); margin-top: var(--ef-space-8); flex-wrap: wrap; }
.ai-build-done-banner { font-size: var(--ef-text-12); white-space: pre-line; }
/* A partial build: a warning, never the green success of a clean one. */
.ai-build-done.ai-build-partial { background: var(--ef-yellow-bg); border-color: var(--ef-yellow); }
.ai-build-partial .ai-build-done-check { color: var(--ef-yellow-text); }

/* Reopen "continue" affordance (durable): a subtler cue than the success banner, shown when a built conversation
   is rehydrated so a chunked build isn't a dead-end. */
.ai-continue-reopen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ef-space-8);
  background: var(--ef-surface-2, #f8fafc);
  border: 1px dashed var(--ef-border);
  border-radius: var(--ef-radius-6);
  padding: var(--ef-space-8) var(--ef-space-12);
  margin: var(--ef-space-8) 0 0;
  flex-wrap: wrap;
}
.ai-continue-reopen-text { font-size: var(--ef-text-12); color: var(--ef-text-muted); flex: 1; min-width: 0; }

.ai-transcript {
  display: flex;
  flex-direction: column;
  gap: var(--ef-space-8);
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  padding: var(--ef-space-12);
  background: var(--ef-surface-2);
}
.ai-transcript-empty { color: var(--ef-text-muted); font-size: var(--ef-text-12); margin: 0; }
.ai-history-loading { color: var(--ef-text-muted); font-size: var(--ef-text-12); margin: 0; }
/* Chat-style turns: user messages are right-aligned tinted bubbles; assistant messages are left-aligned surface
   bubbles - so the two speakers are clearly separated. */
.ai-turn { display: flex; flex-direction: column; gap: 2px; font-size: var(--ef-text-13); max-width: 85%; padding: var(--ef-space-8) var(--ef-space-12); border-radius: var(--ef-radius-8); }
.ai-turn-role { font-size: var(--ef-text-11); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; }
.ai-turn-text { white-space: pre-wrap; word-break: break-word; }
.ai-turn-user {
  align-self: flex-end;
  background: var(--ef-color-primary-bg, rgba(37,99,235,0.08));
  border: 1px solid var(--ef-color-primary-light, rgba(37,99,235,0.25));
}
.ai-turn-user .ai-turn-role { color: var(--ef-color-primary); }
.ai-turn-assistant {
  align-self: flex-start;
  background: var(--ef-surface-2);
  border: 1px solid var(--ef-border);
}
.ai-turn-assistant .ai-turn-role { color: var(--ef-text-muted); }

/* Rendered-markdown assistant turn (ChatMarkdown): block elements own their spacing, so drop the pre-wrap
   whitespace collapse the plain-text turn uses. Tight, readable, list-aware - a question or a bolded label now
   stands out instead of drowning in literal ** and --- markers. */
.ai-turn-md { white-space: normal; }
.ai-turn-md .cm-p { margin: 0 0 var(--ef-space-6, 6px); line-height: 1.45; }
.ai-turn-md .cm-p:last-child { margin-bottom: 0; }
.ai-turn-md .cm-h { font-weight: 700; margin: var(--ef-space-8) 0 var(--ef-space-4); line-height: 1.35; }
.ai-turn-md .cm-h:first-child { margin-top: 0; }
.ai-turn-md .cm-ul,
.ai-turn-md .cm-ol { margin: 0 0 var(--ef-space-6, 6px); padding-left: var(--ef-space-16); }
.ai-turn-md .cm-ul { list-style: disc; }
.ai-turn-md .cm-ol { list-style: decimal; }
.ai-turn-md .cm-ul li,
.ai-turn-md .cm-ol li { margin: 0 0 var(--ef-space-2); line-height: 1.4; }
.ai-turn-md .cm-hr { border: 0; border-top: 1px solid var(--ef-border); margin: var(--ef-space-8) 0; }
.ai-turn-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--ef-surface);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-4);
  padding: 0 4px;
}
.ai-turn-md strong { font-weight: 700; }
.ai-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--ef-space-4);
  align-self: flex-start;
  font-size: var(--ef-text-11);
  color: var(--ef-blue-text);
  background: var(--ef-blue-bg);
  border-radius: var(--ef-radius-14);
  padding: 2px var(--ef-space-8);
}

/* Activity trail: the accumulating "what the AI is doing" list (persistent steps, spinner on the in-progress
   one, check on completed ones) so the admin sees progress during a long think. */
.ai-activity { list-style: none; margin: var(--ef-space-8) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--ef-space-4); }
.ai-activity-item { display: flex; align-items: center; gap: var(--ef-space-8); font-size: var(--ef-text-12); }
.ai-activity-item.is-done { color: var(--ef-text-muted); }
.ai-activity-item.is-running { color: var(--ef-text); }
.ai-activity-check { color: var(--ef-green, #16a34a); font-weight: 700; width: 12px; text-align: center; }
.ai-activity-item.is-failed { color: var(--ef-red-text); flex-wrap: wrap; }
.ai-activity-cross { color: var(--ef-red); font-weight: 700; width: 12px; text-align: center; }
.ai-activity-detail { flex-basis: 100%; padding-left: calc(12px + var(--ef-space-8)); color: var(--ef-text-muted); }
.ai-activity-spin { width: 8px; height: 8px; border-radius: 50%; background: var(--ef-color-primary); animation: ai-activity-pulse 1s ease-in-out infinite; }
@keyframes ai-activity-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* Thinking indicator: the model is drafting but no token/tool step has arrived yet (owner 2026-07-13). A small
   pulsing dot + "Thinking…" so a long silent think reads as working. Cleared on the first token / tool chip. */
.ai-thinking { display: flex; align-items: center; gap: var(--ef-space-8); margin-top: var(--ef-space-8); font-size: var(--ef-text-12); color: var(--ef-text-muted); }
.ai-thinking-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ef-color-primary); animation: ai-activity-pulse 1s ease-in-out infinite; }
.ai-thinking-text::after { content: ""; }
@media (prefers-reduced-motion: reduce) { .ai-thinking-dot, .ai-activity-spin { animation: none; opacity: 0.7; } }

.ai-prompt { display: flex; flex-direction: column; gap: var(--ef-space-8); }
.ai-prompt-input { resize: vertical; min-height: 48px; font-family: inherit; }
/* Keep the actions on ONE line at a stable height so the Send<->Cancel swap mid-stream doesn't reflow the button
   onto a new line (owner: "Cancel button mid thinking shows on new line"). nowrap + a min-height matching the
   button pins it. */
.ai-prompt-actions { display: flex; justify-content: flex-end; gap: var(--ef-space-8); flex-wrap: nowrap; align-items: center; min-height: 32px; }

/* AI plan review (the human gate). High-risk block is emphasized in the danger tint. */
.ai-review { margin-top: var(--ef-space-8); }
.ai-review-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ef-space-8); margin-bottom: var(--ef-space-12); }
.ai-review-head h3 { font-size: var(--ef-text-14); font-weight: 700; margin: 0; }
.ai-review-empty { color: var(--ef-text-muted); font-size: var(--ef-text-13); }
.ai-review-section { margin-bottom: var(--ef-space-12); }
.ai-review-section-title { font-size: var(--ef-text-12); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ef-text-muted); margin: 0 0 var(--ef-space-4); }
.ai-review-list { margin: 0; padding-left: var(--ef-space-16); font-size: var(--ef-text-13); }
.ai-review-sublist { padding-left: var(--ef-space-16); }
.ai-review-queue { margin-bottom: var(--ef-space-8); }
.ai-review-queue-name { font-weight: 600; font-size: var(--ef-text-13); }
.ai-review-event-facets { color: var(--ef-text-muted); }
.ai-review-highrisk {
  background: var(--ef-red-bg);
  border: 1px solid var(--ef-border);
  border-left: 3px solid var(--ef-red);
  border-radius: var(--ef-radius-6);
  padding: var(--ef-space-12);
  margin-bottom: var(--ef-space-16);
}
.ai-review-highrisk .ai-review-section-title { color: var(--ef-red-text); }
.ai-review-highrisk-item { display: flex; align-items: center; gap: var(--ef-space-8); margin-bottom: var(--ef-space-4); }
.ai-review-highrisk-detail { font-size: var(--ef-text-13); }
.ai-review-actions { display: flex; justify-content: flex-end; gap: var(--ef-space-8); margin-top: var(--ef-space-12); }

/* Plan-then-build approval checklist (IR2 pivot): the model's plan rendered as numbered steps for approval.
   Hierarchy: a labeled summary block, then each step as a numbered badge + primary action line + an indented
   secondary "intent" note. Numbered via a CSS counter so the markers are styled chips, not raw list numerals. */
.ai-plan-summary {
  font-size: var(--ef-text-13);
  color: var(--ef-text);
  margin: 0 0 var(--ef-space-12);
  padding: var(--ef-space-8) var(--ef-space-12);
  background: var(--ef-surface-2);
  border-radius: var(--ef-radius-6);
  line-height: 1.45;
}
.ai-plan-steps {
  list-style: none;
  counter-reset: ai-plan-step;
  margin: 0 0 var(--ef-space-8);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ef-space-6, 6px);
}
.ai-plan-step {
  counter-increment: ai-plan-step;
  position: relative;
  padding: var(--ef-space-8) var(--ef-space-8) var(--ef-space-8) var(--ef-space-4);
  padding-left: 34px;              /* room for the number badge */
  border-radius: var(--ef-radius-6);
  border: 1px solid transparent;
  font-size: var(--ef-text-13);
  color: var(--ef-text);
}
.ai-plan-step::before {
  content: counter(ai-plan-step);
  position: absolute;
  left: var(--ef-space-4);
  top: var(--ef-space-8);
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ef-text-11);
  font-weight: 700;
  color: #fff;
  background: var(--ef-blue);
  border-radius: 50%;
}
/* Alternating hairline separation without heavy rules: a subtle surface on hover + high-risk emphasis. */
.ai-plan-step:hover { background: var(--ef-surface-2); }
.ai-plan-step-highrisk {
  background: var(--ef-red-bg);
  border-color: var(--ef-red);
}
.ai-plan-step-highrisk::before { background: var(--ef-red); }
.ai-plan-step-line { font-weight: 600; line-height: 1.4; }
.ai-plan-step-before {
  display: block;
  font-size: var(--ef-text-12);
  color: var(--ef-text-muted);
  margin-top: var(--ef-space-2);
  line-height: 1.4;
}
.ai-plan-step-warning {
  display: block;
  font-size: var(--ef-text-12);
  color: var(--ef-yellow-text);
  background: var(--ef-yellow-bg);
  border-left: 3px solid var(--ef-yellow);
  padding: var(--ef-space-2) var(--ef-space-4);
  margin-top: var(--ef-space-2);
  line-height: 1.4;
}
.ai-plan-step-intent {
  display: block;
  font-size: var(--ef-text-12);
  color: var(--ef-text-muted);
  margin-top: var(--ef-space-2);
  line-height: 1.4;
}

/* Queues tab: queue picker + detail. */
.queues-layout { display: grid; grid-template-columns: 200px 1fr; gap: var(--ef-space-16); align-items: start; }
/* Same .sidebar-inside-a-grid fix as .admin-nav / .designer-nav (see those notes). */
.queues-list {
  grid-row: auto;
  width: 100%;
  align-self: stretch;
}
.queues-detail { min-width: 0; }
.queue-events { list-style: none; padding: 0; margin: 0; }
.queue-event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ef-space-8);
  padding: var(--ef-space-8) 0;
  border-bottom: 1px solid var(--ef-border);
}
.queue-event-actions { display: flex; gap: var(--ef-space-4); }
.queue-event-edit-panel { padding: var(--ef-space-8) 0; }
.queue-route-targets { display: flex; flex-direction: column; gap: var(--ef-space-4); }

/* Queues tab: per-queue event-count chip in the sidebar + a route hint on an event row (EUI parity, 2026-07-17). */
.queue-tree-queue .ni { display: flex; align-items: center; gap: var(--ef-space-8); }
.queue-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item-eventcount {
  flex-shrink: 0;
  font-size: var(--ef-text-11);
  color: var(--ef-text-muted);
  background: var(--ef-surface-2);
  border-radius: var(--ef-radius-14);
  padding: 0 var(--ef-space-6);
  font-variant-numeric: tabular-nums;
}
.queue-event-route { font-size: var(--ef-text-12); color: var(--ef-text-muted); margin-left: var(--ef-space-8); }

/* Queues tab: inline RULE + ACTION authoring (owner 2026-07-17 full parity). Each rule a bordered block with a
   condition tree + an editable action list; each action a catalog-driven parameter form. */
.qt-rule {
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  /* NO padding here: a later single-class `.qt-rule` (the "Rule bands" block below) sets
     `padding: space-4 space-12` and, at equal specificity, wins on source order. Declaring padding here too was
     dead code that read as authoritative - the same specificity-tie trap that broke `.fg-inline`. The rule bands
     own the padding; change it there. */
  margin-bottom: var(--ef-space-8);
  background: var(--ef-surface-2);
}
.qt-rule-head { display: flex; align-items: center; gap: var(--ef-space-8); margin-bottom: var(--ef-space-4); }
.qt-rule-title { font-size: var(--ef-text-12); font-weight: 700; }
.qt-rule-delete { margin-left: auto; color: var(--ef-semantic-error, var(--ef-text-muted)); }
.qt-rule-clause-label { display: inline-block; font-size: var(--ef-text-11); font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ef-color-primary, var(--ef-text-muted)); margin: var(--ef-space-4) 0 2px; }
.qt-rule-actions { margin-top: var(--ef-space-8); display: flex; flex-direction: column; gap: var(--ef-space-8); }
.qt-rule-clause-row { display: flex; align-items: center; gap: var(--ef-space-8); }
.qt-action-editor {
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-4);
  padding: var(--ef-space-8);
  background: var(--ef-surface);
}
.qt-action-editor-head { display: flex; align-items: flex-end; gap: var(--ef-space-8); }
.qt-action-delete { color: var(--ef-semantic-error, var(--ef-text-muted)); }
.qt-action-params { display: flex; flex-direction: column; gap: var(--ef-space-8); margin-top: var(--ef-space-8); }
.qt-action-param { margin: 0; }
.qt-req { color: var(--ef-semantic-error, #c0492f); margin-left: 2px; }
.qt-action-highrisk { color: var(--ef-semantic-warning, #b9760a); font-weight: 600; }
.qt-action-raw { list-style: none; padding: 0; margin: var(--ef-space-4) 0 0; font-size: var(--ef-text-12); }
.qt-action-raw-key { font-family: var(--ef-font-mono, monospace); color: var(--ef-text-muted); }

/* Queues tab: the PATH -> QUEUE sidebar tree (EUI queues.js parity). Collapsible path group headers, each
   holding its queues; a per-group "+" add + a per-queue delete on hover/focus. */
.queue-tree-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ef-space-8);
  padding: var(--ef-space-8) var(--ef-space-8) 0; }
.queue-tree-head-label { font-size: var(--ef-text-11); font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ef-text-muted); }
.queue-tree { list-style: none; padding: var(--ef-space-8) var(--ef-space-8) 0; margin: 0; }
.queue-tree-group { margin-bottom: var(--ef-space-4); }
.queue-tree-group-head { display: flex; align-items: center; gap: var(--ef-space-4); }
.queue-tree-toggle {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: var(--ef-space-8);
  background: transparent; border: 0; cursor: pointer;
  padding: var(--ef-space-4) var(--ef-space-8);
  border-radius: var(--ef-radius-6);
  color: var(--ef-text-muted);
  font-size: var(--ef-text-11); font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  text-align: left;
}
.queue-tree-toggle:hover { background: var(--nav-hover); color: var(--nav-text-active); }
.queue-tree-caret { font-size: var(--ef-text-11); width: 12px; flex-shrink: 0; }
.queue-tree-group-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-tree-count {
  flex-shrink: 0; font-weight: 600; letter-spacing: 0;
  background: var(--ef-surface-2); border-radius: var(--ef-radius-6);
  padding: 0 var(--ef-space-8); font-size: var(--ef-text-11);
}
.queue-tree-add { flex-shrink: 0; }
.queue-tree-queues { padding: var(--ef-space-4) 0 0; }
.queue-tree-queue { display: flex; align-items: center; gap: var(--ef-space-4); }
.queue-tree-queue .ni { flex: 1; min-width: 0; }
.queue-tree-delete { flex-shrink: 0; opacity: 0; transition: opacity var(--ef-motion-fast, 120ms) ease; }
.queue-tree-queue:hover .queue-tree-delete,
.queue-tree-queue:focus-within .queue-tree-delete { opacity: 1; }

/* ── EUI-parity Queues TREE (owner 2026-07-20) ──────────────────────────────────────────────────────────
   A flat, expandable Start + Queue → Event → Rule tree that reads at a glance: colored IF/THEN bands, route
   arrows, per-event-type icons, chevrons. Editing is modal (the tree only reads + toggles). Tokens only. */
.qt-tab { display: flex; flex-direction: column; gap: var(--ef-space-8); }
.qt-toolbar { display: flex; align-items: center; justify-content: space-between; }
.qt-title { font-size: var(--ef-text-18); font-weight: 700; }
.qt-toolbar-actions { display: flex; align-items: center; gap: var(--ef-space-8); }
.qt-paths-count { font-size: var(--ef-text-12); color: var(--ef-text-muted); }

.qt-node { border-radius: var(--ef-radius-6); }
.qt-node-start { background: var(--ef-surface); border: 1px solid var(--ef-border); }
.qt-row { display: flex; align-items: center; gap: var(--ef-space-8); padding: var(--ef-space-8) var(--ef-space-12); min-width: 0; }
.qt-expand, .qt-expand-spacer {
  width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; cursor: pointer; color: var(--ef-text-muted);
  transition: transform var(--ef-motion-fast, 120ms) ease;
}
.qt-expand.open { transform: rotate(90deg); }
.qt-icon { flex-shrink: 0; width: 18px; text-align: center; color: var(--ef-text-muted); }
.qt-icon-start { color: var(--ef-semantic-success, #2a7); }
.qt-icon-queue { color: var(--ef-accent, #3b82f6); }
.qt-icon-button { color: #6b7280; }
.qt-icon-timer { color: #b45309; }
.qt-icon-submit { color: #2563eb; }
.qt-icon-open { color: #0891b2; }
.qt-icon-arrival { color: #7c3aed; }
.qt-icon-system { color: var(--ef-text-muted); }
.qt-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: var(--ef-text-13); }
.qt-name-btn { background: transparent; border: 0; cursor: pointer; color: var(--ef-text); text-align: left; padding: 0; }
.qt-name-btn:hover { color: var(--ef-accent, #3b82f6); text-decoration: underline; }
.qt-meta { flex-shrink: 0; font-size: var(--ef-text-11); color: var(--ef-text-muted); }
.qt-etype { flex-shrink: 0; font-size: var(--ef-text-11); color: var(--ef-text-muted); background: var(--ef-surface-2); border-radius: var(--ef-radius-4); padding: 0 6px; }
.qt-route { flex-shrink: 0; font-size: var(--ef-text-12); color: var(--ef-text-muted); }
.qt-tools { margin-left: auto; display: flex; align-items: center; gap: var(--ef-space-4); flex-shrink: 0; }
.qt-del { color: var(--ef-semantic-error, #ce614e); }

/* Path group card + collapsible header. */
.qt-path-group { padding: 0; overflow: hidden; }
.qt-path-head {
  display: flex; align-items: center; gap: var(--ef-space-8); width: 100%;
  padding: var(--ef-space-8) var(--ef-space-12); background: transparent; border: 0; cursor: pointer;
  border-bottom: 1px solid var(--ef-border); text-align: left;
}
.qt-path-head:hover { background: var(--nav-hover); }
.qt-caret { width: 12px; flex-shrink: 0; transition: transform var(--ef-motion-fast, 120ms) ease; }
.qt-caret.open { transform: rotate(90deg); }
.qt-path-name { font-weight: 600; font-size: var(--ef-text-13); }
.qt-path-add { flex-shrink: 0; font-size: var(--ef-text-16); line-height: 1; padding: 0 6px; border-radius: var(--ef-radius-4); }
.qt-path-add:hover { background: var(--ef-surface-2); }
.qt-path-body { padding: var(--ef-space-4) 0; }

/* Nested children (queue → events, event → rules): indented left rail. */
.qt-node-queue { border-bottom: 1px solid var(--ef-border); }
.qt-node-queue:last-child { border-bottom: 0; }
.qt-children { margin-left: var(--ef-space-16); border-left: 2px solid var(--ef-border); }
.qt-node-event .qt-row { padding-top: var(--ef-space-4); padding-bottom: var(--ef-space-4); }

/* Rule bands: the IF/THEN read-at-a-glance rows. */
.qt-rules { padding: var(--ef-space-4) 0; }
.qt-rule { padding: var(--ef-space-4) var(--ef-space-12); }
.qt-rule-header { display: flex; align-items: center; gap: var(--ef-space-8); font-size: var(--ef-text-11); font-weight: 600; color: var(--ef-text-muted); padding: var(--ef-space-4) 0; }
.qt-rule-tools { margin-left: auto; display: flex; align-items: center; gap: var(--ef-space-4); }
/* A button event's name rendered as its configured color chip (EUI parity). */
.qt-name-chip { padding: 2px 8px; border-radius: var(--ef-radius-4); border: 1px solid transparent; }
/* A clickable IF/THEN band row (opens the condition/action modal). Resets button chrome to look like the band. */
.qt-row-btn { appearance: none; background: none; border: 0; font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; }
.qt-row-btn:hover { filter: brightness(0.97); }
/* .qt-action-row's own layout is declared with .qt-cond-row further down (the shared IF/THEN band rule); a
   layout block here was fully shadowed by it at equal specificity, so its gap: space-4 never applied. Only the
   child rule belongs here. */
.qt-action-row .qt-action-btn { flex: 1; }
/* Event details modal: a scrolling sub-panel for the route-to-queues / icon lists (owner 2026-07-20). The panel's
   own padding now comes from the shared .ef-tabview > .event-tab-panel boundary rule (both event panels render
   inside .ef-tabview), so the standalone .event-tab-panel{padding-top} was removed as dead/shadowed. */
.event-scroll-panel { max-height: 180px; overflow-y: auto; border: 1px solid var(--ef-border); border-radius: var(--ef-radius-4); padding: var(--ef-space-8); margin: var(--ef-space-4) 0; }
.event-button-preview { display: flex; align-items: center; gap: var(--ef-space-12); margin-bottom: var(--ef-space-8); }
.btn-preview-chip { display: inline-block; padding: 6px 16px; border-radius: var(--ef-radius-4); border: 1px solid var(--ef-border); background: var(--ef-surface-2); color: var(--ef-text); font-weight: 600; }
.qt-cond-row, .qt-action-row { display: flex; align-items: center; gap: var(--ef-space-8); padding: 3px var(--ef-space-8); border-radius: var(--ef-radius-4); margin-bottom: 2px; }
.qt-cond-row { background: color-mix(in srgb, #f59e0b 12%, transparent); }
.qt-action-row { background: color-mix(in srgb, #3b82f6 12%, transparent); }
.qt-badge { flex-shrink: 0; font-size: var(--ef-text-11); font-weight: 700; border-radius: var(--ef-radius-4); padding: 0 6px; min-width: 34px; text-align: center; }
.qt-badge-if { background: color-mix(in srgb, #f59e0b 25%, transparent); color: #92400e; }
.qt-badge-then { background: color-mix(in srgb, #3b82f6 25%, transparent); color: #1e40af; }
/* A Send Email action whose mail is not sent / will fail / is redirected (MailActionWarning). */
.qt-badge-mail { background: color-mix(in srgb, #dc2626 18%, transparent); color: #991b1b; min-width: 0; }
.qt-action-mail-warning { color: var(--ef-semantic-warning, #b9760a); font-weight: 600; }
.qt-cond-text, .qt-action-text { font-size: var(--ef-text-12); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-rule-opaque { padding: var(--ef-space-8) var(--ef-space-12); font-size: var(--ef-text-12); color: var(--ef-text-muted); font-style: italic; }

@media (prefers-color-scheme: dark) {
  .qt-badge-if { color: #fcd34d; }
  .qt-badge-then { color: #93c5fd; }
  .qt-badge-mail { color: #fca5a5; }
}

/* Condition builder rows. */
.condition-rows { display: flex; flex-direction: column; gap: var(--ef-space-8); margin: var(--ef-space-8) 0; }
/* Plugin (advanced) conditions authored via ConditionStepEditor + the add-actions row. */
.condition-plugins { display: flex; flex-direction: column; gap: var(--ef-space-8); margin: var(--ef-space-8) 0; }
.condition-plugin-readonly { font-size: var(--ef-text-12); color: var(--ef-text-muted); font-style: italic; padding: var(--ef-space-4) var(--ef-space-8); }
.condition-add-actions { display: flex; gap: var(--ef-space-8); flex-wrap: wrap; }
.condition-step-editor { margin: 0; }
/* OOB UX-parity pass (owner 2026-07-20): section headings, token-insert, hex-beside-swatch color, code widget. */
.qt-param-group { font-size: var(--ef-text-11); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ef-text-muted); margin: var(--ef-space-12) 0 var(--ef-space-4); }
.qt-token-insert { font-size: var(--ef-text-11); margin-left: var(--ef-space-8); padding: 1px 4px; border: 1px solid var(--ef-border); border-radius: var(--ef-radius-4); background: var(--ef-surface-2); color: var(--ef-text-muted); }
/* (.qt-color-row/-swatch/-hex removed — the Action/Condition color inputs now use the shared EfColorField pill.) */
.qt-code { font-family: var(--ef-font-mono, ui-monospace, "Cascadia Code", Consolas, monospace); font-size: var(--ef-text-12); line-height: 1.4; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.qt-kv-map { display: flex; flex-direction: column; gap: var(--ef-space-4); }
.qt-kv-row { display: flex; align-items: center; gap: var(--ef-space-8); }
.qt-kv-key { flex: 0 0 40%; }
.qt-kv-val { flex: 1; }
.qt-type-desc { font-size: var(--ef-text-12); color: var(--ef-text-muted); margin: var(--ef-space-4) 0 var(--ef-space-8); font-style: italic; }
.condition-params { display: flex; flex-direction: column; gap: var(--ef-space-8); margin-top: var(--ef-space-8); }
.condition-row { display: flex; align-items: center; gap: var(--ef-space-8); }
.condition-group-logic { margin-bottom: var(--ef-space-8); }

/* Preview flowchart (SVG graph: toolbar + legend + zoom/pan/drag canvas + node-details panel). */
/* Diagram-semantic colors as tokens (the SVG referenced raw hex inline; centralize + make theme-aware here so
   the flowchart tracks light/dark and stays on the token system). These are graph-specific accents, not part
   of the core --ef-* palette. */
:root {
  --preview-start: #0f766e;      /* start step (teal) */
  --preview-event: #f97316;      /* non-button event marker (orange) */
  --preview-node-fill: var(--ef-surface);
}
@media (prefers-color-scheme: dark) {
  :root { --preview-start: #2dd4bf; --preview-event: #fb923c; }
}
:root[data-theme="light"] { --preview-start: #0f766e; --preview-event: #f97316; }
:root[data-theme="dark"]  { --preview-start: #2dd4bf; --preview-event: #fb923c; }

.preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--ef-space-16); }
.preview-toolbar { display: flex; gap: var(--ef-space-4); flex-shrink: 0; }
.preview-legend { display: flex; flex-wrap: wrap; gap: var(--ef-space-8) var(--ef-space-16); margin: var(--ef-space-8) 0; font-size: var(--ef-text-12); color: var(--ef-text-muted); }
.preview-legend-item { display: inline-flex; align-items: center; gap: var(--ef-space-4); }
.preview-legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.preview-legend-terminal { background: transparent; border: 1.5px dashed var(--ef-text-muted); }
/* The canvas clips the (pannable/zoomable) SVG; touch-action:none lets pointer-drag pan without the browser scrolling. */
.preview-canvas { overflow: hidden; padding: 0; }
.preview-graph { display: block; touch-action: none; max-width: 100%; height: auto; background: var(--ef-surface-2, transparent); }
.preview-node-rect { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.12)); }
.preview-node-title { font-size: var(--ef-text-13); fill: var(--ef-text); }
.preview-node-meta { font-size: var(--ef-text-11); fill: var(--ef-text-muted); }
.preview-node-row { font-size: var(--ef-text-12); fill: var(--ef-text); }
.preview-node-event { fill: var(--ef-text-muted); }
.preview-node-more { font-size: var(--ef-text-11); fill: var(--ef-text-muted); font-style: italic; }
.preview-node:hover .preview-node-rect { stroke-width: 3; }

/* ── FIND / HIGHLIGHT (owner 2026-08-03) ──────────────────────────────────────────────────────────────────────
   HIGHLIGHT, NEVER HIDE. Non-matching nodes and edges stay in place and are dimmed; matches are emphasized. The
   point is to keep a match readable IN CONTEXT — removing the surrounding flow is what makes a filtered graph
   useless. Both classes are only emitted when a highlight is ACTIVE, so the neutral graph is byte-identical to
   before. */
.preview-find { margin-bottom: var(--ef-space-8); }
.preview-find-row { display: flex; align-items: center; gap: var(--ef-space-8); flex-wrap: wrap; }
.preview-find-label { font-size: var(--ef-text-12); color: var(--ef-text-muted); font-weight: 600; }
.preview-find-input { min-width: 20rem; max-width: 100%; flex: 1 1 20rem; }
.preview-find-count { font-size: var(--ef-text-12); color: var(--ef-text-muted); white-space: nowrap; }
/* A zero-match search must be unmistakable — a silent empty highlight reads as a broken search box. */
.preview-find-count-empty { color: var(--ef-danger, #dc2626); font-weight: 600; }
.preview-find-paths { display: flex; flex-wrap: wrap; gap: var(--ef-space-4); margin-top: var(--ef-space-8); }
.preview-path-chip {
  display: inline-flex; align-items: center; gap: var(--ef-space-4);
  padding: 2px var(--ef-space-8); border-radius: 999px;
  border: 1px solid var(--ef-border); background: var(--ef-surface);
  font-size: var(--ef-text-12); color: var(--ef-text-muted); cursor: pointer;
}
.preview-path-chip:hover { border-color: var(--ef-text-muted); color: var(--ef-text); }
.preview-path-chip.is-on { border-color: var(--ef-primary, #2563eb); color: var(--ef-text); background: var(--ef-surface-2, var(--ef-surface)); font-weight: 600; }
.preview-path-chip:focus-visible { outline: 2px solid var(--ef-primary, #2563eb); outline-offset: 2px; }

/* Dimmed: still fully laid out and hit-testable (a dimmed node remains clickable for its details) — just quiet.
   Opacity alone, so path colors/terminal dashes stay truthful rather than being recolored. */
.preview-node.is-hl-dim, .preview-edge-path.is-hl-dim,
.preview-edge-label.is-hl-dim, .preview-edge-condition.is-hl-dim { opacity: 0.18; }
/* Matched: lifted above the dimmed field with a ring on the node rect. */
.preview-node.is-hl-match .preview-node-rect { stroke-width: 3.5; filter: drop-shadow(0 0 6px rgba(37, 99, 235, 0.55)); }
.preview-edge-path.is-hl-match { stroke-width: 3.5; }
.preview-edge-label.is-hl-match { font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .preview-node, .preview-edge-path, .preview-edge-label, .preview-edge-condition { transition: opacity 120ms ease-out; }
}
.preview-edge-label { font-size: var(--ef-text-11); paint-order: stroke; stroke: var(--ef-surface, #fff); stroke-width: 3px; }
.preview-edge-condition { font-size: 9px; fill: var(--ef-text-muted, #9ca3af); paint-order: stroke; stroke: var(--ef-surface, #fff); stroke-width: 3px; }
/* Preview node-details now render inside an EfModal (the queue-details modal); the inner list/event/rule
   classes below style the modal body. The former outer .preview-details card wrapper + its head are retired. */
.preview-details-list { list-style: none; padding: 0; margin: var(--ef-space-8) 0 0; display: flex; flex-direction: column; gap: var(--ef-space-4); }
/* Everything in this modal read as CENTRED (the "looks weird" report), from two causes in this one rule:
   1. it was a DESCENDANT selector, so it also hit the nested .preview-details-rule items; and
   2. `align-items: center` on a row whose .preview-details-event-row sets `flex-direction: column` centres content
      HORIZONTALLY. That override declares `align-items: stretch`, but both selectors have equal specificity (0,1,0)
      and this generic rule comes LATER in the file, so it won.
   Fix: scope to DIRECT children and align to the START, so a column-direction event row lays out left-aligned and
   each nested level owns its own alignment. */
.preview-details-list > li { display: flex; align-items: flex-start; gap: var(--ef-space-8); font-size: var(--ef-text-13); }
.preview-details-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.preview-details-event { background: #f97316; }

/* Enriched per-event details (item 7): each event = a header row (name + kind + route) followed by its rules,
   each rule an IF/THEN clause list with the condition + actions DESCRIBED in human-readable text. Override the
   flat list li flex so an event row stacks its header + rules vertically. */
.preview-details-event-row { display: flex; flex-direction: column; align-items: stretch; gap: var(--ef-space-4);
  padding: var(--ef-space-8) 0; border-bottom: 1px solid var(--ef-border); }
.preview-details-event-row:last-child { border-bottom: none; }
.preview-details-event-head { display: flex; align-items: center; gap: var(--ef-space-8); flex-wrap: wrap; }
.preview-details-event-name { font-weight: 600; }
.preview-details-event-kind { font-size: var(--ef-text-11); color: var(--ef-text-muted);
  background: var(--ef-surface-2); border-radius: var(--ef-radius-6); padding: 1px var(--ef-space-8); }
.preview-details-event-route { font-size: var(--ef-text-12); color: var(--ef-text-muted); }
.preview-details-no-rules { margin: 0 0 0 var(--ef-space-16); }

/* Rules are INDENTED under their event and hang off a rail, so at a glance you can see which rules belong to which
   button/timer - the events are otherwise separated only by a hairline and read as one flat list. */
.preview-details-rules { list-style: none; padding: 0 0 0 var(--ef-space-12);
  margin: var(--ef-space-4) 0 0 var(--ef-space-16);
  border-left: 2px solid var(--ef-border);
  display: flex; flex-direction: column; gap: var(--ef-space-8); }
.preview-details-rule { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.preview-details-rule-label { font-size: var(--ef-text-11); font-weight: 600; color: var(--ef-text-muted); }

/* IF/THEN as a real two-column grid: the keyword column is a FIXED track, so every condition/action text starts at
   the SAME x regardless of keyword width. The old flex + min-width let "IF"/"THEN" push their text to different
   offsets, which is what made the clauses look ragged. */
.preview-details-clause { display: grid; grid-template-columns: 3.25rem 1fr; align-items: baseline;
  column-gap: var(--ef-space-8); font-size: var(--ef-text-12); }
.preview-details-clause-kind { font-weight: 700; font-size: var(--ef-text-11); color: var(--ef-color-primary);
  text-align: right; letter-spacing: .02em; }
/* Long descriptions (a Send Email subject, a field list) wrap inside the text column instead of overflowing. */
.preview-details-clause > span:last-child { min-width: 0; overflow-wrap: anywhere; }

/* Queue preview (EUI#95 route arrow). */
.qp-queue-title { font-size: var(--ef-text-14); font-weight: 600; margin-bottom: var(--ef-space-8); }
.qp-buttons { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--ef-space-8); }
.qp-button-row { display: flex; align-items: center; gap: var(--ef-space-8); }
.qp-route { display: inline-flex; align-items: center; gap: var(--ef-space-4); }
.qp-route-arrow { color: var(--ef-text-muted); font-family: monospace; }
.qp-stays { color: var(--ef-text-muted); font-size: var(--ef-text-12); }

/* ── WORK-ITEM PLAN (WorkItemPlanView.razor) ────────────────────────────────────────────────────────────
   A Preview-like flowchart scoped to ONE work instance: it reuses the Designer preview node/edge SVG styling
   (.preview-*) and layers a per-instance state on each node — CURRENT (highlighted), TRAVELED (dimmed/visited),
   REACHABLE (active, still to come). Bypassed queues are filtered out server-of-render, so nothing here dims a
   removed node — this is purely the three shown states. Read-only (no drag/zoom toolbar). */
.wi-view-plan { padding: var(--ef-space-8); }
.wi-plan { display: flex; flex-direction: column; position: relative; }
/* The plan SVG now pans/zooms via a viewport transform (previewInterop.initReadonly), so the canvas is a fixed
   viewport that CLIPS the graph (the SVG is dragged inside it) rather than a scroll container. */
.wi-plan-canvas { height: 60vh; overflow: hidden; }
/* The SVG FILLS the canvas (viewBox scales the content to fit the box), so the gray canvas is the modal size, not
   a tiny content-sized inset. Pan/zoom then transforms the viewport group within this filled box. */
.wi-plan-canvas .preview-graph { width: 100%; height: 100%; touch-action: none; user-select: none; }
/* Zoom controls, floated top-right over the canvas. */
.wi-plan-zoom { position: absolute; top: 34px; right: 12px; z-index: 2; display: flex; gap: 4px; background: var(--ef-surface); border: 1px solid var(--ef-border); border-radius: 6px; padding: 2px; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.wi-plan-zoom .btn { min-width: 30px; padding: 2px 6px; }
.wi-plan-legend { margin-top: 0; }
.wi-plan-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid transparent; }
.wi-plan-swatch-current { background: var(--ef-color-primary); }
.wi-plan-swatch-traveled { background: var(--ef-surface-2); border-color: var(--ef-text-muted); opacity: 0.55; }
.wi-plan-swatch-reachable { background: transparent; border-color: var(--ef-color-primary); }

/* CURRENT: full opacity + a primary-tinted glow + a thick solid border so "you are here" clearly stands out from
   the future (owner 2026-07-17: make it obvious which is current). */
.wi-plan-node-current .preview-node-rect { filter: drop-shadow(0 0 5px var(--ef-color-primary)); stroke-width: 3.5; }
/* TRAVELED: dimmed to read as done/behind-us (the node + its rows fade together). */
.wi-plan-node-traveled { opacity: 0.5; }
/* REACHABLE (future/still-to-come): a DASHED, muted border so it reads as "not yet reached" and is visually
   distinct from the solid, glowing current node. */
.wi-plan-node-reachable .preview-node-rect { stroke-dasharray: 6 4; stroke-width: 1.5; opacity: 0.9; }
.wi-plan-node-reachable { opacity: 0.82; }

/* Queue-preview SAMPLE GRID (queue-preview.js): the action-button bar above a dashboard-styled grid of the
   queue's visible columns + type-aware placeholder rows. Read-only preview. */
.qp-action-bar { display: flex; flex-wrap: wrap; gap: var(--ef-space-8); margin-bottom: var(--ef-space-12); }
.qp-grid-scroll { overflow-x: auto; margin-bottom: var(--ef-space-12); }
.qp-grid { width: 100%; }
.qp-grid tbody tr:nth-child(odd) { background: var(--ef-surface-2); }
/* Queue Preview sidebar/detail (owner 2026-07-17: pick a queue, preview only that queue). The per-entry row
   count chip; the detail-pane header showing the selection title + "N of M items". */
.qp-nav-count {
  margin-left: auto;
  font-size: var(--ef-text-11);
  color: var(--ef-text-muted);
  font-variant-numeric: tabular-nums;
}
.queues-list .nlist .ni { display: flex; align-items: center; gap: var(--ef-space-8); }
.qp-detail-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--ef-space-8); }

/* ── WORKFLOW KPI CARDS (WorkflowCards.razor; EUI parity - ports css/layout.css .dash-wf-* ) ──────────
   Colored my-items chip + segmented colored queue-breakdown bar + colored-dot queue tags + whole-card click. */

.wf-cards-section { display: flex; flex-direction: column; gap: var(--ef-space-12); }
.wf-cards-head { display: flex; align-items: center; justify-content: space-between; }
.wf-cards-title { font-size: var(--ef-text-14); font-weight: 600; margin: 0; }
.wf-cards-toggle { display: inline-flex; border: 1px solid var(--ef-border); border-radius: var(--ef-radius-6); overflow: hidden; }
.wf-count-mode {
    padding: var(--ef-space-4) var(--ef-space-12);
    font-size: var(--ef-text-12);
    background: var(--ef-surface);
    color: var(--ef-text-muted);
    border: 0;
    cursor: pointer;
}
/* Segment DIVIDERS. Without them the three buttons read as one undifferentiated pill, which is half of why this
   control looked inert - there was no visual grouping to select WITHIN. */
.wf-count-mode + .wf-count-mode { border-left: 1px solid var(--ef-border); }
.wf-count-mode:hover:not(.active) { background: var(--ef-bg); color: var(--ef-text); }
.wf-count-mode:focus-visible { outline: 2px solid var(--ef-color-primary); outline-offset: -2px; }
/* The SELECTED segment. The previous rule tinted the background with --ef-color-primary-bg, which is
   rgba(37,99,235,0.08) - 8% opacity over an already-light surface, i.e. effectively invisible, so all three
   segments looked identical and the control read as broken (owner-reported). A segmented control's selected
   state has to carry real contrast: solid primary fill + white text, matching how .wf-tab-badge already uses
   the primary colour at full strength. */
.wf-count-mode.active {
    background: var(--ef-color-primary);
    color: #fff;
    font-weight: 600;
}
.wf-count-mode.active:hover { background: var(--ef-color-primary); }
.wf-cards-empty { padding: var(--ef-space-24); text-align: center; }

.wf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--ef-space-12); }

/* The whole card is clickable by pointer (EUI#143): cursor + hover lift. Keyboard/AT open via the name button, so the focus ring is on it. */
/* position:relative anchors the absolutely-positioned drag handle below. */
.wf-card { position: relative; padding: var(--ef-space-16); cursor: pointer; transition: border-color 150ms, box-shadow 150ms; display: flex; flex-direction: column; gap: var(--ef-space-12); }
.wf-card:hover { border-color: var(--ef-color-primary); box-shadow: var(--ef-shadow-1); }
.wf-card:focus-within { border-color: var(--ef-color-primary); }
/* A DISABLED workflow: the "Disabled" badge in place of its counts, and its name in the muted text colour. Not dimmed
   with opacity, which blends every child toward the background and takes the badges under the 4.5:1 AA floor. */
.wf-card-disabled .wf-card-name { color: var(--ef-text-muted); }

/* DRAG HANDLE (reorder). Sits in the card's top-right and is the ONLY draggable part: the card body is already a
   click/Enter target that OPENS the workflow, so making the whole card draggable would fire an open on any drag
   that ends where it started. Revealed on hover/focus to keep the resting card clean, but ALWAYS rendered (never
   display:none) so it stays keyboard-reachable and screen-reader-announced. */
.wf-card-drag {
    position: absolute;
    top: var(--ef-space-8);
    right: var(--ef-space-8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: var(--ef-radius-4);
    color: var(--ef-text-muted);
    cursor: grab;
    opacity: 0;
    transition: opacity 150ms;
}
.wf-card-drag svg { fill: currentColor; }
.wf-card:hover .wf-card-drag,
.wf-card-drag:focus-visible { opacity: 1; }
.wf-card-drag:focus-visible { outline: 2px solid var(--ef-color-primary); outline-offset: 1px; }
.wf-card-drag:active { cursor: grabbing; }
/* Touch and keyboard-only users never trigger :hover, so the handle would be invisible-but-focusable there. */
@media (hover: none) { .wf-card-drag { opacity: 1; } }

/* The card being dragged: dimmed so the drop target reads clearly. */
.wf-card-dragging { opacity: 0.45; border-color: var(--ef-color-primary); }

.wf-card-top { display: flex; align-items: flex-start; gap: var(--ef-space-12); }
.wf-card-info { flex: 1; min-width: 0; }
.wf-card-name { font-size: var(--ef-text-14); font-weight: 600; color: var(--ef-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;; display: block; max-width: 100%; border: 0; background: none; padding: 0; margin: 0; font-family: inherit; text-align: left; cursor: pointer; }
.wf-card-name:focus-visible { outline: 2px solid var(--ef-color-primary); outline-offset: 2px; border-radius: var(--ef-radius-4); }
.wf-card-meta { display: flex; align-items: center; gap: var(--ef-space-4); margin-top: 4px; flex-wrap: wrap; }
.wf-int-badge { font-size: var(--ef-text-11); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding: 1px 6px; border-radius: var(--ef-radius-4); background: var(--ef-color-primary-bg); color: var(--ef-color-primary); }

/* The primary-tinted "my items" KPI chip (EUI .dash-wf-my-count). */
.wf-card-mine { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; padding: var(--ef-space-4) var(--ef-space-8); border-radius: var(--ef-radius-6); background: var(--ef-color-primary-bg); }
.wf-card-mine-num { font-size: var(--ef-text-18); font-weight: 700; color: var(--ef-color-primary); line-height: 1; }
.wf-card-mine-lbl { font-size: var(--ef-text-11); color: var(--ef-color-primary); text-transform: uppercase; letter-spacing: 0.5px; }

/* Colored segmented queue-breakdown bar (EUI .dash-queue-bar / .dash-bar-seg). Segment color is inline. */
.wf-queue-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--ef-border); }
.wf-bar-seg { min-width: 4px; transition: width 200ms ease; }
.wf-bar-seg:first-child { border-radius: 3px 0 0 3px; }
.wf-bar-seg:last-child { border-radius: 0 3px 3px 0; }
.wf-bar-seg:only-child { border-radius: 3px; }

/* Colored-dot queue tag list (EUI .dash-queue-list / .dash-queue-tag / .dash-queue-dot). */
.wf-queue-list { display: flex; flex-wrap: wrap; gap: var(--ef-space-4); }
.wf-queue-tag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--ef-text-11); color: var(--ef-text-muted); }
.wf-queue-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.wf-queue-more { color: var(--ef-text-muted); }

.wf-card-actions { display: flex; gap: var(--ef-space-8); }

/* HIDDEN workflows (per-user dashboard preference). Shown only while Show hidden is on, and set apart as "parked" by a
   dashed border in the muted text colour (the default --ef-border is too faint to carry the cue, above all in dark mode)
   and the Hidden badge. The card keeps its own surface, so the grey badges (--ef-surface-2 fill) keep their pill shape.
   Never by opacity: that blends every child toward the background (muted text and grey badges fell to about 2.4:1,
   under the 4.5:1 AA floor, in both themes). Hover/focus still turn the border primary (.wf-card:hover wins). */
.wf-card-hidden { border-style: dashed; border-color: var(--ef-text-muted); }
.wf-hidden-controls { display: flex; align-items: center; gap: var(--ef-space-12); margin-left: auto; margin-right: var(--ef-space-12); }
.wf-hidden-indicator { font-size: var(--ef-text-12); color: var(--ef-text-muted); white-space: nowrap; }
.wf-hidden-owned { color: var(--ef-color-primary); font-weight: 600; }
.wf-hidden-switch-label { font-size: var(--ef-text-12); color: var(--ef-text); }
.wf-card-hidden-queues { font-style: italic; }

/* My Settings > Hidden on your dashboard. */
.my-hidden-list { list-style: none; margin: 0 0 var(--ef-space-8); padding: 0; display: flex; flex-direction: column; gap: var(--ef-space-4); }
.my-hidden-row { display: flex; align-items: center; justify-content: space-between; gap: var(--ef-space-8); font-size: var(--ef-text-13); }

/* ── WORKFLOW TAB BAR (WorkflowTabBar.razor; queue-view workflow switcher - ports css/layout.css .wf-tab*) ── */
.wf-tab-wrapper {
    display: flex;
    align-items: stretch;
    background: var(--ef-surface);
    border: 1px solid var(--ef-border);
    border-bottom: none;
    border-radius: var(--ef-radius-10) var(--ef-radius-10) 0 0;
    position: relative;
}
.wf-tab-bar {
    display: flex;
    gap: 2px;
    padding: 0 var(--ef-space-4);
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.wf-tab-bar::-webkit-scrollbar { display: none; }
/* Click-to-scroll chevrons flanking the tab strip (shown when the strip may overflow). Flat, subtle, don't shrink;
   they page the strip via efScroll.by. */
.wf-tab-scroll {
    flex: 0 0 auto;
    width: 26px;
    border: none;
    background: var(--ef-surface);
    color: var(--ef-text-muted);
    font-size: var(--ef-text-16);
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.wf-tab-scroll:hover { color: var(--ef-text); background: var(--ef-surface-2); }
.wf-tab-scroll-left  { border-right: 1px solid var(--ef-border); border-radius: var(--ef-radius-10) 0 0 0; }
.wf-tab-scroll-right { border-left: 1px solid var(--ef-border); border-radius: 0 var(--ef-radius-10) 0 0; }
.wf-tab {
    padding: var(--ef-space-8) var(--ef-space-16);
    font-size: var(--ef-text-12);
    font-weight: 500;
    color: var(--ef-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 150ms, border-color 150ms;
    display: inline-flex;
    align-items: center;
    gap: var(--ef-space-4);
}
.wf-tab:hover { color: var(--ef-text); }
/* A hidden workflow's tab (shown via Show hidden, or because it is open): italic, like the hidden card's queue line, with
   an "(hidden)" screen-reader suffix. Not dimmed with opacity, which takes its text under the AA contrast floor. */
.wf-tab-hidden { font-style: italic; }
.wf-tab.active {
    color: var(--ef-color-primary);
    border-bottom-color: var(--ef-color-primary);
    font-weight: 600;
}
.wf-tab-badge {
    font-size: var(--ef-text-11);
    font-weight: 700;
    background: var(--ef-color-primary);
    color: #fff;
    border-radius: 9px;
    padding: 0 5px;
    min-width: 16px;
    text-align: center;
    line-height: 16px;
}
/* When the tab bar sits above the queue layout, square off the layout's top corners so they join seamlessly. */
.wf-tab-wrapper + .dash-wf-layout {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}


/* ── NEW-WORKFLOW WIZARD (NewWorkflowWizard.razor; ports js/ai/new-workflow.js) ───────────────────── */

/* The wizard needs a wider modal than the default 440px box. EfModal has a fixed-width .modal-box, so widen
   it only when it hosts the wizard (detected by the .nw-steps indicator) - a scoped, non-invasive override. */
/* (Removed .modal-box:has(.nw-steps) width hack — the wizard now passes Size="md".) */

/* Step indicator (dots + connecting lines): Workflow / Fields / [Kickoff] / AI. */
.nw-steps { display: flex; align-items: center; margin-bottom: var(--ef-space-24); }
.nw-step-dot { display: flex; align-items: center; gap: var(--ef-space-8); color: var(--ef-text-muted); }
.nw-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--ef-border); background: var(--ef-surface);
  font-size: var(--ef-text-12); font-weight: 700;
}
.nw-step-label { font-size: var(--ef-text-12); font-weight: 600; }
.nw-step-dot.active { color: var(--ef-text); }
.nw-step-dot.active .nw-step-num { border-color: var(--ef-color-primary); color: var(--ef-color-primary); }
.nw-step-dot.done .nw-step-num {
  border-color: var(--ef-color-primary); background: var(--ef-color-primary); color: #fff;
}
.nw-step-line { flex: 1; height: 1px; background: var(--ef-border); margin: 0 var(--ef-space-8); }

.nw-body { min-height: 220px; }

/* DMS source-field pick list (a scrollable checkbox list). */
.nw-source-pick {
  max-height: 180px; overflow-y: auto;
  border: 1px solid var(--ef-border); border-radius: var(--ef-radius-6);
}
.nw-src-row {
  display: flex; align-items: center; gap: var(--ef-space-8);
  padding: var(--ef-space-6) var(--ef-space-12); cursor: pointer;
  border-bottom: 1px solid var(--ef-border);
}
.nw-src-row:last-child { border-bottom: none; }

/* Inline "add custom field" row (name + type + Add/Cancel) on a subtle surface. */
.nw-inline-add {
  align-items: flex-end;
  padding: var(--ef-space-8);
  background: var(--ef-surface-2, var(--ef-surface));
  border-radius: var(--ef-radius-8);
  margin-bottom: var(--ef-space-12);
}

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .app      { grid-template-columns: 1fr; }
  .sidebar  { display: none; }
  .admin-layout    { grid-template-columns: 1fr; }
  .admin-config-row { grid-template-columns: 1fr; gap: 0; }
  .designer-layout { grid-template-columns: 1fr; }
  .queues-layout   { grid-template-columns: 1fr; }
  /* Floating AI panel goes near-full-width on small screens (still floating, not docked). */
  .ai-float-panel { right: var(--ef-space-8); left: var(--ef-space-8); bottom: var(--ef-space-8); width: auto; }
  .ai-fab { right: var(--ef-space-8); bottom: var(--ef-space-8); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Header Links dropdown → Small/Large Frame open: an in-page iframe overlay modal (ports EUI .link-frame-*).
   Built by links-interop.js. Uses IR2 design tokens (surface-2 for the subtle header bg). */
.link-frame-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
}
.link-frame-panel {
  background: var(--ef-surface); border-radius: var(--ef-radius-6);
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  display: flex; flex-direction: column; overflow: hidden; max-width: 98vw; max-height: 96vh;
}
.link-frame-panel.small { width: 50vw; height: 75vh; }
.link-frame-panel.large { width: 95vw; height: 90vh; }
.link-frame-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--ef-space-8) var(--ef-space-16);
  border-bottom: 1px solid var(--ef-border); background: var(--ef-surface-2);
}
.link-frame-header h3 { font-size: var(--ef-text-14); font-weight: 600; margin: 0; }
.link-frame-header .btn-close {
  background: none; border: none; cursor: pointer; color: var(--ef-text-muted);
  font-size: 20px; line-height: 1; padding: var(--ef-space-4); border-radius: var(--ef-radius-4);
}
.link-frame-header .btn-close:hover { background: var(--ef-surface-2); color: var(--ef-text); }
.link-frame-body { flex: 1; overflow: hidden; }
.link-frame-body iframe { width: 100%; height: 100%; border: none; }

/* SYSTEM LOG section (admin > System > System Log). Reuses .card/.dt/.kpi-*/.b-* primitives; only the layout bits
   that did not already exist are defined here. */
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--ef-space-12);
  margin-bottom: var(--ef-space-16); }
.filter-row .fg { margin-bottom: 0; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: var(--ef-space-8);
  margin-top: var(--ef-space-12); }
.nowrap { white-space: nowrap; }
/* A stack trace must stay readable and must NOT stretch the modal: wrap long lines, scroll the overflow. */
.log-detail { max-height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: var(--ef-surface-2); border-radius: var(--ef-radius-6); padding: var(--ef-space-12);
  font-size: var(--ef-text-12); margin: 0; }
.text-danger { color: var(--ef-color-danger, #e11d48); }

/* ── Tooltip (.ef-tip) ────────────────────────────────────────────────────────────────────────────────────
   Usage: add .ef-tip and data-tip="TEXT" (plus an aria-label carrying the same text) to any element.
   js/tooltip-interop.js shows ONE .ef-tip-pop for the hovered or focused anchor, appended to <body> (or the open
   <dialog>) and placed with position: fixed. It is not drawn inside the anchor, because a grid cell or a scrolling
   table clips anything absolutely positioned inside it. Anchors carry no native title=, which the browser would
   show as a second tooltip on top of this one.

   The text is set with textContent, so the value is data, never markup (it is HTML-encoded at emit time as well). */
.ef-tip:focus-visible { outline: 2px solid var(--ef-color-primary, #2563eb); outline-offset: 2px; }

.ef-tip-pop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;                      /* above sticky grid headers, the action bar and modals */
  background: var(--ef-surface);
  color: var(--ef-text);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  box-shadow: var(--ef-shadow-2);
  padding: 4px var(--ef-space-8);
  font-size: var(--ef-text-12);
  font-weight: 400;
  font-style: normal;
  line-height: 1.35;
  text-align: left;
  white-space: pre-wrap;               /* honours authored spacing and line breaks, and wraps long text */
  overflow-wrap: anywhere;
  max-width: 260px;
  pointer-events: none;                /* never steals the hover or blocks a click on the row */
  opacity: 0;
  transition: opacity 120ms ease;
}

.ef-tip-pop.is-visible { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .ef-tip-pop { transition: none; }
}

/* ── Monitor (Admin ▸ Monitor) ─────────────────────────────────────────────────────────────────────────────
   The Monitor reuses the existing primitives wherever one exists — .an-tiles/.an-tile for the KPI row, .dt for
   the tables, .badge .b-red/.b-ylw/.b-grn for state, .admin-hint for the explanatory notes. Only the pieces
   below have no primitive to borrow.                                                                        */

/* The 24h activity sparkline. A bare flex row of bars: no chart library for six data shapes, and it degrades
   to nothing visible rather than breaking layout when a bucket is empty. */
.mon-spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 48px;
  padding-top: var(--ef-space-4);
}
.mon-spark-bar {
  flex: 1 1 0;
  min-width: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--ef-blue);
  opacity: 0.55;
  transition: opacity 120ms ease;
}
.mon-spark-bar:hover     { opacity: 1; }
.mon-spark-bar.is-warn   { background: var(--ef-amber, #d97706); opacity: 0.85; }
.mon-spark-bar.is-error  { background: var(--ef-red, #dc2626); opacity: 0.95; }

/* Numeric table cells: tabular figures so counts and ages line up column-wise and a changing value on the 30s
   refresh does not make the column jitter. */
.dt td.num, .dt th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* A dead-letter payload preview. Monospace + clamped: the body can be long and is only there to recognise the
   job, never to read in full. */
.mon-payload {
  font-family: var(--ef-font-mono, ui-monospace, SFMono-Regular, Consolas, monospace);
  font-size: var(--ef-text-11);
  color: var(--ef-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}

/* The inline confirm that replaces a row's action buttons. Amber-tinted so a destructive prompt is visually
   distinct from the row's normal state without shifting layout. */
.mon-confirm {
  display: inline-flex;
  align-items: center;
  gap: var(--ef-space-8);
  padding: var(--ef-space-4) var(--ef-space-8);
  border-radius: var(--ef-radius-6, 6px);
  background: var(--ef-amber-bg, #fffbeb);
  border: 1px solid var(--ef-amber-border, #fcd34d);
}
.mon-confirm-text { font-size: var(--ef-text-12); }
.mon-confirm.is-danger {
  background: var(--ef-red-bg, #fef2f2);
  border-color: var(--ef-red-border, #fca5a5);
}

/* A FAULT banner above a table whose numbers are incomplete (e.g. unreadable runtime shards). Red-tinted rather than
   amber: this is not "heads up", it is "what you are reading below is missing rows". Uses the same red tokens as the
   danger confirm so the palette stays the design system's, not a new one. */
.mon-alert {
  background: var(--ef-red-bg, #fef2f2);
  border: 1px solid var(--ef-red-border, #fca5a5);
}
.mon-alert code {
  display: inline-block;
  margin-top: var(--ef-space-4);
  font-size: var(--ef-text-12);
  word-break: break-word;
}

/* The Scheduler tab's list of problems a Host reported: one per line, the reason code first. */
.mon-problems {
  margin: 0;
  padding-left: var(--ef-space-16);
  display: grid;
  gap: var(--ef-space-4);
}

/* Toolbar: the live/paused state line sits right of the buttons and must not wrap mid-phrase. */
.mon-toolbar-state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--ef-space-8);
  white-space: nowrap;
}
.mon-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ef-green, #16a34a);
  animation: mon-pulse 2s ease-in-out infinite;
}
.mon-live-dot.is-paused { background: var(--ef-text-muted); animation: none; }
@keyframes mon-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .mon-live-dot { animation: none; } }

/* Import review (#95 import A+): the category filter, the review table and the decision column. The category is
   always written out (badge text), so the row tint is a second signal, never the only one. */
.import-review-intro { margin: 0 0 var(--ef-space-12); color: var(--ef-text-secondary); font-size: var(--ef-text-13); }
.import-review-summary { display: flex; flex-wrap: wrap; gap: var(--ef-space-6); margin-bottom: var(--ef-space-12); }
.import-review-summary .btn.is-active { background: var(--ef-color-primary-bg); color: var(--ef-color-primary); }
.import-review-count { margin-left: var(--ef-space-4); font-weight: 600; }
.import-review-table { width: 100%; }
.import-review-table td { vertical-align: top; }
.import-review-detail { font-size: var(--ef-text-13); }
.import-review-blocks { background: var(--ef-red-bg); }
.import-review-decision { display: inline-flex; align-items: center; gap: var(--ef-space-6); white-space: nowrap; cursor: pointer; }

/* ── Expression editor (Shared/ExpressionEditor; model in ExpressionEditorModel.cs, interop in
   js/expression-editor-interop.js) ────────────────────────────────────────────────────────────────────────────────
   A plain <textarea> laid over a MIRROR that draws the same characters with colours, chips and squiggles. The two
   must share every metric (font, size, line height, padding, border width, wrapping) or the caret drifts away from
   the drawn text and caretFromPoint maps a drop to the wrong offset. So: nothing inside the mirror may change a
   character's width - token and chip styles are colour, background, box-shadow and underline only (no padding, no
   border, no bold or italic). The textarea's own text is transparent; only its caret and selection show.
   Both also reserve the same scrollbar gutter: the textarea grows a vertical scrollbar once a long script
   overflows, and without a matching gutter on the mirror the two would wrap at different columns. The mirror stays
   out of hit-testing so it never takes a click; the interop's hit tests lift that for their duration. */
.expr-editor {
  position: relative;
  background: var(--ef-surface);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  transition: border-color var(--ef-motion-fast), box-shadow var(--ef-motion-fast);
}
.expr-editor:focus-within { border-color: var(--ef-color-primary); box-shadow: 0 0 0 2px var(--ef-color-focus); }
.expr-editor__mirror,
.expr-editor__input {
  margin: 0;
  border: 0;
  padding: var(--ef-space-8);
  font-family: var(--ef-font-mono);
  font-size: var(--ef-text-13);
  line-height: 1.5;
  letter-spacing: normal;
  tab-size: 4;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  scrollbar-gutter: stable;
}
.expr-editor__mirror {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: var(--ef-text);
  pointer-events: none;
}
.expr-editor__input {
  position: relative;
  display: block;
  width: 100%;
  min-height: 2.75em;
  overflow-y: auto;
  overflow-x: hidden;
  resize: vertical;
  background: transparent;
  color: transparent;
  caret-color: var(--ef-text);
  outline: none;            /* the focus ring is drawn on .expr-editor via :focus-within */
}
.expr-editor__input::selection { background: var(--ef-color-primary-light); color: transparent; }
.expr-editor__input::placeholder { color: var(--ef-text-muted); }
.expr-editor--readonly { background: var(--ef-surface-2); }

/* Light C# colouring (ExpressionSyntaxColoring.CssClassFor). */
.expr-tok-text { color: var(--ef-text); }
.expr-tok-hole,
.expr-tok-interp { color: var(--ef-accent); }
.expr-tok-kw { color: var(--ef-blue-text); }
.expr-tok-ident { color: var(--ef-text); }
.expr-tok-num { color: var(--ef-color-warn-text); }
.expr-tok-str { color: var(--ef-green-text); }
.expr-tok-comment { color: var(--ef-text-muted); }
.expr-tok-op,
.expr-tok-punct { color: var(--ef-text-secondary); }

/* A reference call drawn as one chip. Red when the server reports the reference missing or deleted; neutral while
   the server has not answered for the current text, so an unchecked reference never looks resolved. */
.expr-chip {
  border-radius: var(--ef-radius-4);
  background: var(--ef-surface-2);
  box-shadow: 0 0 0 1px var(--ef-border);
  color: var(--ef-text);
}
.expr-chip--resolved { background: var(--ef-color-primary-bg); box-shadow: 0 0 0 1px var(--ef-color-primary-light); color: var(--ef-blue-text); }
.expr-chip--missing { background: var(--ef-red-bg); box-shadow: 0 0 0 1px var(--ef-red-border); color: var(--ef-red-text); }

/* Diagnostic squiggles (ExpressionSyntaxColoring.SquiggleClass). The underline sits below the glyphs, so it never
   changes a line's height. */
.expr-squiggle--error,
.expr-squiggle--warning,
.expr-squiggle--info { text-decoration-line: underline; text-decoration-style: wavy; text-decoration-skip-ink: none; text-underline-offset: 3px; }
.expr-squiggle--error { text-decoration-color: var(--ef-semantic-error); }
.expr-squiggle--warning { text-decoration-color: var(--ef-semantic-warning); }
.expr-squiggle--info { text-decoration-color: var(--ef-blue); }

/* The drop caret that follows the pointer while a Fields-panel item is dragged over an editor (positioned by the
   interop over the mirror). */
.expr-drop-caret {
  position: absolute;
  z-index: 2;
  width: 2px;
  background: var(--ef-color-primary);
  pointer-events: none;
}
.expr-drop-caret[hidden] { display: none; }

/* Autocomplete (ARIA combobox popup, role=listbox) and signature help. */
.expr-suggest,
.expr-signature {
  position: absolute;
  z-index: 50;
  background: var(--ef-surface);
  color: var(--ef-text);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  box-shadow: var(--ef-shadow-2);
  font-size: var(--ef-text-13);
}
.expr-suggest {
  min-width: 240px;
  max-width: 420px;
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  padding: var(--ef-space-4) 0;
  list-style: none;
}
.expr-suggest-item {
  display: flex;
  align-items: center;
  gap: var(--ef-space-8);
  padding: var(--ef-space-4) var(--ef-space-8);
  cursor: pointer;
  white-space: nowrap;
}
.expr-suggest-item:hover { background: var(--ef-surface-2); }
.expr-suggest-item[aria-selected="true"] { background: var(--ef-color-primary-bg); color: var(--ef-blue-text); }
.expr-suggest-item[aria-disabled="true"] { color: var(--ef-text-muted); cursor: default; }
.expr-suggest-item__label { overflow: hidden; text-overflow: ellipsis; font-family: var(--ef-font-mono); }
.expr-suggest-item__type { margin-left: auto; color: var(--ef-text-secondary); font-family: var(--ef-font-mono); font-size: var(--ef-text-11); }
.expr-suggest-empty { padding: var(--ef-space-4) var(--ef-space-8); color: var(--ef-text-muted); }
.expr-signature { padding: var(--ef-space-4) var(--ef-space-8); font-family: var(--ef-font-mono); max-width: 520px; }
.expr-signature__param--active { font-weight: 600; color: var(--ef-blue-text); }
.expr-signature__doc { margin-top: var(--ef-space-4); font-family: var(--ef-font); color: var(--ef-text-secondary); }

/* ── Expression editor parts wired in the Designer (Shared/ExpressionEditor): the chip buttons under the text box,
   and the popover a click on a chip in the text opens (placed under the text box, like a chip button's). ───────── */
.expr-editor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ef-space-4);
  align-items: center;
}
.expr-editor-chips__item { display: inline-flex; }
.expr-editor-chip-anchor { position: relative; height: 0; }

/* ── Field panel (Shared/ExpressionFieldPanel, design D20) ────────────────────────────────────────────────────────
   The Designer layout's last column, docked right. Open, it is a resizable column (its width is the
   --expr-fields-width the panel sets); collapsed, a narrow rail. While the AI rail is docked open (a fixed column at the
   right edge) the layout leaves room for it, so the panel sits to the rail's left. On a narrow screen the panel is a
   modal drawer over the page and the rail is not shown. */
.designer-layout.designer-layout--fields { grid-template-columns: 200px minmax(0, 1fr) auto; }
.designer-layout.designer-layout--ai-docked { padding-right: var(--designer-ai-rail, 420px); }

.expr-fields-rail {
  position: sticky;
  top: var(--ef-space-16);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ef-space-8);
  width: 36px;
}
.expr-fields-rail__open {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ef-space-8);
  padding: var(--ef-space-8) var(--ef-space-4);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  background: var(--ef-surface);
  color: var(--ef-text-secondary);
  cursor: pointer;
}
.expr-fields-rail__open:hover { color: var(--ef-text); border-color: var(--ef-color-primary); }
.expr-fields-rail__open:focus-visible { outline: 2px solid var(--ef-color-focus); outline-offset: 2px; }
.expr-fields-rail__label { writing-mode: vertical-rl; font-size: var(--ef-text-12); font-weight: 600; }
.expr-fields-rail__fault {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ef-yellow-bg);
  color: var(--ef-yellow-text);
  font-size: var(--ef-text-11);
  font-weight: 700;
}

.expr-fields-panel {
  position: sticky;
  top: var(--ef-space-16);
  display: flex;
  flex-direction: column;
  gap: var(--ef-space-8);
  width: var(--expr-fields-width, 320px);
  max-height: calc(100vh - 2 * var(--ef-space-16));
  padding: var(--ef-space-12);
  padding-left: var(--ef-space-16);
  background: var(--ef-surface);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-8);
  box-shadow: var(--ef-shadow-1);
  overflow: hidden;
}
.expr-fields-resize {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  background: transparent;
}
.expr-fields-resize:hover,
.expr-fields-resize:focus-visible { background: var(--ef-color-primary); opacity: 0.5; outline: none; }
.expr-fields-resize-overlay { position: fixed; inset: 0; z-index: 900; cursor: ew-resize; }

.expr-fields-head { display: flex; align-items: center; justify-content: space-between; gap: var(--ef-space-8); }
.expr-fields-title { margin: 0; font-size: var(--ef-text-14); font-weight: 700; }
.expr-fields-close {
  border: none;
  background: transparent;
  color: var(--ef-text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 var(--ef-space-4);
}
.expr-fields-close:hover { color: var(--ef-text); }
.expr-fields-close:focus-visible { outline: 2px solid var(--ef-color-focus); outline-offset: 2px; }
.expr-fields-target { margin: 0; font-size: var(--ef-text-12); color: var(--ef-text-secondary); }
.expr-fields-search {
  width: 100%;
  padding: var(--ef-space-4) var(--ef-space-8);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-6);
  background: var(--ef-surface);
  color: var(--ef-text);
  font-size: var(--ef-text-13);
}
.expr-fields-search:focus { outline: none; border-color: var(--ef-color-primary); box-shadow: 0 0 0 2px var(--ef-color-focus); }
.expr-fields-note { margin: 0; font-size: var(--ef-text-12); color: var(--ef-text-secondary); }
.expr-fields-note--warn { color: var(--ef-yellow-text); }
.expr-fields-fault {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ef-space-8);
  padding: var(--ef-space-8);
  border-radius: var(--ef-radius-6);
  background: var(--ef-red-bg);
  color: var(--ef-red-text);
  font-size: var(--ef-text-12);
}

.expr-fields-tree,
.expr-fields-items { margin: 0; padding: 0; list-style: none; }
.expr-fields-tree { flex: 1; min-height: 0; overflow-y: auto; }
.expr-fields-group { padding: var(--ef-space-2) 0; }
.expr-fields-group:focus { outline: none; }
.expr-fields-group:focus-visible > .expr-fields-group__head { outline: 2px solid var(--ef-color-focus); outline-offset: -2px; }
.expr-fields-group__head {
  display: flex;
  align-items: center;
  gap: var(--ef-space-6);
  padding: var(--ef-space-4);
  border-radius: var(--ef-radius-4);
  font-size: var(--ef-text-12);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ef-text-secondary);
  cursor: pointer;
}
.expr-fields-group__head:hover { background: var(--ef-surface-2); }
.expr-fields-group__chevron { width: 12px; flex: none; }
.expr-fields-group__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expr-fields-group__count { margin-left: auto; font-weight: 400; color: var(--ef-text-muted); }
.expr-fields-group__note { margin: 0 0 var(--ef-space-4) var(--ef-space-16); font-size: var(--ef-text-11); color: var(--ef-text-muted); }
.expr-fields-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ef-space-6);
  padding: var(--ef-space-4) var(--ef-space-4) var(--ef-space-4) var(--ef-space-16);
  border-radius: var(--ef-radius-4);
  font-size: var(--ef-text-13);
  cursor: grab;
}
.expr-fields-item:hover { background: var(--ef-surface-2); }
.expr-fields-item:focus { outline: none; }
.expr-fields-item:focus-visible { outline: 2px solid var(--ef-color-focus); outline-offset: -2px; background: var(--ef-color-primary-bg); }
.expr-fields-item--disabled { color: var(--ef-text-muted); cursor: default; }
.expr-fields-item__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 auto; }
.expr-fields-item__lock { display: inline-flex; color: var(--ef-yellow-text); }
.expr-fields-item__type {
  padding: 0 var(--ef-space-6);
  border-radius: var(--ef-radius-4);
  background: var(--ef-surface-2);
  color: var(--ef-text-secondary);
  font-family: var(--ef-font-mono);
  font-size: var(--ef-text-11);
}
.expr-fields-item__insert {
  padding: 0 var(--ef-space-6);
  border: 1px solid var(--ef-border);
  border-radius: var(--ef-radius-4);
  background: var(--ef-surface);
  color: var(--ef-text-secondary);
  font-size: var(--ef-text-11);
  cursor: pointer;
  opacity: 0;
}
.expr-fields-item:hover .expr-fields-item__insert,
.expr-fields-item:focus .expr-fields-item__insert { opacity: 1; }
.expr-fields-item__insert:disabled { cursor: default; }
.expr-fields-item:hover .expr-fields-item__insert:disabled,
.expr-fields-item:focus .expr-fields-item__insert:disabled { opacity: 0.5; }
.expr-fields-item__reason { flex-basis: 100%; font-size: var(--ef-text-11); color: var(--ef-text-muted); }
.expr-fields-doc {
  display: flex;
  flex-direction: column;
  gap: var(--ef-space-2);
  padding-top: var(--ef-space-8);
  border-top: 1px solid var(--ef-border);
  font-size: var(--ef-text-12);
  color: var(--ef-text-secondary);
}
.expr-fields-doc__name { font-weight: 600; color: var(--ef-text); }

.expr-fields-backdrop { position: fixed; inset: 0; z-index: 590; background: rgba(0, 0, 0, 0.32); }
.expr-fields-panel.expr-fields-panel--drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 600;
  width: min(var(--expr-fields-width, 320px), 92vw);
  max-height: none;
  border-radius: 0;
  box-shadow: var(--ef-shadow-4);
}

/* Go to field: the row an expression chip asked the Fields tab to show. */
.fields-row--focus > td { background: var(--ef-color-primary-bg); }
tr.fields-row--focus:focus { outline: 2px solid var(--ef-color-focus); outline-offset: -2px; }

@media (max-width: 768px) {
  .designer-layout.designer-layout--fields { grid-template-columns: 1fr; }
  .designer-layout.designer-layout--ai-docked { padding-right: 0; }
  .expr-fields-rail { display: none; }
}
