/*
 * Relay Activation — prototype stylesheet
 * System: v3.5 (neutral-first) · application of the LOCKED token sheet.
 *
 * Sources of truth:
 *   - brand/relay-tokens-v35.css (v3.5 neutral-first — LINK IT BEFORE this file)
 *   - direction 7HZQAX · briefs/BRIEF.interface-v35.md
 *
 * v3.5 migration: this file no longer redefines surfaces, text, borders,
 * accent slots, fonts, radius, pulse, or the base semantic/indigo tokens —
 * they are inherited from relay-tokens-v35.css (neutral surfaces; teal is a
 * touch-point layer, not a foundation). Only component styles and a handful
 * of supplementary tokens (teal press, semantic/indigo detail slots, motion)
 * live here. Accent is split by role: --rly-accent-text for text (AA),
 * --rly-accent-ui for icons/rings/fills, --rly-accent-fill + --rly-on-accent
 * for buttons (dark uses the ink-flip, never white-on-teal). Teal only on
 * interactive / accent / brand-motion. Flat surfaces — no shadows or glow.
 *
 * This file is the OUTSIDE-THE-APP version (server-rendered /auth/accept +
 * prototype). It mirrors @relay/ui component classes 1:1 so eng can map
 * straight across: .btn-accent / .btn-ghost / .card / .relay-code* /
 * .badge-* / .status-dot-*.
 */

/* =============================================================
   SUPPLEMENTARY TOKENS (v3.5 neutral-first migration)
   ------------------------------------------------------------
   Surfaces, borders, text, accent slots (--rly-accent-ui /
   -accent-text / -accent-fill / -on-accent), fonts, radius, pulse,
   and the base semantic + indigo + teal-alias tokens all come from
   brand/relay-tokens-v35.css, which is linked BEFORE this file.
   Only the tokens that sheet does NOT define are declared here:
   the teal press state, semantic + indigo detail slots, and motion.
   Nothing below tints a surface — teal lives on interactive/accent.
   ============================================================= */
:root {
  /* Interactive press — hover on teal accent fills */
  --rly-teal-press:  #0f766e;

  /* Semantic tint fills — derived from the v3.5 semantic tokens
     so they track light/dark automatically */
  --rly-success-dim: color-mix(in srgb, var(--rly-success) 10%, transparent);
  --rly-warning-dim: color-mix(in srgb, var(--rly-warning) 10%, transparent);
  --rly-error-dim:   color-mix(in srgb, var(--rly-error)  9%, transparent);

  /* Indigo detail slots (org / team / pro tier · MCP info nudge only) */
  --rly-indigo-bd:   #c7d2fe;
  --rly-indigo-tx:   #4338ca;

  /* Motion — product chrome ≤ 0.18s */
  --rly-t:           0.16s;
  --rly-ease:        cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* =============================================================
   SUPPLEMENTARY TOKENS — dark overrides
   (base dark surfaces/text/borders/accent come from the v3.5 sheet)
   ============================================================= */
[data-theme="dark"] {
  --rly-teal-press:  #5eead4;
  --rly-indigo-bd:   rgba(129, 140, 248, 0.30);
  --rly-indigo-tx:   #c7d2fe;
}

/* =============================================================
   RESET / BASE
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--rly-font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--rly-text);
  background: var(--rly-bg);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--rly-teal-dim); }

/* =============================================================
   TYPE SCALE  (briefs/BRIEF.design-v34.md)
   ============================================================= */
.rly-display {
  font-family: var(--rly-font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--rly-text-bright);
}
.rly-h1 { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; color: var(--rly-text-bright); }
.rly-h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; color: var(--rly-text-bright); }
.rly-h3 { font-size: 14px; font-weight: 600; color: var(--rly-text-bright); }
.rly-body { font-size: 14px; color: var(--rly-text-2); }
.rly-sub { font-size: 13.5px; color: var(--rly-text-2); line-height: 1.65; }
.rly-label { font-size: 12px; font-weight: 500; color: var(--rly-text-2); }
.rly-eyebrow {
  font-family: var(--rly-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rly-text-muted);
}
.rly-muted { color: var(--rly-text-muted); }

