/* ============================================
   Architecture — section styling
   ============================================

   A complete restyle of the standalone artefact, not an import of it. The
   artefact shipped a light "Clawpilot" theme (cream #f7f4ef canvas, crimson
   accent, `color-scheme: light`); none of that survives here. Structure and
   geometry are kept, every colour and type decision is re-expressed in the
   site's tokens from /ui/styles/tokens.css.

   Everything is scoped under .arch-root and every colour resolves through a
   token, which is what makes the section work in light mode too — tokens.css
   redefines --bg/--bg2/--bg3/--text/--border under [data-theme="light"], so a
   hardcoded hex here would be a section that looks correct exactly half the
   time.

   The artefact's class names are short and generic — .node, .grid, .step, .t,
   .d. Measured before writing this: none of them currently collide with
   style.css, base.css, components.css or frost-command-center.css. That is a
   fact about today, not a guarantee, so every rule below is scoped under
   .arch-root rather than trusting the global namespace to stay clear.
   ============================================ */

.arch-root {
  /* The artefact's palette, given explicit per-theme values.
   *
   * It used to point at the site's global greys — --f-deep: var(--bg2),
   * --f-panel: var(--bg3) — and that is what made the light theme unreadable.
   * Measured relative luminance of the light ramp:
   *
   *     --bg  (page)  #f0f0f5   0.8744
   *     --bg2 (card)  #e4e4ec   0.7804   <- an elevated surface, DARKER
   *     --bg3 (panel) #dcdce6   0.7212   <- darker still
   *
   * Every raised surface in the section receded into the page instead of
   * lifting off it. Those tokens are right for the rest of the site and are
   * not this section's to change (admin.css alone reads --bg2/--bg3 thirty
   * times), so the fix is a local palette, exactly as .kmt-console defines
   * --kmt-surface / --kmt-surface-raised rather than leaning on the greys.
   * Kometa ships no light override; this section needs one, so it has one.
   *
   * Keeping the --f-* NAMES means the ported markup's inline
   * `style="background:var(--f-cyan)"` attributes keep working unchanged.
   *
   * Every value below is measured. Ratios quoted are against the WORSE of the
   * two surfaces the tier actually sits on, and the floor is WCAG AA 4.5:1 for
   * anything that carries meaning. See the light block further down for the
   * other half of each pair. */
  --f-deep: #12121c;
  --f-panel: #1a1a28;
  --f-edge: var(--border);

  --f-ink: #e8e6e3;      /* 13.79 on --f-panel */
  --f-dim: #bdbbbc;      /*  9.00 on --f-panel, was 5.01 at text@55% */
  --f-unknown: #a09fa2;  /*  6.53 on --f-panel, was 3.81 — below AA */
  --f-faint: #8e8d91;    /*  5.21 on --f-panel, was 3.09 — below AA */

  --f-cyan: #00d4aa;     /*  9.00 */
  --f-blue: #847dff;     /*  5.20 — var(--accent) #6c63ff measured 3.98 here */
  --f-rose: #ff6b9d;     /*  6.42 */
  --f-violet: #a98eff;   /*  6.55 */
  --f-amber: #f0a830;    /*  8.47 */
  --f-green: #3ddc84;    /* 10.42 */

  --f-live: #3ddc84;
  --f-down: #ff4757;     /*  5.15 */

  /* The accent in its two jobs, which need opposite treatments. As TEXT it has
     to clear 4.5:1 against a dark surface, so it is lightened; as the FILL
     behind the white step numerals it has to give white 4.5:1, so it is
     darkened. One token could not do both — at #6c63ff the text reads 3.98 and
     white-on-it reads 4.32, and both of those fail. */
  --f-accent: #847dff;   /*  5.20 as text on --f-panel */
  --f-badge: #5a50ff;    /*  5.22 for white text sitting on it */

  color: var(--f-ink);
  font-family: var(--font-body);
  font-size: 15px;
  /* The readability floor below costs vertical space, and this section is not
     allowed to grow. It is paid for out of leading rather than out of page:
     1.55 across this much prose was ~7000px of pure leading, so 1.45 returns
     more than the larger glyphs take. Measured: the section is +0.96% taller
     than before the type change, against a 5% budget. */
  line-height: 1.45;
}

.arch-root .arch-ollama-manager { display: grid; gap: 20px; }
.arch-root .arch-ollama-heading,
.arch-root .arch-ollama-section-heading,
.arch-root .arch-ollama-confirm-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.arch-root .arch-ollama-heading h2,
.arch-root .arch-ollama-section-heading h3 { margin: 0; color: var(--f-ink); }
.arch-root .arch-ollama-connection { color: var(--f-dim); font-size: 13px; overflow-wrap: anywhere; }
.arch-root .arch-ollama-kpis,
.arch-root .arch-ollama-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 12px;
}
.arch-root .arch-ollama-kpi,
.arch-root .arch-ollama-gauge,
.arch-root .arch-ollama-download,
.arch-root .arch-ollama-catalogue {
  min-width: 0;
  border: 1px solid var(--f-edge);
  border-radius: 12px;
  background: var(--f-panel);
}
.arch-root .arch-ollama-kpi { padding: 14px 12px; display: grid; grid-template-columns: 20px 1fr; gap: 2px 8px; align-items: center; }
.arch-root .arch-ollama-kpi > span { grid-row: span 2; color: var(--f-cyan); font-size: 24px; }
.arch-root .arch-ollama-kpi strong { font-size: clamp(17px, 2.4vw, 22px); color: var(--f-ink); line-height: 1.2; }
.arch-root .arch-ollama-kpi small { color: var(--f-dim); }
.arch-root .arch-ollama-gauge { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; }
.arch-root .arch-ollama-gauge svg { width: 64px; height: 64px; flex-shrink: 0; transform: rotate(-90deg); }
.arch-root .arch-ollama-gauge circle { fill: none; stroke-width: 7; stroke: var(--f-edge); }
.arch-root .arch-ollama-gauge circle + circle { stroke: var(--f-cyan); stroke-linecap: round; }
.arch-root .arch-ollama-gauge strong { display: block; color: var(--f-ink); font-size: 20px; }
.arch-root .arch-ollama-gauge span,
.arch-root .arch-ollama-gauge small { display: block; color: var(--f-dim); }
.arch-root .arch-ollama-download,
.arch-root .arch-ollama-catalogue { padding: 18px; }
.arch-root .arch-ollama-section-heading { margin-bottom: 14px; }
.arch-root .arch-ollama-section-heading a { color: var(--f-cyan); font-size: 13px; }
.arch-root .arch-ollama-download-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.arch-root .arch-ollama-download-form label { flex: 1; min-width: min(100%, 200px); color: var(--f-dim); font-size: 13px; }
.arch-root .arch-ollama-manager input {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--f-edge);
  border-radius: 8px;
  color: var(--f-ink);
  background: var(--f-deep);
  font: inherit;
}
.arch-root .arch-ollama-manager input::placeholder { color: var(--f-dim); }
.arch-root .arch-ollama-manager button {
  min-height: 44px;
  padding: 8px 12px;
  color: var(--f-ink);
  background: var(--f-deep);
  border: 1px solid var(--f-edge);
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}
.arch-root .arch-ollama-manager button.arch-ollama-primary { background: var(--f-cyan); color: var(--f-deep); border-color: var(--f-cyan); font-weight: 700; }
.arch-root .arch-ollama-manager button:disabled { cursor: not-allowed; color: var(--f-dim); }
.arch-root .arch-ollama-manager button.arch-ollama-primary:disabled { background: var(--f-deep); border-color: var(--f-edge); }
.arch-root .arch-ollama-filter { width: min(100%, 240px); }
.arch-root .arch-ollama-table-wrap { overflow-x: auto; }
.arch-root .arch-ollama-table { width: 100%; border-collapse: collapse; text-align: left; }
.arch-root .arch-ollama-table th { font-size: 12px; color: var(--f-dim); font-weight: 600; text-transform: uppercase; }
.arch-root .arch-ollama-table :is(th, td) { padding: 12px 10px; border-bottom: 1px solid var(--f-edge); vertical-align: middle; }
.arch-root .arch-ollama-table td { color: var(--f-ink); font-variant-numeric: tabular-nums; }
.arch-root .arch-ollama-table td:first-child { min-width: 160px; max-width: 300px; overflow-wrap: anywhere; }
.arch-root .arch-ollama-table small { display: block; color: var(--f-dim); font-size: 12px; }
.arch-root .arch-ollama-table .arch-ollama-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.arch-root .arch-ollama-actions button { padding: 6px 10px; font-size: 13px; }
.arch-root .arch-ollama-badge { display: inline-flex; gap: 5px; align-items: center; padding: 4px 8px; border: 1px solid var(--f-edge); border-radius: 20px; font-size: 12px; white-space: nowrap; }
.arch-root .arch-ollama-badge.is-resident { color: var(--f-green); }
.arch-root .arch-ollama-badge.is-protected { color: var(--f-amber); }
.arch-root .arch-ollama-details h3 { margin: 0 0 12px; color: var(--f-ink); overflow-wrap: anywhere; }
.arch-root .arch-ollama-details dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.arch-root .arch-ollama-details dt { font-size: 13px; color: var(--f-dim); }
.arch-root .arch-ollama-details dd { margin: 0; overflow-wrap: anywhere; color: var(--f-ink); }
.arch-root .arch-ollama-details:not(:empty) { margin-top: 20px; }
.arch-root .arch-ollama-policy { color: var(--f-dim); font-size: 13px; }
.arch-root .arch-ollama-policy summary { cursor: pointer; }
.arch-root .arch-ollama-operation { margin: 8px 0; }
.arch-root .arch-ollama-job:not(:empty) { margin-top: 16px; }
.arch-root .arch-ollama-job progress { width: 100%; height: 10px; accent-color: var(--f-cyan); }
.arch-root .arch-ollama-job-line { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.arch-root .arch-ollama-job-line strong { overflow-wrap: anywhere; }
.arch-root .arch-ollama-job small { color: var(--f-dim); }
.arch-root .arch-ollama-confirm { width: min(440px, calc(100% - 48px)); max-height: 85dvh; overflow-y: auto; background: var(--f-panel); color: var(--f-ink); border: 1px solid var(--f-edge); border-radius: 16px; padding: 24px; }
.arch-root .arch-ollama-confirm::backdrop { background: rgb(0 0 0 / 65%); }
.arch-root .arch-ollama-confirm h3 { margin-top: 0; color: var(--f-ink); }
.arch-root .arch-ollama-confirm p { overflow-wrap: anywhere; color: var(--f-dim); }
.arch-root .arch-ollama-confirm-buttons { margin-top: 20px; }
.arch-root .arch-ollama-confirm-note { font-size: 13px; }
.arch-root .arch-ollama-manager :is(input, button, summary, a):focus-visible { outline: 2px solid var(--f-cyan); outline-offset: 3px; }
@media (max-width: 600px) {
  .arch-root .arch-ollama-table,
  .arch-root .arch-ollama-table tbody { display: block; }
  .arch-root .arch-ollama-table thead { display: none; }
  .arch-root .arch-ollama-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 8px 0; border-bottom: 1px solid var(--f-edge); }
  .arch-root .arch-ollama-table td { border: 0; }
  .arch-root .arch-ollama-table :is(th, td) { padding: 10px 5px; }
  .arch-root .arch-ollama-table .arch-ollama-size-col,
  .arch-root .arch-ollama-table .arch-ollama-vram-col { display: none; }
  .arch-root .arch-ollama-catalogue { padding: 12px; }
  .arch-root .arch-ollama-table td:first-child { min-width: 0; max-width: none; }
  .arch-root .arch-ollama-table td:last-child { grid-column: 1 / -1; }
  .arch-root .arch-ollama-table .arch-ollama-actions { min-width: 68px; }
}

