  /* System theme unless the operator has saved a preference. */
  :root {
    color-scheme: light;
    --bg: #F6F5F1;
    --surface: #FFFFFF;
    --surface-sunken: #F9F8F5;
    --rail: #EDEBE5;
    --border: #DEDDD6;
    --border-strong: #C6C8C2;
    --divider: #EAE8E2;
    --track: #ECEBE6;
    --chart-grid: #DEDED7;
    --chart-axis: #B4BAB5;
    --ink: #202A2D;
    --ink-2: #48565B;
    --ink-3: #59676C;
    --idle: #858D8D;
    --accent: #21566C;
    --accent-bg: #E5EFF2;
    --accent-border: #A8C3CD;
    --accent-ink: #1A4D60;
    /* An external node: another node's data coming in or going out. A sky
       blue no stage kind or health colour uses. */
    --link: #0A78A8;
    --link-bg: #E4F2F8;
    --link-border: #9CCBE0;
    --link-ink: #075A7F;
    --on-link: #FFFFFF;
    /* Looking at another node through this one (the VIEWING banner): a
       teal treatment distinct from the default header, so the two differ in
       lightness as well as hue. */
    --viewing: #0B6B63;
    --viewing-bg: #CFEBE5;
    --viewing-border: #8CCBBF;
    --viewing-ink: #0A4F49;
    --on-viewing: #FFFFFF;
    --on-accent: #FFFFFF;
    --radius-control: 4px;
    --radius-panel: 6px;
    --ok: #1E9E63;
    --ok-ink: #0F6B42;
    --ok-bg: #E7F5EE;
    --ok-border: #C3E5D4;
    --warn: #C9871B;
    --warn-ink: #7D5200;
    --warn-bg: #FCF4E6;
    --warn-border: #ECD9AC;
    --bad: #D14237;
    --bad-ink: #96261D;
    --bad-bg: #FDF1F0;
    --bad-border: #EFC7C3;
    --series-1: #285E82;
    --series-2: #B0602A;
    --series-3: #0E8AA0;
    --shadow: rgba(25,39,44,0.10);
    --selection-glow: rgba(33,86,108,0.16);
    --font-ui: system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Consolas, monospace;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --bg: #1A2124;
      --surface: #232B2F;
      --surface-sunken: #1D2529;
      --rail: #181F22;
      --border: #394449;
      --border-strong: #526168;
      --divider: #323D42;
      --track: #303B40;
      --chart-grid: #3A474D;
      --chart-axis: #627279;
      --ink: #EDF1F1;
      --ink-2: #BEC9CB;
      --ink-3: #A4B2B6;
      --idle: #87979B;
      --accent: #8AC2D4;
      --accent-bg: #293F47;
      --accent-border: #4D7482;
      --accent-ink: #B7DBE6;
      --link: #4FB6E6;
      --link-bg: #0F2733;
      --link-border: #2C6A88;
      --link-ink: #84CFF2;
      --on-link: #06202D;
      --viewing: #3CC7B5;
      --viewing-bg: #11433D;
      --viewing-border: #2A6D64;
      --viewing-ink: #86E3D6;
      --on-viewing: #03201C;
      --on-accent: #15262C;
      --ok: #35C98A;
      --ok-ink: #5FD9A4;
      --ok-bg: #10281E;
      --ok-border: #1E4A36;
      --warn: #E0A33B;
      --warn-ink: #EFBE6B;
      --warn-bg: #2B2211;
      --warn-border: #4E3E1C;
      --bad: #F0665B;
      --bad-ink: #FF8F85;
      --bad-bg: #301917;
      --bad-border: #572823;
      --series-1: #86AFD4;
      --series-2: #C47C3A;
      --series-3: #2CA2B8;
      --shadow: rgba(0,0,0,0.42);
      --selection-glow: rgba(138,194,212,0.18);
    }
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1A2124;
    --surface: #232B2F;
    --surface-sunken: #1D2529;
    --rail: #181F22;
    --border: #394449;
    --border-strong: #526168;
    --divider: #323D42;
    --track: #303B40;
    --chart-grid: #3A474D;
    --chart-axis: #627279;
    --ink: #EDF1F1;
    --ink-2: #BEC9CB;
    --ink-3: #A4B2B6;
    --idle: #87979B;
    --accent: #8AC2D4;
    --accent-bg: #293F47;
    --accent-border: #4D7482;
    --accent-ink: #B7DBE6;
    --link: #4FB6E6;
    --link-bg: #0F2733;
    --link-border: #2C6A88;
    --link-ink: #84CFF2;
    --on-link: #06202D;
    --viewing: #3CC7B5;
    --viewing-bg: #11433D;
    --viewing-border: #2A6D64;
    --viewing-ink: #86E3D6;
    --on-viewing: #03201C;
    --on-accent: #15262C;
    --ok: #35C98A;
    --ok-ink: #5FD9A4;
    --ok-bg: #10281E;
    --ok-border: #1E4A36;
    --warn: #E0A33B;
    --warn-ink: #EFBE6B;
    --warn-bg: #2B2211;
    --warn-border: #4E3E1C;
    --bad: #F0665B;
    --bad-ink: #FF8F85;
    --bad-bg: #301917;
    --bad-border: #572823;
    --series-1: #86AFD4;
    --series-2: #C47C3A;
    --series-3: #2CA2B8;
    --shadow: rgba(0,0,0,0.42);
    --selection-glow: rgba(138,194,212,0.18);
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    font-family: var(--font-ui);
    font-size: 14px;
    background: var(--bg);
    color: var(--ink);
    margin: 0;
    -webkit-font-smoothing: antialiased;
  }
  a { color: var(--accent-ink); text-decoration: none; }
  a:hover { text-decoration: underline; }
  .mono { font-family: var(--font-mono); }

  /* ---------- App shell (docs/ui-handoff/mockups/axe.css "App shell") ----------
     A fixed 56px header across the top, then the rail + scrolling main
     area underneath. The whole app is one embedded page; views are
     re-rendered into #diagram. */
  .app-shell { display: flex; flex-direction: column; height: 100vh; }
  .app-header {
    height: 56px; flex: 0 0 56px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px; padding: 0 20px; position: relative; z-index: 20;
  }
  .brand-name { font: 700 16px var(--font-ui); letter-spacing: 0.055em; }
  /* The logo is the way home (All nodes). */
  a.brand-name { color: var(--ink); text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; padding: 0 4px; border-radius: var(--radius-control); }
  a.brand-name:hover { color: var(--accent-ink); }
  .transport-badge {
    font: 500 10.5px var(--font-mono); color: var(--ink-3); background: var(--track);
    border-radius: 5px; padding: 2px 6px; text-transform: uppercase;
  }
  .header-vdiv { width: 1px; height: 26px; background: var(--divider); flex-shrink: 0; }
  .header-live { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
  .header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  /* The Replay entry: a button while this node has a replay, green with the recording's name while one plays. */
  .header-replay { display: inline-flex; align-items: center; gap: 6px; max-width: 360px; white-space: nowrap; }
  .header-replay .hr-file { overflow: hidden; text-overflow: ellipsis; font: 12px var(--font-mono); }
  .header-replay[hidden] { display: none; }
  .header-replay.playing { color: var(--ok); }
  @media (max-width: 720px) { .header-replay .hr-file { display: none; } }
  .header-icon-btn {
    appearance: none; border: none; background: transparent; width: 32px; height: 32px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2);
    font-size: 15px; cursor: pointer; padding: 0;
  }
  .header-icon-btn:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
  .header-icon-btn svg { width: 17px; height: 17px; }
  .app-body { display: flex; flex: 1 1 auto; min-height: 0; position: relative; }
  .app-sidebar {
    width: var(--sidebar-w, 292px); flex: 0 0 var(--sidebar-w, 292px); background: var(--rail); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 14px 10px 12px; gap: 14px; overflow-y: auto;
  }
  .app-content { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 26px 34px 44px; }
  #diagram { max-width: 1400px; margin: 0 auto; }
  .app-sidebar.collapsed { width: 0; flex-basis: 0; padding: 0; border-right: none; overflow: hidden; }
  /* Drag handle on the sidebar's right edge: drag to resize, double-click
     to reset, arrow keys when focused. Hidden while the sidebar is. */
  .sidebar-resizer {
    flex: 0 0 6px; margin-left: -3px; margin-right: -3px; cursor: col-resize; position: relative; z-index: 5;
    touch-action: none; outline: none;
  }
  .sidebar-resizer::after {
    content: ''; position: absolute; top: 0; bottom: 0; left: 2px; width: 2px; background: transparent; transition: background .12s;
  }
  .sidebar-resizer:hover::after, .sidebar-resizer:focus-visible::after, .sidebar-resizer.dragging::after { background: var(--accent, #3b82f6); }
  .app-sidebar.collapsed + .sidebar-resizer { display: none; }
  /* All nodes and Mesh: no node is selected, so no node sidebar. */
  body.no-node-sidebar .app-sidebar, body.no-node-sidebar .sidebar-resizer, body.no-node-sidebar #sidebar-collapse-btn { display: none; }
  body.sidebar-resizing { cursor: col-resize; user-select: none; }
  .nav-scrim { display: none; }
  /* Which node every node page is about (docs/ui-node-workspace): the node
     chip in the header. THIS SERVER is the plain default (no tag); VIEWING
     <node> is teal and tints the whole header (body.viewing); ALL NODES is
     a neutral pill (body.all-nodes-bar). */
  .header-node { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; }
  .header-node[hidden] { display: none; }
  /* The page is older than its server (an upgrade while it was open). */
  .update-banner {
    display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 8px 20px; flex: 0 0 auto;
    background: var(--warn-bg); border-bottom: 2px solid var(--warn); color: var(--warn-ink); font-size: 14px;
  }
  .update-banner-tag { font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 3px 10px; border-radius: 999px; background: var(--warn); color: #fff; text-transform: uppercase; }
  .update-banner-text { flex: 1 1 280px; min-width: 0; color: var(--ink); }
  .update-banner-status { color: var(--warn-ink); }
  .update-banner .link-btn { background: none; border: 0; padding: 0; color: var(--accent-ink); text-decoration: underline; cursor: pointer; font: inherit; }
  @media (max-width: 640px) { .update-banner { padding: 8px 16px; } }
  /* The dead-man's switch (D70): red on every page while a sensor is lost or deaf, a calm line when it is back. */
  .sensor-banner[hidden] { display: none; }
  .sensor-banner-row {
    display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 8px 20px; font-size: 14px;
    background: var(--bad-bg); border-bottom: 2px solid var(--bad); color: var(--ink);
  }
  .sensor-banner-row.ok { background: var(--ok-bg); border-bottom: 1px solid var(--ok-border); color: var(--ok-ink); }
  .sensor-banner-tag { font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 3px 10px; border-radius: 999px; background: var(--bad); color: #fff; text-transform: uppercase; white-space: nowrap; }
  .sensor-banner-text { flex: 1 1 280px; min-width: 0; font-weight: 600; color: var(--bad-ink); }
  .sensor-banner-row.ok .sensor-banner-text { font-weight: 400; color: var(--ok-ink); }
  .sensor-banner-row .link-btn { background: none; border: 0; padding: 0; min-height: 32px; color: var(--accent-ink); text-decoration: underline; cursor: pointer; font: inherit; }
  @media (max-width: 640px) { .sensor-banner-row { padding: 8px 16px; } }
  body.viewing .app-header { background: var(--viewing-bg); border-bottom: 2px solid var(--viewing); }
  body.all-nodes-bar .app-header { background: var(--surface-sunken); }
  .node-banner-tag {
    font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 4px 10px; border-radius: 999px;
    background: var(--accent); color: var(--on-accent); white-space: nowrap;
  }
  body.viewing .node-banner-tag { background: var(--viewing); color: var(--on-viewing); }
  /* All nodes and Mesh: about every node, so no node's colour. */
  body.all-nodes-bar .node-banner-tag { background: var(--ink); color: var(--surface); }
  .node-switcher-btn {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; font-size: 16px; font-weight: 700;
    background: var(--surface); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 8px; cursor: pointer;
    max-width: 100%;
  }
  body.viewing .node-switcher-btn { color: var(--viewing-ink); border-color: var(--viewing); }
  body.all-nodes-bar .node-switcher-btn { color: var(--ink); border-color: var(--border-strong); }
  .node-switcher-btn .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .node-switcher-desc { margin: 0; padding: 10px 14px 4px; color: var(--ink-2); font-size: 13px; }
  .node-switcher-desc strong { color: var(--ink); }
  body.viewing .node-switcher-desc { color: var(--viewing-ink); }
  .node-switcher-all-nodes { display: flex; gap: 14px; padding: 8px 14px 0; }
  .nav-group-label { font: 600 11px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px 2px; }
  .node-switcher {
    position: fixed; z-index: 60; width: min(360px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 10px 30px var(--shadow); display: flex; flex-direction: column; overflow: hidden;
  }
  .node-switcher input[type=search] { margin: 10px; width: calc(100% - 20px); min-height: 40px; }
  .node-switcher-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
  .node-switcher-opt {
    display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: 44px; cursor: pointer;
  }
  .node-switcher-opt.hi, .node-switcher-opt:hover { background: var(--accent-bg); }
  .node-switcher-opt .opt-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
  .node-switcher-opt .opt-name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .node-switcher-opt .opt-sub { font-size: 12px; color: var(--ink-2); }
  .node-switcher-opt .opt-current { font-size: 12px; font-weight: 700; color: var(--accent-ink); }
  .node-switcher-foot {
    display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px;
    border-top: 1px solid var(--divider); background: var(--surface-sunken); font-size: 12px; color: var(--ink-2);
  }
  .node-switcher-all {
    display: flex; align-items: center; min-height: 44px; padding: 0 14px; font-weight: 600; color: var(--accent-ink);
    text-decoration: none; border-bottom: 1px solid var(--divider);
  }
  .node-switcher-all:hover, .node-switcher-all:focus-visible { background: var(--accent-bg); }
  .node-switcher-empty { padding: 12px 14px; color: var(--ink-2); }
  /* The front page: every node, as cards or a list. */
  .nodes-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
  .nodes-head h1 { margin: 0; font-size: 28px; }
  .nodes-head .nodes-sub { color: var(--ink-2); flex: 1 1 280px; padding-top: 8px; }
  .nodes-head .nodes-actions { display: flex; gap: 8px; flex-wrap: wrap; }
  .nodes-notice {
    margin: 0 0 14px; padding: 10px 14px; border-radius: 8px; background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--ink);
  }
  .nodes-notice + .nodes-notice { margin-top: -6px; }
  .nodes-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
  .nodes-tools input[type=search] { flex: 0 1 320px; min-width: 0; min-height: 40px; }
  .nodes-chips { display: flex; gap: 6px; flex-wrap: wrap; }
  .nodes-chip {
    min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--ink); font-size: 13px; cursor: pointer;
  }
  .nodes-chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
  .nodes-view-toggle { margin-left: auto; display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
  .nodes-view-toggle button { min-height: 40px; padding: 6px 14px; border: 0; border-radius: 0; background: var(--surface); color: var(--ink); cursor: pointer; }
  .nodes-view-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--surface); font-weight: 600; }
  .node-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
  .node-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px;
    display: flex; flex-direction: column; gap: 10px; min-width: 0;
  }
  .node-card.this-server { border: 2px solid var(--accent); padding: 15px 17px; }
  .node-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .node-card-top h2 { margin: 0; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .node-card-top h2.mono { font-family: var(--font-mono); font-size: 16px; }
  .node-card-top .node-menu-btn { margin-left: auto; }
  .this-server-tag {
    font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 3px 8px; border-radius: 999px;
    background: var(--accent); color: var(--on-accent); white-space: nowrap;
  }
  .node-menu-btn { min-width: 40px; min-height: 40px; padding: 0; font-size: 18px; line-height: 1; }
  .node-menu-btn svg { width: 18px; height: 18px; display: block; margin: auto; }
  .node-card-desc { color: var(--ink-2); margin: 0; overflow-wrap: anywhere; }
  .node-card-facts { display: grid; grid-template-columns: auto 1fr; margin: 0; border-top: 1px solid var(--divider); }
  .node-card-facts dt, .node-card-facts dd { margin: 0; padding: 5px 0; border-bottom: 1px solid var(--divider); font-size: 13px; }
  .node-card-facts dt { color: var(--ink-2); padding-right: 12px; }
  .node-card-facts dd { text-align: right; overflow-wrap: anywhere; }
  .node-card-facts dd.mono { font-family: var(--font-mono); font-size: 12px; }
  .node-card-chips { display: flex; gap: 6px; flex-wrap: wrap; }
  .node-chip { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-border); }
  .node-card-open { margin-top: auto; min-height: 40px; width: 100%; }
  .nodes-empty { color: var(--ink-2); padding: 20px 0; }
  .nodes-list td.actions { white-space: nowrap; text-align: right; }
  .nodes-list td.actions button { min-height: 40px; }
  .nodes-list .cell-sub { max-width: 360px; }
  .nodes-list-wrap { overflow-x: auto; }
  .code-block {
    font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-sunken); border: 1px solid var(--border);
    border-radius: 6px; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 10px;
  }
  /* A phone: the navigation slides over the page from ☰ and goes away
     once you pick something; the header keeps only what fits. */
  @media (max-width: 760px) {
    .app-header { gap: 8px; padding: 0 10px; }
    .transport-badge, .header-vdiv, #header-live-text, .identity-name, .identity-chip .identity-role { display: none; }
    #header-search-slot { margin-left: auto; }
    .header-search-btn { width: 40px; padding: 0; justify-content: center; }
    .header-search-btn .search-btn-label, .header-search-btn kbd { display: none; }
    .header-actions { gap: 2px; margin-left: 0; }
    .search-dialog { margin-top: 8px; }
    .search-where { display: none; }
    .app-content { padding: 18px 16px 36px; }
    .page-header .page-header-actions { flex-wrap: wrap; justify-content: flex-start; margin-left: 0; max-width: 100%; }
    .app-sidebar, .app-sidebar.collapsed {
      position: absolute; top: 0; bottom: 0; left: 0; z-index: 40;
      width: min(300px, 86vw); flex: none; padding: 14px 10px 12px; border-right: 1px solid var(--border);
      overflow-y: auto; transform: translateX(-105%); transition: transform .18s ease;
      box-shadow: 8px 0 24px var(--shadow);
    }
    .app-sidebar.phone-open { transform: none; }
    .sidebar-resizer { display: none; }
    .nav-scrim.on { display: block; position: absolute; inset: 0; z-index: 35; background: color-mix(in srgb, var(--ink) 25%, transparent); }
    .header-node { flex: 1 1 auto; }
    .node-switcher-btn { font-size: 14px; padding: 4px 10px; max-width: 100%; }
    .node-banner-tag { font-size: 10.5px; padding: 3px 7px; }
    .app-header .header-live { display: none; }
    #header-search-slot { margin-left: 0; }
    .node-cards { grid-template-columns: 1fr; }
    .nodes-tools input[type=search] { flex: 1 1 100%; }
    .nodes-view-toggle { margin-left: 0; }
  }

  .app-nav { display: flex; flex-direction: column; gap: 1px; }
  .app-sidebar-footer {
    margin-top: auto; border-top: 1px solid var(--divider); padding: 10px 8px 0;
    font: 11.5px var(--font-mono); color: var(--ink-3);
  }

  /* ---------- Identity (header user menu) ---------- */
  .identity-chip {
    display: flex; align-items: center; gap: 8px; background: none; border: none; padding: 4px 6px;
    border-radius: 8px; cursor: pointer; text-align: left; font: 500 13.5px var(--font-ui); color: var(--ink);
  }
  .identity-chip:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
  .identity-avatar {
    flex-shrink: 0; width: 26px; height: 26px; border-radius: 999px; background: var(--accent); color: var(--on-accent);
    display: flex; align-items: center; justify-content: center; font: 700 11px var(--font-ui);
  }
  .identity-text { min-width: 0; display: flex; align-items: center; gap: 8px; }
  .identity-name { font: 500 13.5px var(--font-ui); color: var(--ink); white-space: nowrap; }
  .identity-role {
    font: 600 10.5px var(--font-ui); letter-spacing: 0.05em; text-transform: uppercase;
    background: var(--track); color: var(--ink-2); border-radius: 999px; padding: 2px 8px;
  }

  /* §7 rule 2 (RBAC): a gated action keeps its place, dims, swaps its
     icon for a padlock, and states the requirement underneath. */
  button.gated, .pipeline-switch.gated {
    background: var(--surface-sunken) !important; color: var(--ink-3) !important;
    border-color: var(--border) !important; cursor: not-allowed !important; opacity: 1 !important;
  }

  .status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--idle); display: inline-block; flex-shrink: 0; }
  .status-dot.connected, .status-dot.ok { background: var(--ok); }
  .status-dot.warn { background: var(--warn); }
  .status-dot.bad { background: var(--bad); }
  .spacer { flex: 1; }

  /* ---------- Buttons ---------- */
  button { font-family: inherit; }
  button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  button.primary, button.secondary, button.destructive {
    height: 36px; border-radius: var(--radius-control); font: 600 13px var(--font-ui); padding: 0 15px;
    display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; cursor: pointer;
    white-space: nowrap; transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  }
  button.primary { background: var(--accent); color: var(--on-accent); }
  button.primary:hover { opacity: 0.9; }
  button.secondary { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
  button.secondary:hover { border-color: var(--accent-border); background: color-mix(in srgb, var(--accent-bg) 45%, var(--surface)); }
  button.destructive { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad-ink); }
  button.dense { height: 31px; padding: 0 11px; font-size: 13px; }
  button:disabled { opacity: 0.55; cursor: default; }
  .btn-icon { font-size: 13px; line-height: 1; color: var(--ink-3); }
  button.primary .btn-icon { color: inherit; }
  button.secondary.on { background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent-ink); font-weight: 600; }
  button.secondary.on .btn-icon { color: var(--accent-ink); }

  .empty-note { color: var(--ink-3); font-size: 14px; }

  /* ---------- Object header ---------- */
  /* Sticky within #diagram-scroll; `.stuck` (set on scroll) tucks the facts
     line away and shrinks the title so the bar stays short. */
  .page-header {
    display: flex; align-items: flex-end; gap: 24px; margin: -8px -12px 20px; padding: 8px 12px 16px;
    position: sticky; top: 0; z-index: 8; background: var(--bg);
  }
  .page-header.stuck { padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); box-shadow: 0 4px 10px -8px var(--shadow); }
  .page-header.stuck .page-header-meta { display: none; }
  .page-header.stuck h1 { font-size: 22px; }
  .page-header-titles { display: flex; flex-direction: column; gap: 9px; flex-grow: 1; min-width: 0; }
  .page-header-breadcrumb { display: flex; align-items: center; gap: 7px; font: 13px var(--font-ui); color: var(--ink-3); flex-wrap: wrap; }
  .page-header-breadcrumb a { color: var(--accent-ink); font-family: var(--font-mono); }
  .page-header-breadcrumb > span[aria-hidden] { color: var(--idle); }
  .page-header-breadcrumb-current { color: var(--ink-2); font-weight: 500; }
  /* One line: the title takes what the actions leave, shrinking when
     long and ending in "..." past that (the full name is its tooltip). */
  /* The actions wrap onto a line of their own rather than squeeze the
     title below about 14 characters. */
  .page-title-row { display: flex; align-items: center; gap: 12px; row-gap: 10px; flex-wrap: wrap; min-width: 0; }
  .page-title-row > * { flex-shrink: 0; }
  .page-title-row > h1 { flex: 0 1 auto; min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-header-actions { flex-wrap: wrap; }
  .page-header h1.t-long { font-size: 26px; }
  .page-header h1.t-longer { font-size: 22px; }
  @media (max-width: 760px) { .page-title-row { flex-wrap: wrap; } .page-title-row > h1 { white-space: normal; } }
  .id-chip {
    font: 500 11.5px var(--font-mono); color: var(--ink-3); background: var(--track);
    border-radius: 5px; padding: 3px 8px;
  }
  .page-header h1 { margin: 0; font: 700 30px/1.15 var(--font-ui); letter-spacing: -0.025em; }
  .page-header h1.mono { font-family: var(--font-mono); letter-spacing: -0.03em; }
  .page-header-meta { display: flex; align-items: center; gap: 12px; font: 13.5px var(--font-ui); color: var(--ink-2); flex-wrap: wrap; }
  .page-header-meta .live { display: inline-flex; align-items: center; gap: 6px; color: var(--ok-ink); font-weight: 600; }
  .page-header-meta .sep { color: var(--idle); }
  .page-header-meta code, .page-header-meta .mono { font-family: var(--font-mono); color: var(--ink); }
  .page-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; justify-content: flex-end; margin-left: auto; }
  .page-header-actions button { white-space: nowrap; }
  .page-header-actions:empty { display: none; }
  .page-header-actions .more-btn { display: inline-flex; align-items: center; gap: 6px; }
  /* Stop and Restart as one joined Run control. */
  .btn-group { display: inline-flex; }
  .btn-group > button { border-radius: 0; }
  .btn-group > button + button { margin-left: -1px; }
  .btn-group > button:first-child { border-radius: var(--radius-control) 0 0 var(--radius-control); }
  .btn-group > button:last-child { border-radius: 0 var(--radius-control) var(--radius-control) 0; }
  .btn-group > button:only-child { border-radius: var(--radius-control); }
  /* The ? that lists the gestures: small, round, quiet. */
  .help-btn { width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--ink-2); font: 600 14px var(--font-ui); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
  .help-btn:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
  .help-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .gesture-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0; align-items: baseline; }
  .gesture-list dt, .gesture-list dd { margin: 0; }
  .gesture-list kbd { font: 600 12px var(--font-mono); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border); background: var(--track); white-space: nowrap; }
  /* In a page header, state is text with a dot -- never a button-shaped
     pill, so everything button-shaped there can be clicked. */
  .page-header .status-pill:is(.ok, .warn, .bad, .idle), .page-header .node-chip { background: none; border: 0; padding: 0; border-radius: 0; }
  .page-header .status-pill.ok { color: var(--ok-ink); }
  .page-header .status-pill.warn, .page-header .node-chip { color: var(--warn-ink); }
  .page-header .status-pill.bad { color: var(--bad-ink); }
  .page-header .status-pill.idle { color: var(--ink-2); }
  /* The pipeline's run switch beside its name, and what it's doing. */
  .run-state { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; min-width: 0; }
  .run-switch {
    display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px 0 8px; border-radius: 999px;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); font: 600 15px var(--font-ui); cursor: pointer;
  }
  .run-switch:hover:not(:disabled) { border-color: var(--ink-3); }
  .run-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .run-switch:disabled { cursor: default; opacity: .65; }
  .run-switch-track { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--track); box-shadow: inset 0 0 0 1.5px var(--idle); transition: background .15s ease; flex: 0 0 40px; }
  .run-switch-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1.5px var(--idle); transition: left .15s ease; }
  .run-switch.on { border-color: var(--ok-border); background: var(--ok-bg); color: var(--ok-ink); }
  .run-switch.on .run-switch-track { background: var(--ok); box-shadow: none; }
  .run-switch.on .run-switch-knob { left: 19px; box-shadow: none; }
  .run-switch.pending .run-switch-track { opacity: .55; }
  .run-switch-label { white-space: nowrap; }
  #pipeline-state-pill:empty { display: none; }
  .run-activity { font: 13.5px var(--font-ui); color: var(--ink-3); white-space: nowrap; }
  .run-activity.ok { color: var(--ok-ink); }
  .run-activity.bad { color: var(--bad-ink); font-weight: 500; }
  @media (max-width: 760px) { .run-switch-label, .run-activity { white-space: normal; } .run-switch { height: auto; min-height: 40px; padding-top: 6px; padding-bottom: 6px; } }
  /* Tables: "● Started" / "○ Stopped", and the last 10 minutes' activity. */
  .run-state-text { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; margin-right: 6px; }
  .run-state-text .run-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
  .run-state-text.started { color: var(--ok-ink); }
  .run-state-text.started .run-dot { background: var(--ok); }
  .run-state-text.stopped { color: var(--ink-3); font-weight: 500; }
  .run-state-text.stopped .run-dot { box-shadow: inset 0 0 0 1.6px var(--idle); }
  .run-state-text.finished .run-dot { background: var(--idle); }
  .run-state-text.crashed .run-dot { background: var(--bad); }
  .activity-row { display: inline-flex; align-items: center; gap: 8px; }
  .activity-spark { flex: 0 0 auto; display: block; }
  .activity-spark rect.some { fill: var(--ok); }
  .activity-spark rect.zero { fill: var(--idle); }
  .activity-spark rect.none { fill: transparent; }
  .activity-text { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
  .activity-text.ok { color: var(--ok-ink); }
  .activity-text.bad { color: var(--bad-ink); }
  /* Status & control band: the same on the Node, Pipeline and Stage pages. */
  /* Live metrics: one strip of cells (label, value, one-line caption),
     the same shape on the Node, Pipeline and Stage pages; state and
     uptime sit in the header's facts line. History lives in the
     Performance charts, not here. */
  .cband {
    padding: 14px 6px; margin: 0 0 18px;
    border: 1px solid var(--border); border-radius: var(--radius-panel); background: var(--surface);
  }
  .cband-since { color: var(--ink-2); }
  .cband-fresh.warn { color: var(--warn-ink); }
  .cband-fresh.bad { color: var(--bad-ink); font-weight: 500; }
  .page-header-why { font-size: 13px; color: var(--warn-ink); }
  .page-header-why:empty, .page-header.stuck .page-header-why { display: none; }
  .cband-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); row-gap: 10px; }
  .cband-cells .counter { background: none; border: 0; border-left: 1px solid var(--border); border-radius: 0; padding: 1px 14px; gap: 2px; }
  .cband-cells .counter:first-child { border-left: 0; }
  .cband-cells .counter-label { font-size: 10.5px; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cband-cells .counter-value { font-size: 22px; white-space: nowrap; }
  .cband-cells .counter-unit { font-size: 11.5px; }
  .cband-cells .counter-caption { font-size: 12px; min-height: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cband-cells .tile-meter { margin: 4px 0 2px; }
  @media (max-width: 520px) {
    .cband-cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cband-cells .counter:nth-child(odd) { border-left: 0; }
  }

  /* Status pill (ok / warn / bad / idle) -- the one place status colors
     are allowed to fill a shape. */
  .status-pill {
    border-radius: 999px; padding: 3px 10px 3px 8px; font: 600 12.5px var(--font-ui);
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  }
  .status-pill .status-dot { width: 7px; height: 7px; }
  .status-pill.ok { background: var(--ok-bg); border: 1px solid var(--ok-border); color: var(--ok-ink); }
  .status-pill.ok .status-dot { background: var(--ok); }
  .status-pill.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-ink); }
  .status-pill.warn .status-dot { background: var(--warn); }
  .status-pill.bad { background: var(--bad-bg); border: 1px solid var(--bad-border); color: var(--bad-ink); }
  .status-pill.bad .status-dot { background: var(--bad); }
  .status-pill.idle { background: var(--track); border: 1px solid var(--border); color: var(--ink-2); }
  .status-pill.idle .status-dot { background: var(--idle); }

  /* ---------- Banners (verdict) ---------- */
  .verdict-band { border-radius: 12px; padding: 14px 18px; display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
  .verdict-band.bad { background: var(--bad-bg); border: 1px solid var(--bad-border); }
  .verdict-band.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); }
  .verdict-band.ok { background: var(--ok-bg); border: 1px solid var(--ok-border); }
  .verdict-icon {
    flex-shrink: 0; width: 32px; height: 32px; border-radius: 999px; background: var(--surface);
    display: flex; align-items: center; justify-content: center;
  }
  .verdict-band.bad .verdict-icon { color: var(--bad-ink); }
  .verdict-band.warn .verdict-icon { color: var(--warn-ink); }
  .verdict-band.ok .verdict-icon { color: var(--ok-ink); }
  .verdict-body { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .verdict-headline { margin: 0; font: 700 14.5px var(--font-ui); color: var(--ink); }
  .verdict-detail { margin: 0; font: 13.5px var(--font-ui); color: var(--ink-2); }
  .verdict-detail code { font-family: var(--font-mono); color: var(--ink); }
  .verdict-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
  .verdict-actions a {
    height: 34px; padding: 0 14px; display: inline-flex; align-items: center; border: 1px solid var(--border-strong);
    border-radius: 9px; background: var(--surface); color: var(--ink); font: 500 13.5px var(--font-ui);
  }
  .verdict-actions a:hover { text-decoration: none; border-color: var(--accent-border); }
  .verdict-muted { margin: 0 0 18px; font: 13px var(--font-ui); color: var(--ink-3); }
  .verdict-muted.bad { color: var(--bad-ink); }
  .verdict-muted.warn { color: var(--warn-ink); }
  .verdict-unmute {
    appearance: none; border: 0; background: none; padding: 0; color: var(--accent-ink);
    font: inherit; text-decoration: underline; cursor: pointer;
  }
  .verdict-actions button {
    height: 34px; padding: 0 12px; border: 1px solid transparent; border-radius: 9px; background: transparent;
    cursor: pointer; font: 500 13.5px var(--font-ui); color: var(--ink-2);
  }
  .verdict-actions button:hover { background: color-mix(in srgb, currentColor 10%, transparent); }

  /* ---------- Stat tiles: each counter is its own bordered tile ---------- */
  .counters-grid { display: grid; gap: 13px; }
  .counters-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .counters-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  @media (max-width: 1100px) {
    .counters-grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }
  @media (max-width: 700px) {
    .counters-grid.cols-4, .counters-grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  .counter {
    display: flex; flex-direction: column; gap: 4px; min-width: 0; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 17px 19px;
  }
  .counter-label { font: 600 11.5px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
  .counter-value-row { display: flex; align-items: baseline; gap: 6px; }
  .counter-value { font: 600 28px var(--font-mono); letter-spacing: -0.03em; }
  .counter-unit { font: 600 12.5px var(--font-mono); color: var(--ink-2); }
  .counter-value.warn { color: var(--warn-ink); }
  .counter-value.bad { color: var(--bad-ink); }
  .counter-caption { font: 13px var(--font-ui); color: var(--ink-2); min-height: 17px; }
  .counter-caption.warn { color: var(--warn-ink); font-weight: 500; }
  .counter-caption.bad { color: var(--bad-ink); font-weight: 500; }
  .counter-caption.ok { color: var(--ok-ink); }
  .counters-secondary {
    margin-top: 12px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    font: 13.5px var(--font-ui); color: var(--ink-2); padding: 0 4px;
  }
  .counters-secondary .mono { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
  .counters-secondary .sep { color: var(--idle); }
  .counters-secondary .spacer { flex-grow: 1; }

  /* ---------- Meters ---------- */
  .meter-track { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
  .meter-fill { height: 6px; display: block; border-radius: 3px; background: var(--ok); }
  .meter-fill.warn { background: var(--warn); }
  .meter-fill.bad { background: var(--bad); }

  /* ---------- Tables ---------- */
  .data-table { width: 100%; border-collapse: collapse; font-size: 14px; background: none; border: none; border-radius: 0; overflow: visible; }
  .data-table th {
    white-space: nowrap; text-align: left; padding: 9px 10px; font: 600 11.5px var(--font-ui); letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--ink-2); border-bottom: 1px solid var(--border); background: var(--surface-sunken);
  }
  .data-table td { padding: 11px 10px; border-bottom: 1px solid var(--divider); font: 14px var(--font-ui); vertical-align: middle; }
  .data-table tr:last-child td { border-bottom: none; }
  .data-table th.num { text-align: right; }
  .data-table td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
  .data-table tr.attention td { background: var(--warn-bg); }
  .data-table-name { display: inline-flex; align-items: center; gap: 8px; font: 500 14px var(--font-ui); color: var(--accent-ink); }
  .data-table-row-clickable { cursor: pointer; }
  .data-table-row-clickable:hover td { background: color-mix(in srgb, var(--accent-bg) 40%, transparent); }
  .data-table tr.selected td { background: var(--accent-bg); }
  /* Config files screen: read-only file text. */
  .config-file-viewer { display: flex; flex-direction: column; gap: 10px; }
  .config-file-head { align-items: center; }
  .config-file-head #config-file-name { font-weight: 600; overflow-wrap: anywhere; }
  .config-file-head #config-file-download { margin-left: auto; }
  .config-file-text {
    margin: 0; padding: 12px 14px; max-height: 60vh; overflow: auto; white-space: pre; tab-size: 4;
    font: 12.5px/1.5 var(--font-mono); color: var(--ink);
    background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 6px;
  }
  /* Node settings: a failed control's text (a restart 400 can be multi-line). */
  .node-action-error { margin: 8px 0 0; white-space: pre-wrap; font-family: var(--font-mono); }
  .pipelines-table-scroll { max-height: 420px; overflow: auto; }
  /* A static shape: set column widths, one line per cell, a note line
     that is always there, so live values never resize or shift anything. */
  .pipelines-table { table-layout: fixed; min-width: 1100px; }
  #pipeline-stages-table { min-width: 1250px; }
  #pipeline-stages-table th:first-child,
  #pipeline-stages-table th:nth-child(3) { width: 132px; }
  .pipelines-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pipelines-table td.num, .pipelines-table td.activity-cell { font-variant-numeric: tabular-nums; }
  .pipelines-table .data-table-name { max-width: 100%; }
  .pipelines-table .data-table-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .pipelines-table .data-table-note { min-height: 17px; overflow: hidden; text-overflow: ellipsis; }
  .pipelines-table .data-table-note:empty { display: block; }
  .pipelines-table .activity-row { max-width: 100%; }
  .pipelines-table .activity-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .pipelines-table-scroll .data-table { border-collapse: separate; border-spacing: 0; }
  .pipelines-table-scroll .data-table th { background: var(--surface); position: sticky; top: 0; z-index: 1; }
  .data-table th.sortable-th { padding: 0; }
  .sortable-th-btn {
    appearance: none; background: none; border: none; width: 100%; padding: 9px 10px; font: inherit;
    letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer;
    display: flex; align-items: center; gap: 4px;
  }
  .data-table th.num .sortable-th-btn { justify-content: flex-end; }
  .sortable-th-btn:hover { color: var(--ink); }
  .data-table th.sortable-th.sorted .sortable-th-btn { color: var(--accent-ink); }
  .sortable-th-arrow { font-size: 9px; color: var(--accent); }
  .pcard-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--idle); flex-shrink: 0; }
  /* The pipeline page's phase lanes (stage `group`; docs/ui-node-workspace screen 8). */
  .phase-lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; }
  .phase-lane { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-sunken); padding: 10px; min-width: 0; }
  .phase-lane.warn { border-color: var(--warn-border); background: var(--warn-bg); }
  .phase-lane-head { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }
  .phase-lane.warn .phase-lane-head { color: var(--warn-ink); }
  .phase-lane-stages { display: flex; flex-direction: column; gap: 6px; }
  .phase-stage { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 7px 10px;
    border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; min-width: 0; }
  .phase-stage:hover { border-color: var(--accent); }
  .phase-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  .phase-stage.warn { border-color: var(--warn-border); }
  .phase-stage.off { opacity: .6; }
  .phase-stage-head { display: flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; }
  .phase-stage-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .phase-stage-sub { font-size: 11px; color: var(--ink-3); padding-left: 14px; }
  .phase-stage.warn .phase-stage-sub { color: var(--warn-ink); }
  .phase-note { font-size: 12px; color: var(--ink-3); margin: 10px 0 0; }
  /* Previous / Next on the stage page. */
  .stage-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
  .stage-steps button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .stage-flash { outline: 3px solid var(--accent); outline-offset: 3px; transition: outline-color .4s; }
  .pcard-dot.active { background: var(--ok); }
  /* A pipeline's run state: filled green started, hollow grey stopped;
     filled grey when its run finished. */
  .pcard-dot.started { background: var(--ok); }
  .pcard-dot.stopped { background: transparent; box-shadow: inset 0 0 0 1.6px var(--idle); }
  .pcard-dot.finished { background: var(--idle); }
  .pcard-dot.warn { background: var(--warn); }
  .pcard-dot.error { background: var(--bad); }
  .pcard-dot.stopped.warn, .pcard-dot.stopped.error { background: transparent; }
  /* Running and healthy, but nothing has moved lately (a feed between
     polls, a quiet sensor): a hollow green ring rather than idle grey. */
  .pcard-dot.quiet, .stage-name .dot.quiet { background: transparent; box-shadow: inset 0 0 0 1.6px var(--ok); }
  .data-table-note { display: block; margin-top: 3px; padding-left: 15px; font: 500 12.5px var(--font-ui); }
  .data-table-note:empty { display: none; }
  .data-table-note.warn { color: var(--warn-ink); }
  .data-table-note.muted { color: var(--ink-3); font-weight: 400; }

  .pipeline-switch {
    position: relative; width: 34px; height: 20px; flex-shrink: 0; border-radius: 999px;
    border: 1px solid var(--border-strong); cursor: pointer; background: var(--surface); padding: 0;
  }
  .pipeline-switch::after {
    content: ''; position: absolute; top: 1px; left: 1px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--ink-3); transition: transform 0.15s, background 0.15s;
  }
  .pipeline-switch.on { background: var(--ok-bg); border-color: var(--ok); }
  .pipeline-switch.on::after { background: var(--ok); transform: translateX(14px); }
  .pipeline-switch.busy { opacity: 0.6; cursor: wait; }
  .switch-lock { font-size: 11px; margin: 0 4px; vertical-align: middle; }

  /* ---------- Panels ---------- */
  .pipelines-section, .panel-box {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-panel);
    padding: 20px 24px; margin-bottom: 18px;
  }
  /* A wrapper whose children are already tiles -- no box of its own. */
  .tiles-wrap { margin-bottom: 18px; }
  .section-titlebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
  .section-title { font: 650 16px var(--font-ui); }
  .section-sub { font: 12.5px var(--font-ui); color: var(--ink-3); margin-left: 8px; font-weight: 400; }
  .section-actions { display: flex; gap: 8px; flex-shrink: 0; }
  .chart-tooltip {
    position: absolute; z-index: 5; pointer-events: none; opacity: 0; background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 11px; font: 14px/1.5 var(--font-mono);
    color: var(--ink); white-space: nowrap; box-shadow: 0 6px 18px var(--shadow);
  }
  .chart-tooltip.visible { opacity: 1; }
  .chart-tooltip div:first-child { color: var(--ink-2); font-size: 12.5px; font-weight: 500; margin-bottom: 4px; }
  .chart-tooltip-row { display: flex; align-items: center; gap: 7px; }
  .chart-tooltip-swatch { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
  .range-selector { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
  .range-btn {
    background: var(--surface); border: none; padding: 5px 12px; font: 13px var(--font-ui); color: var(--ink-2); cursor: pointer;
  }
  .range-btn + .range-btn { border-left: 1px solid var(--border-strong); }
  .range-btn:hover { color: var(--ink); }
  .range-btn.active { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }

  /* ---------- Pipeline flow (existing DAG view) ---------- */
  .graph-viewport {
    position: relative; overflow: hidden; width: 100%; height: clamp(210px, 31vh, 360px); min-height: 190px; max-height: 92vh;
    border: 1px solid var(--border); border-radius: var(--radius-panel); background-color: var(--surface-sunken);
    background-image: radial-gradient(var(--border-strong) 0.75px, transparent 0.75px); background-size: 16px 16px;
    cursor: grab; resize: vertical;
  }
  .graph-viewport.dragging { cursor: grabbing; }
  .graph-camera { position: absolute; top: 0; left: 0; z-index: 2; transform-origin: 0 0; will-change: transform; pointer-events: none; }
  .graph-columns { display: flex; align-items: center; gap: 64px; padding: 24px 24px 28px; }
  .graph-column { display: flex; flex-direction: column; gap: 16px; flex-shrink: 0; }
  .graph-columns.free { display: block; position: relative; padding: 0; }
  .stage-box.free { position: absolute; }
  svg.edges-svg-overlay { position: absolute; top: 0; left: 0; z-index: 1; overflow: visible; pointer-events: none; }
  .edge-path { fill: none; stroke: var(--border-strong); stroke-width: 1.75; transition: stroke 0.2s, stroke-width 0.2s; }
  .edge-path.active { stroke: var(--ink-3); stroke-width: 2; }
  .edge-path.warn { stroke: var(--warn); stroke-width: 2.5; }
  .edge-path.disabled { stroke: var(--ink-3); stroke-width: 1.75; stroke-dasharray: 5 4; }
  .edge-path.has-filter { stroke-dasharray: 6 4; }
  .edge-hit { fill: none; stroke: transparent; stroke-width: 18; pointer-events: stroke; cursor: pointer; }
  .edge-group:hover .edge-path { stroke: var(--accent); stroke-width: 2.5; }
  .edge-handle { fill: var(--surface); stroke: var(--ink-3); stroke-width: 1.5; pointer-events: all; cursor: pointer; }
  .edge-handle:hover { stroke: var(--accent); }
  .edge-handle.has-filter { fill: var(--accent); stroke: var(--accent); }
  /* An external node (a mesh_subscribe / mesh_publish stage): a capsule, not
     the stage rectangle, dashed and blue, with the other node and the
     stream on two lines and the flow's health as a dot on its edge. */
  .stage-box.mesh-node {
    position: relative; display: flex; align-items: center; gap: 9px; box-sizing: border-box; width: 214px; min-height: 0;
    padding: 9px 20px 9px 9px; border-radius: 999px; background: var(--link-bg); border: 1.5px dashed var(--link);
    box-shadow: none;
  }
  .stage-box.mesh-node:hover { border-color: var(--link-ink); }
  .stage-box.mesh-node.disabled { background: var(--link-bg); border-color: var(--warn); }
  .mesh-glyph {
    flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--link); color: var(--on-link);
    display: inline-flex; align-items: center; justify-content: center; font: 700 16px/1 var(--font-ui);
  }
  .mesh-text { min-width: 0; flex: 1 1 auto; }
  .mesh-node-name, .mesh-node-stream { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mesh-node-name { font: 700 12.5px var(--font-mono); color: var(--link-ink); }
  .mesh-node-name.goes { cursor: pointer; }
  .mesh-node-name.goes:hover { text-decoration: underline; }
  .mesh-node-stream { margin-top: 2px; font: 500 11.5px var(--font-mono); color: var(--ink-2); }
  .mesh-dot {
    position: absolute; top: -6px; right: 14px; width: 14px; height: 14px; box-sizing: border-box; border-radius: 50%;
    background: var(--idle); border: 2px solid var(--surface);
  }
  .mesh-dot.ok { background: var(--ok); }
  .mesh-dot.warn { background: var(--warn); }
  .mesh-dot.bad { background: var(--bad); }
  .flow-group + .flow-group { margin-top: 10px; }
  .flow-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 2px 0; }
  .zoom-controls {
    position: absolute; right: 10px; bottom: 10px; z-index: 3; display: flex; border: 1px solid var(--border-strong);
    border-radius: 8px; overflow: hidden; background: var(--surface);
  }
  .zoom-controls button {
    min-width: 32px; height: 30px; border: none; background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 13px;
  }
  .zoom-controls button + button { border-left: 1px solid var(--border); }
  .zoom-controls button:hover { color: var(--accent-ink); }

  .stage-box {
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-panel); padding: 12px 15px;
    width: 220px; min-height: 120px; cursor: pointer; pointer-events: auto;
    transition: border-color 0.2s;
  }
  .stage-box:hover { border-color: var(--accent-border); }
  .stage-open-cue { margin-left: auto; color: var(--ink-3, var(--ink-2)); font-size: 18px; line-height: 1; padding-left: 8px; }
  .stage-box:hover .stage-open-cue, .stage-box:focus-visible .stage-open-cue { color: var(--accent-ink, var(--ink)); }
  .stage-box:focus-visible { outline: 2px solid var(--accent-border); outline-offset: 2px; }
  .stage-box.disabled {
    border: 1.5px dashed var(--warn); box-shadow: none;
    background: var(--warn-bg);
  }
  .stage-box.disabled:hover { border-color: var(--warn-ink); }
  .stage-box.disabled .stage-name { color: var(--ink-2); }
  .stage-box.disabled .stage-stat { color: var(--warn-ink); font-family: var(--font-ui); font-weight: 600; }
  .stage-off-pill {
    margin-left: auto; padding: 1px 8px; border-radius: 999px; font: 700 10.5px var(--font-ui); letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn);
  }
  .stage-box.bottleneck { border-color: var(--bad); box-shadow: 0 0 0 1.5px var(--bad); }
  .stage-now-playing { margin-top: 3px; font: 500 11.5px var(--font-ui); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* A replay's "what it plays": green while it plays, muted while stopped
     or played out, red when it crashed. */
  .now-playing.np-started, .replay-state.np-started { color: var(--ok); }
  .now-playing.np-stopped, .now-playing.np-finished, .replay-state.np-stopped, .replay-state.np-finished { color: var(--ink-3); }
  .now-playing.np-crashed, .replay-state.np-crashed { color: var(--bad); }
  .replay-state { font-weight: 600; }
  .replay-start-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
  .stage-type-eyebrow { margin-top: 4px; font: 600 10.5px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
  .stage-queue-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
  .stage-queue-row .meter-track { flex-grow: 1; }
  .stage-queue-row .meter-label { flex-shrink: 0; font: 11.5px var(--font-mono); color: var(--ink-3); }
  .stage-name { display: flex; align-items: center; gap: 7px; font: 600 14px var(--font-mono); }
  .stage-title, .stage-idsub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .stage-idsub { font: 11.5px var(--font-mono); color: var(--ink-3); margin-top: 2px; }
  .stage-name .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--idle); flex-shrink: 0; }
  .stage-name .dot.active { background: var(--ok); }
  .stage-name .dot.error { background: var(--bad); }
  .stage-stat { font: 500 13px var(--font-mono); color: var(--ink-2); margin-top: 4px; font-variant-numeric: tabular-nums; }
  .stage-perf { font: 12px var(--font-mono); color: var(--ink-3); margin-top: 3px; }
  .stage-badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
  .badge { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; font-weight: 600; }
  .badge.error { background: var(--bad-bg); color: var(--bad-ink); border: 1px solid var(--bad-border); }
  .badge.muted { background: var(--track); color: var(--ink-2); }

  /* ---------- Dialogs ---------- */
  dialog.panel {
    border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 0; width: min(640px, 94vw);
    max-height: 88vh; background: var(--surface); color: var(--ink); box-shadow: 0 16px 48px var(--shadow);
  }
  dialog.panel::backdrop { background: rgba(0,0,0,0.40); }
  .modal-inner { padding: 20px 24px 24px; overflow-y: auto; max-height: 88vh; }
  .modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .modal-header h2 { font: 600 16.5px var(--font-ui); margin: 0; }
  #edge-modal-title { font-family: var(--font-mono); }
  .modal-header .sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
  .modal-header button.close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink-2); line-height: 1; border-radius: 7px; width: 30px; height: 30px; }
  .modal-header button.close:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }

  /* ---------- Forms ---------- */
  .toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); margin-bottom: 14px; }
  .field { margin-bottom: 14px; }
  label { display: block; font: 600 11.5px var(--font-ui); color: var(--ink-3); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.05em; }
  .toggle { text-transform: none; letter-spacing: 0; font-weight: 400; }
  input[type=text], input[type=number], input[type=search], input[type=email], input[type=password], textarea, select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
    font: 13.5px var(--font-mono); background: var(--surface); color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  input[type=text]:focus, input[type=number]:focus, input[type=search]:focus, input[type=email]:focus, input[type=password]:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--selection-glow);
  }
  textarea { min-height: 120px; resize: vertical; }
  #stage-config-area { min-height: 42vh; }
  input.bad, textarea.bad { outline: 1px solid var(--bad); }
  .field-hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

  table { width: 100%; border-collapse: collapse; font-size: 14px; }
  th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--divider); }
  th { color: var(--ink-3); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; border-bottom-color: var(--border); }
  tr:last-child td { border-bottom: none; }
  .use-btn { background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); border-radius: 8px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
  .use-btn:hover { border-color: var(--accent-border); }

  .bar { display: flex; gap: 10px; align-items: center; margin-top: 16px; }


  /* ---------- Tree nav (UI-BRIEF §2; axe.css "Tree nav") ---------- */
  .tree-filter {
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 9px; color: var(--ink-3);
  }
  .tree-filter[hidden] { display: none; }
  .tree-filter:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--selection-glow); }
  .tree-filter-ic svg { width: 15px; height: 15px; display: block; }
  .tree-filter input[type=search] {
    border: none; background: transparent; padding: 0; height: 100%; flex: 1; min-width: 0;
    font: 13.5px var(--font-ui); color: var(--ink); box-shadow: none;
  }
  .tree-filter input[type=search]:focus { box-shadow: none; }
  .tree-section {
    display: flex; align-items: center; padding: 6px 8px; border-radius: 7px; font: 600 14px var(--font-ui); color: var(--ink);
  }
  .tree-section .n { margin-left: auto; font: 500 11.5px var(--font-mono); color: var(--ink-3); }
  .tree-section.clickable { cursor: pointer; }
  .tree-section.clickable:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
  .tree-section.active { background: var(--accent-bg); color: var(--accent-ink); }
  .tree-section.active .n { color: var(--accent-ink); }
  .tree { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; }
  .tree-row {
    position: relative; display: flex; align-items: center; gap: 7px; height: 30px; padding-right: 0;
    border-radius: 7px; font: 14px var(--font-ui); color: var(--ink-2); white-space: nowrap; cursor: pointer;
  }
  .tree-row:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
  .tree-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  #about-dialog .about-label { display: block; font: 600 12px var(--font-ui); color: var(--ink-2); margin: 12px 0 4px; }
  #about-dialog .confirm-detail { margin-top: 4px; }
  /* The same quiet chevron as a section heading's (.nav-chev): borderless, 12 px glyph, a hover wash;
     only the indent tells the level. Nothing to expand: the same chevron, dimmed and inert, so names line up. */
  .tree-row .chev { width: 22px; height: 22px; flex: 0 0 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); border-radius: 5px; }
  .tree-row .chev svg { width: 12px; height: 12px; transition: transform .12s ease; }
  .tree-row .chev.open svg { transform: rotate(90deg); }
  .tree-row .chev.clickable { cursor: pointer; }
  .tree-row .chev.clickable:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }
  .tree-row.active .chev.clickable { color: var(--accent-ink); }
  .tree-row .chev.leaf { opacity: .35; cursor: default; }
  .tree-row .label { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
  .tree-row .chev { margin-left: 2px; }
  .tree-row .meta { font: 11.5px var(--font-mono); color: var(--ink-3); padding-left: 6px; }
  /* A node row: status dot, what kind of node (an icon), its name, and how many pipelines it says it has. */
  .tree-row .kind { width: 14px; height: 14px; flex: 0 0 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); }
  .tree-row .kind svg { width: 13px; height: 13px; }
  .tree-row .kind.link { color: var(--link); }
  .tree-row .count { font: 11.5px var(--font-ui); color: var(--ink-3); padding-left: 6px; white-space: nowrap; }
  .tree-row.active .count { color: var(--accent-ink); }
  .nav-help { margin-left: 6px; width: 17px; height: 17px; flex: 0 0 17px; border-radius: 999px; border: 1px solid var(--border-strong); background: none; color: var(--ink-3); font: 600 11px var(--font-ui); line-height: 1; padding: 0; cursor: pointer; }
  .nav-help:hover { color: var(--accent-ink); border-color: var(--accent-ink); }
  .node-legend { width: 310px; padding: 10px 12px; font: 12.5px/1.45 var(--font-ui); color: var(--ink-2); }
  .node-legend h4 { margin: 0 0 6px; font: 600 12px var(--font-ui); color: var(--ink); }
  .node-legend .row { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
  .node-legend .row .pcard-dot { flex: 0 0 7px; }
  .node-legend .row .kind { color: var(--ink-3); }
  .node-legend .row .kind.link { color: var(--link); }
  .node-legend .row .kind svg { width: 13px; height: 13px; }
  .node-legend .sep { height: 1px; background: var(--divider); margin: 8px 0; }
  .node-rename { appearance: none; border: none; background: none; cursor: pointer; color: var(--ink-3); padding: 0 4px; font: 13px var(--font-ui); }
  .node-rename:hover { color: var(--accent-ink); }
  .tree-row.stage .label { font: 13px var(--font-mono); }
  .tree-row.onpath { color: var(--ink); font-weight: 500; }
  .tree-row.active { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; box-shadow: inset 2px 0 var(--accent); }
  .tree-row.active .meta { color: var(--accent-ink); }
  .relbadge {
    font: 600 10.5px var(--font-mono); letter-spacing: 0.03em; border-radius: 5px; padding: 1px 6px;
    background: var(--accent-bg); color: var(--accent-ink); border: 1px solid var(--accent-border);
  }
  .relbadge.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-border); }
  .tree-empty { padding: 8px; font-size: 13px; color: var(--ink-3); }
  .tree-nav-group { display: flex; flex-direction: column; gap: 1px; margin-top: 14px; }
  .tree-group-label { font: 600 11.5px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 0 8px 5px; }
  .tree-nav-item {
    display: flex; align-items: center; padding: 7px 8px; border-radius: var(--radius-control); font: 14px var(--font-ui); color: var(--ink-2); cursor: pointer;
  }
  /* The navigation's sections: a heading with a chevron that folds it. */
  .nav-section + .nav-section { margin-top: 12px; }
  /* Every top-level label (Overview, Pipelines, Insights, ...) starts at
     the same left edge; a section's chevron is at the row's right edge. */
  .nav-section-head { gap: 4px; padding-left: 8px; padding-right: 0; }
  .nav-section-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-section-head .n { margin-left: 0; padding-left: 6px; }
  .nav-section-head:has(> #tree-count) { display: flex; align-items: center; min-height: 29px; }
  #tree-count { font: 11.5px var(--font-mono); color: var(--ink-3); }
  .nav-chev {
    appearance: none; border: 0; background: transparent; width: 22px; height: 22px; flex: 0 0 22px; padding: 0; border-radius: 5px;
    display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); cursor: pointer;
  }
  .nav-chev:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }
  .nav-chev svg { width: 12px; height: 12px; transition: transform .12s ease; }
  .nav-chev.open svg { transform: rotate(90deg); }
  .nav-section-body { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; }
  .nav-section-body > .tree-nav-item { padding-left: 24px; padding-right: 26px; }
  .nav-section-body.node-nav-top > .tree-nav-item { padding-left: 8px; }
  .nav-section-body .nav-item-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tree-nav-item:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
  .tree-nav-item.active { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; box-shadow: inset 2px 0 var(--accent); }
  .tree-nav-item .n { margin-left: auto; font: 11.5px var(--font-mono); color: var(--ink-3); }
  .tree-nav-item.active .n { color: var(--accent-ink); }
  /* Kept in place on a node seen through a link, greyed, with the reason. */
  .tree-nav-item.unavailable, .tree-nav-item.unavailable:hover { color: var(--ink-3); background: none; cursor: default; }
  .nav-unavailable-note { padding: 2px 8px 8px 12px; font-size: 12px; color: var(--ink-3); }

  /* ---------- Search: a button in the header, a pop-up (Ctrl K) ---------- */
  #header-search-slot { flex: 0 0 auto; margin-left: 12px; }
  .header-search-btn {
    height: 40px; min-width: 40px; border-radius: 9px; background: var(--surface-sunken); border: 1px solid var(--border);
    display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--ink-3); cursor: pointer;
    font: 13.5px var(--font-ui);
  }
  .header-search-btn:hover { border-color: var(--border-strong); color: var(--ink-2); }
  .header-search-btn .search-btn-label { color: var(--ink-2); }
  .header-search-btn .search-ic svg, .search-dialog-field .search-ic svg { width: 15px; height: 15px; display: block; }
  .header-search-btn kbd, .search-dialog kbd, .help-body kbd {
    font: 500 11px var(--font-mono); background: var(--track); border-radius: 4px; padding: 1px 6px; color: var(--ink-3);
  }
  .search-dialog {
    padding: 0; border: none; background: transparent; width: min(640px, calc(100vw - 32px)); max-width: none;
    margin: 12vh auto auto; overflow: visible;
  }
  .search-dialog::backdrop { background: color-mix(in srgb, var(--ink) 35%, transparent); }
  .search-dialog-box {
    background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); border-radius: var(--radius-panel);
    box-shadow: 0 12px 32px var(--shadow); overflow: hidden;
  }
  .search-dialog-field {
    display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 52px; border-bottom: 1px solid var(--divider); color: var(--ink-3);
  }
  .search-dialog-field input[type=search] {
    border: none; background: transparent; padding: 0; min-height: 50px; flex: 1; min-width: 0; box-shadow: none;
    font: 15px var(--font-ui); color: var(--ink);
  }
  .search-dialog-field input[type=search]:focus { outline: none; box-shadow: none; }
  .search-results { max-height: min(60vh, 480px); overflow-y: auto; padding: 6px; }
  .search-hit { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
  .search-hit.hi { background: var(--accent-bg); }
  .search-kind { flex: 0 0 64px; font: 600 10.5px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
  .search-name { font-family: var(--font-mono); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .search-hit.hi .search-name { color: var(--accent-ink); }
  .search-where { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
  .search-empty { padding: 10px; font-size: 13px; color: var(--ink-3); }

  /* ---------- Menus / kebab ---------- */
  .kebab-btn {
    appearance: none; border: 1px solid transparent; background: transparent; width: 34px; height: 34px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); cursor: pointer; padding: 0;
  }
  .kebab-btn svg { width: 17px; height: 17px; }
  .kebab-btn:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
  .popover-menu {
    position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
    box-shadow: 0 10px 28px var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 1px; min-width: 210px;
    width: max-content; max-width: calc(100vw - 16px);
  }
  .popover-item {
    appearance: none; border: none; background: none; text-align: left; padding: 8px 10px; border-radius: 7px;
    font: 13.5px var(--font-ui); color: var(--ink); cursor: pointer; white-space: nowrap;
  }
  .popover-item:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
  .popover-item:disabled { color: var(--ink-3); cursor: default; }
  .popover-item.destructive { color: var(--bad-ink); }
  .popover-divider { height: 1px; background: var(--divider); margin: 4px 2px; }
  .popover-heading { font: 600 11px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 6px 12px 2px; }

  /* ---------- Drawer (Configuration, Tap) ---------- */
  .drawer {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(600px, 92vw); background: var(--surface);
    border-left: 1px solid var(--border); box-shadow: -12px 0 32px var(--shadow); display: flex; flex-direction: column; z-index: 15;
    animation: drawer-in 0.16s ease-out;
  }
  @keyframes drawer-in { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
  .drawer-head { display: flex; align-items: center; gap: 10px; padding: 17px 22px; border-bottom: 1px solid var(--border); }
  .drawer-title { font: 600 17px var(--font-ui); }
  .drawer-subtitle { font-size: 13px; color: var(--ink-2); }
  .drawer-close {
    margin-left: auto; appearance: none; border: none; background: none; width: 32px; height: 32px; border-radius: 8px;
    color: var(--ink-2); font-size: 20px; cursor: pointer; line-height: 1;
  }
  .drawer-close:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
  .drawer-expand {
    margin-left: auto; appearance: none; border: none; background: none; width: 32px; height: 32px; border-radius: 8px;
    padding: 8px; color: var(--ink-2); cursor: pointer;
  }
  .drawer-expand + .drawer-close { margin-left: 0; }
  .drawer-expand:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--accent-ink); }
  .drawer-expand svg { width: 100%; height: 100%; display: block; }
  .drawer.wide { width: min(900px, 96vw); }
  .drawer.expanded { width: 100%; animation: none; box-shadow: none; border-left: none; }
  .drawer-body > .tap-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .drawer-body > .quick-edit-error { margin: 18px 22px 0; }
  @media (max-width: 760px) { .drawer, .drawer.wide { width: 100%; border-left: none; } }
  .drawer.expanded .ed-form { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .kv .v.list { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; overflow-x: auto; overflow-wrap: normal; }
  .kv .v.list .list-count { font: 12px var(--font-ui); color: var(--ink-3); margin-top: 3px; }
  .ed-form textarea.list-input { font: 13px/1.6 var(--font-mono); white-space: pre; overflow-x: auto; min-height: 0; }
  .drawer-body { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; }
  .drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); }
  .drawer-foot .spacer { flex: 1; }
  .quick-edit-status { font-size: 12.5px; color: var(--ink-3); }
  .quick-edit-status.dirty { color: var(--warn-ink); font-weight: 500; }
  .quick-edit-error {
    margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.45;
    background: var(--bad-bg); color: var(--bad-ink); border: 1px solid var(--bad-border); white-space: pre-wrap;
  }

  /* ---------- Toasts / confirm ---------- */
  #toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
  .toast {
    display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--bg); border-radius: 10px;
    padding: 10px 14px; font: 13.5px var(--font-ui); box-shadow: 0 10px 28px var(--shadow); max-width: 640px;
  }
  .toast.bad { background: var(--bad-ink); color: #fff; }
  .toast-action { appearance: none; border: none; background: none; color: var(--accent-bg); font: 600 13.5px var(--font-ui); cursor: pointer; text-decoration: underline; }
  .confirm-dialog { width: min(480px, 94vw); }
  .confirm-message { font: 600 16px var(--font-ui); margin: 0 0 8px; }
  .confirm-detail { font: 14px var(--font-ui); color: var(--ink-2); margin: 0 0 4px; line-height: 1.5; }
  .confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
  .ed-leave-dialog .confirm-actions { flex-wrap: wrap; }

  /* ---------- Page bits ---------- */
  .page-lede { font: 14px var(--font-ui); color: var(--ink-2); margin: 2px 0 16px; }
  .page-lede-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
  .page-lede-row .page-lede { margin: 0; }
  .crumb-kind { color: var(--ink-3); }
  .panel-prose { font: 14px var(--font-ui); color: var(--ink-2); line-height: 1.55; margin: 0 0 12px; max-width: 820px; }
  .panel-foot { font: 12.5px var(--font-ui); color: var(--ink-3); margin: 12px 0 0; }
  .inline-form { display: flex; gap: 8px; align-items: center; max-width: 620px; }
  .inline-form input { flex: 1; }
  .cell-sub { font-size: 12px; color: var(--ink-3); }
  .household-lines { margin: 0 0 12px; padding-left: 18px; font: 14px var(--font-ui); color: var(--ink-2); line-height: 1.5; }
  .household-lines li { margin-bottom: 6px; }
  tr.household-low td { color: var(--ink-3); }
  /* AXE Output: the lines a dispatch stage sends, in a quiet monospace box with a find bar over it. */
  .ao-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
  .ao-bar select { max-width: 100%; }
  .ao-follow { display: inline-flex; align-items: center; gap: 5px; font: 13px var(--font-ui); color: var(--ink-2); cursor: pointer; text-transform: none; letter-spacing: normal; margin: 0; }
  .ao-spacer { flex: 1 1 auto; }
  .ao-lines { font: 12.5px/1.55 var(--font-mono); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; height: min(60vh, 560px); overflow: auto; color: var(--ink-2); scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent; }
  .ao-line { white-space: pre-wrap; overflow-wrap: anywhere; padding: 1px 0; }
  .ao-line + .ao-line { border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent); }
  .ao-gap { color: var(--bad-ink); }
  .ao-empty { color: var(--ink-3); font: 13px var(--font-ui); }
  .ao-line mark { background: color-mix(in srgb, var(--accent-bg) 70%, #f5c518); color: inherit; border-radius: 2px; padding: 0 1px; }
  .ao-line mark.cur { background: #f08c24; color: #1b1100; outline: 1px solid #b86500; }
  @media (max-width: 760px) {
    .ao-bar .mail-find-seg { flex: 1 1 100%; }
    .ao-bar .mail-find-input { flex: 1 1 auto; width: 0; }
    .ao-spacer { display: none; }
    .ao-lines { height: 55vh; }
  }
  tr.household-dev-row:hover td { background: var(--bg-hover, rgba(127,127,127,.08)); }
  .cell-sub.mono { font-family: var(--font-mono); }
  .kv-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 13px; }
  .kv-list dt { color: var(--ink-3); }
  .kv-list dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
  .kv-list dd.mono { font-family: var(--font-mono); }
  /* One node page (docs/ui-node-workspace): action groups, the reach card. */
  .node-actions { margin: 4px 0 16px; }
  .node-action-groups { display: flex; flex-wrap: wrap; gap: 12px 28px; }
  .node-action-group { min-width: 0; }
  .node-action-title { font: 600 11px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
  .node-action-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
  .node-action-buttons button { min-height: 40px; }
  .node-action-why { margin-top: 8px; font: 12.5px var(--font-ui); color: var(--ink-3); }
  .node-action-why div + div { margin-top: 2px; }
  .node-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
  .node-split > .panel-box { margin: 0; }
  .linked-details { padding: 12px 16px; margin-bottom: 16px; }
  .linked-details > summary { cursor: pointer; }
  .linked-details[open] > summary { margin-bottom: 10px; }
  .linked-details .drawer-label { margin: 12px 0 6px; }
  @media (max-width: 760px) { .node-split { grid-template-columns: minmax(0, 1fr); } }
  .reach-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; margin-bottom: 12px; }
  .reach-kv dt { font-size: 12.5px; }
  .reach-kv dd + dt { margin-top: 8px; }
  .reach-kv dd { color: var(--ink); }
  .reach-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  /* A link's page and the Relay page (docs/ui-node-workspace, screens 5 and 7). */
  .link-paths { display: flex; flex-direction: column; gap: 16px; }
  .link-path-row.in-use .link-path-label { color: var(--ink); }
  .link-path-label { display: flex; align-items: center; gap: 8px; font: 600 12.5px var(--font-ui); color: var(--ink-3); margin-bottom: 8px; }
  .link-path { display: flex; align-items: center; min-width: 0; }
  .link-box { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
    background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; }
  .link-box.self { border-color: var(--accent); }
  .link-box.relay { border-color: var(--warn); background: var(--warn-bg); }
  .link-box-kind { font: 600 11px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
  .link-box-name { font: 600 16px var(--font-ui); color: var(--ink); overflow-wrap: anywhere; }
  .link-box-sub { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
  .link-box .status-pill { margin-top: 4px; }
  .link-line { flex: 0 0 48px; height: 0; border-top: 2px dashed var(--ink-3); opacity: 0.7; }
  .link-line.live { border-top-style: solid; border-top-color: var(--accent); opacity: 1; }
  .link-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .link-panels > .panel-box { margin: 0; }
  .relay-carried { margin-top: 13px; }
  .relay-used-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; overflow-wrap: anywhere; }
  .empty-panel .empty-title { font: 600 15px var(--font-ui); color: var(--ink); margin: 0 0 6px; }
  .empty-panel p { margin: 0 0 6px; color: var(--ink-2); overflow-wrap: anywhere; }
  .table-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--ink-2) transparent; }
  @media (max-width: 760px) {
    .link-path { flex-direction: column; align-items: stretch; }
    .link-line { flex: 0 0 22px; height: auto; width: 0; border-top: 0; border-left: 2px dashed var(--ink-3); align-self: center; }
    .link-line.live { border-left-style: solid; border-left-color: var(--accent); }
    .link-panels { grid-template-columns: minmax(0, 1fr); }
  }
  .link-settings-dialog .kv-list { margin: 12px 0; }
  .empty-cell { color: var(--ink-3); text-align: center; padding: 22px 10px !important; }
  .warn-text { color: var(--warn-ink); }
  .tpl-badge { display: inline-block; font: 600 11.5px var(--font-ui); padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--track); color: var(--ink-2); white-space: nowrap; }
  .tpl-badge.in-sync { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-border); }
  .tpl-badge.update, .tpl-badge.edited { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-border); }
  .tpl-diff { margin: 4px 0 0; padding-left: 18px; font: 12.5px var(--font-ui); color: var(--ink-2); }
  .tpl-diff li { margin: 2px 0; overflow-wrap: anywhere; }
  .tpl-dialog-body { max-width: 760px; }
  .tpl-diff-view { margin: 8px 0; padding: 8px 10px; max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--track); font: 12px/1.45 var(--font-mono, monospace); white-space: pre-wrap; overflow-wrap: anywhere; }
  .tpl-diff-view .add { background: var(--ok-bg); color: var(--ok-ink); display: block; }
  .tpl-diff-view .del { background: var(--bad-bg); color: var(--bad-ink); display: block; }
  .tpl-diff-view .gap { color: var(--ink-3); display: block; }
  .tpl-diff-view .ctx { display: block; }
  .tpl-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; }
  /* ---------- Saved state panels ---------- */
  .toast.warn { background: var(--warn-ink); color: #fff; }
  .field-label { display: block; font: 600 12px var(--font-ui); color: var(--ink-2); margin: 12px 0 4px; }
  .state-summary { font: 600 15px var(--font-ui); color: var(--ink); margin: 0 0 10px; }
  .kv-rows { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font: 14px var(--font-ui); }
  .kv-rows dt { color: var(--ink-3); }
  .kv-rows dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
  .state-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
  .state-subtitle { font: 600 11px var(--font-ui); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin: 20px 0 6px; }
  .state-leftover { font: 600 11px var(--font-ui); color: var(--warn-ink); background: var(--warn-bg); border-radius: 999px; padding: 1px 8px; }
  .state-table td .dim-text { font-size: 12.5px; }
  .state-row-actions { text-align: right; white-space: nowrap; }
  .crit-badge { flex: 0 0 auto; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font: 600 11px var(--font-ui); line-height: 18px; text-align: center; margin-left: 6px; }
  .attention-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--warn); background: var(--warn-bg); border-radius: 10px; font: 13.5px var(--font-ui); }
  .attention-strip[hidden] { display: none; }
  .attention-title { font: 600 11px var(--font-ui); letter-spacing: .07em; text-transform: uppercase; color: var(--warn-ink); }
  .attention-item { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
  .attention-item.bad { color: var(--bad-ink); }
  .state-summary-line { display: flex; align-items: center; gap: 12px; font: 14px var(--font-ui); color: var(--ink-2); }
  .state-summary-line.attention { color: var(--warn-ink); }
  .state-summary-text { flex: 1 1 auto; min-width: 0; }
  .state-detail { margin-top: 10px; }
  .state-table th { padding: 6px 10px; }
  .state-table td { padding: 4px 10px; font-size: 13px; }
  .state-table .kebab-btn { min-width: 30px; min-height: 30px; }
  .restore-scope { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 6px; font: 14px var(--font-ui); }
  .restore-stages { display: flex; flex-direction: column; gap: 4px; margin: 0 0 6px 24px; font: 13.5px var(--font-ui); }
  .restore-warnings p { margin: 6px 0 0; font: 13px var(--font-ui); }
  @media (max-width: 700px) {
    .state-table { display: block; overflow-x: auto; }
  }
  .ok-text { color: var(--ok-ink); }
  .bad-text, .mono.bad { color: var(--bad-ink); }
  .mono.warn { color: var(--warn-ink); }
  .dim-text { color: var(--ink-3); }
  .tile-meter { margin: 10px 0 4px; }
  .help-body { font-size: 14px; line-height: 1.55; color: var(--ink-2); }
  .help-body h3 { font: 600 14px var(--font-ui); color: var(--ink); margin: 16px 0 6px; }
  .help-body ul { margin: 0; padding-left: 18px; }
  .help-body li { margin: 4px 0; }

  /* ---------- Config screen ---------- */
  .config-split { display: flex; gap: 16px; align-items: stretch; }
  .config-list-panel { width: 300px; flex: 0 0 300px; margin-bottom: 0; padding: 14px; }
  .config-view-panel { flex: 1 1 auto; min-width: 0; margin-bottom: 0; padding: 0; overflow: hidden; }
  .config-files { display: flex; flex-direction: column; gap: 2px; }
  .config-dir { font-size: 13px; font-weight: 600; color: var(--accent-ink); background: var(--accent-bg); border-radius: 7px; padding: 7px 10px; margin-bottom: 4px; }
  .config-file { appearance: none; border: none; background: none; text-align: left; padding: 7px 10px 7px 22px; border-radius: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
  .config-file:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
  .config-file.active { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }
  .config-search { width: 100%; box-sizing: border-box; margin: 4px 0 8px; }
  .config-group { margin-top: 6px; }
  .config-group-head { cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 6px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
  .config-group-note { font-size: 12px; color: var(--ink-3, var(--ink-2)); padding: 0 4px 4px; }
  .config-item { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
  .config-item .config-file { flex: 1 1 auto; padding-left: 10px; }
  .config-caption { flex-basis: 100%; font-size: 12px; color: var(--ink-3, var(--ink-2)); padding: 0 10px 4px; margin-top: -4px; }
  .config-file-sub { flex: 0 0 auto !important; font-size: 12px; padding: 3px 8px !important; border: 1px solid var(--border); }
  .config-viewer-head { padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--ink-2); background: var(--surface-sunken); }
  .code-view { font: 13px/1.7 var(--font-mono); padding: 12px 0; overflow-x: auto; background: var(--surface-sunken); min-height: 380px; }
  .code-view .line { display: flex; }
  .code-view .ln { width: 44px; flex: 0 0 44px; text-align: right; padding-right: 14px; color: var(--ink-3); user-select: none; }
  .code-view .content { white-space: pre; padding-right: 20px; color: var(--ink); }
  .code-view .k { color: var(--accent-ink); }
  .code-view .s { color: var(--ok-ink); }
  .code-view .n { color: var(--series-2); }
  .code-view .c { color: var(--ink-3); }
  @media (max-width: 900px) { .config-split { flex-direction: column; } .config-list-panel { width: auto; flex-basis: auto; } }

  /* ---------- Object pages (Stage / Edge / Pipeline) ---------- */
  .obj-desc { font: 14.5px/1.6 var(--font-ui); color: var(--ink-2); max-width: 1100px; margin: -6px 0 18px; }
  .obj-desc-src { color: var(--ink-3); font-size: 13px; }
  .obj-desc.empty { color: var(--ink-3); margin-top: -10px; }
  .obj-desc .obj-desc-edit { font-size: 13px; color: var(--accent-ink); }
  .obj-desc.empty .obj-desc-edit { padding-left: 0; }
  #about-dialog .about-check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
  .strong { font-weight: 600; color: var(--ink); }
  /* Saved state inspector */
  .inspect-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
  .inspect-search { flex: 1 1 220px; min-width: 0; }
  .inspect-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 22px 0; }
  .inspect-chips[hidden] { display: none; }
  .inspect-chip { appearance: none; display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 12.5px var(--font-ui); cursor: pointer; }
  .inspect-chip .mono { font: 12.5px var(--font-mono); }
  .inspect-chip:hover { border-color: var(--accent); }
  .inspect-chip.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
  .inspect-chip-n { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
  .inspect-chip.on .inspect-chip-n { color: inherit; }
  .inspect-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin: 0 0 8px; font: 12.5px var(--font-mono); }
  .inspect-crumbs[hidden] { display: none; }
  .inspect-crumb { appearance: none; border: none; background: none; padding: 2px 4px; border-radius: 4px; font: inherit; color: var(--accent-ink); cursor: pointer; overflow-wrap: anywhere; }
  .inspect-crumb:hover { background: var(--accent-bg); }
  .inspect-crumb.here { color: var(--ink); font-weight: 600; cursor: default; }
  .inspect-crumb-sep { color: var(--ink-3); }
  .jv-drill { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--accent-ink); border-radius: 4px; padding: 0 6px; margin-left: 8px; font: 11.5px var(--font-ui); cursor: pointer; }
  .jv-drill:hover { border-color: var(--accent); background: var(--accent-bg); }
  .jv-drill.jv-row { margin-left: 0; font-family: var(--font-mono); }
  .inspect-note { padding: 12px 22px 0; margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
  .inspect-count { font-size: 12.5px; color: var(--ink-3); margin: 0; padding: 10px 22px 4px; }
  .inspect-pane { padding: 0 22px 18px; }
  .inspect-table { table-layout: fixed; }
  .inspect-table > thead > tr > th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
  .inspect-table > tbody > tr > td { padding: 8px 10px; vertical-align: top; }
  .inspect-table col.c-key { width: 32%; }
  .inspect-table col.c-seq { width: 70px; }
  .inspect-table col.c-when { width: 130px; }
  .inspect-table col.c-size { width: 96px; }
  .inspect-table td.num { white-space: nowrap; }
  .inspect-row { cursor: pointer; }
  .inspect-row:hover > td { background: color-mix(in srgb, var(--accent-bg) 40%, transparent); }
  .inspect-row.open > td { background: var(--accent-bg); border-bottom-color: transparent; }
  .inspect-row .caret { display: inline-block; width: 12px; color: var(--ink-3); transition: transform .12s; }
  .inspect-row.open .caret { transform: rotate(90deg); }
  .inspect-key { font: 13px var(--font-mono); overflow-wrap: anywhere; }
  .inspect-preview { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .inspect-table > tbody > tr.inspect-detail > td { padding: 4px 10px 16px; background: color-mix(in srgb, var(--accent-bg) 25%, transparent); }
  .inspect-value-bar { display: flex; align-items: center; gap: 10px; margin: 6px 0 8px; font-size: 12.5px; color: var(--ink-3); }
  .inspect-value-bar .spacer { flex: 1; }
  .inspect-value { max-height: 560px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
  .inspect-value pre { margin: 0; padding: 10px 12px; font: 12px/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
  .inspect-more { margin-top: 10px; }
  .inspect-more[hidden] { display: none; }
  /* A JSON value, as nested tables */
  .jv { font: 12.5px/1.45 var(--font-mono); }
  .jv table { border-collapse: collapse; width: 100%; }
  .inspect-value .jv td, .inspect-value .jv th { padding: 4px 8px; border-bottom: 1px solid var(--divider); vertical-align: top; text-align: left; font: 12.5px/1.45 var(--font-mono); background: none; }
  .inspect-value .jv tr:last-child > td { border-bottom: none; }
  .jv-obj > tbody > tr > td.k { width: 1%; white-space: nowrap; color: var(--ink-3); }
  .inspect-value .jv-grid th { font: 600 11px var(--font-ui); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-sunken, var(--track)); white-space: nowrap; }
  .jv-grid td.i { color: var(--ink-3); width: 1%; }
  .jv-grid-wrap { overflow-x: auto; }
  .jv details > summary { cursor: pointer; color: var(--accent-ink); font-family: var(--font-ui); font-size: 12.5px; }
  .jv details[open] > summary { margin-bottom: 4px; }
  .jv details .jv-obj, .jv details .jv-grid-wrap { border-left: 2px solid var(--divider); }
  .jv-str { color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
  .jv-num { color: var(--accent-ink); }
  .jv-lit { color: var(--ink-3); font-style: italic; }
  .jv-time { color: var(--ink-3); font-family: var(--font-ui); margin-left: 6px; }
  .jv-empty { color: var(--ink-3); }
  .jv-note { color: var(--ink-3); font: 12px var(--font-ui); padding: 4px 8px; }
  .drawer.inspect-drawer:not(.expanded) { width: min(1000px, 96vw); }
  /* Sign-in pages (--auth-dir) */
  .auth-screen { position: fixed; inset: 0; z-index: 200; overflow-y: auto; background: var(--bg); display: flex; flex-direction: column; align-items: center; padding: 56px 16px 32px; }
  .auth-brand { display: flex; align-items: baseline; gap: 10px; margin-bottom: 22px; }
  .auth-logo { font: 700 22px var(--font-ui); letter-spacing: .04em; color: var(--ink); }
  .auth-node { font: 500 15px var(--font-mono); color: var(--ink-2); }
  .auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 28px 28px 22px; box-shadow: 0 8px 28px var(--shadow); }
  .auth-title { font: 600 21px var(--font-ui); margin: 0 0 8px; color: var(--ink); }
  .auth-lede { font: 14px/1.55 var(--font-ui); color: var(--ink-2); margin: 0 0 18px; }
  .auth-form { display: flex; flex-direction: column; gap: 14px; }
  .auth-field, .auth-check { display: flex; flex-direction: column; gap: 5px; text-transform: none; letter-spacing: normal; font: 14px var(--font-ui); margin: 0; }
  .auth-label { font: 600 11.5px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
  .auth-field input, .auth-field textarea {
    width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 8px;
    background: var(--surface); color: var(--ink); font: 15px var(--font-ui);
  }
  .auth-field textarea { resize: vertical; line-height: 1.45; }
  .auth-hint { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
  .auth-notice { font-size: 13px; line-height: 1.5; color: var(--ink-2); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
  .auth-notice p { margin: 0 0 8px; }
  .auth-notice .auth-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); cursor: pointer; }
  .auth-submit { width: 100%; justify-content: center; padding-top: 10px; padding-bottom: 10px; font-size: 15px; }
  .auth-button { display: inline-block; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; }
  .auth-msg { min-height: 1.2em; margin: 14px 0 0; font-size: 13.5px; color: var(--ink-2); }
  .auth-msg:empty { display: none; }
  .auth-msg.bad { color: var(--bad-ink); }
  .auth-links { margin-top: 18px; font-size: 13.5px; color: var(--ink-3); }
  .auth-links a { color: var(--accent-ink); }
  .auth-sep { margin: 0 8px; }
  .auth-foot { max-width: 420px; text-align: center; margin: 22px 0 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
  @media (max-width: 480px) { .auth-screen { padding-top: 28px; } .auth-card { padding: 22px 18px 18px; } }
  /* Mail page: an inbox list and a reading pane */

  /* The list and the reading pane share the window below the header,
     equally tall; each scrolls on its own (the email inside its frame). */
  .mail-split { flex: 1 1 auto; min-height: 360px; display: grid; grid-template-columns: var(--mail-list-w, 340px) 14px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  /* The divider between them: drag to resize the list. */
  .mail-resizer { cursor: col-resize; touch-action: none; position: relative; }
  .mail-resizer::after { content: ''; position: absolute; top: 0; bottom: 0; left: 6px; width: 2px; border-radius: 2px; background: transparent; transition: background .12s; }
  .mail-resizer:hover::after, .mail-resizer.dragging::after, .mail-resizer:focus-visible::after { background: var(--accent); }
  .mail-resizer:focus-visible { outline: none; }
  .mail-list { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
  .mail-list-empty { padding: 18px; margin: 0; }
  .mail-more-row { display: flex; justify-content: center; padding: 12px; color: var(--ink-2); font-size: 13px; }
  .mail-more { margin: 0; }
  .mail-item { display: flex; flex-direction: column; gap: 6px; text-align: left; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--divider); background: transparent; color: var(--ink); font: 14px var(--font-ui); cursor: pointer; }
  .mail-item:last-child { border-bottom: 0; }
  .mail-item:hover { background: var(--surface-sunken); }
  .mail-item.on { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
  .mail-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  /* Multi-select: a row wraps a checkbox and the item; the row carries the divider, hover and open state. */
  .mail-list-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 12px; border-bottom: 1px solid var(--divider); background: var(--surface); font-size: 12.5px; color: var(--ink-3); }
  .mail-list-head .mail-check { margin: 0; }
  .mail-select-count { flex: 1 1 auto; min-width: 0; }
  .mail-row { display: flex; align-items: flex-start; border-bottom: 1px solid var(--divider); }
  .mail-row:last-child { border-bottom: 0; }
  .mail-row:hover { background: var(--surface-sunken); }
  .mail-row.picked { background: var(--surface-sunken); }
  .mail-row.on { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
  .mail-row .mail-item { flex: 1 1 auto; min-width: 0; padding-left: 8px; border-bottom: 0; }
  .mail-row .mail-item:hover, .mail-row .mail-item.on { background: transparent; box-shadow: none; }
  .mail-check { flex: none; width: 15px; height: 15px; margin: 13px 0 0 12px; accent-color: var(--accent); cursor: pointer; }
  .mail-item-top { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
  .mail-item-subject { flex: 1 1 auto; min-width: 0; font-weight: 600; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
  .mail-item-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
  /* Unread (client-side read state): bold subject and an accent dot; read rows go lighter. */
  .mail-item:not(.unread) .mail-item-subject { font-weight: 500; }
  .mail-item.unread .mail-item-subject { font-weight: 700; }
  .mail-item.unread .mail-item-top::before { content: ''; flex: none; width: 7px; height: 7px; margin: 6px -2px 0 -6px; border-radius: 50%; background: var(--accent); }
  .mail-item-snippet { font-size: 12.5px; line-height: 1.4; color: var(--ink-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .tree-nav-item .nav-badge { margin-left: auto; background: var(--accent); color: #fff; }
  .mail-item-time { flex: none; white-space: nowrap; font-size: 12.5px; line-height: 1.35; color: var(--ink-3); }
  .mail-sev { flex: none; font: 600 10.5px var(--font-ui); letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; margin-top: 1px; }
  .mail-sev.bad { background: var(--bad-bg); color: var(--bad-ink); border: 1px solid var(--bad-border); }
  .mail-sev.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-border); }
  .mail-sev.idle { background: var(--track); color: var(--ink-2); border: 1px solid var(--border); }
  .mail-status { font-size: 11.5px; padding: 1px 8px; }
  .mail-reader { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
  .mail-reader-empty { margin: auto; padding: 40px 24px; text-align: center; }
  .mail-empty-title { font: 600 16px var(--font-ui); margin: 0 0 6px; color: var(--ink); }
  .mail-loading { padding: 20px; margin: 0; }
  /* The Mail page: a slim header, then the email as high as it can go. */
  .app-content:has(> #diagram.mail-screen) { padding-top: 14px; padding-bottom: 16px; display: flex; flex-direction: column; }
  #diagram.mail-screen { flex: 1 1 auto; min-height: 0; width: 100%; max-width: none; display: flex; flex-direction: column; }
  .mail-head { flex: none; }
  .mail-head { display: flex; align-items: center; gap: 8px 14px; flex-wrap: nowrap; margin-bottom: 12px; }
  .mail-title { font: 600 22px var(--font-ui); letter-spacing: -0.01em; margin: 0; }
  .mail-scope { font-size: 14px; flex: 0 0 auto; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mail-head-facts { font-size: 13px; color: var(--ink-3); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  /* The filters stay on one line: the search gives up room first. */
  .mail-head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; min-width: 0; }
  .mail-head-actions .mail-search { flex: 0 1 240px; width: 240px; min-width: 120px; height: 32px; padding-top: 0; padding-bottom: 0; }
  .mail-head-actions .mail-filter { flex: none; height: 32px; padding-top: 0; padding-bottom: 0; width: auto; max-width: 240px; }
  .mail-head-actions .mail-delete-all { flex: none; white-space: nowrap; }
  .mail-head-actions .mail-since { height: 32px; box-sizing: border-box; }
  .mail-reader-head { flex: none; padding: 8px 12px 8px; border-bottom: 1px solid var(--divider); }
  .mail-line1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .mail-subject { flex: 1 1 auto; min-width: 0; margin: 0; font: 600 15.5px/1.35 var(--font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mail-nav { flex: none; display: inline-flex; align-items: center; gap: 4px; }
  .mail-pos { font: 12px var(--font-mono); color: var(--ink-3); min-width: 44px; text-align: center; }
  .mail-icon-btn {
    width: 28px; height: 28px; padding: 0; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--ink-2); font: 15px/1 var(--font-ui); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  }
  .mail-icon-btn:hover:not(:disabled) { border-color: var(--accent-border); color: var(--accent-ink); background: var(--accent-bg); }
  .mail-icon-btn:disabled { opacity: .4; cursor: default; }
  .mail-line2 { margin-top: 3px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mail-line2 .mono { color: var(--ink-2); }
  .mail-line2 a { color: var(--accent-ink); }
  .mail-line2 .status-pill { vertical-align: 1px; }
  .mail-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
  .mail-actions .seg-btn { padding: 4px 11px; font-size: 12.5px; }
  .mail-actions a.mail-btn, .mail-actions button { height: 28px; font-size: 12.5px; padding: 0 10px; }
  button.mail-back { display: none; height: 28px; font-size: 12.5px; margin-right: 2px; }
  a.mail-btn { height: 31px; box-sizing: border-box; display: inline-flex; align-items: center; padding: 0 11px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: 500 13px var(--font-ui); text-decoration: none; white-space: nowrap; }
  a.mail-btn:hover { border-color: var(--accent-border); background: color-mix(in srgb, var(--accent-bg) 45%, var(--surface)); }
  .mail-attachments { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; }
  .mail-attachment { color: var(--accent-ink); text-decoration: none; padding: 2px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-sunken); max-width: 100%; overflow-wrap: anywhere; }
  .mail-attachment:hover { border-color: var(--accent-border); }
  .mail-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  /* The rest of the pane; the email scrolls inside it. */
  .mail-frame { display: block; flex: 1 1 0; min-height: 0; width: 100%; border: 0; background: #fff; }
  /* Full screen: the email over the whole window, zoomable, paged. */
  .mail-full { position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column; background: var(--bg); }
  .mail-full-bar { display: flex; align-items: center; gap: 8px 10px; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
  .mail-full-head { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; }
  .mail-full-title { font: 600 14.5px var(--font-ui); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* The zoom group, a divider, the paging group: each a quiet segmented control under a small label. */
  .mail-full-controls { flex: none; display: flex; align-items: center; gap: 10px; margin-left: auto; }
  .mail-full-group { display: inline-flex; align-items: center; gap: 7px; }
  .mail-full-label { font: 600 10.5px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
  .mail-full-seg { display: inline-flex; align-items: stretch; height: 30px; box-sizing: border-box; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
  .mail-full-seg .mail-icon-btn { width: 30px; height: auto; border: none; border-radius: 0; }
  .mail-full-bar .mail-full-seg > * + * { border-left: 1px solid var(--border); }
  .mail-full-seg .mail-full-zoom, .mail-full-seg .mail-pos { display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; }
  .mail-full-zoom { font: 600 12.5px var(--font-mono); min-width: 46px; text-align: center; color: var(--ink-2); }
  .mail-full-reset { appearance: none; border: none; background: var(--surface); padding: 0 10px; font: 12.5px var(--font-ui); color: var(--ink-2); cursor: pointer; }
  .mail-full-reset:hover { color: var(--accent-ink); background: var(--accent-bg); }
  .mail-full-sep { flex: none; width: 1px; height: 22px; background: var(--border-strong); }
  /* Find in the email: a field and its count, ‹ › and clear, in the same segmented frame. */
  .mail-find-input { appearance: none; border: none; outline: none; background: var(--surface); color: var(--ink); font: 13px var(--font-ui); width: 150px; min-width: 0; padding: 0 8px; }
  .mail-find-input::placeholder { color: var(--ink-3); }
  .mail-find-input::-webkit-search-cancel-button { display: none; }
  .mail-find-seg:focus-within { border-color: var(--accent-border); }
  .mail-find-count { display: inline-flex; align-items: center; padding: 0 8px; font: 12px var(--font-mono); color: var(--ink-3); white-space: nowrap; }
  .mail-find-count.none { color: var(--bad-ink); }
  .mail-find-seg [hidden] { display: none; }
  .mail-find-toggle { display: none; }
  @media (max-width: 760px) {
    .mail-find-toggle { display: inline-flex; }
    .mail-full-controls { flex-wrap: wrap; row-gap: 6px; }
    .mail-full-sep:not(.mail-full-sep-close) { display: none; }
    .mail-find:not(.open) .mail-find-field { display: none; }
    .mail-find.open { flex: 1 1 100%; }
    .mail-find.open .mail-full-seg { flex: 1 1 auto; }
    .mail-find.open .mail-find-input { flex: 1 1 auto; width: 0; }
  }
  @media (max-width: 760px) {
    .mail-full-bar { flex-wrap: wrap; }
    .mail-full-head { flex-basis: 0; }
    .mail-full-close { order: 1; }
    .mail-full-sep-close { display: none; }
    .mail-full-controls { order: 2; flex: 1 1 100%; justify-content: flex-end; }
  }
  @media (max-width: 460px) { .mail-full-label { display: none; } .mail-full-controls { gap: 8px; } }
  .mail-full iframe { flex: 1; width: 100%; border: 0; background: #fff; }
  @media (max-width: 760px) { .mail-head { flex-wrap: wrap; } .mail-head-actions { margin-left: 0; flex-wrap: wrap; } .mail-head-actions .mail-search { flex: 1 1 100%; width: 100%; } }
  .mail-pre { flex: 1 1 0; min-height: 0; margin: 10px; padding: 12px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.55 var(--font-mono); background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 8px; color: var(--ink); }
  @media (max-width: 900px) {
    .mail-split { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .mail-resizer { display: none; }
    .mail-split.reading .mail-list { display: none; }
    .mail-split:not(.reading) .mail-reader { display: none; }
    button.mail-back { display: inline-flex; }
    .mail-line2 { white-space: normal; }
    .mail-reader-head { padding: 8px 10px; }
  }
  /* Access page, with sign-in on */
  .access-tabs { margin: 0 0 16px; }
  .access-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
  .access-search { flex: 1 1 260px; max-width: 420px; }
  .access-table-wrap { overflow-x: auto; }
  .access-table th.sortable { cursor: pointer; user-select: none; }
  .access-table th.sortable:hover { color: var(--accent-ink); }
  .access-table th[data-sort="asc"]::after { content: " ▲"; font-size: 9px; }
  .access-table th[data-sort="desc"]::after { content: " ▼"; font-size: 9px; }
  .access-table td { vertical-align: middle; }
  .access-role { font-size: 13px; padding: 3px 6px; }
  .access-actions { display: inline-flex; gap: 6px; align-items: center; }
  .request-outcome { margin: 18px 0; }
  .request-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
  .request-actions .dim-text { flex-basis: 100%; font-size: 13px; }
  .access-note { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
  .visitor-pages { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
  .visitor-ua { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  .page-header-meta code { background: var(--track); border-radius: 5px; padding: 1px 6px; font-size: 12.5px; }
  .two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .two-col > .panel-box { margin-bottom: 18px; }
  @media (max-width: 1050px) { .two-col { grid-template-columns: 1fr; } }
  .section-titlebar .section-title .section-sub { margin-left: 8px; }
  .open-link { font-size: 13.5px; white-space: nowrap; }
  .dir-chip {
    font: 600 11px var(--font-ui); letter-spacing: 0.06em; color: var(--ink-2); background: var(--track);
    border-radius: 6px; padding: 3px 9px;
  }
  .editing-pill {
    font: 700 11.5px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink);
    background: var(--accent-bg); border-radius: 6px; padding: 4px 9px;
  }

  /* ---------- Line charts ---------- */
  .lc-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
  .lc-pair > .lc:only-child { grid-column: 1 / -1; }
  @media (max-width: 900px) { .lc-pair { grid-template-columns: 1fr; } }
  .lc { min-width: 0; }
  .lc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
  .lc-title { font: 600 14px var(--font-ui); }
  .lc-legend { display: inline-flex; flex-wrap: wrap; gap: 2px 8px; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
  .lc-legend-row { margin: 2px 0 0 58px; }
  .lc-legend-item {
    appearance: none; border: none; background: none; padding: 1px 3px; border-radius: 5px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px; font: 12.5px var(--font-ui); color: var(--ink-2);
  }
  .lc-legend-item:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
  .lc-legend-item.off { color: var(--ink-3); text-decoration: line-through; }
  .lc-legend-item.off .lc-dot { opacity: 0.35; }
  .lc-idle {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
    font: 13px var(--font-ui); color: var(--ink-3);
  }
  .lc-idle:empty { display: none; }
  .lc-expand {
    appearance: none; border: none; background: none; width: 26px; height: 26px; border-radius: 7px; padding: 5px;
    color: var(--ink-3); cursor: pointer; flex-shrink: 0;
  }
  .lc-expand:hover { color: var(--accent-ink); background: var(--accent-bg); }
  .lc-expand svg { width: 100%; height: 100%; display: block; }
  .lc-plot.clickable { cursor: zoom-in; }
  .lc-svgwrap { position: relative; flex: 1; min-width: 0; }
  .lc-svgwrap .lc-svg { width: 100%; }
  .lc-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--accent); opacity: 0; pointer-events: none; }
  .lc-cross-y { position: absolute; left: 0; right: 0; height: 1px; background: var(--accent); opacity: 0; pointer-events: none; }
  .lc-cross.visible, .lc-cross-y.visible { opacity: 0.45; }
  .lc-mark { position: absolute; width: 7px; height: 7px; margin: -4px 0 0 -4px; border-radius: 50%; border: 1.5px solid var(--surface); pointer-events: none; box-sizing: content-box; }
  /* Where the crosshair meets each axis: the value it reads there. */
  .lc-axis-tag {
    position: absolute; z-index: 4; pointer-events: none; opacity: 0; padding: 2px 7px; border-radius: 5px;
    background: var(--accent-bg); color: var(--accent-ink); border: 1px solid var(--accent-border);
    box-shadow: 0 1px 4px var(--shadow); font: 600 12.5px var(--font-mono); white-space: nowrap;
  }
  .lc-axis-tag.visible { opacity: 1; }
  .lc-ytag { left: 0; transform: translateY(-50%); min-width: 40px; text-align: right; }
  .lc-xtag { top: 0; transform: translateX(-50%); }
  .lc-vgrid { stroke: var(--chart-grid); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 2 3; }
  .lc-big .lc-svg { height: 420px; }
  .lc-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
  @media (max-width: 1100px) { .lc-trio { grid-template-columns: 1fr; } }
  dialog.chart-popup { width: min(1280px, 96vw); max-height: 94vh; }
  .chart-popup .modal-inner { max-height: 94vh; }
  .chart-popup-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
  .chart-popup-head h2 { margin: 0; font: 600 18px var(--font-ui); }
  .chart-popup-head .drawer-close { margin-left: 0; }
  .lc-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
  .lc-unit { margin-left: auto; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
  .lc-plot { position: relative; display: flex; gap: 8px; }
  .lc-ylabels { display: flex; flex-direction: column; justify-content: space-between; min-width: 50px; text-align: right; font: 12.5px var(--font-mono); color: var(--ink-2); padding: 2px 0; }
  .lc-svg { flex: 1; min-width: 0; height: 70px; display: block; overflow: visible; }
  .lc-grid { stroke: var(--chart-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
  .lc-axis { stroke: var(--chart-axis); stroke-width: 1; vector-effect: non-scaling-stroke; }
  .lc-xlabels { position: relative; height: 18px; margin: 3px 0 0 58px; font: 12.5px var(--font-mono); color: var(--ink-2); }
  .lc-xlabels > span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
  .lc-empty .lc-svg { opacity: 0.6; }

  /* ---------- Where events went ---------- */
  .outcome-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--track); margin: 4px 0 14px; }
  .outcome-bar > div { height: 100%; }
  .outcome-rows { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 7px 12px; align-items: center; font-size: 14px; }
  .outcome-rows .sw { width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid transparent; box-sizing: border-box; }
  .outcome-rows .num { text-align: right; }
  .outcome-rows .pct { text-align: right; color: var(--ink-3); min-width: 52px; }
  .outcome-edges { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--divider); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
  .outcome-edges-title { font: 600 11.5px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
  .outcome-edge-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; }

  /* ---------- Drawer content ---------- */
  .drawer-section { padding: 18px 22px 4px; }
  .drawer-label { font: 600 11.5px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px; }
  .drawer-prose { font: 14px/1.55 var(--font-ui); color: var(--ink-2); margin: 0; }
  .drawer-note { font-size: 12.5px; color: var(--ink-3); margin: 10px 0 0; line-height: 1.5; }
  .kv { display: grid; grid-template-columns: minmax(150px, max-content) 1fr; column-gap: 18px; font-size: 13.5px; }
  .kv > div { padding: 8px 0; border-bottom: 1px solid var(--divider); min-width: 0; overflow-wrap: anywhere; }
  .kv .k { color: var(--ink-3); }
  .kv .v { color: var(--ink); }
  .tap-empty { padding: 36px 22px; text-align: center; color: var(--ink-2); font-size: 14px; }

  /* ---------- Edge page ends ---------- */
  .ends { display: flex; align-items: center; gap: 14px; }
  .endcard { flex: 1 1 0; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface-sunken); min-width: 0; }
  .endcard .role { font: 600 11px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
  .endcard .nm { font: 600 16px var(--font-mono); margin-top: 4px; overflow-wrap: anywhere; }
  .endcard-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
  .endarrow { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--ink-3); font-size: 12px; }
  .endarrow .line { width: 110px; height: 2px; background: var(--accent); position: relative; }
  .endarrow .line::after { content: ""; position: absolute; right: -2px; top: -4px; border-left: 8px solid var(--accent); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }

  /* ---------- Tap drawer ---------- */
  .tap-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
  .tap-toolbar-label { font-size: 12.5px; color: var(--ink-3); }
  .tap-history-note { font-size: 12px; color: var(--ink-3); }
  .tap-history-note.off { font-style: italic; }
  .seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
  .seg-btn { appearance: none; border: none; background: var(--surface); padding: 6px 14px; font: 13px var(--font-ui); color: var(--ink-2); cursor: pointer; }
  .seg-btn + .seg-btn { border-left: 1px solid var(--border-strong); }
  .seg-btn.on { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }
  .seg-btn:disabled { color: var(--idle); cursor: not-allowed; }
  .tap-pager { display: flex; align-items: center; gap: 12px; padding: 11px 22px; background: var(--surface-sunken); border-bottom: 1px solid var(--border); font-size: 13.5px; }
  .tap-pager-text { flex: 1; min-width: 0; }
  .tap-pager-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
  .pagebtn {
    width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--ink); font-size: 17px; cursor: pointer; flex-shrink: 0;
  }
  .pagebtn:disabled { color: var(--idle); background: var(--surface-sunken); cursor: default; }
  .tap-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 22px; font: 12.5px var(--font-mono); color: var(--ink-3); border-bottom: 1px solid var(--divider); }
  .tap-meta:empty { display: none; }
  .tap-meta b { color: var(--ink); font-weight: 500; }
  .tap-body { flex: 1 1 auto; overflow: auto; }
  .tap-list { max-height: 190px; overflow-y: auto; border-bottom: 1px solid var(--border); font: 12.5px var(--font-mono); }
  .tap-row { display: flex; gap: 12px; align-items: baseline; padding: 4px 22px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
  .tap-row:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
  .tap-row.on { background: var(--accent-bg); color: var(--accent-ink); }
  .tap-row.earlier .tap-row-n { color: var(--ink-3); }
  .tap-row-n { width: 42px; flex-shrink: 0; text-align: right; }
  .tap-row-t { flex-shrink: 0; }
  .tap-row-s { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
  .tap-row-e { flex-shrink: 0; color: var(--ink-3); }
  .tap-row-b { flex-shrink: 0; color: var(--ink-3); }
  .tap-row-d { width: 28px; flex-shrink: 0; color: var(--ink-3); font-size: 11.5px; text-transform: uppercase; }
  .tap-row.earlier .tap-row-t, .tap-row.earlier .tap-row-s { color: var(--ink-3); }
  .tap-row .tap-badge { margin-left: 0; flex-shrink: 0; }
  .tap-badge { margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink-3); }
  .tap-json { margin: 0; padding: 16px 22px; font: 13px/1.65 var(--font-mono); color: var(--ink); white-space: pre; }
  .tap-json .k { color: var(--accent-ink); }
  .tap-json .s { color: var(--ok-ink); }
  .tap-json .n { color: var(--series-2); }
  .tap-json .c { color: var(--ink-3); }
  .tap-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 22px; border-bottom: 1px solid var(--border); }
  .tap-filter-input { flex: 1 1 240px; min-width: 0; font: 13px/1.4 var(--font-mono); }
  .tap-filter-msg { flex-basis: 100%; font-size: 12px; color: var(--ink-3); }
  .tap-filter-msg code { font: 12px var(--font-mono); }
  .tap-field { cursor: pointer; border-radius: 3px; }
  .tap-field:hover, .tap-field:focus-visible { outline: 1px dashed var(--accent); outline-offset: 1px; }
  .tap-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; }
  .tap-wait { color: var(--ink-2); }
  .tap-foot-note { max-width: 380px; line-height: 1.45; }
  /* Compare view (tap plan T3): one processor call, its input beside its outputs. */
  .tap-side { display: inline-flex; align-items: center; gap: 8px; }
  .tap-side[hidden] { display: none; }
  .tap-compare-counts { padding: 8px 22px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--divider); }
  .tap-compare-counts:empty { display: none; }
  .tap-kind { display: inline-block; padding: 1px 8px; border-radius: 999px; font: 600 11.5px var(--font-ui); white-space: nowrap;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); }
  .tap-kind.k-transform { background: var(--accent-bg); color: var(--accent-ink); border-color: transparent; }
  .tap-kind.k-no_output { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
  .tap-kind.k-split { background: var(--ok-bg); color: var(--ok-ink); border-color: transparent; }
  .tap-row .tap-kind { flex-shrink: 0; }
  .tap-cmp { padding-bottom: 16px; }
  .tap-cmp-sec { border-bottom: 1px solid var(--divider); padding-bottom: 10px; }
  .tap-cmp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 22px 0; }
  .tap-cmp-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
  .tap-cmp-sub { font: 12px var(--font-mono); color: var(--ink-3); overflow-wrap: anywhere; min-width: 0; }
  .tap-cmp-note { padding: 8px 22px 0; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
  .tap-cmp .tap-json { padding: 8px 22px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
  .tap-cmp summary { padding: 8px 22px 0; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
  .tap-diff { list-style: none; margin: 8px 22px 0; padding: 0; font: 12.5px/1.5 var(--font-mono); border: 1px solid var(--divider); border-radius: 8px; }
  .tap-diff li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 1px 10px; padding: 5px 10px; }
  .tap-diff li + li { border-top: 1px solid var(--divider); }
  .tap-diff-op { font: 600 12px var(--font-ui); }
  .tap-diff li.added .tap-diff-op { color: var(--ok-ink); }
  .tap-diff li.removed .tap-diff-op { color: var(--bad-ink); }
  .tap-diff li.changed .tap-diff-op { color: var(--warn-ink); }
  .tap-diff-path { color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
  .tap-diff-val { grid-column: 2; color: var(--ink-2); overflow-wrap: anywhere; min-width: 0; }
  /* At phone width the event or call takes its full height and the drawer
     scrolls, rather than squeezing it under the filter and counts. */
  @media (max-width: 640px) { .tap-body { flex: 0 0 auto; overflow: visible; min-height: 50vh; } .tap-list { flex-shrink: 0; } }
  .idle-text { color: var(--ink-2); }
  .lc-single { margin-top: 22px; }
  .data-table td.mono { font-family: var(--font-mono); font-size: 13.5px; }
  .data-table td.nowrap { white-space: nowrap; }
  .tapping-pill {
    display: inline-flex; align-items: center; gap: 6px; font: 600 12px var(--font-ui); color: var(--accent-ink);
    background: var(--accent-bg); border: 1px solid var(--accent-border); border-radius: 999px; padding: 2px 10px;
  }
  .tapping-pill .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--selection-glow); animation: tap-pulse 1.4s ease-in-out infinite; }
  @keyframes tap-pulse { 50% { box-shadow: 0 0 0 6px transparent; } }

  /* ---------- Pipeline editor ---------- */
  .ed-nodefield {
    display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 9px; padding: 5px 12px; font-size: 13.5px; color: var(--ink-2);
  }
  .linklike { appearance: none; border: none; background: none; padding: 0 0 0 10px; color: var(--ink-3); font: 13.5px var(--font-ui); cursor: pointer; }
  .linklike:disabled { cursor: not-allowed; }
  .ed-count { font-size: 13px; color: var(--accent-ink); white-space: nowrap; }
  #ed-changed-count { font-size: 12.5px; color: var(--warn-ink); white-space: nowrap; }
  #ed-changed-count:empty { display: none; }
  .link-btn#ed-discard-all { appearance: none; border: 0; background: none; padding: 0 2px; color: var(--accent-ink); font: 500 12.5px var(--font-ui); cursor: pointer; text-decoration: underline; white-space: nowrap; }
  #ed-discard-all[hidden] { display: none; }
  .ed-wrap { position: relative; }
  .ed-canvas {
    position: relative; height: calc(100vh - 280px); min-height: 460px; border: 1px solid var(--border); border-radius: var(--radius-panel); overflow: hidden;
    background-color: var(--surface-sunken); background-image: radial-gradient(var(--border-strong) 0.75px, transparent 0.75px); background-size: 16px 16px;
    cursor: grab; outline: none; touch-action: none;
  }
  .ed-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .ed-bar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; z-index: 4; pointer-events: none; }
  .ed-bar > * { pointer-events: auto; }
  .ed-saved, .ed-valid {
    font-size: 12.5px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px; white-space: nowrap;
  }
  .ed-saved { color: var(--ok-ink); }
  .ed-saved.dirty { color: var(--ink-2); }
  .ed-valid:empty { display: none; }
  .ed-valid.ok { color: var(--ok-ink); }
  .ed-valid.bad { color: var(--bad-ink); border-color: var(--bad-border); background: var(--bad-bg); max-width: 520px; overflow: hidden; text-overflow: ellipsis; }
  .ed-valid.checking { color: var(--ink-3); }
  .ed-zoom { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); overflow: hidden; }
  .ed-zoom button { appearance: none; border: none; background: none; padding: 6px 11px; font: 13px var(--font-ui); color: var(--ink-2); cursor: pointer; }
  .ed-zoom button:hover { color: var(--accent-ink); }
  .ed-zoom > * + * { border-left: 1px solid var(--border); }
  .ed-zoom-pct { padding: 6px 12px; font: 12.5px var(--font-mono); color: var(--ink-2); min-width: 58px; text-align: center; }
  .ed-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
  .ed-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; }
  .ed-edge-path { fill: none; stroke: var(--ink-3); stroke-width: 1.8; }
  .ed-edge.filtered .ed-edge-path { stroke-dasharray: 6 4; }
  .ed-edge.new .ed-edge-path { stroke: var(--accent); }
  .ed-edge.selected .ed-edge-path { stroke: var(--accent); stroke-width: 3; }
  .ed-edge-hit { fill: none; stroke: transparent; stroke-width: 16; cursor: pointer; pointer-events: stroke; }
  .ed-edge:hover .ed-edge-path { stroke: var(--accent); }
  .ed-edge.changed .ed-edge-path, .ed-edge-path.changed { stroke: var(--warn); }
  .ed-edge.selected .ed-edge-path.changed { stroke: var(--accent); }
  .ed-temp { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; }
  .ed-card {
    position: absolute; width: 220px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-panel);
    padding: 10px 14px; cursor: grab; user-select: none;
  }
  .ed-card.off { border-style: dashed; background: var(--surface-sunken); }
  .ed-card.new { border-color: var(--accent-border); }
  .ed-card.selected { border: 2px solid var(--accent); box-shadow: 0 0 0 2px var(--selection-glow); padding: 9px 13px; }
  .ed-card.invalid { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); }
  /* A link (a mesh_subscribe / mesh_publish stage) in the editor: the same
     dashed blue capsule as on the diagram, ED_CARD_W wide so the handles sit
     where the edge code expects them. */
  .ed-card.ed-mesh {
    display: flex; align-items: center; gap: 9px; box-sizing: border-box; padding: 9px 20px 9px 9px; border-radius: 999px;
    background: var(--link-bg); border: 1.5px dashed var(--link); box-shadow: none;
  }
  .ed-card.ed-mesh.new { border-color: var(--link); }
  .ed-card.ed-mesh.off { background: var(--link-bg); border-color: var(--warn); }
  .ed-card.ed-mesh.selected { border: 2px solid var(--accent); box-shadow: 0 0 0 2px var(--selection-glow); padding: 8.5px 19.5px 8.5px 8.5px; }
  .ed-card.ed-mesh.invalid { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); }
  .ed-card.ed-mesh .mesh-dot { right: 22px; }
  .ed-card.ed-mesh .mesh-node-name.empty, .ed-card.ed-mesh .mesh-node-stream.empty { font-style: italic; font-weight: 500; color: var(--ink-3); }
  .ed-kind { font: 600 10.5px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
  .ed-title { display: flex; align-items: center; gap: 6px; margin-top: 2px; font: 600 14px var(--font-mono); min-width: 0; }
  .ed-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ed-newtag { font: 700 9.5px var(--font-ui); letter-spacing: 0.06em; color: var(--accent-ink); background: var(--accent-bg); border-radius: 4px; padding: 1px 5px; }
  .ed-newtag.off { color: var(--ink-2); background: var(--track); }
  .ed-card.changed:not(.selected):not(.invalid) { border-color: var(--warn-border); }
  .ed-changed-dot { display: inline-block; flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
  .ed-idsub { font: 11.5px var(--font-mono); color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ed-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ed-handle {
    position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%;
    background: var(--surface); border: 2px solid var(--ink-3); cursor: crosshair;
  }
  .ed-handle.in { left: -8px; } .ed-handle.out { right: -8px; }
  .ed-handle:hover, .ed-handle.hot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px var(--selection-glow); }
  .ed-handle.target { border-color: var(--accent); box-shadow: 0 0 0 7px var(--selection-glow); }
  .ed-tools {
    position: absolute; z-index: 5; display: flex; align-items: center; gap: 2px; background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: 10px; padding: 3px; box-shadow: 0 6px 18px var(--shadow);
  }
  /* One round accent button pinned to the stage corner / edge midpoint; its
     diameter (--kb) follows the zoom, clamped so it stays hittable and never huge. */
  .ed-tools { padding: 0; border: none; border-radius: 50%; background: none; box-shadow: none; }
  .ed-tools .ed-kebab {
    padding: 0; width: var(--kb, 26px); height: var(--kb, 26px); border-radius: 50%; justify-content: center;
    background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 2px var(--surface), 0 2px 6px var(--shadow);
  }
  .ed-tools .ed-kebab svg { width: 62%; height: 62%; transform: rotate(90deg); }
  .ed-tools button.ed-kebab:hover:not(:disabled) { background: var(--accent-ink); color: var(--surface); }
  .ed-tools .ed-kebab:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
  .ed-tools button {
    appearance: none; border: none; background: none; padding: 5px 10px; border-radius: 7px; font: 13px var(--font-ui);
    color: var(--ink); cursor: pointer; white-space: nowrap; display: inline-flex; gap: 5px; align-items: center;
  }
  .ed-tools button:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
  .ed-tools button:disabled { color: var(--ink-3); cursor: not-allowed; }
  .ed-tools button.bad { color: var(--bad-ink); }
  .ed-tools-sep { width: 1px; align-self: stretch; background: var(--divider); margin: 3px 2px; }
  .ed-dragtip { position: absolute; z-index: 6; font-size: 12.5px; background: var(--ink); color: var(--bg); border-radius: 7px; padding: 5px 10px; white-space: nowrap; pointer-events: none; }
  .ed-dragtip.bad { background: var(--bad-ink); color: #fff; }
  .ed-hint {
    position: absolute; left: 12px; bottom: 12px; z-index: 3; font-size: 12.5px; color: var(--ink-3); background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; pointer-events: none;
  }
  .ed-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; max-width: 420px; text-align: center; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; }
  .ed-empty[hidden] { display: none; }
  .ed-empty p { margin: 0 0 12px; }
  .ed-empty .ed-empty-title { font: 600 15px var(--font-ui); color: var(--ink); margin-bottom: 6px; }
  .ed-addmenu { width: 380px; max-height: min(620px, 72vh); padding: 0; overflow: hidden; display: flex; flex-direction: column; }
  .ed-addsearch { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--ink-3); }
  .ed-addsearch .search-ic svg { width: 15px; height: 15px; display: block; }
  .ed-addsearch input[type=search] { border: none; box-shadow: none; padding: 0; font: 13.5px var(--font-ui); background: transparent; }
  .ed-addlist { overflow-y: auto; padding: 4px 0; }
  .ed-addgroup { font: 600 10.5px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 10px 14px 4px; }
  .ed-addgroup.dim { opacity: 0.8; }
  .ed-additem {
    appearance: none; border: none; background: none; width: 100%; text-align: left; cursor: pointer; padding: 7px 14px;
    display: grid; grid-template-columns: 1fr auto; column-gap: 10px; font: 13px var(--font-ui);
  }
  .ed-additem:hover, .ed-additem.hi { background: var(--accent-bg); }
  .ed-additem .nm { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
  .ed-additem:hover .nm, .ed-additem.hi .nm { color: var(--accent-ink); }
  .ed-additem .ver { font: 11px var(--font-mono); color: var(--ink-3); }
  .ed-additem .ds { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); }
  .ed-additem .nm.has-glyph { display: flex; align-items: center; gap: 8px; }
  .ed-additem .mesh-glyph.small { width: 18px; height: 18px; font-size: 11px; }
  .ed-addnote { padding: 4px 14px 10px; font-size: 12px; color: var(--ink-3); }
  .ed-addfoot { padding: 9px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--ink-3); }
  .ed-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; padding: 18px 22px; }
  .ed-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; min-width: 0; }
  .ed-field.full { grid-column: 1 / -1; }
  .ed-field label { margin: 0; }
  .ed-field .dirty { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-ink); }
  .ed-field .bad { border-color: var(--bad); }
  .fieldhint { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
  /* One row pattern for every setting: label (+ Reset when changed), control, visible help,
     "Default X · range", an inline error. A changed row gets an amber bar on its left. */
  .ed-label-row { display: flex; align-items: center; justify-content: flex-start; gap: 6px; min-width: 0; }
  .ed-label-row label, .ed-label-row .obj-name { min-width: 0; }
  .ed-label-row .fieldreset { margin-left: auto; }
  .fieldreset { appearance: none; border: 0; background: none; padding: 0 2px; min-height: 24px; color: var(--accent-ink); font: 500 12px var(--font-ui); cursor: pointer; text-decoration: underline; white-space: nowrap; }
  .fieldreset[hidden] { display: none; }
  .fielddef { font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }
  .fielddef:empty { display: none; }
  .fielderr { font-size: 12px; color: var(--bad-ink); line-height: 1.4; font-weight: 500; }
  .fielderr[hidden] { display: none; }
  .ed-field.is-changed, .obj-cell.is-changed { border-left: 3px solid var(--warn); padding-left: 8px; margin-left: -11px; }
  .obj-cell.is-changed { margin-left: -11px; }
  .ed-field.changed { position: relative; border-left: 3px solid var(--warn); padding-left: 8px; margin-left: -11px; }
  .ed-field.changed > .ed-label-row > label::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--warn); vertical-align: middle; }
  .field-reset { appearance: none; margin-left: auto; border: 0; background: none; padding: 0 4px; min-height: 24px; color: var(--accent-ink); font: 600 14px var(--font-ui); line-height: 1; cursor: pointer; border-radius: 4px; }
  .field-reset:hover, .field-reset:focus-visible { background: var(--accent-bg); }
  .bool-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 32px; }
  .bool-switch { appearance: none; position: relative; width: 38px; height: 22px; padding: 0; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--track); cursor: pointer; flex: 0 0 auto; }
  .bool-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px var(--shadow); transition: left .12s; }
  .bool-switch[aria-checked=true] { background: var(--accent); border-color: var(--accent); }
  .bool-switch[aria-checked=true]::after { left: 18px; }
  .bool-switch.is-default { opacity: .6; }
  .bool-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .bool-state { font-size: 12.5px; color: var(--ink-2); }
  .bool-use-default { appearance: none; border: 0; background: none; padding: 0 2px; min-height: 24px; color: var(--accent-ink); font: 500 12px var(--font-ui); cursor: pointer; text-decoration: underline; }
  .bool-use-default[hidden] { display: none; }
  .tbl-edit td .fielderr { white-space: normal; min-width: 70px; }
  .lookup-file .lf-source { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-sunken); padding: 8px 10px; font-size: 13px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; }
  .lookup-file .lf-source b { color: var(--ink); }
  .lookup-file .lf-source.dirty { border-color: var(--warn-border); background: var(--warn-bg); }
  .lookup-file .lf-actions, .lookup-file .lf-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .lookup-file .lf-panel { border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
  .lookup-file .lf-bad { color: var(--bad-ink); font-size: 13px; overflow-wrap: anywhere; }
  .lookup-file .lf-text { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
  .fieldhint .was { color: var(--warn-ink); }
  /* File picker (path settings): a folder button beside the text box, and its dialog. */
  .path-row { display: flex; gap: 6px; align-items: center; min-width: 0; }
  .path-row > input { flex: 1 1 auto; min-width: 0; width: auto; }
  .path-row > button.fp-open { flex: 0 0 auto; height: 32px; width: 36px; padding: 0; justify-content: center; }
  .path-row > button.fp-open svg { width: 17px; height: 17px; }
  dialog.fp-dialog { width: min(720px, 96vw); }
  .fp-dialog .modal-inner { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 18px; }
  .fp-dialog .modal-header { margin-bottom: 0; }
  .fp-dialog .modal-header h2 { overflow-wrap: anywhere; }
  .fp-roots { display: flex; flex-wrap: wrap; gap: 6px; }
  .fp-roots button[aria-selected="true"] { background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent-ink); font-weight: 600; }
  .fp-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font: 13px var(--font-mono); color: var(--ink-2); min-width: 0; }
  .fp-crumbs button { background: none; border: 0; padding: 2px 4px; border-radius: 5px; color: var(--accent-ink); cursor: pointer; font: inherit; overflow-wrap: anywhere; text-align: left; }
  .fp-crumbs button:hover { background: var(--accent-bg); }
  .fp-crumbs .fp-here { padding: 2px 4px; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
  .fp-tools { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); }
  .fp-tools label { display: inline-flex; align-items: center; gap: 5px; margin: 0; cursor: pointer; font: 13px var(--font-ui); color: var(--ink-2); text-transform: none; letter-spacing: normal; }
  .fp-list { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-sunken);
    height: min(360px, 46vh); overflow-y: auto; overflow-x: hidden; }
  .fp-list:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  .fp-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; min-height: 32px; min-width: 0; }
  .fp-item.active { background: var(--accent-bg); outline: 1px solid var(--accent-border); }
  .fp-item.chosen .fp-name { font-weight: 600; color: var(--accent-ink); }
  .fp-item.off { cursor: default; color: var(--ink-3); }
  .fp-item .fp-ico { flex: 0 0 auto; width: 18px; text-align: center; color: var(--ink-3); }
  .fp-item .fp-name { flex: 1 1 auto; min-width: 0; font: 13.5px var(--font-mono); overflow-wrap: anywhere; }
  .fp-item .fp-meta { flex: 0 0 auto; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .fp-item .fp-tag { flex: 0 0 auto; font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--track); color: var(--ink-2); white-space: nowrap; }
  .fp-note { font-size: 13px; color: var(--ink-2); margin: 0; overflow-wrap: anywhere; }
  .fp-note.bad { color: var(--bad-ink); }
  .fp-empty { padding: 14px 10px; color: var(--ink-3); font-size: 13.5px; }
  .fp-name-row { display: flex; flex-direction: column; gap: 4px; margin: 0; font: 13px var(--font-ui); color: var(--ink-2); text-transform: none; letter-spacing: normal; }
  .fp-name-row input { width: 100%; font-family: var(--font-mono); }
  .fp-choice { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font: 13px var(--font-mono); color: var(--ink-2); overflow-wrap: anywhere; margin: 0; }
  .fp-choice b { color: var(--ink); }
  .fp-dialog .confirm-actions { flex-wrap: wrap; gap: 8px; margin-top: 4px; }
  @media (max-width: 560px) {
    .fp-item .fp-meta { display: none; }
    .fp-dialog .modal-inner { padding: 14px 12px 14px; }
  }
  a.button { display: inline-flex; align-items: center; gap: 6px; height: 31px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font: 500 13px var(--font-ui); text-decoration: none; white-space: nowrap; }
  a.button:hover { background: var(--surface-sunken); }
  .lookup-upload-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; }
  .fp-crumbs .fp-sep { color: var(--ink-3); }
  .ed-section { grid-column: 1 / -1; font: 600 11.5px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 8px 0 6px; padding-top: 12px; border-top: 1px solid var(--divider); }
  .ed-form textarea { min-height: 70px; font-family: var(--font-ui); }
  /* Help: hidden until the (i) button in the label row is pressed; then the full text and the default show in place. */
  .ed-field:has(> .ed-label-row > .help-i):not(.help-open) > .fieldhint .hint-text,
  .ed-field:has(> .ed-label-row > .help-i):not(.help-open) > .fielddef { display: none; }
  .ed-field.help-open > .fieldhint .hint-text { white-space: pre-wrap; overflow-wrap: anywhere; }
  .fieldhint .was { display: block; }
  .help-i { appearance: none; flex: 0 0 auto; align-self: center; width: 18px; height: 18px; padding: 0; margin: 3px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--accent-ink); font: italic 700 11px/1 Georgia, serif; cursor: pointer; position: relative; }
  .help-i::after { content: ''; position: absolute; inset: -6px; }
  .help-i:hover, .help-i[aria-expanded=true] { background: var(--accent-bg); border-color: var(--accent-border); }
  .help-i:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  .help-pop { position: fixed; z-index: 10000; box-sizing: border-box; width: max-content; max-width: min(380px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: 0 8px 24px var(--shadow); font-size: 13px; line-height: 1.45; text-transform: none; letter-spacing: 0; font-weight: 400; }
  .help-pop p { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
  .help-pop .help-pop-def { margin: 0; font-size: 12px; color: var(--ink-3); }
  /* The settings search at the top of the form. */
  .ed-search { grid-column: 1 / -1; position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 2px 0 8px; margin: 0 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .ed-search input[type=search] { flex: 1 1 220px; min-width: 0; }
  .ed-search-note { flex: 1 1 100%; font-size: 12.5px; color: var(--ink-3); }
  .ed-search-note:empty { display: none; }
  .ed-nomatch { display: none !important; }
  .ed-keybox { grid-column: 1 / -1; border: 1px solid var(--accent-border); background: color-mix(in srgb, var(--accent-bg) 40%, var(--surface)); border-radius: 8px; padding: 10px 12px 6px; margin: 4px 0 8px; }
  .ed-keyhead { font: 600 11.5px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 8px; }
  .ed-keystar { margin-right: 2px; }
  /* The Stage settings page (a read-only table of every stage's settings). */
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ss-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
  .ss-search { flex: 1 1 280px; min-width: 0; }
  .ss-stage { flex: 0 1 260px; min-width: 0; max-width: 100%; }
  .ss-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
  .ss-count { font-size: 12.5px; color: var(--ink-3); margin-right: 6px; min-width: 120px; }
  .ss-chip { appearance: none; min-height: 30px; padding: 4px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 13px var(--font-ui); cursor: pointer; }
  .ss-chip:hover { background: var(--surface-sunken); }
  .ss-chip[aria-pressed="true"] { background: var(--accent-bg); color: var(--accent-ink); border-color: var(--accent-border); font-weight: 600; }
  .ss-chip[aria-pressed="true"]::before { content: "✓ "; }
  .ss-panel { padding: 0; }
  .ss-table-wrap { overflow-x: auto; }
  .ss-table { min-width: 720px; }
  .ss-table td { vertical-align: top; }
  .ss-row { cursor: pointer; }
  .ss-row:hover td { background: var(--surface-sunken); }
  .ss-row.flash td { animation: ss-flash 2.6s ease-out; }
  .ss-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .ss-star { color: var(--accent-ink); }
  .ss-desc { font-size: 12.5px; color: var(--ink-3); max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ss-stagecell { white-space: nowrap; }
  .ss-value .mono { word-break: break-word; }
  .ss-unset { color: var(--ink-3); }
  .ss-custom { margin-left: 8px; font: 500 11px var(--font-ui); padding: 1px 7px; border-radius: 999px; background: var(--accent-bg); color: var(--accent-ink); border: 1px solid var(--accent-border); white-space: nowrap; }
  .ss-range { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
  .ss-default { color: var(--ink-2); }
  .ss-act { text-align: right; white-space: nowrap; }
  .ss-edit { min-height: 30px; }
  .ss-empty { padding: 18px 14px; color: var(--ink-2); }
  .ss-backlink { padding-left: 12px; color: var(--accent-ink); }
  .ss-hl { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; background: var(--accent-bg); }
  @keyframes ss-flash { from { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); } to { background: transparent; box-shadow: none; } }
  @media (max-width: 640px) {
    .ss-table { min-width: 0; }
    .ss-table thead { display: none; }
    .ss-table, .ss-table tbody, .ss-table tr, .ss-table td { display: block; }
    .ss-row { padding: 10px 12px; border-bottom: 1px solid var(--divider); }
    .ss-table td { padding: 2px 0; border: 0; }
    .ss-stagecell::before, .ss-default::before { font: 12px var(--font-ui); color: var(--ink-3); }
    .ss-stagecell::before { content: "Stage  "; }
    .ss-default::before { content: "Default  "; }
    .ss-act { text-align: left; padding-top: 6px; }
    .ss-desc { max-width: none; white-space: normal; }
  }
  @media (prefers-reduced-motion: reduce) { .ss-row.flash td { animation: none; background: var(--accent-bg); } }
  .ed-group { grid-column: 1 / -1; border-top: 1px solid var(--divider); padding-top: 10px; margin-top: 4px; }
  .ed-group > summary { cursor: pointer; font: 600 11.5px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
  .ed-group > summary:hover { color: var(--ink-2); }
  .ed-count-tag { margin-left: 8px; font: 500 10.5px var(--font-ui); letter-spacing: 0; padding: 1px 7px; border-radius: 999px; background: var(--surface-sunken); color: var(--ink-3); }
  .ed-advtag { margin-left: 8px; font: 500 10px var(--font-ui); letter-spacing: 0.04em; padding: 1px 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-ink); }
  .ed-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
  .ed-group > summary { padding: 4px 0; }
  /* Phone width: one column, so no two settings share a row and nothing runs into its neighbour. */
  @media (max-width: 640px) {
    /* The drawer's foot is its sticky bottom bar: the count and the buttons stay in view. */
    .drawer-foot { padding: 10px 12px; gap: 8px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); box-shadow: 0 -6px 14px var(--shadow); }
    .drawer-foot .quick-edit-status, .drawer-foot .ed-drawer-count { flex: 1 1 100%; order: -1; }
    .drawer-foot button { min-height: 40px; }
    .ed-form { grid-template-columns: minmax(0, 1fr); padding: 14px 12px; }
    .ed-group-grid { grid-template-columns: minmax(0, 1fr); }
    .obj-edit { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .ed-keybox { padding: 10px 10px 6px; }
  }
  .tbl-edit { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
  .tbl-edit.dirty { border-color: var(--warn-border); }
  .tbl-edit table { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 12.5px; }
  .tbl-edit th .th-in { display: flex; align-items: center; gap: 4px; min-width: 0; }
  .tbl-edit th .th-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .help-q { font: 700 10px/1 var(--font-ui); }
  .tbl-edit .cell-label, .tbl-edit .cell-hint, .tbl-edit .cell-def { display: none; }
  .tbl-edit th { text-align: left; font: 600 10.5px var(--font-ui); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); padding: 6px 4px; border-bottom: 1px solid var(--divider); white-space: nowrap; }
  .tbl-edit td { padding: 3px 4px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
  .tbl-edit td.n { color: var(--ink-3); font: 11.5px var(--font-mono); text-align: right; }
  .tbl-edit td input, .tbl-edit td select { width: 100%; min-width: 0; font-size: 12.5px; padding: 4px 6px; }
  .tbl-edit td.acts { white-space: nowrap; }
  .tbl-edit .icon-btn { appearance: none; border: none; background: none; cursor: pointer; color: var(--ink-3); padding: 2px 4px; font-size: 13px; }
  .tbl-edit .icon-btn:hover:not([disabled]) { color: var(--ink); }
  .tbl-edit .icon-btn[disabled] { opacity: 0.3; cursor: default; }
  .tbl-empty { padding: 10px; font-size: 12.5px; color: var(--ink-3); }
  .tbl-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; margin-top: 6px; }
  .paste-wrap { display: contents; }
  .paste-panel { flex-basis: 100%; }
  .paste-panel .paste-input { width: 100%; font: 12.5px/1.5 var(--font-mono); min-height: 0; }
  .obj-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; align-items: start; }
  /* Layout rule: label above the control on one line (ellipsis; the full text is its title), help under it;
     groups are an even grid; short values (numbers, durations, switches) get a short box, text the full width. */
  .ed-label-row { min-height: 24px; }
  .ed-label-row > label, .ed-label-row > .obj-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ed-group-grid { align-items: start; }
  .ed-field > input.short, .obj-cell > input.short { width: 100%; max-width: 11em; }
  .ed-group-grid > .ed-field, .obj-cell { min-width: 0; }
  /* Phone width: one column everywhere; each table row is a card. */
  @media (max-width: 640px) {
    .obj-edit { grid-template-columns: minmax(0, 1fr); }
    .tbl-edit { overflow: visible; border: 0; }
    .tbl-edit table, .tbl-edit tbody { display: block; min-width: 0 !important; }
    .tbl-edit thead, .tbl-edit colgroup { display: none; }
    .tbl-edit tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 8px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: var(--surface); }
    .tbl-edit td { display: flex; flex-direction: column; gap: 4px; flex: 0 0 100%; min-width: 0; padding: 0; border: 0; }
    .tbl-edit td.n { flex: 1 1 auto; flex-direction: row; text-align: left; font-weight: 600; }
    .tbl-edit td.n::before { content: 'Row '; }
    .tbl-edit td.n { order: -2; }
    .tbl-edit td.acts { flex: 0 0 auto; flex-direction: row; order: -1; }
    .tbl-edit td .cell-label { display: flex; align-items: center; gap: 6px; min-width: 0; font: 600 10.5px var(--font-ui); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
    .tbl-edit td .cell-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tbl-edit td .cell-hint, .tbl-edit td .cell-def { display: block; }
    .tbl-edit td > input.short { max-width: 11em; }
    .tbl-edit td .icon-btn { min-width: 36px; min-height: 36px; }
  }
  .obj-edit.dirty { outline: 1px solid var(--warn-border); outline-offset: 3px; border-radius: 6px; }
  .obj-edit .fieldhint, .obj-edit .fielddef { font-size: 11px; }
  .ed-drawer-count { font-size: 12.5px; color: var(--ink-3); }
  .ed-drawer-count.dirty { color: var(--warn-ink); font-weight: 500; }
  .obj-cell { display: flex; flex-direction: column; gap: 3px; margin: 0; font-size: 12px; min-width: 0; }
  .obj-name { overflow-wrap: anywhere; }
  .obj-cell input { font-size: 12.5px; padding: 4px 6px; }
  .obj-name { color: var(--ink-2); font-weight: 500; }
  .obj-share { font-size: 11px; color: var(--ink-3); }
  .obj-share.off { color: var(--warn-ink); }
  .route-sketch { margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; }
  .route-sketch svg { display: block; width: 100%; height: auto; }
  .route-sketch .rs-circle { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 1.5; }
  .route-sketch .rs-leg { stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 4 3; }
  .route-sketch .rs-len { fill: var(--ink-2); font: 12px var(--font-ui); text-anchor: middle; }
  .route-sketch .rs-pin circle { fill: var(--accent); }
  .route-sketch .rs-pin text { fill: #fff; font: 600 10px var(--font-ui); text-anchor: middle; }
  .route-sketch .rs-area { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 1.5; }
  .route-sketch .rs-area.imported { stroke-dasharray: 5 3; }
  .route-sketch .rs-name { fill: var(--ink-2); font: 600 11px var(--font-ui); text-anchor: middle; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
  .route-sketch .rs-scale { stroke: var(--ink-2); stroke-width: 1.5; fill: none; }
  .route-sketch .rs-scale-text { fill: var(--ink-2); font: 12px var(--font-ui); }
  textarea.text-input { width: 100%; font-family: var(--font-mono); font-size: 12px; }
  .fieldhint.warn { color: var(--warn-ink); }
  button.small { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }


  /* ---------- Compact cards (Node page) ---------- */
  .counters-grid.compact { gap: 10px; }
  .counters-grid.compact .counter { padding: 11px 14px; gap: 2px; border-radius: 12px; }
  .counters-grid.compact .counter-value { font-size: 22px; }
  .counters-grid.compact .counter-caption { font-size: 12px; min-height: 15px; }
  .counters-grid.compact .counter-value-row { align-items: center; gap: 10px; }
  .counters-grid.compact .tile-meter { margin: 6px 0 3px; }
  .counter-value.ok-value { color: var(--ok-ink); }

  /* Stage state inspector (#/p/<pid>/s/<sid>/state) */
  #state-summary { padding: 14px 16px; margin-bottom: 16px; }
  .state-summary-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .state-summary-head .field-hint { margin-top: 0; }
  .state-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0; font-size: 13px; }
  .state-facts dt { color: var(--ink-3); }
  .state-facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
  .state-note { margin: 10px 0; padding: 10px 14px; border-radius: 8px; color: var(--ink); font-size: 13px; }
  .state-note.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); }
  .state-sessions-table { margin-top: 10px; }
  .state-badge { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; vertical-align: middle; }
  .state-badge.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-ink); }
  .state-entries-table td { vertical-align: top; }
  .state-payload { max-width: 520px; }
  .state-payload summary, .state-raw summary { cursor: pointer; }
  .state-payload summary code, .state-raw summary code { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
  .state-payload-full { margin: 6px 0 0; padding: 8px 10px; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
  tr.state-row-corrupt td { background: var(--bad-bg); }
  .state-decode-error { font-size: 13px; margin-bottom: 4px; }
  .state-more { display: flex; justify-content: center; padding: 12px 0 4px; }
  @media (max-width: 640px) {
    .state-facts { grid-template-columns: 1fr; }
    .state-payload { max-width: none; }
  }

/* Stage groups (pipeline stage table) */
.group-badge { white-space: nowrap; }
.group-summary {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--ink-3);
}
.group-summary li { display: flex; align-items: center; gap: 6px; }

/* Trend sparklines (components/sparkline.rs). Colours follow the theme tokens. */
.sparkline { display: inline-block; width: 120px; height: 24px; line-height: 0; vertical-align: middle; }
.sparkline svg { width: 100%; height: 100%; overflow: visible; }
.sparkline-line { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.sparkline-area { fill: var(--accent-bg); stroke: none; }
.sparkline-base { fill: none; stroke: var(--chart-grid); stroke-width: 1; }
.sparkline.muted .sparkline-line { stroke: var(--ink-3); }
.sparkline.muted .sparkline-area { fill: var(--track); }
.counter .sparkline { display: block; width: 100%; height: 22px; margin-top: 6px; }
/* Node table: under the rate, right-aligned (the rate columns are narrow). */
.sparkline.cell { display: block; width: 100%; max-width: 64px; height: 14px; margin: 2px 0 0 auto; }
/* Stage throughput panel: label | trend | current rate. */
.stage-trend { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 12px; align-items: center; }
.stage-trend-row { display: contents; }
.stage-trend-label { font: 500 13px var(--font-ui); color: var(--ink-2); }
.stage-trend .sparkline { display: block; width: 100%; height: 32px; }
.stage-trend-now { font-size: 13px; color: var(--ink); text-align: right; min-width: 72px; }

/* Edge table extras. */
.edge-problems { white-space: nowrap; }
.edge-problems .muted { color: var(--ink-3); }
.edge-problem + .edge-problem::before { content: " · "; color: var(--ink-3); }

/* Stage page: phase badge, last error, logs, program. */
.phase-badge {
  display: inline-flex; align-items: center; gap: 6px; font: 600 12px var(--font-ui); border-radius: 999px;
  padding: 2px 10px; border: 1px solid var(--border); background: var(--surface-sunken); color: var(--ink-2);
}
.phase-badge.info { color: var(--accent-ink); background: var(--accent-bg); border-color: var(--accent-border); }
.phase-badge.ok { color: var(--ok-ink); background: var(--ok-bg); border-color: var(--ok-border); }
.phase-badge.bad { color: var(--bad-ink); background: var(--bad-bg); border-color: var(--bad-border); }
.phase-badge.muted { color: var(--ink-3); }
.phase-badge.pulse::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px var(--selection-glow); animation: tap-pulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .phase-badge.pulse::before { animation: none; } }

.stage-last-error {
  display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 8px 12px; min-width: 0;
  border: 1px solid var(--bad-border); background: var(--bad-bg); border-radius: 8px; font-size: 13px;
}
.stage-last-error-label { font-weight: 600; color: var(--bad-ink); white-space: nowrap; }
.stage-last-error-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.stage-warn {
  margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--warn-border); background: var(--warn-bg);
  color: var(--warn-ink); border-radius: 8px; font-size: 13px;
}

.log-toolbar { padding: 10px 0 12px; border-bottom: 0; }
.log-error, .log-dropped, .log-empty { margin: 4px 0 8px; font-size: 13px; }
.log-dropped, .log-empty { color: var(--ink-3); }
.log-list {
  font: 12.5px/1.5 var(--font-mono); max-height: 360px; overflow: auto; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-sunken); padding: 6px 0;
}
.log-row { display: flex; align-items: baseline; gap: 10px; padding: 1px 12px; }
.log-row:hover { background: var(--surface); }
.log-time { color: var(--ink-3); white-space: nowrap; font-family: var(--font-mono); font-size: 12px; }
.log-text { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.log-src {
  flex: none; font: 600 11px var(--font-ui); padding: 0 7px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--ink-2); background: var(--surface);
}
.log-src.build { color: var(--link-ink); background: var(--link-bg); border-color: var(--link-border); }
.log-src.lifecycle { color: var(--accent-ink); background: var(--accent-bg); border-color: var(--accent-border); }
.log-src.error { color: var(--bad-ink); background: var(--bad-bg); border-color: var(--bad-border); }
.log-src.error + .log-text { color: var(--bad-ink); }