/* =============================================================
   THE MARK — Open Signal, unboxed, currentColor (v3.4.1)
   Inline SVG only. rm-* classes are animation hooks.
   ============================================================= */
.rly-mark { display: inline-block; line-height: 0; color: var(--rly-accent-ui); }
.rly-mark svg { display: block; width: 100%; height: 100%; }
.rly-wordmark {
  font-family: var(--rly-font);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--rly-text-bright);
}

/* =============================================================
   CODE — canonical display pattern
   JetBrains Mono 600 · teal · uppercase · always a "Code"
   ============================================================= */
.relay-code {
  font-family: var(--rly-font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--rly-accent-text);
}
.relay-code-chip {
  display: inline-block;
  font-family: var(--rly-font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rly-accent-text);
  background: var(--rly-teal-dim);
  padding: 2px 8px;
  border-radius: var(--rly-radius-sm);
}
.relay-code-hero {
  font-family: var(--rly-font-mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rly-accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 22px;
  background: var(--rly-panel);
  border: 0.5px solid var(--rly-border);
  border-radius: var(--rly-radius-card);
  cursor: pointer;
  transition: border-color var(--rly-t), background var(--rly-t);
  position: relative;
}
.relay-code-hero:hover { border-color: var(--rly-accent-ui); }
.relay-code-hero .rch-copy {
  font-family: var(--rly-font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--rly-text-muted);
}
.relay-code-hero:hover .rch-copy { color: var(--rly-accent-text); }
/* Entrance — blur + scale in (Step 2 delight) */
@keyframes rly-code-enter {
  0%   { opacity: 0; filter: blur(6px); transform: scale(0.96); }
  100% { opacity: 1; filter: blur(0);   transform: scale(1); }
}
.relay-code-hero.is-enter { animation: rly-code-enter 0.5s var(--rly-ease) both; }
/* Pop — on claim / copy */
@keyframes rly-code-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.045); }
  100% { transform: scale(1); }
}
.relay-code-hero.is-pop { animation: rly-code-pop 0.42s var(--rly-ease); }

/* =============================================================
   BUTTONS  (@relay/ui: .btn-accent / .btn-ghost)
   ============================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--rly-font);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1;
  padding: 11px 18px;
  border: 0.5px solid transparent;
  border-radius: var(--rly-radius);
  cursor: pointer;
  transition: background var(--rly-t), border-color var(--rly-t), opacity var(--rly-t), color var(--rly-t);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 12.5px; }

.btn-accent { background: var(--rly-accent-fill); color: var(--rly-on-accent); }
.btn-accent:not(:disabled):hover { background: var(--rly-teal-press); }

.btn-ghost { background: transparent; color: var(--rly-text); border-color: var(--rly-border); }
.btn-ghost:not(:disabled):hover { background: var(--rly-surface); border-color: var(--rly-border-hi); }

.btn-link { background: transparent; color: var(--rly-accent-text); border: none; padding: 8px; font-weight: 500; }
.btn-link:not(:disabled):hover { color: var(--rly-teal-press); }

/* =============================================================
   CARD  (@relay/ui: .card)  ·  surface · 0.5px border · 8px · 16px
   ============================================================= */
.card {
  background: var(--rly-surface);
  border: 0.5px solid var(--rly-border);
  border-radius: var(--rly-radius-card);
  padding: 16px;
  transition: border-color var(--rly-t);
}
.card-title { font-weight: 600; font-size: 13.5px; color: var(--rly-text-bright); }
.card-body { font-size: 12.5px; color: var(--rly-text-2); line-height: 1.55; }

/* =============================================================
   FORM  (@relay/ui input tokens)
   ============================================================= */
.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 11.5px; font-weight: 500; color: var(--rly-text-2); margin-bottom: 5px; }
.input {
  width: 100%;
  padding: 9px 11px;
  font-family: var(--rly-font);
  font-size: 13px;
  color: var(--rly-text);
  background: var(--rly-panel);
  border: 1px solid var(--rly-border);
  border-radius: var(--rly-radius);
  outline: none;
  transition: border-color var(--rly-t), box-shadow var(--rly-t);
}
.input::placeholder { color: var(--rly-text-muted); }
.input:focus { border-color: var(--rly-accent-ui); box-shadow: 0 0 0 3px var(--rly-teal-dim); }