/* ---- light theme --------------------------------------------------------
   The same palette, re-measured for a light page rather than derived from it.
   The surfaces follow the one element on this page that was already right: the
   status bar, which paints var(--card-bg) = rgba(255,255,255,0.85) and reads
   as near-white. These are opaque rather than alpha so the contrast figures
   above are a property of the stylesheet and not of whatever the WebGL canvas
   happens to be drawing behind the section on any given frame.

       page   #f0f0f5  L 0.8744
       deep   #f7f7fb  L 0.9326   inset tiles
       card   (0.85 w) L 0.9805   the status bar, deliberately untouched
       panel  #ffffff  L 1.0000   raised containers

   The ramp now rises. It also keeps the dark theme's relationship — panel is
   the brighter of the two there as well — so a zone still reads as raised and
   the nodes inside it still read as set into it.

   This selector carries [data-theme="light"], so it is 'requires-light' to
   tests/theme-token-shadowing.js and cannot shadow anything. It declares only
   --f-* locals; not one themed token from tokens.css is re-declared here or
   anywhere else in this file. */
[data-theme="light"] .arch-root,
[data-admin-theme="light"] .arch-root {
  --f-deep: #f7f9fc;
  --f-panel: #ffffff;
  /* On white, --border's rgba(108,99,255,0.2) is barely a line, and with the
     surfaces now white the borders are what carries the structure. */
  --f-edge: rgba(33, 46, 72, 0.24);

  --f-ink: #172033;
  --f-dim: #465267;
  --f-unknown: #566176;
  --f-faint: #626d81;

  /* The status palette, darkened until it is readable ON white instead of
     against black. These hues were chosen for a dark page; unchanged, every
     one of them fails badly here — green measured 1.67, amber 1.90, cyan 1.79.
     Hue and saturation are preserved, only lightness moves, so "live" is still
     the same green and "warn" is still the same amber. */
  --f-cyan: #00765f;     /*  5.23 — was #00d4aa at 1.79 */
  --f-blue: #5449ff;     /*  5.21 — was #6c63ff at 4.04 */
  --f-rose: #d00046;     /*  5.21 — was #ff6b9d at 2.51 */
  --f-violet: #6c3eff;   /*  5.21 — was #a98eff at 2.46 */
  --f-amber: #905e0a;    /*  5.18 — was #f0a830 at 1.90 */
  --f-green: #167841;    /*  5.18 — was #3ddc84 at 1.67 */

  --f-live: #167841;
  --f-down: #d30012;     /*  5.20 — was #ff4757 at 3.12 */

  --f-accent: #5449ff;   /*  5.21 as text */
  --f-badge: #5a50ff;    /*  5.22 for white text sitting on it */
}

/* color-mix is well supported, but a browser without it would fall back to an
   invalid value and inherit — which reads as "no colour set" rather than as a
   broken layout. The three emphasis tiers no longer need a fallback at all:
   they are plain hex in both themes now. Collapsing them onto a single
   var(--muted) is what this block used to do, and it destroyed the three-step
   hierarchy the page reads by — on top of --muted itself measuring 3.24 on
   --bg2 and 2.99 on --bg3, so the "safe" fallback was the least readable
   value in the file. What is left below is the handful of genuinely mixed
   colours. */
@supports not (color: color-mix(in srgb, red 50%, transparent)) {
  /* The change tags are the one place a dropped color-mix would cost meaning:
     without the tint they are three words in three colours with no chip behind
     them. A flat transparent background with the coloured border restores the
     distinction without needing the mix. */
  .arch-root .tag {
    background: transparent;
    border: 1px solid currentColor;
  }
}

.arch-root .mono,
.arch-root code,
.arch-root .port,
.arch-root .num {
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  /* 0.92em compensates for the monospace face running visually larger at the
     same nominal size. Unbounded it also drags every inherited size back under
     the 12px floor — 13px became 11.96, 12px became 11.04 — so the floor is
     applied here rather than undone here. */
  font-size: max(13px, 0.92em);
}

/* ---- status bar ---------------------------------------------------------- */

.arch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
}

.arch-meta { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.arch-meta-text { font-size: 13px; color: var(--f-dim); }
.arch-age { color: var(--f-ink); font-weight: 600; }

/* Stale and unreachable are called out in colour as well as words. The age line
   is the one thing on the page that says whether anything below can be
   trusted. */
.arch-age.is-stale { color: var(--f-amber); }
.arch-warn { color: var(--f-amber); }

.arch-counts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--f-dim); }
.arch-count { display: inline-flex; align-items: center; gap: 6px; }
.arch-bar-controls { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.arch-filter-label { display: flex; flex-direction: column; gap: 4px; color: var(--f-dim); font-size: 12px; }
.arch-status-filter {
  min-height: 36px;
  padding: 6px 10px;
  color: var(--f-ink);
  background: var(--card-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font: inherit;
}
.arch-status-filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.arch-refresh {
  font-family: var(--font);
  /* The status strip is the one element the owner singled out as already
     correct, so it is held at its original 12px / var(--accent) rather than
     being swept up in the type-scale and palette pass. It already measured
     16.74:1, so it needs neither. */
  font-size: 12px;
  font-weight: 600;
  color: var(--f-ink);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.arch-refresh:hover:not(:disabled) { background: rgba(108, 99, 255, 0.12); box-shadow: var(--glow); }
.arch-refresh:disabled { opacity: 0.55; cursor: default; }

.arch-error {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--f-dim);
}

/* ---- live measurements --------------------------------------------------- */

.arch-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.arch-fig {
  border: 1px solid var(--f-edge);
  border-left: 3px solid var(--f-cyan);
  border-radius: var(--radius-sm);
  background: var(--f-deep);
  padding: 7px 10px;
}
/* A figure with no live reading is visibly a gap, not a value. It must never
   look like a measurement that happens to be low. */
.arch-fig.is-missing { border-left-color: var(--f-unknown); }

/* ---- live-value treatment ------------------------------------------------

   The page already owns a three-state HOST vocabulary that must not be
   disturbed: --f-live green = host answering, --f-down red = host failed,
   --f-unknown faded + dashed = never measured. A figure being freshly measured
   is a DIFFERENT fact from a host being healthy, so it gets a different
   channel: --f-accent (violet) plus a soft glow, matching the admin metric
   cards. Green is left alone so it keeps meaning exactly one thing.

   The class is `is-measured`, not `is-live`, so it cannot be confused with the
   `.is-live` host state used by .dot and .arch-pill.

   Height budget: the ring is a grid column beside the existing text stack, so
   the card's height stays max(ring, stack). The stack is already three lines
   tall, which is taller than the ring — so the ring adds no height at all. The
   glow is a text-shadow, which does not affect layout either. */
.arch-fig.has-ring {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  /* Top-aligned so this card's label sits on the same baseline as every other
     card's label. Centring the row instead pushes the whole stack down and the
     figures row stops reading as a row. */
  align-items: start;
}
.arch-fig-main { min-width: 0; }

.arch-fig-ring {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  position: relative;
  /* Drops past the uppercase key line so the ring sits beside the number it
     describes rather than beside the caption. 15px = the key's line box
     (12px x 1.45) less half the difference between the ring and the 24px
     value line. Costs no height: the card is already taller than 15+34. */
  margin-top: 15px;
  /* --arch-pct is written by architecture.js from a real ready/total pair and
     is only ever emitted when both numbers exist. */
  background: conic-gradient(
    var(--f-accent) calc(var(--arch-pct, 0) * 1%),
    var(--f-edge) 0
  );
}
.arch-fig-ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--f-deep);
}

.arch-fig.is-measured .arch-fig-v {
  color: var(--f-accent);
  text-shadow: 0 0 10px color-mix(in srgb, var(--f-accent) 35%, transparent);
}

/* One shot on paint, not a loop. A dense data page must not have anything
   pulsing permanently in the corner of the eye. */
@keyframes arch-measured-in {
  from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--f-accent) 50%, transparent); }
  to { box-shadow: 0 0 0 9px transparent; }
}
.arch-fig.is-measured .arch-fig-ring { animation: arch-measured-in 1.1s ease-out 1; }

@media (prefers-reduced-motion: reduce) {
  .arch-fig.is-measured .arch-fig-ring { animation: none; }
}

.arch-fig-k { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--f-faint); }
.arch-fig-v { font-family: var(--font); font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--f-ink); }
.arch-fig.is-missing .arch-fig-v { color: var(--f-unknown); }
.arch-fig-c { font-size: 12.5px; color: var(--f-dim); }
.arch-fig-nores { color: var(--f-amber); font-weight: 600; }
.arch-fig-n { font-size: 12.5px; color: var(--f-faint); margin-top: 5px; font-style: italic; }

.arch-inventory {
  margin-top: 18px;
  border-top: 1px solid var(--f-edge);
  padding-top: 10px;
}
.arch-inventory summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: fit-content;
  color: var(--f-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.arch-inventory summary:hover { color: var(--f-ink); }
.arch-inventory summary span {
  color: var(--f-faint);
  font-size: 11.5px;
  font-weight: 400;
}
.arch-lists { display: grid; gap: 7px; margin-top: 10px; }
.arch-list {
  border: 1px solid var(--f-edge);
  border-radius: var(--radius-sm);
  background: var(--f-deep);
  padding: 8px 11px;
}
.arch-list-k { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--f-faint); margin-bottom: 6px; }
.arch-list-v { display: flex; flex-wrap: wrap; gap: 5px; }
.arch-list-v.is-missing { color: var(--f-unknown); font-size: 13px; }
.arch-list-c { font-size: 12.5px; color: var(--f-dim); margin-top: 6px; }

.arch-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 12.5px;
  padding: 3px 8px;
  border: 1px solid var(--f-edge);
  border-radius: 999px;
  background: var(--f-panel);
  color: var(--f-dim);
}
.arch-pill em { font-style: normal; color: var(--f-faint); font-size: 12px; }
.arch-pill.is-key { border-color: var(--f-cyan); color: var(--f-cyan); }
.arch-pill.is-live { border-color: var(--f-live); color: var(--f-live); }
.arch-pill.is-down { border-color: var(--f-down); color: var(--f-down); }