/* tap + node (tier 2) */
.tap-filter-input.tap-sample-filter { flex: 0 1 220px; }
.tap-match { font: 12px var(--font-mono); color: var(--ink-3); white-space: nowrap; }
.tap-match:empty { display: none; }
.tap-meta { align-items: center; }
.tap-meta-text { display: flex; flex-wrap: wrap; gap: 6px 18px; flex: 1 1 auto; min-width: 0; }
.tap-meta > button { flex: 0 0 auto; }
.pipelines-tools { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pipelines-filter { flex: 0 1 240px; width: 240px; min-width: 0; font: 13px/1.4 var(--font-mono); }
@media (max-width: 640px) {
  .section-titlebar:has(.pipelines-tools) { flex-wrap: wrap; }
  .pipelines-tools { flex: 1 1 100%; }
  .pipelines-filter { flex: 1 1 auto; width: auto; }
}

/* shell (tier 2) */
a.tree-row, a.tree-nav-item, a.status-pill { text-decoration: none; }
a.tree-row:hover, a.tree-nav-item:hover, a.status-pill:hover { text-decoration: none; }
a.tree-nav-item:focus-visible, a.status-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
a.status-pill { cursor: pointer; }
a.status-pill.warn:hover { border-color: var(--warn); }
.tree-stages { display: flex; flex-direction: column; gap: 1px; }
.tree-row.stage { height: 26px; }
.tree-row.stage .label { font-size: 12.5px; }
.app-sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
#footer-version { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.footer-health { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.footer-health-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--idle); flex-shrink: 0; }
.footer-health.ok { color: var(--ok-ink); }
.footer-health.ok .footer-health-dot { background: var(--ok); }
.footer-health.warn { color: var(--warn-ink); }
.footer-health.warn .footer-health-dot { background: var(--warn); }
.footer-health.bad { color: var(--bad-ink); }
.footer-health.bad .footer-health-dot { background: var(--bad); }
.footer-health.idle .footer-health-dot { background: var(--idle); }

/* sessions + config files (tier 3) */
.state-session-picker { align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.state-session-picker #state-session-search { min-width: 0; flex: 1 1 220px; max-width: 320px; }
.state-session-picker #state-session-showing { min-width: 0; }
.config-file-actions { text-align: right; white-space: nowrap; }
a.config-file-edit { font-size: 12.5px; white-space: nowrap; }

/* access + gated (tier 3) */
.gated-caption { font-size: 11.5px; color: var(--ink-3); margin-left: 6px; white-space: nowrap; align-self: center; }
.access-you { margin: 0; }
.access-caps .access-mark { text-align: center; width: 72px; color: var(--ink-3); }
.access-caps .access-mark.granted { color: var(--ok); font-weight: 600; }
.access-note { margin: 12px 0 0; font-size: 12.5px; color: var(--ink-3); }
.access-denied { margin-bottom: 16px; }