/* Checkbox — accessible, custom box, 3px teal focus ring */
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 13px;
  color: var(--rly-text);
  line-height: 1.5;
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-box {
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin-top: 1px;
  border: 1.5px solid var(--rly-border-hi);
  border-radius: var(--rly-radius-sm);
  background: var(--rly-bg);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--rly-t), border-color var(--rly-t);
}
.check-box svg { width: 11px; height: 11px; opacity: 0; transform: scale(0.6); transition: all var(--rly-t); color: var(--rly-on-accent); }
.check input:checked + .check-box { background: var(--rly-accent-ui); border-color: var(--rly-accent-ui); }
.check input:checked + .check-box svg { opacity: 1; transform: scale(1); }
.check input:focus-visible + .check-box { box-shadow: 0 0 0 3px var(--rly-teal-dim); }

/* =============================================================
   BADGES  (@relay/ui: .badge-*)
   ============================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--rly-font-mono);
  font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--rly-radius-sm);
  border: 0.5px solid var(--rly-border);
  color: var(--rly-text-muted);
}
.badge-teal    { color: var(--rly-accent-text); border-color: var(--rly-accent-ui); background: var(--rly-teal-dim); }
.badge-indigo  { color: var(--rly-indigo-tx); border-color: var(--rly-indigo-bd); background: var(--rly-indigo-dim); }
.badge-success { color: var(--rly-success); border-color: color-mix(in srgb, var(--rly-success) 35%, transparent); background: var(--rly-success-dim); }
.badge-warning { color: var(--rly-warning); border-color: color-mix(in srgb, var(--rly-warning) 35%, transparent); background: var(--rly-warning-dim); }

/* =============================================================
   STATUS DOTS  (@relay/ui: .status-dot-*)  7px · always with a label
   ============================================================= */
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.status-dot-teal    { background: var(--rly-accent-ui); }
.status-dot-success { background: var(--rly-success); }
.status-dot-warning { background: var(--rly-warning); }
.status-dot-muted   { background: var(--rly-text-muted); }
/* Awaiting — slow breathe (used on "Opening…" / waiting rows) */
.status-dot-pulse { animation: rly-dot-breathe 1.5s ease-in-out infinite; }
@keyframes rly-dot-breathe { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.82); } }

/* =============================================================
   ALERTS / NUDGES
   ============================================================= */
.alert {
  display: flex; gap: 9px;
  padding: 11px 13px;
  border-radius: var(--rly-radius);
  font-size: 12.5px; line-height: 1.55;
  border: 0.5px solid var(--rly-border);
  color: var(--rly-text-2);
  background: var(--rly-surface);
}
.alert-icon { flex-shrink: 0; margin-top: 1px; }
.alert-warning { background: var(--rly-warning-dim); border-color: color-mix(in srgb, var(--rly-warning) 30%, transparent); color: color-mix(in srgb, var(--rly-warning) 70%, var(--rly-text)); }
.alert-indigo  { background: var(--rly-indigo-dim);  border-color: var(--rly-indigo-bd); color: var(--rly-indigo-tx); }
.alert-title { font-weight: 600; }

/* =============================================================
   STEPPER — vertical, numbered nodes, one expanded at a time
   ============================================================= */
.stepper { display: flex; flex-direction: column; }
.step { display: flex; gap: 14px; }
.step-rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.step-node {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--rly-font-mono); font-size: 12px; font-weight: 600;
  background: var(--rly-panel); color: var(--rly-text-muted);
  border: 1.5px solid var(--rly-border);
  transition: all var(--rly-t);
}
.step-node svg { width: 13px; height: 13px; }
.step.is-active .step-node { border-color: var(--rly-accent-ui); color: var(--rly-accent-text); background: var(--rly-bg); box-shadow: 0 0 0 3px var(--rly-teal-dim); }
.step.is-done   .step-node { border-color: var(--rly-accent-ui); background: var(--rly-accent-ui); color: var(--rly-on-accent); }
.step-line { flex: 1; width: 1.5px; background: var(--rly-border); margin: 4px 0; min-height: 14px; transition: background var(--rly-t); }
.step.is-done .step-line { background: var(--rly-accent-ui); }
.step:last-child .step-line { display: none; }
.step-body { flex: 1; padding-bottom: 22px; min-width: 0; }
.step:last-child .step-body { padding-bottom: 0; }
.step-title { font-weight: 600; font-size: 14.5px; color: var(--rly-text-bright); display: flex; align-items: center; gap: 8px; }
.step.is-collapsed .step-title { color: var(--rly-text-2); font-weight: 500; cursor: pointer; }
.step.is-collapsed.is-done .step-title { color: var(--rly-text-muted); }
.step-meta { font-family: var(--rly-font-mono); font-size: 10px; color: var(--rly-text-muted); margin-top: 3px; }
.step-content { margin-top: 12px; }
.step.is-collapsed .step-content { display: none; }
/* expand/collapse content reveal */
@keyframes rly-reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.step.is-active .step-content { animation: rly-reveal 0.28s var(--rly-ease) both; }