.arch-root .arch-stack-overview [data-arch-component] {
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  margin: 3px 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  cursor: pointer;
}
.arch-root .arch-stack-overview [data-arch-component]:focus-visible {
  outline: 2px solid var(--f-cyan);
  outline-offset: 2px;
}

/* The universe uses the same raised-surface hierarchy as the surrounding page. */
.arch-universe {
  --au-ink: #e4f3ff;
  --au-muted: #96acc7;
  --au-edge: #284059;
  color: var(--au-ink);
  background: #060d1c;
  border: 1px solid var(--au-edge);
  border-radius: 16px;
  overflow: hidden;
  color-scheme: dark;
}

[data-theme="light"] .arch-universe,
[data-admin-theme="light"] .arch-universe {
  --au-ink: #172033;
  --au-muted: #566176;
  --au-edge: rgba(33, 46, 72, 0.24);
  background: var(--surface-raised);
  color-scheme: light;
  box-shadow: var(--shadow-sm);
}
[data-theme="light"] .arch-universe .au-header,
[data-admin-theme="light"] .arch-universe .au-header,
[data-theme="light"] .arch-universe .au-toolbar,
[data-admin-theme="light"] .arch-universe .au-toolbar,
[data-theme="light"] .arch-universe footer,
[data-admin-theme="light"] .arch-universe footer {
  background: var(--surface-raised);
}
[data-theme="light"] .arch-universe .au-search input,
[data-admin-theme="light"] .arch-universe .au-search input,
[data-theme="light"] .arch-universe .au-results,
[data-admin-theme="light"] .arch-universe .au-results,
[data-theme="light"] .arch-universe button,
[data-admin-theme="light"] .arch-universe button {
  background: var(--surface-control);
  border-color: var(--au-edge);
  color: var(--au-ink);
}
[data-theme="light"] .arch-universe button:hover,
[data-theme="light"] .arch-universe button[aria-pressed="true"],
[data-admin-theme="light"] .arch-universe button:hover,
[data-admin-theme="light"] .arch-universe button[aria-pressed="true"] {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}
[data-theme="light"] .arch-universe .au-eyebrow,
[data-admin-theme="light"] .arch-universe .au-eyebrow,
[data-theme="light"] .arch-universe .au-help,
[data-admin-theme="light"] .arch-universe .au-help {
  color: var(--accent);
}
[data-theme="light"] .arch-universe .au-search input::placeholder,
[data-admin-theme="light"] .arch-universe .au-search input::placeholder,
[data-theme="light"] .arch-universe footer,
[data-admin-theme="light"] .arch-universe footer {
  color: var(--au-muted);
}
.arch-universe * { box-sizing: border-box; }
.arch-universe [hidden] { display: none !important; }
.au-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px 12px; }
.arch-universe h3 { color: var(--au-ink); margin: 4px 0; font-size: 19px; }
.au-eyebrow { color: #60eaff; font: 10px/1.5 Consolas, monospace; letter-spacing: .16em; }
.au-search { position: relative; width: min(360px, 50%); z-index: 5; }
.au-search label, .au-search input { display: block; width: 100%; }
.au-search input { padding: 12px 14px; color: var(--au-ink); background: #101c30; border: 1px solid #3e5873; border-radius: 8px; font: inherit; font-size: 14px; }
.au-search input::placeholder { color: #a8bad0; }
.au-results { position: absolute; inset: calc(100% + 5px) 0 auto; background: #101c30; border: 1px solid #416781; border-radius: 8px; padding: 6px; max-height: 340px; overflow: auto; box-shadow: 0 16px 48px #000a; }
.au-results button { display: block; width: 100%; text-align: left; margin: 3px 0; }
.au-results small { display: block; color: var(--au-muted); font-size: 10px; }
.au-results p { padding: 8px; }
.arch-universe button {
  color: var(--au-ink); border: 1px solid var(--au-edge); background: #101c30;
  border-radius: 6px; padding: 9px 11px; min-height: 38px; font: 12px/1.4 var(--font); cursor: pointer;
}
.arch-universe button:hover, .arch-universe button[aria-pressed="true"] { border-color: #60eaff; background: #143044; color: #91f4ff; }
.arch-universe button:disabled { opacity: .42; cursor: default; }
.arch-universe :focus-visible { outline: 2px solid #b4faff; outline-offset: 3px; }
.au-toolbar { display: flex; gap: 5px; flex-wrap: wrap; padding: 0 20px 12px; }
.au-stage {
  position: relative; height: clamp(560px, 76vh, 920px); isolation: isolate; overflow: hidden;
  background: radial-gradient(ellipse at 45% 50%, #17224b70, transparent 62%),
    radial-gradient(ellipse at 75% 25%, #46135533, transparent 40%), #030916;
}
.au-stage::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background-image: linear-gradient(#4a779112 1px, transparent 1px), linear-gradient(90deg, #4a779112 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(ellipse, #000, transparent 75%); }
.au-space { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; cursor: grab; }
.au-space:active { cursor: grabbing; }
.au-star { fill: #aacce9; opacity: .35; pointer-events: none; }
.au-orbit { fill: none; stroke: var(--domain); stroke-width: 1; stroke-dasharray: 3 9; opacity: .2; }
.au-domain-name { fill: var(--domain); font: 9px Consolas, monospace; letter-spacing: 1.4px; pointer-events: none; }
.au-link { fill: none; stroke: #7996d3; stroke-width: .7; opacity: .075; pointer-events: none; }
.au-link.au-relevant { stroke: #80eaff; opacity: .8; stroke-width: 1.2; }
.au-link .au-route-trace { stroke: #e3fbff; stroke-dasharray: 3 25; stroke-width: 1.7; animation: au-route 6s linear infinite; opacity: .65; }
@keyframes au-route { to { stroke-dashoffset: -112; } }
.au-node { --node: var(--domain); cursor: pointer; }
.au-node.au-down { --node: #e58493; }
.au-node.au-degraded, .au-node.au-stale { --node: #f5bd68; }
.au-node.au-unknown, .au-node.au-disabled, .au-node.au-standby { --node: #8091ac; }
.au-node.au-measured { --node: #60eaff; }
.au-node.au-selected { --node: #edfeff; }
.au-core { fill: var(--node); stroke: #defaff; stroke-width: .5; filter: drop-shadow(0 0 5px var(--node)); }
.au-halo { fill: var(--node); opacity: .09; }
.au-hub-ring { fill: none; stroke: var(--node); stroke-width: .6; opacity: .5; }
.au-workload { fill: none; stroke: #f5bd68; stroke-width: 1.5; stroke-dasharray: 2 8; animation: au-route 6s linear infinite; }
.au-hit { fill: transparent; stroke: none; }
.au-node text { fill: #dbeaff; font: 11px var(--font); paint-order: stroke; stroke: #030916; stroke-width: 4px; stroke-linejoin: round; }
.au-node text.au-node-state { fill: var(--node); font: 9px Consolas, monospace; }
.au-node text.au-node-endpoint { fill: var(--f-dim); font: 10px Consolas, monospace; }
.au-node.au-selected .au-hub-ring, .au-node:focus-visible .au-hub-ring { stroke-width: 2; opacity: 1; }
.au-node:focus-visible .au-core { stroke-width: 3; }
.au-node.au-measured .au-halo { animation: au-health 3.8s ease-in-out infinite; }
@keyframes au-health { 50% { opacity: .25; } }
.au-dim { opacity: .13; }
.au-link.au-dim { opacity: .02; }
.au-domains { position: absolute; top: 12px; left: 12px; display: flex; gap: 4px; flex-wrap: wrap; max-width: min(650px, calc(100% - 24px)); }
.au-domains button { font: 9px/1.4 Consolas, monospace; min-height: 30px; padding: 6px 8px; background: #081325df; border-color: #254155; }
.au-domains button::before { content: ''; display: inline-block; width: 4px; height: 4px; background: var(--domain); border-radius: 50%; margin-right: 5px; }
.au-location { position: absolute; bottom: 14px; left: 16px; right: 16px; pointer-events: none; color: #a3c4da; font: 11px Consolas, monospace; text-shadow: 0 1px 4px #000; }
.au-hud { position: absolute; right: 14px; top: 110px; bottom: 42px; width: min(320px, 38%); overflow: auto; overscroll-behavior: contain;
  padding: 16px; background: #071323f2; backdrop-filter: blur(18px); border: 1px solid #548397;
  border-radius: 10px; box-shadow: 0 0 32px #34c7ee12, 0 20px 60px #0007; }
.au-hud-actions { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.au-hud h3 { font-size: 20px; overflow-wrap: anywhere; }
.au-hud p { color: #a8bed4; font-size: 12px; line-height: 1.6; }
.au-status { color: #a7b8ce; font: 12px Consolas, monospace; margin: 10px 0; }
.au-status.au-live { color: #60eaff; }
.au-status.au-down { color: #e58493; }
.au-status.au-degraded, .au-status.au-stale { color: #f5bd68; }
.au-status small { color: #a3b4ca; display: block; margin-top: 5px; }
.au-hud dl { margin: 12px 0; }
.au-hud .au-essential { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.au-hud details { margin-top: 16px; }
.au-hud summary { color: #c3deed; font-size: 12px; cursor: pointer; padding: 8px 0; }
.au-hud dl > div { padding: 7px 0; border-bottom: 1px solid #26384b; }
.au-hud dt { font-size: 10px; color: #8daac2; }
.au-hud dd { margin: 3px 0 0; font-size: 12px; color: #e0f0fc; overflow-wrap: anywhere; }
.au-hud h4 { color: #60eaff; font: 10px Consolas, monospace; text-transform: uppercase; margin: 18px 0 8px; letter-spacing: .12em; }
.au-peers { display: flex; gap: 6px; flex-wrap: wrap; }
.au-peers button { text-align: left; max-width: 100%; }
.au-peers span { display: block; color: #9baecb; font-size: 10px; }
.au-caveat { font-size: 10px !important; }
.arch-universe footer { display: grid; gap: 5px; color: #99afc7; padding: 12px 18px; border-top: 1px solid #203148; font-size: 10px; line-height: 1.5; }
.au-help { color: #c3d9ea; }
.au-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.au-paused .au-route-trace, .au-paused .au-halo, .au-paused .au-workload { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .arch-universe .au-route-trace, .arch-universe .au-halo, .arch-universe .au-workload { animation: none !important; }
}
@media (max-width: 600px) {
  .au-header { align-items: stretch; flex-direction: column; padding: 14px; gap: 8px; }
  .au-search { width: 100%; }
  .au-toolbar { padding: 0 14px 12px; }
  .arch-universe button { min-height: 40px; }
  .au-toolbar button { flex: 1 0 auto; }
  .au-stage { height: 700px; }
  .au-domains { flex-wrap: nowrap; overflow-x: auto; max-width: calc(100% - 24px); padding-bottom: 6px; }
  .au-domains button { flex-shrink: 0; }
  .au-hud { width: auto; left: 10px; right: 10px; top: auto; bottom: 36px; max-height: 42%; padding: 12px; }
  .au-node text { font-size: 12px; }
  .au-location { font-size: 10px; }
}

/* ---- tabs ---------------------------------------------------------------- */

.arch-view-menu {
  padding: 9px;
  margin: 0 0 16px;
  border: 1px solid var(--f-edge);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--f-accent) 7%, transparent), transparent 46%),
    var(--f-panel);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--f-ink) 5%, transparent);
}
.arch-view-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 3px 8px;
}
.arch-view-menu-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--f-faint);
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.arch-view-menu-label span {
  color: var(--f-accent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--f-accent) 60%, transparent);
}
.arch-expand-all {
  display: grid;
  place-items: center;
  width: 28px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--f-edge);
  border-radius: 7px;
  background: color-mix(in srgb, var(--f-deep) 86%, transparent);
  color: var(--f-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.arch-expand-all:hover,
.arch-expand-all:focus-visible {
  color: var(--f-accent);
  border-color: var(--f-accent);
  box-shadow: 0 0 9px color-mix(in srgb, var(--f-accent) 20%, transparent);
  outline: none;
}
.arch-expand-all:disabled {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}
.arch-tabstrip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}
.arch-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--f-dim);
  background: color-mix(in srgb, var(--f-deep) 86%, transparent);
  border: 1px solid var(--f-edge);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.arch-tab-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid color-mix(in srgb, var(--f-edge) 80%, transparent);
  border-radius: 7px;
  color: var(--f-faint);
  background: color-mix(in srgb, var(--f-panel) 84%, transparent);
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 13px;
}
.arch-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.arch-tab:hover {
  color: var(--f-ink);
  border-color: color-mix(in srgb, var(--f-accent) 46%, var(--f-edge));
  transform: translateY(-1px);
}
.arch-tab.is-active {
  color: var(--f-accent);
  border-color: var(--f-accent);
  background: color-mix(in srgb, var(--f-accent) 10%, var(--f-deep));
  box-shadow:
    inset 0 0 14px color-mix(in srgb, var(--f-accent) 7%, transparent),
    0 0 10px color-mix(in srgb, var(--f-accent) 12%, transparent);
}
.arch-tab.is-active .arch-tab-icon {
  color: var(--f-accent);
  border-color: color-mix(in srgb, var(--f-accent) 60%, var(--f-edge));
  box-shadow: 0 0 9px color-mix(in srgb, var(--f-accent) 24%, transparent);
}

@media (max-width: 900px) {
  .arch-tabstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .arch-tab:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---- focused tab content ------------------------------------------------ */

.arch-actions {
  --fcc-accent: var(--f-accent);
  --fcc-surface: var(--surface-glass-strong);
  --fcc-surface-raised: var(--surface-raised);
  min-width: 0;
}

.arch-panel {
  display: grid;
  gap: 7px;
  min-width: 0;
}
.arch-section {
  min-width: 0;
  border: 1px solid var(--f-edge);
  border-radius: var(--radius-sm);
  background: var(--f-deep);
  overflow: clip;
}
.arch-section > summary {
  padding: 10px 12px;
  color: var(--f-ink);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  list-style-position: inside;
}
.arch-section > summary:hover { color: var(--f-accent); }
.arch-section[open] > summary {
  border-bottom: 1px solid var(--f-edge);
  color: var(--f-accent);
}
.arch-section-body {
  padding: 10px;
  overflow-x: auto;
}
.arch-section-body > .hint {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
}
.arch-note {
  margin-top: 8px;
  border-top: 1px solid var(--f-edge);
  padding-top: 6px;
}
.arch-note > summary {
  width: fit-content;
  color: var(--f-faint);
  font-size: 12px;
  cursor: pointer;
}
.arch-note > .call { margin-top: 7px; }
.arch-panel .node,
.arch-panel .step,
.arch-panel .chip,
.arch-panel .side,
.arch-panel .fwgrp { padding: 6px 8px; }
.arch-panel svg.wire {
  max-height: 68vh;
}

/* ---- projected 3D routing map ------------------------------------------- */
.arch-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.arch-summary-card { min-width: 0; display: grid; align-content: start; gap: 10px; padding: 16px; border: 1px solid var(--f-edge); border-radius: 10px; background: var(--f-deep); }
.arch-summary-card strong { font-size: 19px; line-height: 1.3; color: var(--f-ink); overflow-wrap: anywhere; }
.arch-summary-label { color: var(--f-dim); font-size: 14px; font-weight: 600; }
.arch-summary-detail { color: var(--f-dim); font-size: 14px; line-height: 1.5; }
.arch-summary-card details { font-size: 14px; overflow-wrap: anywhere; }
.arch-summary-card summary,
.arch-catalogue-note summary { cursor: pointer; color: var(--f-dim); }
.arch-catalogue-note { margin-top: 16px; font-size: 14px; }
.arch-section-icon { color: var(--f-accent); margin-right: 10px; }
.arch-journey { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; counter-reset: stage; }
.arch-journey li { counter-increment: stage; padding: 16px; border: 1px solid var(--f-edge); border-radius: 10px; background: var(--f-deep); display: grid; gap: 8px; }
.arch-journey li::before { content: counter(stage, decimal-leading-zero); color: var(--f-cyan); font-size: 20px; font-weight: 700; }
.arch-journey li span { color: var(--f-dim); font-size: 14px; }
.arch-routing { min-width: 0; container: architecture-map / inline-size; }
.arch-routing.is-embedded {
  --arch-control-size: var(--widget-control-size, 20px);
  --arch-control-padding: 0 4px;
}
.arch-routing-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.arch-routing-toolbar button {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--f-edge);
  border-radius: 9px;
  color: var(--f-ink);
  background: var(--f-panel);
  font: inherit;
  cursor: pointer;
}
.arch-routing-toolbar button[aria-pressed="true"] {
  color: var(--f-accent);
  border-color: var(--f-accent);
  background: color-mix(in srgb, var(--f-accent) 12%, var(--f-panel));
}
.arch-routing-toolbar label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  color: var(--f-dim);
}
.arch-routing-toolbar input { width: 110px; accent-color: var(--f-accent); }
.arch-routing-toolbar select {
  max-width: min(290px, 65vw); min-height: 44px; padding: 8px;
  background: var(--f-deep); color: var(--f-ink); border: 1px solid var(--f-edge); border-radius: 8px;
}
.arch-routing-toolbar button:focus-visible,
.arch-routing-toolbar input:focus-visible,
.arch-routing-viewport:focus-visible {
  outline: 2px solid var(--f-accent);
  outline-offset: 3px;
}
.arch-routing-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 12px;
}
.arch-routing-legend span { display: flex; align-items: center; gap: 7px; color: var(--route-color); }
.arch-routing-legend span::before {
  content: "";
  width: 20px;
  border-top: 3px solid currentColor;
}
.arch-routing .is-stream, .arch-routing .is-surface { --route-color: var(--f-cyan); }
.arch-routing .is-audio, .arch-routing .is-voice { --route-color: var(--f-rose); }
.arch-routing .is-tool { --route-color: var(--f-blue); }
.arch-routing .is-data { --route-color: var(--f-amber); }
.arch-routing .is-request, .arch-routing .is-runtime { --route-color: var(--f-violet); }
.arch-routing .is-hosting { --route-color: var(--f-faint); }
.arch-routing-viewport {
  overflow: auto;
  max-height: 78vh;
  border: 1px solid var(--f-edge);
  border-radius: 14px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--f-cyan) 6%, transparent) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--f-cyan) 6%, transparent) 1px, transparent 1px),
    radial-gradient(ellipse at 45% 30%, color-mix(in srgb, var(--f-cyan) 14%, transparent), transparent 70%), var(--f-deep);
  background-size: 40px 40px, 40px 40px, auto;
  box-shadow: inset 0 0 50px color-mix(in srgb, var(--f-cyan) 7%, transparent);
  scrollbar-color: var(--f-accent) var(--f-deep);
}
.arch-routing:not(.is-flat) .arch-routing-viewport { touch-action: none; cursor: grab; }
.arch-routing:not(.is-flat) .arch-routing-viewport:active { cursor: grabbing; }
.arch-routing-help { color: var(--f-dim); font-size: 13px; }
.arch-routing-layers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.arch-routing-layers button { min-height: 44px; padding: 6px 10px; background: var(--f-deep); color: var(--f-ink); border: 1px solid var(--f-edge); border-radius: 8px; font: inherit; font-size: 11px; cursor: pointer; }
.arch-routing-layers button:focus-visible { outline: 2px solid var(--f-accent); outline-offset: 2px; }
.arch-routing-layer path { fill: var(--f-deep); stroke: var(--f-cyan); stroke-width: 1.5; }
.arch-routing-layer .arch-layer-plane { fill: color-mix(in srgb, var(--f-cyan) 5%, var(--f-deep)); }
.arch-routing-layer .arch-layer-depth { fill: color-mix(in srgb, var(--f-cyan) 19%, var(--f-deep)); stroke-opacity: .7; }
.arch-routing-layer .arch-layer-grid { fill: url(#arch-blueprint-grid); color: var(--f-cyan); opacity: .2; stroke: none; }
.arch-routing-layer text { fill: var(--f-cyan); font-size: 23px; font-weight: 700; letter-spacing: 3px; }
.arch-blueprint-coverage { display: grid; gap: 6px; padding: 12px 16px; border-left: 3px solid var(--f-cyan); background: var(--f-deep); }
.arch-blueprint-coverage strong { color: var(--f-cyan); letter-spacing: .08em; text-transform: uppercase; }
.arch-blueprint-coverage span { color: var(--f-dim); font-size: 12px; }
.arch-routing-health { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 12px 0; font-size: 12px; color: var(--f-dim); }
.arch-routing-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.arch-routing-metrics > div { padding: 12px; border: 1px solid var(--f-edge); border-radius: 10px; background: var(--f-deep); }
.arch-routing-metrics span, .arch-routing-metrics small { display: block; color: var(--f-dim); font-size: 12px; }
.arch-routing-metrics strong { display: block; font-size: 21px; color: var(--f-ink); margin: 6px 0; }
.arch-routing-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.arch-routing-facts div { min-width: 0; padding: 10px; background: var(--f-deep); border-radius: 8px; }
.arch-routing-facts dt { font-size: 12px; color: var(--f-dim); }
.arch-routing-facts dd { margin: 4px 0 0; color: var(--f-ink); overflow-wrap: anywhere; }
.arch-routing-svg {
  display: block;
  width: 100%;
  min-width: 1550px;
  height: auto;
  font-family: var(--font-body);
  margin-inline: auto;
}
.arch-routing.is-system .arch-routing-name { font-size: 26px; }
.arch-routing.is-system .arch-routing-detail { font-size: 15px; }
.arch-routing.is-system .arch-routing-layer text { font-size: 34px; letter-spacing: 4px; }
.arch-routing.is-system .arch-routing-node rect { filter: drop-shadow(0 8px 7px color-mix(in srgb, var(--route-color) 22%, transparent)); }
.arch-routing-floor {
  fill: color-mix(in srgb, var(--f-accent) 4%, var(--f-panel));
  stroke: var(--f-edge);
  stroke-dasharray: 5 8;
}
.arch-routing-edge { color: var(--route-color); }
.arch-routing-edge path { fill: none; stroke: currentColor; }
.arch-routing-track { stroke-width: 1.3; opacity: 0.38; }
.arch-routing-signal {
  stroke-width: 2;
  stroke-dasharray: 5 17;
  animation: arch-routing-flow 3s linear infinite;
}
.arch-routing-edge.is-audio .arch-routing-signal { stroke-dasharray: 2 7; animation-duration: 1.6s; }
.arch-routing-edge.is-stream .arch-routing-signal { stroke-dasharray: 12 10; animation-duration: 1.8s; }
.arch-routing-edge.is-data .arch-routing-signal,
.arch-routing-edge.is-request .arch-routing-signal { animation: none; stroke-dasharray: 3 6; opacity: 0.6; }
.arch-routing-arrow { stroke-width: 2.5; }
.arch-routing-node { cursor: pointer; }
.arch-routing-node rect {
  fill: var(--f-panel);
  stroke: var(--route-color);
  stroke-width: 1.5;
  filter: drop-shadow(0 6px 5px color-mix(in srgb, var(--f-ink) 10%, transparent));
}
.arch-routing-plinth {
  fill: color-mix(in srgb, var(--route-color) 18%, var(--f-deep));
  stroke: var(--route-color);
  stroke-width: 1;
}
.arch-routing-rim { fill: none; stroke: var(--route-color); opacity: 0.65; }
.arch-routing-name { fill: var(--f-ink); font-size: 21px; font-weight: 650; }
.arch-routing-endpoint { fill: var(--f-dim); font: 12px Consolas, monospace; }
.arch-routing-detail { fill: var(--f-dim); font-size: 14px; }
.arch-routing-status { fill: var(--f-dim); font-size: 16px; font-weight: 600; }
.arch-routing-status.is-live { fill: var(--f-live); }
.arch-routing-status.is-down { fill: var(--f-down); }
.arch-routing-status.is-stale { fill: var(--f-amber); }
.arch-routing-status.is-degraded { fill: var(--f-amber); }
.arch-count .arch-dot.is-degraded { background: var(--f-amber); }
.arch-routing-status.is-implemented { fill: var(--f-violet); }
.arch-routing-node:hover rect,
.arch-routing-node:focus-visible rect,
.arch-routing-node.is-selected rect {
  stroke-width: 3;
  fill: color-mix(in srgb, var(--route-color) 12%, var(--f-panel));
}
.arch-routing .arch-routing-node:focus-visible { outline: none; opacity: 1; }
.arch-routing .is-muted { opacity: 0.15; }
.arch-routing-edge.is-muted .arch-routing-signal { animation-play-state: paused; }
.arch-routing-selection {
  margin-top: 12px;
  padding: 12px 16px;
  border-left: 3px solid var(--f-accent);
  background: var(--f-panel);
  color: var(--f-dim);
}
.arch-routing-selection h3 { color: var(--f-ink); margin: 0 0 8px; }
.arch-routing-selection p { margin: 0; }
.arch-routing-selection ul { margin: 0; padding-left: 18px; }
.arch-routing-selection li + li { margin-top: 6px; }
.arch-routing-selection button,
.arch-component-dialog button {
  min-height: 44px; border: 1px solid var(--f-edge); border-radius: 7px; padding: 6px 10px;
  background: var(--f-deep); color: var(--f-cyan); font: inherit; cursor: pointer;
}
.arch-component-dialog {
  box-sizing: border-box; width: min(900px, calc(100vw - 24px)); max-height: calc(100dvh - 32px);
  padding: 0; color: var(--f-ink); background: var(--f-panel);
  border: 1px solid var(--f-cyan); border-radius: 16px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--f-cyan) 9%, transparent), 0 24px 100px #0008;
}
.arch-component-dialog::backdrop { background: #000a; backdrop-filter: blur(6px); }
.arch-component-dialog header {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 20px; background: var(--f-deep); border-bottom: 1px solid var(--f-edge);
}
.arch-component-dialog header span { color: var(--f-cyan); letter-spacing: .12em; font-size: 11px; }
.arch-component-dialog header > div { display: flex; gap: 8px; flex-shrink: 0; }
.arch-component-body { padding: 20px; }
.arch-component-body h3 { margin: 0; font-size: 24px; color: var(--f-cyan); }
.arch-component-body h4 { margin-top: 22px; }
.arch-component-body ul { padding-left: 20px; line-height: 1.7; }
.arch-component-body li + li { margin-top: 10px; }
.arch-component-dialog footer { padding: 14px 20px; color: var(--f-dim); border-top: 1px solid var(--f-edge); font-size: 12px; }
.arch-component-dialog button:focus-visible,
.arch-routing-toolbar select:focus-visible { outline: 2px solid var(--f-cyan); outline-offset: 3px; }
.arch-routing-facts progress { display: block; width: 100%; height: 7px; margin-top: 8px; accent-color: var(--f-cyan); }
.arch-routing.is-paused .arch-routing-signal { animation-play-state: paused; }
@keyframes arch-routing-flow { to { stroke-dashoffset: -88; } }
@media (prefers-reduced-motion: reduce) {
  .arch-routing .arch-routing-signal { animation: none; }
}
@media (max-width: 600px) {
  .arch-routing-toolbar button { flex: 1 1 42%; }
  .arch-routing-toolbar label { width: 100%; }
  .arch-routing-toolbar input { flex: 1; }
  .arch-routing-viewport { max-height: 65vh; }
}

/* ---- zones and nodes ----------------------------------------------------- */

.arch-root .zone {
  border: 1px solid var(--f-edge);
  border-radius: var(--radius-lg);
  background: var(--f-panel);
  padding: 11px;
  margin-bottom: 12px;
}
.arch-root .zone > h2 {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 3px;
  color: var(--f-ink);
  letter-spacing: -0.01em;
}
.arch-root .zone > .hint { font-size: 13px; color: var(--f-dim); margin-bottom: 11px; }

.arch-root .zone.cyan   { border-top: 2px solid var(--f-cyan); }
.arch-root .zone.blue   { border-top: 2px solid var(--f-blue); }
.arch-root .zone.amber  { border-top: 2px solid var(--f-amber); }
.arch-root .zone.rose   { border-top: 2px solid var(--f-rose); }
.arch-root .zone.green  { border-top: 2px solid var(--f-green); }
.arch-root .zone.violet { border-top: 2px solid var(--f-violet); }

.arch-root .grid { display: grid; gap: 8px; }
.arch-root .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.arch-root .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.arch-root .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.arch-root .g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.arch-root .node {
  border: 1px solid var(--f-edge);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--f-deep);
  padding: 9px 11px;
  position: relative;
  min-height: 62px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  column-gap: 7px;
  align-content: start;
}
.arch-root .node .t {
  grid-column: 2;
  align-self: center;
  min-width: 0;
  font-weight: 700;
  font-size: 15px;
  color: var(--f-ink);
}
.arch-root .node .port { color: var(--f-dim); font-weight: 500; }
.arch-component-endpoint { display: block; color: var(--f-dim); font: 11px Consolas, monospace; overflow-wrap: anywhere; }
.arch-root .node .d { grid-column: 1 / -1; margin-top: 5px; font-size: 14px; color: var(--f-dim); }
.arch-root .node .d b { color: var(--f-ink); font-weight: 600; }

.arch-root .node.c { border-left-color: var(--f-cyan); }
.arch-root .node.b { border-left-color: var(--f-blue); }
.arch-root .node.a { border-left-color: var(--f-amber); }
.arch-root .node.r { border-left-color: var(--f-rose); }
.arch-root .node.g { border-left-color: var(--f-green); }
.arch-root .node.v { border-left-color: var(--f-violet); }

/* ---- status indicators --------------------------------------------------
   Match the site-wide icon vocabulary: check = healthy, exclamation = issue,
   cross = failed/disabled, dash = standby, question = unknown. Colour remains
   a secondary cue, never the only cue. Every indicator also receives the
   server-owned state as title/aria-label in architecture.js.
   ------------------------------------------------------------------------- */

.arch-root .dot {
  position: static;
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-sizing: border-box;
  color: var(--f-unknown);
  background: color-mix(in srgb, currentColor 12%, transparent);
  font: 800 11px/1 system-ui, sans-serif;
}
.arch-root .dot::before { content: '?'; }
.arch-root .dot.is-live {
  color: var(--f-live);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--f-live) 22%, transparent);
}
.arch-root .dot.is-live::before,
.arch-root .dot.is-implemented::before { content: '\2713'; }
.arch-root .dot.is-down {
  color: var(--f-down);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--f-down) 28%, transparent);
}
.arch-root .dot.is-down::before,
.arch-root .dot.is-disabled::before { content: '\00d7'; }
.arch-root .dot.is-unknown {
  color: var(--f-unknown);
  box-shadow: none;
}
.arch-root .dot.is-stale {
  color: var(--f-amber);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--f-amber) 24%, transparent);
}
.arch-root .dot.is-stale::before,
.arch-root .dot.is-degraded::before { content: '!'; }
.arch-root .dot.is-implemented {
  color: var(--f-violet);
}
.arch-root .dot.is-standby {
  color: var(--f-amber);
}
.arch-root .dot.is-standby::before { content: '\2013'; }
.arch-root .dot.is-disabled {
  color: var(--f-unknown);
  opacity: 0.55;
}
.arch-root .dot.is-degraded { color: var(--f-amber); }
/* A weak signal is a live reading that does not prove much — a 200 from an SPA
   shell. The check remains, but loses its healthy halo. */
.arch-root .dot.is-live.is-weak {
  box-shadow: none;
  opacity: 0.72;
}
/* An authored caveat, independent of live status. It marks nodes the text has
   something to warn about, which is a permanent editorial fact and must not be
   confused with a health reading. */
.arch-root .dot[data-arch-caveat]::after {
  content: '';
  position: absolute;
  right: -1px;
  bottom: -4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--f-amber);
}

.arch-count .arch-dot {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-sizing: border-box;
  color: var(--f-unknown);
  background: color-mix(in srgb, currentColor 12%, transparent);
  font: 800 11px/1 system-ui, sans-serif;
  font-style: normal;
}
.arch-count .arch-dot::before { content: '?'; }
.arch-count .arch-dot.is-live { color: var(--f-live); }
.arch-count .arch-dot.is-live::before,
.arch-count .arch-dot.is-configured::before,
.arch-count .arch-dot.is-implemented::before { content: '\2713'; }
.arch-count .arch-dot.is-down { color: var(--f-down); }
.arch-count .arch-dot.is-down::before,
.arch-count .arch-dot.is-disabled::before { content: '\00d7'; }
.arch-count .arch-dot.is-stale,
.arch-count .arch-dot.is-degraded { color: var(--f-amber); }
.arch-count .arch-dot.is-stale::before,
.arch-count .arch-dot.is-degraded::before { content: '!'; }
.arch-count .arch-dot.is-configured,
.arch-count .arch-dot.is-implemented { color: var(--f-violet); }
.arch-count .arch-dot.is-standby { color: var(--f-amber); }
.arch-count .arch-dot.is-standby::before { content: '\2013'; }
.arch-count .arch-dot.is-disabled { opacity: 0.55; }

/* ---- voice pipeline lanes ------------------------------------------------ */

/* Deliberately div.lane, not .lane. The class is used twice in the ported
   markup for two unrelated things: three <div class="lane"> pipeline rows here,
   and eleven <text class="lane"> swim-lane captions inside the wiring SVGs.
   An unqualified .lane would put `display: grid` on those eleven SVG text
   nodes. Same story for .lbl, .dash and .hl further down — the artefact relied
   on `svg.wire` scoping to keep the two namespaces apart, so this port has to
   preserve that separation rather than flatten it. */
.arch-root div.lane { display: grid; grid-template-columns: 126px 1fr; gap: 10px; margin-bottom: 7px; }
.arch-root div.lane .lbl {
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--f-deep);
  border: 1px solid var(--f-edge);
  border-left-width: 3px;
}
.arch-root div.lane .lbl b { display: block; font-family: var(--font); font-size: 12.5px; letter-spacing: 0.06em; color: var(--f-ink); }
.arch-root div.lane .lbl span { font-size: 12px; color: var(--f-dim); }
.arch-root div.lane.browser .lbl { border-left-color: var(--f-cyan); }
.arch-root div.lane.node .lbl { border-left-color: var(--f-green); }
.arch-root div.lane.gpu .lbl { border-left-color: var(--f-rose); }

.arch-root .flow { display: flex; align-items: stretch; gap: 8px; overflow-x: auto; padding-bottom: 3px; }
.arch-root .step {
  flex: 1 1 0;
  min-width: 138px;
  border: 1px solid var(--f-edge);
  border-radius: var(--radius-sm);
  background: var(--f-deep);
  padding: 7px 8px;
  position: relative;
}
.arch-root .step .n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  margin-right: 5px;
  border-radius: 5px;
  background: var(--f-badge);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.arch-root .step .h { font-weight: 700; font-size: 13px; margin-bottom: 3px; color: var(--f-ink); }
.arch-root .step .s { font-size: 12.5px; color: var(--f-dim); }
.arch-root .step .k {
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 12px;
  color: var(--f-faint);
  margin-top: 5px;
}

/* ---- prose blocks -------------------------------------------------------- */

.arch-root .bus {
  border: 1px solid var(--f-edge);
  border-left: 3px solid var(--f-accent);
  border-radius: var(--radius-sm);
  background: var(--f-deep);
  padding: 9px 12px;
  margin-bottom: 11px;
  font-size: 13px;
  color: var(--f-dim);
}
.arch-root .bus b { color: var(--f-ink); }

.arch-root .call {
  border: 1px solid var(--f-edge);
  border-left: 3px solid var(--f-amber);
  border-radius: var(--radius-sm);
  background: var(--f-deep);
  padding: 8px 11px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--f-dim);
}
.arch-root .call b { color: var(--f-ink); }
.arch-root .call.good { border-left-color: var(--f-green); }
.arch-root .call.bad { border-left-color: var(--f-down); }
.arch-root .call .cap {
  display: inline-block;
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--f-amber);
  margin-bottom: 3px;
}
.arch-root .call.good .cap { color: var(--f-green); }
.arch-root .call.bad .cap { color: var(--f-down); }

/* The three verdict cells in the Home Assistant Assist-pipeline table. Ported
   from the artefact's --f-* versions onto the same status palette the dots use,
   so "good" here and "live" there are the same green rather than two greens. */
.arch-root .vgood { color: var(--f-live); font-weight: 600; }
.arch-root .vwarn { color: var(--f-amber); font-weight: 600; }
.arch-root .vbad { color: var(--f-down); font-weight: 600; }

.arch-root .legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--f-dim); margin-bottom: 11px; }
.arch-root .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

.arch-root .hint { font-size: 13px; color: var(--f-dim); }
.arch-root .sec { font-size: 13px; color: var(--f-dim); }
.arch-root .foot { font-size: 12.5px; color: var(--f-faint); margin-top: 14px; }

/* ---- chips --------------------------------------------------------------- */

.arch-root .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.arch-root .chip {
  border: 1px solid var(--f-edge);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--f-panel);
  padding: 4px 7px;
  min-width: 0;
  flex: 0 1 auto;
  font-size: 12.5px;
}
.arch-root .chip b { display: block; font-size: 12.5px; color: var(--f-ink); }
.arch-root .chip span { font-size: 12px; color: var(--f-dim); }
.arch-root .chip .p { color: var(--f-cyan); }
.arch-root .chip.c { border-left-color: var(--f-cyan); }
.arch-root .chip.b { border-left-color: var(--f-blue); }
.arch-root .chip.a { border-left-color: var(--f-amber); }
.arch-root .chip.r { border-left-color: var(--f-rose); }
.arch-root .chip.g { border-left-color: var(--f-green); }
.arch-root .chip.v { border-left-color: var(--f-violet); }
/* "Does not exist" is a claim the page makes in words; the dashed edge is what
   marks it, not a dimmer. At 0.55 the whole chip — including its title — was
   multiplied down to roughly 3.4:1 on white, so the one chip whose text is a
   statement about absence was the least readable thing in the section. */
.arch-root .chip.ghost { opacity: 0.85; border-left-style: dashed; }

/* ---- agent portraits ----------------------------------------------------- */

.arch-root .agents { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.arch-root .agent {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--f-edge);
  border-left: 4px solid var(--ac, var(--f-accent));
  border-radius: var(--radius-sm);
  background: var(--f-panel);
  padding: 7px 9px;
  min-width: 0;
}
/* The portraits are the ones from frost_agents and the --ac accent on each row
   is that agent's own colour, carried over from the artefact as data. */
.arch-root .agent img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid var(--f-edge);
}
.arch-root .agent .am { min-width: 0; }
/* The --ac value is each agent's own colour, carried over from the artefact as
   data: nine bright hues picked for a black page. As the NAME's colour they
   measured 9.69:1 in dark and 1.30:1 in light — #26de81 on white is not text.
   The identity survives on the 4px rule and in the portrait, where a bright
   hue costs nothing; the name itself is ink. */
.arch-root .agent .an { font-family: var(--font); font-weight: 700; font-size: 13px; color: var(--f-ink); }
.arch-root .agent .ad { font-size: 12px; color: var(--f-dim); }
.arch-root .agent .sc {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--f-edge);
  color: var(--f-faint);
  margin-top: 3px;
}
.arch-root .sc.priv { border-color: var(--f-green); color: var(--f-green); }
.arch-root .sc.both { border-color: var(--f-amber); color: var(--f-amber); }
.arch-root .sc.work { border-color: var(--f-blue); color: var(--f-blue); }

/* ---- split panels -------------------------------------------------------- */

.arch-root .split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.arch-root .split3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.arch-root .side {
  border: 1px solid var(--f-edge);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  background: var(--f-deep);
  min-width: 0;
}
.arch-root .side > .st {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--f-faint);
}
.arch-root .side.priv { border-top: 2px solid var(--f-green); }
.arch-root .side.both { border-top: 2px solid var(--f-amber); }
.arch-root .side.work { border-top: 2px solid var(--f-blue); }
.arch-root .side.priv > .st { color: var(--f-green); }
.arch-root .side.both > .st { color: var(--f-amber); }
.arch-root .side.work > .st { color: var(--f-blue); }

/* ---- change tags --------------------------------------------------------- */

.arch-root .tag {
  display: inline-block;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.arch-root .tag.new { background: color-mix(in srgb, var(--f-green) 20%, transparent); color: var(--f-green); }
.arch-root .tag.chg { background: color-mix(in srgb, var(--f-amber) 20%, transparent); color: var(--f-amber); }
.arch-root .tag.del { background: color-mix(in srgb, var(--f-down) 20%, transparent); color: var(--f-down); }

/* ---- tables -------------------------------------------------------------- */

.arch-root table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 6px 0; }
.arch-root th,
.arch-root td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--f-edge); vertical-align: top; }
.arch-root th {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--f-faint);
  font-weight: 700;
}
.arch-root td { color: var(--f-dim); }
.arch-root td b { color: var(--f-ink); }

/* ---- wiring diagrams ----------------------------------------------------- */

/* The two hand-authored SVGs are entirely class-driven, so they restyle from
   here rather than needing their markup rewritten. Every rule is scoped
   `svg.wire` exactly as the artefact scoped it, because several of these class
   names (.lane, .lbl, .dash, .hl, .b, .s, .v) are also HTML class names in the
   tabs above and the two namespaces must not bleed into each other.

   Mapped off the artefact's light palette: --cp-surface -> --f-deep,
   --cp-border -> --f-edge, --cp-text-muted/-soft -> --f-dim,
   --cp-accent -> --accent, --cp-danger -> --f-down. The stroke widths,
   dash arrays and font weights are the artefact's own, kept as-is: they encode
   meaning in the diagram (dashed = optional path, 2.6px = the tool path,
   red dashes = a connection that does not exist). */
.arch-root svg.wire { width: 100%; height: auto; display: block; margin-top: 6px; overflow: visible; }

.arch-root svg.wire .nb { fill: var(--f-deep); stroke: var(--f-edge); stroke-width: 1.5; }
.arch-root svg.wire .nb.hl { fill: color-mix(in srgb, var(--f-accent) 16%, transparent); stroke: var(--f-accent); }
.arch-root svg.wire .nb.acc-b { stroke: var(--f-accent); stroke-width: 2.2; }
.arch-root svg.wire .nb.wd { stroke: var(--f-down); stroke-dasharray: 4 3; }
.arch-root svg.wire .nb.sys { fill: var(--f-panel); }
.arch-root svg.wire .nb.voc { stroke: var(--f-green); stroke-width: 2.2; }
.arch-root svg.wire .nb.v { stroke: var(--f-violet); stroke-width: 2; }
.arch-root svg.wire .nb.mdl { stroke: var(--f-blue); stroke-width: 2; }
.arch-root svg.wire .grp { fill: color-mix(in srgb, var(--f-accent) 10%, transparent); stroke: var(--f-edge); stroke-dasharray: 6 4; }

/* SVG text is laid out in viewBox user units, so the browser scales it by
   container width / viewBox width before it reaches the screen. At a 1170px
   content column and a 1440-unit viewBox that factor is 0.8125, which turned
   the 11px labels below into 8.94 rendered pixels — smaller than anything in
   the HTML above and the sharpest part of the "onscherp" complaint.

   These sizes are not a guess. Sweeping them in the browser against the real
   diagrams, checking both text-vs-text collision and each label's fit inside
   its own node rect, the first failure appears at 14px: "picker
   .frost-provider-select" grows to 394px inside a 374px box. 13px is one step
   below that — 119 of 119 boxed labels still fit, no new overlapping pairs,
   nothing escapes the svg — and renders at 10.56px instead of 8.94px. The box
   coordinates are hand-authored and will not move, so this is the ceiling. */
.arch-root svg.wire .nt { fill: var(--f-ink); font: 600 15.5px var(--font-body); }
.arch-root svg.wire .nt.s { font-size: 14px; }
.arch-root svg.wire .ns { fill: var(--f-dim); font: 400 13px 'JetBrains Mono', Consolas, monospace; }
.arch-root svg.wire .ns.b { fill: var(--f-ink); font-weight: 700; font-family: var(--font-body); font-size: 13.5px; }
.arch-root svg.wire .ns.acc { fill: var(--f-accent); font-weight: 700; }
.arch-root svg.wire .lane { fill: var(--f-faint); font: 700 13px var(--font); letter-spacing: 0.1em; }
.arch-root svg.wire .lbl { fill: var(--f-dim); font: 500 13px var(--font-body); }
.arch-root svg.wire .lbl.acc { fill: var(--f-accent); font-weight: 700; }
.arch-root svg.wire .lbl.end { fill: var(--f-down); font-weight: 600; }
.arch-root svg.wire .lbl.grn { fill: var(--f-green); font-weight: 700; }
.arch-root svg.wire .lbl.blu { fill: var(--f-blue); font-weight: 700; }
.arch-root svg.wire .bndt { fill: var(--f-accent); font: 700 13px var(--font); letter-spacing: 0.06em; }
.arch-root svg.wire .xg { fill: var(--f-down); font: 800 19px var(--font); }

.arch-root svg.wire .ln { stroke: var(--f-faint); stroke-width: 1.6; fill: none; }
.arch-root svg.wire .ln.tool { stroke: var(--f-accent); stroke-width: 2.6; }
.arch-root svg.wire .ln.dash { stroke-dasharray: 5 4; opacity: 0.75; }
.arch-root svg.wire .ln.no { stroke: var(--f-down); stroke-width: 1.6; stroke-dasharray: 3 4; opacity: 0.85; }
.arch-root svg.wire .ln.back { stroke: var(--f-accent); stroke-width: 2.6; opacity: 0.4; }
.arch-root svg.wire .ln.voice { stroke: var(--f-green); stroke-width: 2.6; fill: none; }
.arch-root svg.wire .ln.model { stroke: var(--f-blue); stroke-width: 2.2; fill: none; }
.arch-root svg.wire .bnd { stroke: var(--f-accent); stroke-width: 1.4; stroke-dasharray: 8 5; opacity: 0.7; }

@supports not (color: color-mix(in srgb, red 50%, transparent)) {
  .arch-root svg.wire .nb.hl { fill: var(--f-panel); }
  .arch-root svg.wire .grp { fill: none; }
}

/* ---- responsive ---------------------------------------------------------- */

@media (max-width: 900px) {
  .arch-root .g3,
  .arch-root .g4,
  .arch-root .g5,
  .arch-root .agents,
  .arch-root .split3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .arch-root div.lane { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .arch-root .g2,
  .arch-root .g3,
  .arch-root .g4,
  .arch-root .g5,
  .arch-root .agents,
  .arch-root .split,
  .arch-root .split3 { grid-template-columns: 1fr; }
  .arch-bar { flex-direction: column; align-items: stretch; }
  .arch-refresh { width: 100%; min-height: 44px; }
  .arch-expand-all { width: 44px; height: 44px; }
  .arch-tab { min-height: 44px; }
  .arch-section > summary { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .arch-refresh { transition: none; }
}

/* Put the instrument first; reference material and source detail stay on demand. */
.arch-root.is-viewer-first > .arch-bar,
.arch-root.is-viewer-first > .arch-figures,
.arch-root.is-viewer-first .arch-view-menu-head { display: none; }
.arch-root.is-viewer-first .arch-view-menu { padding: 5px; margin-bottom: 6px; }
.arch-root.is-viewer-first .arch-tab { padding: 8px; font-size: 13px; }
.arch-root.is-viewer-first .arch-tabstrip { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.arch-root.is-viewer-first .arch-tab:last-child { grid-column: auto; }
.arch-viewer-frame {
  --au-ink: #e4f3ff;
  --au-muted: #96acc7;
  --au-edge: #284059;
  position: relative;
  isolation: isolate;
  color: var(--au-ink);
  background: #060d1c;
  color-scheme: dark;
}
.arch-viewer-frame .arch-routing-toolbar,
.arch-universe .au-header,
.arch-universe .au-toolbar { position: absolute; z-index: 5; margin: 0; padding: 0; }
.arch-viewer-frame .arch-routing-toolbar { top: 10px; left: 10px; right: 10px; gap: 5px; }
.arch-viewer-frame .arch-routing-toolbar > button,
.arch-routing-zoom-controls > button,
.arch-viewer-menu > summary,
.arch-universe .au-menu > summary {
  box-sizing: border-box;
  border: 1px solid var(--au-edge); border-radius: 6px;
  padding: var(--arch-control-padding, 8px 10px); min-height: var(--arch-control-size, 36px);
  background: #101c30; color: var(--au-ink); font: 12px/1.5 var(--font); cursor: pointer;
}
.arch-viewer-frame .arch-routing-toolbar > button:hover,
.arch-viewer-frame .arch-routing-toolbar > button[aria-pressed="true"],
.arch-routing-zoom-controls > button:hover,
.arch-viewer-menu > summary:hover,
.arch-viewer-menu[open] > summary {
  border-color: #60eaff;
  background: #143044;
  color: #91f4ff;
}
.arch-viewer-label { display: none; }
.arch-routing-zoom-controls {
  position: absolute;
  z-index: 4;
  top: 62px;
  right: 10px;
  display: flex;
  gap: 4px;
}
.arch-routing-zoom-controls > button {
  width: var(--arch-control-size, 36px);
  min-height: var(--arch-control-size, 36px);
  padding: 0;
  font-size: 18px;
}
.arch-viewer-menu, .arch-universe .au-menu { position: static; }
.arch-viewer-menu > :not(summary), .arch-universe .au-menu > :not(summary) {
  position: absolute; top: calc(100% + 6px); left: 0; width: min(400px, 100%); max-height: 48vh;
  overflow: auto; overscroll-behavior: contain; padding: 12px; margin: 0; border: 1px solid #548397;
  border-radius: 10px; background: #071323f2; color: var(--au-ink);
  backdrop-filter: blur(18px); box-shadow: 0 0 32px #34c7ee12, 0 20px 60px #0007;
}
.arch-viewer-menu > div { display: flex; flex-wrap: wrap; gap: 8px; }
.arch-viewer-help > div { display: block; }
.arch-viewer-menu > summary:focus-visible, .arch-universe .au-menu > summary:focus-visible {
  outline: 2px solid #b4faff; outline-offset: 3px;
}
.arch-viewer-frame .arch-routing-toolbar label { color: var(--au-muted); }
.arch-viewer-frame .arch-routing-toolbar select {
  color: var(--au-ink);
  background: #101c30;
  border-color: var(--au-edge);
}
.arch-viewer-frame .arch-routing-toolbar input { accent-color: #60eaff; }
.arch-viewer-frame .arch-routing-layers button {
  color: var(--au-ink);
  background: #101c30;
  border-color: var(--au-edge);
}
.arch-viewer-frame .arch-routing-layers button:hover,
.arch-viewer-frame .arch-routing-layers button[aria-current="true"] {
  color: #91f4ff;
  background: #143044;
  border-color: #60eaff;
}
.arch-viewer-frame .arch-routing-viewport { height: clamp(480px, 76vh, 820px); max-height: none; padding-top: 62px; scroll-padding-top: 70px; }
.arch-routing-metrics {
  position: absolute; z-index: 2; bottom: 12px; right: 12px; display: flex; gap: 5px;
  width: min(360px, calc(100% - 24px)); margin: 0;
}
.arch-routing-metrics > div { flex: 1; min-width: 0; padding: 7px 9px; background: var(--f-panel); border-radius: 7px; }
.arch-routing-metrics span { font-size: 12px; }
.arch-routing-metrics strong { font-size: 15px; margin: 2px 0; }
.arch-routing-metrics progress { display: block; width: 100%; height: 3px; accent-color: var(--f-cyan); }
.arch-universe .au-header { top: 10px; right: 10px; left: auto; width: min(260px, 30%); }
.arch-universe .au-header > div:first-child { display: none; }
.arch-universe .au-search { width: 100%; }
.arch-universe .au-search input {
  box-sizing: border-box; height: var(--arch-control-size, 36px); padding: 0 8px; font-size: 12px;
}
.arch-universe .au-toolbar { top: 10px; left: 10px; right: calc(30% + 20px); gap: 4px; }
.arch-universe .au-toolbar > button {
  min-height: var(--arch-control-size, 36px); padding: var(--arch-control-padding, 7px 9px);
}
.arch-universe .au-menu > summary { color: #e4f3ff; background: #101c30; border-color: #284059; }
.arch-universe .au-menu > :not(summary) { color: #e4f3ff; background: #071323; border-color: #284059; }
.arch-universe .au-domains { position: absolute; flex-wrap: wrap; max-width: 100%; }
.arch-universe .au-stage { height: clamp(480px, 76vh, 820px); }
.arch-universe .au-metrics { bottom: 35px; right: 12px; }
.arch-universe .au-metrics > div { background: #101c30; border-color: #284059; }
.arch-universe .au-metrics span { color: #a8bed4; }
.arch-universe .au-metrics strong { color: #e4f3ff; }
.arch-universe .au-hud { bottom: 112px; }
[data-theme="light"] .arch-universe .au-stage,
[data-admin-theme="light"] .arch-universe .au-stage {
  background:
    radial-gradient(ellipse at 45% 50%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%),
    radial-gradient(ellipse at 75% 25%, color-mix(in srgb, var(--f-cyan) 7%, transparent), transparent 42%),
    var(--f-deep);
}
[data-theme="light"] .arch-universe .au-stage::before,
[data-admin-theme="light"] .arch-universe .au-stage::before {
  background-image:
    linear-gradient(color-mix(in srgb, var(--f-blue) 10%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--f-blue) 10%, transparent) 1px, transparent 1px);
}
[data-theme="light"] .arch-universe .au-star,
[data-admin-theme="light"] .arch-universe .au-star {
  fill: var(--f-blue);
  opacity: .22;
}
[data-theme="light"] .arch-universe .au-orbit,
[data-admin-theme="light"] .arch-universe .au-orbit {
  stroke: color-mix(in srgb, var(--domain) 58%, var(--f-ink));
  opacity: .28;
}
[data-theme="light"] .arch-universe .au-domain-name,
[data-admin-theme="light"] .arch-universe .au-domain-name {
  fill: color-mix(in srgb, var(--domain) 45%, var(--f-ink));
  font-weight: 700;
}
[data-theme="light"] .arch-universe .au-link,
[data-admin-theme="light"] .arch-universe .au-link {
  stroke: color-mix(in srgb, var(--f-blue) 35%, var(--f-dim));
  opacity: .2;
}
[data-theme="light"] .arch-universe .au-link.au-relevant,
[data-admin-theme="light"] .arch-universe .au-link.au-relevant {
  stroke: var(--f-blue);
  opacity: .8;
}
[data-theme="light"] .arch-universe .au-link .au-route-trace,
[data-admin-theme="light"] .arch-universe .au-link .au-route-trace {
  stroke: var(--f-cyan);
}
[data-theme="light"] .arch-universe .au-core,
[data-admin-theme="light"] .arch-universe .au-core {
  stroke: var(--f-panel);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--node) 45%, transparent));
}
[data-theme="light"] .arch-universe .au-node text,
[data-admin-theme="light"] .arch-universe .au-node text {
  fill: var(--f-ink);
  stroke: color-mix(in srgb, var(--f-deep) 94%, transparent);
}
[data-theme="light"] .arch-universe .au-node text.au-node-state,
[data-admin-theme="light"] .arch-universe .au-node text.au-node-state {
  fill: color-mix(in srgb, var(--node) 45%, var(--f-ink));
}
[data-theme="light"] .arch-universe .au-menu > summary,
[data-admin-theme="light"] .arch-universe .au-menu > summary,
[data-theme="light"] .arch-universe .au-domains button,
[data-admin-theme="light"] .arch-universe .au-domains button,
[data-theme="light"] .arch-universe .au-metrics > div,
[data-admin-theme="light"] .arch-universe .au-metrics > div {
  color: var(--au-ink);
  background: var(--surface-control);
  border-color: var(--au-edge);
}
[data-theme="light"] .arch-universe .au-menu > :not(summary),
[data-admin-theme="light"] .arch-universe .au-menu > :not(summary),
[data-theme="light"] .arch-universe .au-hud,
[data-admin-theme="light"] .arch-universe .au-hud {
  color: var(--au-ink);
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  border-color: var(--au-edge);
  box-shadow: var(--shadow-lg);
}
[data-theme="light"] .arch-universe .au-location,
[data-admin-theme="light"] .arch-universe .au-location,
[data-theme="light"] .arch-universe .au-metrics span,
[data-admin-theme="light"] .arch-universe .au-metrics span,
[data-theme="light"] .arch-universe .au-hud p,
[data-admin-theme="light"] .arch-universe .au-hud p,
[data-theme="light"] .arch-universe .au-status,
[data-admin-theme="light"] .arch-universe .au-status,
[data-theme="light"] .arch-universe .au-status small,
[data-admin-theme="light"] .arch-universe .au-status small,
[data-theme="light"] .arch-universe .au-peers span,
[data-admin-theme="light"] .arch-universe .au-peers span {
  color: var(--au-muted);
  text-shadow: none;
}
[data-theme="light"] .arch-universe .au-metrics strong,
[data-admin-theme="light"] .arch-universe .au-metrics strong,
[data-theme="light"] .arch-universe .au-hud dd,
[data-admin-theme="light"] .arch-universe .au-hud dd,
[data-theme="light"] .arch-universe .au-hud summary,
[data-admin-theme="light"] .arch-universe .au-hud summary {
  color: var(--au-ink);
}
[data-theme="light"] .arch-universe .au-hud dl > div,
[data-admin-theme="light"] .arch-universe .au-hud dl > div {
  border-bottom-color: var(--au-edge);
}
[data-theme="light"] .arch-viewer-frame,
[data-admin-theme="light"] .arch-viewer-frame {
  --au-ink: #172033;
  --au-muted: #566176;
  --au-edge: rgba(33, 46, 72, 0.24);
  background: var(--surface-raised);
  color-scheme: light;
}
[data-theme="light"] .arch-viewer-frame .arch-routing-toolbar > button,
[data-admin-theme="light"] .arch-viewer-frame .arch-routing-toolbar > button,
[data-theme="light"] .arch-routing-zoom-controls > button,
[data-admin-theme="light"] .arch-routing-zoom-controls > button,
[data-theme="light"] .arch-viewer-menu > summary,
[data-admin-theme="light"] .arch-viewer-menu > summary,
[data-theme="light"] .arch-viewer-frame .arch-routing-toolbar select,
[data-admin-theme="light"] .arch-viewer-frame .arch-routing-toolbar select,
[data-theme="light"] .arch-viewer-frame .arch-routing-layers button,
[data-admin-theme="light"] .arch-viewer-frame .arch-routing-layers button {
  background: var(--surface-control);
  border-color: var(--au-edge);
  color: var(--au-ink);
}
[data-theme="light"] .arch-viewer-frame .arch-routing-toolbar > button:hover,
[data-theme="light"] .arch-viewer-frame .arch-routing-toolbar > button[aria-pressed="true"],
[data-admin-theme="light"] .arch-viewer-frame .arch-routing-toolbar > button:hover,
[data-admin-theme="light"] .arch-viewer-frame .arch-routing-toolbar > button[aria-pressed="true"],
[data-theme="light"] .arch-routing-zoom-controls > button:hover,
[data-admin-theme="light"] .arch-routing-zoom-controls > button:hover,
[data-theme="light"] .arch-viewer-menu > summary:hover,
[data-theme="light"] .arch-viewer-menu[open] > summary,
[data-admin-theme="light"] .arch-viewer-menu > summary:hover,
[data-admin-theme="light"] .arch-viewer-menu[open] > summary {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}
[data-theme="light"] .arch-viewer-menu > :not(summary),
[data-admin-theme="light"] .arch-viewer-menu > :not(summary) {
  background: var(--surface-raised);
  border-color: var(--au-edge);
  color: var(--au-ink);
  box-shadow: var(--shadow-lg);
}
@media (max-width: 600px) {
  .arch-root.is-viewer-first .arch-tabstrip { display: flex; overflow-x: auto; }
  .arch-root.is-viewer-first .arch-tab { flex: 0 0 auto; min-height: 36px; }
  .arch-viewer-frame .arch-routing-toolbar { gap: 4px; }
  .arch-viewer-frame .arch-routing-toolbar > button,
  .arch-viewer-menu > summary { font-size: 10px; padding: var(--arch-control-padding, 8px); }
  .arch-viewer-frame .arch-routing-toolbar > [data-routing-mode] { flex: 0 0 auto; }
  .arch-viewer-frame .arch-routing-viewport { padding-top: 110px; scroll-padding-top: 118px; }
  .arch-routing-zoom-controls { top: 112px; }
  .arch-universe .au-header { width: auto; right: 10px; left: 10px; }
  .arch-universe .au-toolbar { top: 56px; right: 10px; }
  .arch-universe .au-toolbar > button { flex: 0 0 auto; }
  .arch-universe .au-menu > summary { font-size: 11px; }
  .arch-universe .au-hud { bottom: 112px; max-height: 38%; }
  .arch-universe .au-stage, .arch-viewer-frame .arch-routing-viewport { height: 72vh; min-height: 500px; }
}

.arch-root .arch-routing :is(.arch-routing-toolbar, .au-toolbar) > .arch-navigation-icon {
  display: inline-grid; place-items: center; width: var(--arch-control-size, 36px);
  min-width: var(--arch-control-size, 36px); padding: 0; font-size: 0;
}
.arch-root .arch-routing :is(.arch-routing-toolbar, .au-toolbar) > .arch-navigation-icon::before {
  content: ''; width: 18px; height: 18px; background: currentColor;
  mask: var(--arch-action-icon) center / contain no-repeat;
}
.arch-universe [data-au-action="back"] {
  --arch-action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m10 5-7 7 7 7M3 12h18' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.arch-universe [data-au-action="home"] {
  --arch-action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m3 10 9-7 9 7M5 9v12h5v-7h4v7h5V9' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.arch-universe [data-au-action="flat"],
.arch-routing [data-routing-scope="routing"] {
  --arch-action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 3h6v5H9zM3 16h6v5H3zM15 16h6v5h-6zM12 8v4M6 16v-4h12v4' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.arch-routing [data-routing-scope="system"] {
  --arch-action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M3 12h18M12 3a18 18 0 0 1 0 18 18 18 0 0 1 0-18Z' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E");
}
.arch-routing [data-routing-mode="3d"] {
  --arch-action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2 9 5v10l-9 5-9-5V7Zm0 10 9-5m-9 5L3 7m9 5v10' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@container architecture-map (max-width: 700px) {
  .arch-universe .au-stage {
    display: flex; flex-direction: column; gap: 6px; padding: 8px;
  }
  .arch-universe .au-header,
  .arch-universe .au-toolbar {
    position: relative; inset: auto; width: auto; flex: 0 0 auto; padding: 0;
  }
  .arch-universe .au-header { align-items: stretch; flex-direction: row; }
  .arch-universe .au-toolbar > button {
    flex: 0 0 auto; height: var(--arch-control-size, 36px); min-width: var(--arch-control-size, 36px);
  }
  .arch-universe .au-space { flex: 1 1 0; min-height: 0; }
  .arch-universe .au-metrics,
  .arch-universe .au-location {
    position: static; inset: auto; width: auto; flex: 0 0 auto;
  }
  .arch-universe .au-location { font-size: 10px; }
  .arch-universe .au-hud { inset: 100px 8px 8px; width: auto; max-height: none; }
  .arch-routing-metrics { flex-wrap: wrap; gap: 4px; }
  .arch-routing-metrics > div {
    display: flex; flex: 1 1 100px; flex-wrap: wrap; align-items: baseline; gap: 4px; padding: 3px 6px;
  }
  .arch-routing-metrics span { font-size: 10px; }
  .arch-routing-metrics strong { margin: 0; font-size: 12px; }
  .arch-routing-metrics progress { flex-basis: 100%; }
}
.arch-viewer-frame {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
}
.arch-viewer-frame .arch-routing-toolbar {
  position: relative; inset: auto; grid-area: 1 / 1; padding: 8px; align-items: center;
}
.arch-viewer-frame .arch-routing-viewport {
  grid-area: 2 / 1; min-height: 0; padding-top: 0; scroll-padding-top: 8px;
}
.arch-viewer-frame .arch-routing-zoom-controls {
  position: relative; inset: auto; grid-area: 2 / 1; align-self: start; justify-self: end; margin: 8px;
}
.arch-viewer-frame .arch-routing-metrics {
  position: static; grid-area: 3 / 1; box-sizing: border-box; width: 100%; padding: 8px;
}