/* =============================================================
   RECOVERY CODE GRID — 2-col mono
   ============================================================= */
.code-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px;
  background: var(--rly-panel);
  border: 0.5px solid var(--rly-border);
  border-radius: var(--rly-radius-card);
}
.code-cell {
  font-family: var(--rly-font-mono);
  font-size: 14px; font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--rly-text);
  display: flex; align-items: center; gap: 8px;
}
.code-cell .ix { color: var(--rly-text-muted); font-size: 10px; width: 14px; text-align: right; flex-shrink: 0; }

/* =============================================================
   AGENT LAUNCHER — the single canonical component
   ============================================================= */
.launcher { display: flex; flex-direction: column; gap: 8px; }
.launcher.is-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.launch-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  background: var(--rly-surface);
  border: 0.5px solid var(--rly-border);
  border-radius: var(--rly-radius-card);
  cursor: pointer;
  transition: border-color var(--rly-t), background var(--rly-t);
  position: relative;
}
.launch-row:not(:disabled):hover { border-color: var(--rly-border-hi); background: var(--rly-deep); }
.launch-row:disabled { opacity: 0.55; cursor: not-allowed; }
/* Claude carries the teal primary treatment */
.launch-row.is-primary { border-color: var(--rly-accent-ui); background: var(--rly-teal-dim); }
.launch-row.is-primary:not(:disabled):hover { border-color: var(--rly-accent-ui); background: color-mix(in srgb, var(--rly-accent-ui) 18%, var(--rly-bg)); }

.launch-icon {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: var(--rly-radius);
  display: flex; align-items: center; justify-content: center;
  background: var(--rly-panel);
  border: 0.5px solid var(--rly-border);
  font-family: var(--rly-font-mono); font-weight: 600; font-size: 13px;
  color: var(--rly-text-2);
}
.launch-row.is-primary .launch-icon { background: var(--rly-bg); border-color: var(--rly-accent-ui); color: var(--rly-accent-text); }
.launch-icon svg { width: 17px; height: 17px; }

.launch-text { flex: 1; min-width: 0; }
.launch-label { font-weight: 600; font-size: 13.5px; color: var(--rly-text-bright); display: flex; align-items: center; gap: 7px; }
.launch-sub { font-size: 11.5px; color: var(--rly-text-muted); margin-top: 1px; }

.launch-chev {
  flex-shrink: 0; color: var(--rly-text-muted);
  display: flex; align-items: center;
  transition: transform var(--rly-t), color var(--rly-t);
}
.launch-row:hover .launch-chev { transform: translateX(3px); color: var(--rly-accent-ui); }
.launch-row.is-primary .launch-chev { color: var(--rly-accent-ui); }

/* spinner for the launching state */
.launch-spin {
  width: 15px; height: 15px;
  border: 1.5px solid var(--rly-border-hi);
  border-top-color: var(--rly-accent-ui);
  border-radius: 50%;
  animation: rly-spin 0.7s linear infinite;
}
@keyframes rly-spin { to { transform: rotate(360deg); } }

.launch-tag {
  font-family: var(--rly-font-mono); font-size: 8.5px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--rly-accent-text); background: var(--rly-teal-dim);
  padding: 1px 5px; border-radius: var(--rly-radius-sm);
}

/* Warm confirmation line after claim */
.launch-warm {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px; padding: 9px 2px;
  font-size: 12.5px; color: var(--rly-text-2);
  animation: rly-reveal 0.4s var(--rly-ease) both;
}
.launch-warm .rly-mark { width: 16px; height: 16px; }

/* =============================================================
   SPARK BURST — teal pulse, ~14 particles, event animation (once)
   anchored to the claimed element; suppressed under reduced motion
   ============================================================= */
.spark-field { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 5; }
.spark {
  position: absolute; top: 50%; left: 50%;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--rly-pulse);
  /* --a angle, --d distance set inline per particle */
  animation: rly-spark 0.62s var(--rly-ease) both;
}
@keyframes rly-spark {
  0%   { opacity: 1; transform: translate(-50%, -50%) rotate(var(--a)) translateX(0) scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateX(var(--d)) scale(0.3); }
}

/* =============================================================
   REDUCED MOTION — state still confirms via labels + warm line,
   but spark burst, code pop, and entrance blur are suppressed.
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .relay-code-hero.is-enter,
  .relay-code-hero.is-pop { animation: none; }
  .spark { display: none; }
  .status-dot-pulse { animation: none; }
  .step.is-active .step-content,
  .launch-warm { animation: none; }
  .launch-spin { animation-duration: 1.4s; }
}
/* App-level reduced-motion override (Tweaks toggle) — same suppression */
[data-reduced-motion="true"] .relay-code-hero.is-enter,
[data-reduced-motion="true"] .relay-code-hero.is-pop { animation: none; }
[data-reduced-motion="true"] .spark { display: none; }
[data-reduced-motion="true"] .status-dot-pulse { animation: none; }
[data-reduced-motion="true"] .step.is-active .step-content,
[data-reduced-motion="true"] .launch-warm { animation: none; }

/* =============================================================
   ACTIVATION SCREEN — card shell (mirrors _ACCEPT_PAGE_HTML)
   ============================================================= */
.act-shell { width: 100%; max-width: 460px; margin: 0 auto; }
.act-card {
  background: var(--rly-bg);
  border: 0.5px solid var(--rly-border);
  border-radius: var(--rly-radius-card);
  padding: 28px 26px;
}
.act-gate { padding-top: 34px; }
.act-head { }
.act-mark { color: var(--rly-accent-ui); }
.act-row { display: flex; gap: 8px; flex-wrap: wrap; }
.act-link { color: var(--rly-accent-text); text-decoration: underline; text-underline-offset: 2px; }
.act-link:hover { color: var(--rly-teal-press); }

/* =============================================================
   APP SHELL — chrome (always light tokens; preview subtree themes itself)
   ============================================================= */
.app { min-height: 100vh; display: flex; flex-direction: column; background: var(--rly-bg); }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 9px;
  height: 46px; padding: 0 18px;
  background: color-mix(in srgb, var(--rly-bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 0.5px solid var(--rly-border);
}
.tb-brand { display: flex; align-items: center; gap: 8px; }
.tb-brand .rly-mark { color: var(--rly-accent-ui); }
.tb-sep { color: var(--rly-border-hi); }
.tb-crumb { font-family: var(--rly-font-mono); font-size: 10.5px; letter-spacing: 0.05em; color: var(--rly-text-muted); }
.tb-view { font-family: var(--rly-font-mono); font-size: 10.5px; font-weight: 500; color: var(--rly-accent-text); }
.tb-badge {
  margin-left: auto;
  font-family: var(--rly-font-mono); font-size: 9px; letter-spacing: 0.08em;
  color: var(--rly-text-muted); border: 0.5px solid var(--rly-border);
  padding: 3px 8px; border-radius: var(--rly-radius-sm);
}
.theme-toggle {
  font-family: var(--rly-font-mono); font-size: 10px;
  color: var(--rly-text-2); background: var(--rly-surface);
  border: 0.5px solid var(--rly-border); border-radius: var(--rly-radius-sm);
  padding: 4px 9px; cursor: pointer; transition: border-color var(--rly-t);
}
.theme-toggle:hover { border-color: var(--rly-accent-ui); color: var(--rly-accent-text); }

.layout { flex: 1; display: flex; min-height: 0; }

/* SIDEBAR */
.sidebar {
  width: 208px; flex-shrink: 0;
  border-right: 0.5px solid var(--rly-border);
  padding: 10px 0;
  position: sticky; top: 46px;
  height: calc(100vh - 46px); overflow-y: auto;
  display: flex; flex-direction: column;
}
.sb-group {
  font-family: var(--rly-font-mono); font-size: 9px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--rly-text-muted);
  padding: 14px 16px 5px;
}
.sb-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left;
  padding: 7px 16px; font-size: 12.5px; color: var(--rly-text-2);
  background: none; border: none; border-left: 2px solid transparent;
  cursor: pointer; transition: background var(--rly-t), color var(--rly-t);
}
.sb-item:hover { color: var(--rly-text); background: var(--rly-surface); }
.sb-item.is-active { color: var(--rly-accent-text); border-left-color: var(--rly-accent-ui); background: var(--rly-teal-dim); font-weight: 500; }
.sb-tag {
  font-family: var(--rly-font-mono); font-size: 8.5px; letter-spacing: 0.04em;
  color: var(--rly-text-muted); border: 0.5px solid var(--rly-border);
  padding: 1px 5px; border-radius: 3px; white-space: nowrap;
}
.sb-item.is-active .sb-tag { color: var(--rly-accent-text); border-color: var(--rly-accent-ui); }
.sb-foot { margin-top: auto; padding: 16px; border-top: 0.5px solid var(--rly-border); }
.sb-foot-note { font-size: 10.5px; color: var(--rly-text-muted); margin-top: 4px; }

/* MAIN + preview */
.main {
  flex: 1; min-width: 0;
  padding: 28px 32px 64px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background:
    radial-gradient(circle at 1px 1px, var(--rly-border) 1px, transparent 0) 0 0 / 22px 22px,
    var(--rly-surface);
}
.screen-path {
  align-self: center;
  font-family: var(--rly-font-mono); font-size: 9px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--rly-text-muted);
}
.preview {
  width: 100%; max-width: 900px;
  background: var(--rly-bg);
  border: 0.5px solid var(--rly-border);
  border-radius: 14px;
  padding: 34px 28px;
  color: var(--rly-text);
}

/* TWEAKS PANEL */
.tweaks {
  width: 268px; flex-shrink: 0;
  border-left: 0.5px solid var(--rly-border);
  position: sticky; top: 46px;
  height: calc(100vh - 46px); overflow-y: auto;
  transition: width var(--rly-t);
}
.tweaks.is-closed { width: 40px; overflow: hidden; }
.tweaks-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px; border-bottom: 0.5px solid var(--rly-border);
  position: sticky; top: 0; background: var(--rly-bg); z-index: 1;
}
.tweaks-collapse {
  background: none; border: none; cursor: pointer;
  color: var(--rly-text-muted); font-size: 13px; padding: 2px 4px;
}
.tweaks-collapse:hover { color: var(--rly-accent-text); }
.tweaks.is-closed .tweaks-body, .tweaks.is-closed .rly-eyebrow { display: none; }
.tweaks-body { padding: 14px; }
.twk-intro { font-size: 11.5px; color: var(--rly-text-muted); line-height: 1.5; margin-bottom: 16px; }
.twk { margin-bottom: 16px; }
.twk.is-disabled { opacity: 0.45; }
.twk-label { font-size: 11.5px; font-weight: 600; color: var(--rly-text); margin-bottom: 6px; }
.twk-why { font-size: 10.5px; color: var(--rly-text-muted); line-height: 1.45; margin-top: 6px; }
.seg {
  display: flex; gap: 3px; padding: 3px;
  background: var(--rly-panel); border: 0.5px solid var(--rly-border);
  border-radius: var(--rly-radius);
}
.seg-btn {
  flex: 1; padding: 5px 6px; font-size: 10.5px; font-weight: 500;
  font-family: var(--rly-font);
  color: var(--rly-text-2); background: none; border: none; border-radius: var(--rly-radius-sm);
  cursor: pointer; transition: background var(--rly-t), color var(--rly-t); white-space: nowrap;
}
.seg-btn:hover { color: var(--rly-text); }
.seg-btn.is-on { background: var(--rly-bg); color: var(--rly-accent-text); font-weight: 600; box-shadow: 0 0 0 0.5px var(--rly-border); }
.seg-btn:disabled { cursor: not-allowed; }

/* =============================================================
   SURFACES (unification view)
   ============================================================= */
.surfaces { display: flex; flex-direction: column; gap: 18px; }
.surfaces-note { font-size: 12.5px; color: var(--rly-text-2); line-height: 1.6; margin-bottom: 4px; }
.surface-frame { border: 0.5px solid var(--rly-border); border-radius: var(--rly-radius-card); overflow: hidden; }
.sf-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--rly-surface);
  border-bottom: 0.5px solid var(--rly-border);
}
.sf-title { font-weight: 600; font-size: 12.5px; color: var(--rly-text-bright); }
.sf-sub { font-size: 11px; color: var(--rly-text-muted); }
.sf-body { padding: 16px; }

.mock-email { border: 0.5px solid var(--rly-border); border-radius: var(--rly-radius-card); overflow: hidden; }
.me-subject { padding: 11px 14px; font-weight: 600; font-size: 13px; color: var(--rly-text-bright); background: var(--rly-panel); border-bottom: 0.5px solid var(--rly-border); }
.me-body { padding: 12px 14px; font-size: 12.5px; color: var(--rly-text-2); line-height: 1.6; }
.me-body + .launcher-wrap { padding: 0 14px 14px; }
.mock-card { }

/* =============================================================
   NO-JS FALLBACK
   ============================================================= */
.nojs-list { list-style: none; counter-reset: nojs; margin-top: 18px; }
.nojs-list li {
  position: relative; padding: 0 0 18px 30px; font-size: 13px; color: var(--rly-text-2); line-height: 1.6;
  border-left: 1.5px solid var(--rly-border); margin-left: 8px;
}
.nojs-list li:last-child { border-left-color: transparent; padding-bottom: 0; }
.nojs-list li::before {
  counter-increment: nojs; content: counter(nojs);
  position: absolute; left: -14px; top: -2px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--rly-panel); border: 1.5px solid var(--rly-border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--rly-font-mono); font-size: 11px; font-weight: 600; color: var(--rly-text-2);
}
.nojs-list strong { color: var(--rly-text-bright); }
.nojs-prompt {
  font-family: var(--rly-font-mono); font-size: 12px; color: var(--rly-accent-text);
  background: var(--rly-panel); border: 0.5px solid var(--rly-border);
  border-radius: var(--rly-radius); padding: 10px 12px; margin: 10px 0;
  white-space: pre-wrap; word-break: break-word; line-height: 1.5;
}

/* =============================================================
   REFERENCE VIEW
   ============================================================= */
.reference { display: flex; flex-direction: column; gap: 16px; }
.ref-card { border: 0.5px solid var(--rly-border); border-radius: var(--rly-radius-card); padding: 16px 18px; background: var(--rly-surface); }
.ref-list { list-style: none; margin-top: 10px; }
.ref-list li { font-size: 12.5px; color: var(--rly-text-2); line-height: 1.6; padding: 5px 0 5px 16px; position: relative; }
.ref-list li::before { content: '·'; position: absolute; left: 4px; color: var(--rly-accent-ui); font-weight: 700; }
.ref-list b { color: var(--rly-text-bright); }
.ref-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12px; }
.ref-table th { text-align: left; font-family: var(--rly-font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--rly-text-muted); padding: 6px 8px; border-bottom: 0.5px solid var(--rly-border); }
.ref-table td { padding: 6px 8px; border-bottom: 0.5px solid var(--rly-border); color: var(--rly-text-2); vertical-align: middle; }
.ref-table tr:last-child td { border-bottom: none; }
.inline-mono { font-family: var(--rly-font-mono); font-size: 11.5px; color: var(--rly-text); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 0.5px solid var(--rly-border); margin-right: 7px; vertical-align: -1px; }

/* =============================================================
   RESPONSIVE — collapse rails on narrow viewports
   ============================================================= */
@media (max-width: 1080px) {
  .tweaks { display: none; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { padding: 20px 14px 48px; }
  .preview { padding: 22px 16px; }
  .launcher.is-grid { grid-template-columns: 1fr; }
}
