.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; min-width: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: var(--mark, 30px); block-size: var(--mark, 30px);
  border-radius: 30%; flex: none;
  background: var(--brand-50);
  border: 1px solid var(--accent-rim);
  box-shadow: none;
}
.brand-mark img { display: block; inline-size: 100%; block-size: 100%; object-fit: contain; }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.04); }
.brand-mark { transition: transform var(--dur-slow) var(--spring); }
.brand-text { display: grid; line-height: 1.05; min-width: 0; }
.brand-text b { font: 900 21px/1.15 var(--display); }
.brand-text em {
  font-style: normal; font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.22em; margin-inline-end: -0.22em; margin-block-start: 3px;
  color: var(--text-4); opacity: .75;
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 36px; padding: 0 10px;
  border: 0; border-radius: var(--r-sm); background: transparent;
  font: var(--t-footnote); font-family: var(--sans); color: var(--text-2);
  cursor: pointer; text-align: start;
}
.menu-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.menu-item .ic { width: 16px; height: 16px; color: var(--text-4); }
.menu-item.is-danger { color: var(--red-ink); }
.menu-item.is-danger:hover { background: var(--red-wash); }
.menu-item.is-danger .ic { color: currentColor; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
/* ── Avatars ─────────────────────────────────────────────────────── */

.avatar {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: 40px; block-size: 40px; flex: none;
  border-radius: 14px;
  background: var(--brand-50);
  box-shadow: inset 0 0 0 1px var(--accent-rim);
  color: var(--brand-700);
  font: 700 16px/1 var(--sans);
}
.avatar-sm { inline-size: 30px; block-size: 30px; border-radius: 9px; font-size: 13px; }
.avatar .presence { position: absolute; inset-block-end: -2px; inset-inline-end: -2px; }
.count {
  min-width: 22px; padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--text-3);
  font: var(--t-caption); font-weight: 600; text-align: center;
}
.search-ic {
  position: absolute; inset-inline-start: calc(var(--sp-4) + 10px); inset-block-start: 9px;
  color: var(--text-4); pointer-events: none;
}
.search-ic .ic { width: 17px; height: 17px; }
.tone-ok { color: var(--green-ink); }
.tone-warn { color: var(--orange-ink); }
.tone-bad { color: var(--red-ink); }
@supports not (backdrop-filter: blur(1px)) { .work-head { background: var(--canvas); } }
.stack { display: grid; gap: var(--sp-5); max-width: 1120px; min-width: 0; }
/* ── Panels + grouped rows ───────────────────────────────────────── */

.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(214, 217, 255, 0.025), transparent 120px), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: var(--lift-2);
  transition: border-color var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
}
.panel-head {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-block-end: 1px solid var(--border-soft);
}
.panel-head h2 { font: var(--t-title-3); letter-spacing: var(--tr-title-3); }
.panel-head p { margin-block-start: 4px; font: var(--t-footnote); color: var(--text-3); max-width: 70ch; }
.panel-actions { display: flex; align-items: center; gap: var(--sp-2); margin-inline-start: auto; flex-wrap: wrap; justify-content: flex-end; }
.panel-body { padding: var(--sp-5); display: grid; gap: var(--sp-5); min-width: 0; }
.dirty-flag {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 22px; padding: 0 9px;
  border-radius: var(--r-pill);
  background: var(--orange-wash); border: 1px solid var(--orange-rim);
  color: var(--orange-ink); font: var(--t-caption); font-weight: 600;
}
.dirty-flag i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* Rows: the settings primitive. Flat, hairline-separated, never a card. */
.rows {
  display: grid; min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-2);
  list-style: none; padding: 0; margin: 0;
}
.rows-flush > li + li { border-block-start: 1px solid var(--border-soft); }
.rows > * + * { border-block-start: 1px solid var(--border-soft); }
.rows-flush > li > * { width: 100%; }
.row {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; min-height: 56px;
  padding: var(--sp-3) var(--sp-4);
  border: 0; background: transparent;
  font-family: var(--sans); font-size: 14px;
  color: var(--text); text-align: start; cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.row:hover { background: var(--surface-3); text-decoration: none; }
.row:hover .row-hint .ic-flip { transform: scaleX(-1) translateX(3px); }
.row-hint .ic { transition: transform var(--dur) var(--ease); }
.row-static { cursor: default; }
.row-static:hover { background: transparent; }
.row-ic { display: inline-flex; color: var(--text-3); flex: none; }
.row-ic .ic { width: 18px; height: 18px; }
.row-label {
  display: grid; gap: 2px; min-width: 0; flex: 1 1 auto;
  font: var(--t-callout); font-weight: 550; letter-spacing: var(--tr-callout);
}
.row-label small { font: var(--t-footnote); color: var(--text-3); font-weight: 400; }
.row-label small.mono { color: var(--text-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-hint {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font: var(--t-footnote); color: var(--text-3); flex: none;
}
.row-hint .ic { width: 16px; height: 16px; color: var(--text-4); }
.row-danger { color: var(--red-ink); }
.row-danger .row-ic { color: var(--red-ink); }
.row-danger:hover { background: var(--red-wash); }
.row-pick .row-hint .ic { color: var(--accent); }
.row-spin { margin-inline-start: auto; }
/* Definition rows for identifiers ---------------------------------- */
.dl {
  display: grid; margin: 0;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; background: var(--surface-2);
}
.dl-row {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px; padding: 10px var(--sp-4);
}
.dl-row + .dl-row { border-block-start: 1px solid var(--border-soft); }
.dl-row dt { flex: none; inline-size: 150px; font: var(--t-footnote); color: var(--text-3); }
.dl-row dd {
  margin: 0; flex: 1 1 auto; min-width: 0;
  font-family: var(--mono); font-size: 12.5px; color: var(--text);
  text-align: right;
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.dl-row dd::-webkit-scrollbar { display: none; }
/* Fieldset groups inside forms ------------------------------------- */
.group {
  display: grid; gap: var(--sp-4); min-width: 0;
  margin: 0; padding: var(--sp-4);
  border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  background: var(--surface-2);
}
.group > legend {
  padding: 0 6px; margin-inline-start: -6px;
  font: var(--t-caption); font-weight: 600;
  letter-spacing: 0; text-transform: uppercase; color: var(--text-4);
}
.setting {
  min-width: 0; max-width: 100%; box-sizing: border-box; padding: var(--sp-4);
  border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  background: var(--surface-2);
}
.form-foot {
  display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
  padding-block-start: var(--sp-1);
}
.form-foot .field-note { flex: 1 1 220px; }
.form-foot .btn, .form-foot .btn-row { margin-inline-start: auto; }
.form.is-muted { opacity: 0.75; }
.form.is-dirty { position: relative; }
.copy-line { display: grid; gap: 6px; min-width: 0; }
.copy-line-k {
  display: inline-flex; align-items: center; gap: 6px;
  font: var(--t-caption); font-weight: 600; color: var(--text-3);
}
.copy-line-k .ic { width: 14px; height: 14px; }
.copy-line-body {
  display: flex; align-items: center; gap: var(--sp-2); min-width: 0;
  padding: 6px 6px 6px var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--canvas-deep);
}
.copy-line-body code {
  flex: 1 1 auto; min-width: 0; padding: 0; border: 0; background: none;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2);
  overflow-x: auto; white-space: nowrap; scrollbar-width: thin;
}
/* ── Pairing ─────────────────────────────────────────────────────── */

.pair {
  padding: var(--sp-6);
  border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--surface); box-shadow: var(--lift-2);
  display: grid; gap: var(--sp-5);
}
.pair-scan { background: var(--brand-50); border-color: var(--accent-rim); }
.steps { display: flex; align-items: center; gap: var(--sp-2); list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 7px; font: var(--t-footnote); color: var(--text-4); }
.step + .step::before { content: ""; inline-size: 18px; block-size: 1px; background: var(--border-strong); margin-inline-end: 7px; }
.step i {
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: 20px; block-size: 20px; border-radius: 50%;
  border: 1px solid var(--border-strong); font-style: normal;
  font: var(--t-caption); font-weight: 700; color: var(--text-4);
}
.step.is-now { color: var(--accent-ink); font-weight: 600; }
.step.is-now i { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }
.step.is-done { color: var(--green-ink); }
.step.is-done i { border-color: var(--green-rim); background: var(--green-wash); color: var(--green-ink); }
.pair-grid {
  display: grid; gap: clamp(var(--sp-5), 4vw, var(--sp-9));
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: center;
}
.qr-shell {
  display: grid; place-items: center;
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: #fff; border: 1px solid var(--border-strong);
  box-shadow: var(--lift-3);
  animation: mrsal-breathe 3.2s var(--ease-soft) infinite;
}
.qr-shell img { display: block; inline-size: 220px; block-size: 220px; image-rendering: pixelated; }
.pair-copy h2 { font: var(--t-title-2); letter-spacing: var(--tr-title-2); }
.link-steps { margin: var(--sp-3) 0 0; padding-inline-start: var(--sp-5); display: grid; gap: 6px; }
.link-steps li { font: var(--t-callout); color: var(--text-2); }
.pair-note { margin-block-start: var(--sp-3); font: var(--t-footnote); color: var(--text-3); max-width: 60ch; }
.pair-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-block-start: var(--sp-4); }
.pair-linked-body { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.pair-linked-body h2 { font: var(--t-title-2); letter-spacing: var(--tr-title-2); }
.pair-linked-body p { margin-block-start: 4px; font: var(--t-callout); color: var(--text-3); }
.pair-linked-body .pair-actions { margin-block-start: 0; margin-inline-start: auto; }
.pair-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: 48px; block-size: 48px; border-radius: 14px; flex: none;
  background: var(--surface-3); color: var(--text-3);
}
.pair-glyph .ic { width: 24px; height: 24px; }
.pair-glyph.ok { background: var(--green-wash); color: var(--green-ink); }
.pair-glyph.bad { background: var(--red-wash); color: var(--red-ink); }
/* ── Compose ─────────────────────────────────────────────────────── */

.compose-layout {
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: start;
}
.compose-main, .compose-side { display: grid; gap: var(--sp-5); min-width: 0; }
.compose-side .panel-body { padding: var(--sp-3); }
.result {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--green-rim); border-radius: var(--r-lg);
  background: var(--green-wash);
  font: var(--t-footnote); color: var(--text-2);
}
.result.is-bad { border-color: var(--red-rim); background: var(--red-wash); }
.result b { display: block; color: var(--text); font-size: 14px; }
.result-line { display: block; margin-block-start: 3px; }
.result-ic { display: inline-flex; color: var(--green-ink); }
.result.is-bad .result-ic { color: var(--red-ink); }
.result-ic .ic { width: 18px; height: 18px; }
/* Failures --------------------------------------------------------- */
.fail { display: grid; gap: var(--sp-2); padding: var(--sp-4); }
.fail-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.fail-head b { font: var(--t-headline); letter-spacing: var(--tr-headline); }
.fail-spacer { flex: 1 1 auto; }
.fail-body { font: var(--t-callout); color: var(--text-2); overflow-wrap: anywhere; }
.fail-error {
  display: block; padding: 8px var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--red-wash); border: 1px solid var(--red-rim);
  font-family: var(--mono); font-size: 12px; color: var(--red-ink);
  overflow-x: auto;
}
.fail-meta { display: flex; gap: var(--sp-3); flex-wrap: wrap; font: var(--t-caption); color: var(--text-4); }
.fail.is-resolved .fail-error { background: var(--green-wash); border-color: var(--green-rim); color: var(--green-ink); }
.code-wrap { position: relative; min-width: 0; }
.code-wrap .copy-btn-labeled { position: absolute; inset-block-start: 8px; right: 8px; z-index: 2; }
.code-wrap .code-block { padding-block-start: 46px; }
/* ── Storage bar ─────────────────────────────────────────────────── */

.bar {
  display: flex; overflow: hidden;
  block-size: 10px; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--border-soft);
}
.bar i { display: block; block-size: 100%; }
.bar-a { background: var(--chart-1); }
.bar-b { background: var(--chart-2); }
.bar-c { background: var(--text-4); }
.bar-empty { background: var(--surface-3); }
.bar-key { display: flex; gap: var(--sp-4); flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.bar-key li { display: inline-flex; align-items: center; gap: 6px; font: var(--t-footnote); color: var(--text-3); }
.bar-key i { inline-size: 9px; block-size: 9px; border-radius: 3px; }
.k-a { background: var(--chart-1); } .k-b { background: var(--chart-2); } .k-c { background: var(--text-4); }
/* ── States ──────────────────────────────────────────────────────── */

.state {
  display: grid; justify-items: center; gap: var(--sp-2);
  padding: clamp(var(--sp-7), 6vw, var(--sp-11)) var(--sp-5);
  text-align: center;
}
.state-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: 44px; block-size: 44px; border-radius: 14px;
  background: var(--surface-3); color: var(--text-4);
  margin-block-end: var(--sp-1);
}
.state h3 { font: var(--t-title-3); letter-spacing: var(--tr-title-3); }
.state p { font: var(--t-footnote); color: var(--text-3); max-width: 46ch; }
.state-bad .state-glyph { background: var(--red-wash); color: var(--red-ink); }
.state .btn { margin-block-start: var(--sp-3); }
.loading-rows { display: grid; gap: var(--sp-3); }
.loading-row {
  padding: var(--sp-4);
  border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  background: var(--surface);
}
.boot {
  display: grid; place-items: center; gap: var(--sp-4);
  min-height: 100svh; text-align: center;
}
.boot p { font: var(--t-footnote); color: var(--text-3); }
.boot .brand-mark { animation: mrsal-pop .6s var(--spring) both; }
/* ── Onboarding ──────────────────────────────────────────────────── */

.onboard { max-width: 620px; }
.onboard-panel .panel-body { justify-items: center; text-align: center; gap: var(--sp-4); padding: clamp(var(--sp-6), 5vw, var(--sp-9)); }
.onboard-glyph { display: inline-flex; }
.onboard-panel h2 { font: var(--t-title-1); letter-spacing: var(--tr-title-1); }
.onboard-panel p { font: var(--t-callout); color: var(--text-3); max-width: 52ch; }
.onboard-form { width: 100%; text-align: start; }
.steps-inline { justify-content: center; }
/* ── Toasts ──────────────────────────────────────────────────────── */

.toast-stack {
  position: fixed; z-index: 200;
  inset-block-end: var(--sp-5); inset-inline-end: var(--sp-5);
  display: grid; gap: var(--sp-2); width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--lift-3);
  font: var(--t-footnote); color: var(--text-2);
  animation: mrsal-slide-in var(--dur-slow) var(--spring) both;
  -webkit-backdrop-filter: var(--blur-thin); backdrop-filter: var(--blur-thin);
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
}
.toast .ic { width: 18px; height: 18px; flex: none; color: var(--green-ink); margin-block-start: 1px; }
.toast-bad .ic { color: var(--red-ink); }
.toast-bad { border-color: var(--red-rim); }
.toast-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.toast .icon-btn { width: 28px; height: 28px; }
.toast.is-leaving { opacity: 0; transform: translateX(-16px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
/* ── Modals ──────────────────────────────────────────────────────── */

.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 0; border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface); color: var(--text);
  box-shadow: var(--lift-4);
}
.modal[open] { animation: mrsal-pop var(--dur-slow) var(--spring) both; }
.modal::backdrop { background: rgba(22, 24, 27, 0.36); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: mrsal-fade var(--dur) var(--ease) both; }
.modal-inner { display: grid; gap: var(--sp-4); padding: var(--sp-5); }
.modal-head { display: flex; align-items: flex-start; gap: var(--sp-3); }
.modal-head h2 { font: var(--t-title-3); letter-spacing: var(--tr-title-3); }
.modal-head p { margin-block-start: 5px; font: var(--t-footnote); color: var(--text-3); }
.modal-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: 36px; block-size: 36px; border-radius: 11px; flex: none;
  background: var(--accent-wash); color: var(--accent-ink);
}
.modal-glyph .ic { width: 18px; height: 18px; }
.modal-glyph.is-danger { background: var(--red-wash); color: var(--red-ink); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); }
/* ── Landing ─────────────────────────────────────────────────────── */

.front { position: relative; display: flex; flex-direction: column; min-height: 100svh; overflow: hidden; }
.front > * { position: relative; z-index: 1; }
@media (max-width: 420px) { .front-nav .brand-text { display: none; } }
.btn-glow { position: relative; overflow: hidden; }
.btn-glow::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(22,24,27,.05) 50%, transparent 70%);
  transform: translateX(120%); transition: transform .7s var(--ease-out);
}
.btn-glow:hover::after { transform: translateX(-120%); }
@keyframes core-ping { 0% { opacity: .85; transform: scale(.55); } 100% { opacity: 0; transform: scale(2.5); } }
@keyframes core-nudge { 0% { transform: none; } 34% { transform: translateY(-2px) scale(1.018); } 100% { transform: none; } }
@keyframes core-breathe { from { opacity: .68; } to { opacity: 1; } }
@keyframes log-in { from { opacity: 0; } to { opacity: 1; } }
/* Nav brand: a tiny one-time takeoff */
.brand-mark.is-takeoff img { animation: brand-takeoff .9s cubic-bezier(.22,1,.36,1) .15s both; }
@keyframes brand-takeoff {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  40% { transform: translate(-7px, -6px) rotate(-10deg); opacity: 0; }
  41% { transform: translate(6px, 5px) rotate(0); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
.band-head { max-width: 680px; }
.auth-card {
  width: min(460px, 100%);
  display: grid; gap: var(--sp-4);
  padding: clamp(var(--sp-6), 4vw, var(--sp-8));
  border: 1px solid var(--accent-rim); border-radius: 26px;
  background: var(--surface);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--lift-3);
}
.auth-card .seg { justify-self: start; }
.auth-card h2 { font: 700 28px/1.35 var(--display); }
.auth-lead { font: var(--t-footnote); color: var(--text-3); margin-block-start: -8px; }
/* ── Hero responsive ──────────────────────────────────────────────
   Under 980px the copy stacks above the switchboard, and the switchboard
   itself reflows: the four sources sit in a 2×2 grid above the core, the
   four destinations in a 2×2 grid below it, joined by short vertical
   connectors that JS measures exactly as it does the long curves. */
@media (max-width: 1180px) {
  .front-hero { gap: clamp(var(--sp-6), 3vw, var(--sp-8)); }
}
@media (max-width: 1180px) and (min-width: 980px) {
  /* The copy needs room before the switchboard does. */
  .front-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr); }
}
@media (max-width: 979px) {
  .front-hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "scene" "facts";
    gap: clamp(var(--sp-8), 6vw, var(--sp-11));
    padding-block-start: clamp(var(--sp-7), 7vw, var(--sp-10));
  }
}
@media (max-width: 560px) {
  .hub { gap: 26px; }
}
@media (max-width: 380px) {
}
@media (max-width: 720px) {
  .hero-copy h1 { font-size: clamp(29px, 8.2vw, 41px); line-height: 1.3; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .btn-sm { min-height: 40px; }
}
@media (max-width: 480px) {
  .front-nav .link-docs span { display: none; }
}
/* Reduced motion: the composed picture, and nothing moves. */
@media (prefers-reduced-motion: reduce) {
  .code-card,
  .brand-mark.is-takeoff img {
    animation: none !important;
    transition: none !important;
  }
}
/* Scroll reveal — plays once per visit; any later re-render shows content immediately */
.reveal { opacity: 0; transform: translate3d(0, 16px, 0); transition: opacity .45s var(--ease-out), transform .45s var(--ease-out); transition-delay: calc(var(--d, 0) * 60ms); }
body:not(.view-intro) .reveal { opacity: 1; transform: none; transition: none; }
.reveal.is-in { opacity: 1; transform: none; }
.view-intro .stack > *,
.ws-intro .stack > * { animation: mrsal-rise var(--dur-enter) var(--ease-out) both; }
.view-intro .stack > :nth-child(2), .ws-intro .stack > :nth-child(2) { animation-delay: 70ms; }
.view-intro .stack > :nth-child(3), .ws-intro .stack > :nth-child(3) { animation-delay: 140ms; }
.view-intro .stack > :nth-child(4), .ws-intro .stack > :nth-child(4) { animation-delay: 210ms; }
.view-intro .stack > :nth-child(n+5), .ws-intro .stack > :nth-child(n+5) { animation-delay: 260ms; }
/* ── Responsive ──────────────────────────────────────────────────── */

/* Rail collapses to icons; the instance list keeps its own column. */
@media (max-width: 1279px) {
  .shell { grid-template-columns: 68px var(--list-w) minmax(0, 1fr); }
}
/* Single column: rail and instance list become drawers. */
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  body.is-locked { overflow: hidden; }
  .compose-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .work-title { padding-block: var(--sp-4); align-items: flex-start; }
  .step + .step::before { display: none; }
  .pair-grid { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .pair-copy { text-align: start; }
  .link-steps { text-align: start; }
  .pair-linked-body .pair-actions { margin-inline-start: 0; width: 100%; }
  .dl-row { flex-wrap: wrap; gap: var(--sp-2); }
  .dl-row dt { inline-size: auto; flex: 1 1 100%; }
  .dl-row dd { flex: 1 1 auto; }
  .panel-head { flex-wrap: wrap; }
  .panel-actions { margin-inline-start: 0; }
  .form-foot .btn, .form-foot .btn-row { margin-inline-start: 0; width: 100%; }
  .form-foot .btn-row .btn { flex: 1 1 auto; }
  .toast-stack { inset-inline: var(--sp-3); inset-block-end: var(--sp-3); width: auto; }
}
/* Comfortable touch targets and no hover-only affordances */
@media (hover: none) {
  .row, .rail-item, .inst { min-height: 48px; }
  .code-wrap .copy-btn-labeled { opacity: 1; }
}
@media (max-width: 400px) {
  .work-bar { padding-inline: var(--sp-3); gap: var(--sp-2); }
  .panel-body, .panel-head { padding: var(--sp-4); }
}
.panel .rows > * + *, .panel .dl-row + .dl-row { border-block-start-color: var(--border-soft); }
/* State colour on the pairing panel */
.pair-linked { background: linear-gradient(180deg, var(--green-wash), transparent 150px), var(--surface); }
.pair-down { background: linear-gradient(180deg, var(--red-wash), transparent 150px), var(--surface); }
.pair-linked.is-fresh .pair-glyph { animation: pair-ok .48s var(--spring) both; }
@keyframes pair-ok { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: none; opacity: 1; } }
/* Drawers slide in when opened (no re-render happens while open) */
@media (max-width: 1023px) {
  .rail.is-open, .instances.is-open { animation: drawer-in .32s var(--ease-out) both; }
}
@keyframes drawer-in { from { transform: translateX(102%); } to { transform: none; } }
/* Features and the how-band share one even grid — same card, same rhythm. */
@media (min-width: 1024px) {
  .features { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Language control inside the account menu */
.menu-lang { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); font: var(--t-footnote); color: var(--text-3); }
.lang-switch { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); }
.lang-btn { appearance: none; border: 0; background: none; cursor: pointer; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--text-4); padding: 5px 10px; border-radius: 7px; line-height: 1.2;
  transition: color .16s ease, background .16s ease; }
.lang-btn.is-on { color: var(--text); background: var(--surface); box-shadow: var(--lift-1); }
.lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ═══════════════════════════════════════════════════════════════════
   Console shell — one bar, full-width page.
   Replaces the old three-column layout (rail + number column + work).
   ═══════════════════════════════════════════════════════════════════ */
.app { min-block-size: 100svh; background: var(--canvas); }
.app .page { max-inline-size: 1180px; margin-inline: auto;
  padding: clamp(20px, 2.6vw, 34px) clamp(16px, 3vw, 28px) 80px; }
.app .page:focus { outline: none; }

/* ── Bar ──────────────────────────────────────────────────────────── */
.bar { position: sticky; inset-block-start: 0; z-index: 50;
  display: flex; align-items: center; gap: var(--sp-3); min-block-size: 60px;
  padding: 9px clamp(16px, 3vw, 28px);
  background: color-mix(in srgb, var(--canvas) 90%, transparent);
  backdrop-filter: blur(10px); border-block-end: 1px solid var(--border-soft); }
.bar-brand { display: inline-flex; align-items: center; gap: 8px; flex: none;
  font-weight: 700; font-size: 16px; color: var(--text); text-decoration: none; }
.bar-brand:hover { text-decoration: none; color: var(--text); }
.bar-side { display: flex; align-items: center; gap: var(--sp-2); margin-inline-start: auto; flex: none;
  padding-inline-start: var(--sp-3); }
.bar-menu { display: none; }

/* Tabs */
.tabs { display: flex; align-items: center; gap: 2px; min-inline-size: 0; overflow-x: auto;
  scrollbar-width: none; margin-inline-start: var(--sp-2); }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 500;
  color: var(--text-3); text-decoration: none; white-space: nowrap;
  transition: color .15s ease, background .15s ease; }
.tab:hover { color: var(--text); background: var(--glass-1); text-decoration: none; }
.tab.is-on { color: var(--accent-ink); background: var(--accent-wash); font-weight: 600; }
.tab svg { inline-size: 17px; block-size: 17px; flex: none; }
.tabs-sheet { display: none; }

/* Number picker */
.picker { position: relative; z-index: 2; flex: none; margin-inline-start: var(--sp-2);
  padding-inline-start: var(--sp-3); border-inline-start: 1px solid var(--border-soft); }
.picker-btn { display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 6px 10px 6px 8px; border-radius: 10px; font: inherit; text-align: start;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: border-color .15s ease; }
.picker-btn:hover { border-color: var(--border-strong); }
.picker-btn > svg { inline-size: 15px; block-size: 15px; color: var(--text-4); flex: none; }
.picker-text { display: grid; min-inline-size: 0; line-height: 1.3; }
.picker-text b { font-size: 13.5px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-inline-size: 15ch; }
.picker-text small { font-size: 11.5px; color: var(--text-4); unicode-bidi: isolate; }
.picker-menu { position: fixed; inset: auto; margin: 0; inline-size: min(320px, calc(100vw - 24px)); padding: 6px; z-index: 60;
  max-block-size: min(420px, calc(100dvh - 24px)); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--lift-3); }
.picker-menu:popover-open { position: fixed; }
.picker-cap { margin: 6px 8px; font: var(--t-caption); color: var(--text-4); }
.picker-item { display: flex; align-items: center; gap: 10px; inline-size: 100%;
  padding: 8px; border: 0; border-radius: 10px; cursor: pointer; font: inherit;
  text-align: start; background: none; color: var(--text); text-decoration: none; }
.picker-item:hover { background: var(--glass-1); text-decoration: none; }
.picker-item.is-on { background: var(--accent-wash); }
.picker-item > svg { inline-size: 16px; block-size: 16px; margin-inline-start: auto;
  flex: none; color: var(--accent); }
.picker-add { color: var(--accent-ink); font-weight: 600; }
.picker-add svg { margin-inline-start: 0; }

/* Avatar + presence dot, used by the bar, the picker and the inbox */
.ava { position: relative; display: inline-flex; align-items: center; justify-content: center;
  inline-size: 32px; block-size: 32px; flex: none; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--brand-700); background: var(--brand-50); }
.ava-sm { inline-size: 26px; block-size: 26px; font-size: 11.5px; }
.ava .dot { position: absolute; inset-block-end: -2px; inset-inline-end: -2px;
  inline-size: 9px; block-size: 9px; border-radius: 50%; border: 2px solid var(--canvas); }
.dot-ok { background: var(--green); } .dot-warn { background: var(--orange); }
.dot-bad { background: var(--red); } .dot-idle { background: var(--text-4); }

/* Page heading */
.page-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-4); margin-block-end: var(--sp-5); flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; font: var(--t-title-xl); }
.page-head p { margin: 0; color: var(--text-3); font: var(--t-callout); max-inline-size: 60ch; }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ── Home ─────────────────────────────────────────────────────────── */
.home { display: grid; gap: var(--sp-5); }
.status-card { display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--border); }
.status-card.is-ok { border-color: var(--green-rim); background: var(--green-wash); }
.status-card.is-wait { border-color: var(--orange-rim); background: var(--orange-wash); }
.status-ic { display: inline-flex; align-items: center; justify-content: center;
  inline-size: 38px; block-size: 38px; border-radius: 11px; flex: none;
  background: var(--surface); color: var(--green-ink); }
.status-card.is-wait .status-ic { color: var(--orange-ink); }
.status-ic svg { inline-size: 19px; block-size: 19px; }
.status-text { min-inline-size: 0; margin-inline-end: auto; }
.status-text b { display: block; font-size: 15.5px; font-weight: 600; }
.status-text p { margin: 2px 0 0; font-size: 13.5px; color: var(--text-3); unicode-bidi: isolate; }

.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.figure { display: grid; gap: 2px; padding: var(--sp-4); border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--border); text-decoration: none;
  color: var(--text); transition: border-color .15s ease, transform .15s ease; }
.figure:hover { border-color: var(--accent-rim); transform: translateY(-1px); text-decoration: none; }
.figure b { font-size: 26px; font-weight: 700; line-height: 1.2; }
.figure span { font-size: 12.5px; color: var(--text-3); }
.figure.is-bad b { color: var(--red); }
@media (max-width: 860px) { .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.sec-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-3); margin-block-end: var(--sp-3); }
.sec-head h2 { margin: 0; font: var(--t-title-2); }
.mini-convs { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none;
  border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden;
  background: var(--border-soft); }
.mini-convs a { display: flex; align-items: center; gap: 11px; padding: 12px var(--sp-4);
  background: var(--surface); text-decoration: none; color: var(--text); min-inline-size: 0; }
.mini-convs a:hover { background: var(--surface-2); text-decoration: none; }
.mini-main { display: grid; min-inline-size: 0; margin-inline-end: auto; line-height: 1.45; }
.mini-main b { font-size: 13.5px; font-weight: 600; unicode-bidi: isolate; }
.mini-main span { font-size: 13px; color: var(--text-3); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.mini-convs time { flex: none; font-size: 11.5px; color: var(--text-4); }

/* ── Conversations ────────────────────────────────────────────────── */
.inbox { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: var(--sp-4); align-items: start; }
.conv-col { min-inline-size: 0; border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--surface); overflow: hidden; }
.conv-tools { display: flex; align-items: center; gap: var(--sp-2);
  padding: 10px; border-block-end: 1px solid var(--border-soft); }
.search { position: relative; flex: 1; display: flex; align-items: center; min-inline-size: 0; }
.search svg { position: absolute; inset-inline-start: 10px; inline-size: 15px; block-size: 15px;
  color: var(--text-4); pointer-events: none; }
.search input { inline-size: 100%; padding: 9px 11px; padding-inline-start: 32px;
  border-radius: 9px; font: inherit; font-size: 13.5px; }
.conv-flag { flex: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 8px 10px; border-radius: 9px; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--red-ink); background: var(--red-wash); border: 1px solid var(--red-rim); }
.conv-flag.is-on { background: var(--red); color: #fff; border-color: var(--red); }
.conv-flag svg { inline-size: 14px; block-size: 14px; }
.conv-list { margin: 0; padding: 0; list-style: none; max-block-size: 64vh; overflow-y: auto; }
.conv { display: flex; align-items: center; gap: 10px; inline-size: 100%; cursor: pointer;
  padding: 11px 12px; border: 0; border-block-end: 1px solid var(--border-soft);
  background: none; font: inherit; text-align: start; color: var(--text); min-inline-size: 0; }
.conv:hover { background: var(--surface-2); }
.conv.is-on { background: var(--accent-wash); }
.conv-main { display: grid; gap: 2px; min-inline-size: 0; flex: 1; }
.conv-top { display: flex; align-items: baseline; gap: 8px; min-inline-size: 0; }
.conv-top b { font-size: 13.5px; font-weight: 600; unicode-bidi: isolate; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.conv-top time { margin-inline-start: auto; flex: none; font-size: 11px; color: var(--text-4); }
.conv-sub { display: flex; align-items: center; gap: 5px; min-inline-size: 0;
  font-size: 12.5px; color: var(--text-3); }
.conv-sub > span { min-inline-size: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-out { display: inline-flex; flex: none; }
.conv-bad { display: inline-flex; flex: none; color: var(--red); }
.conv-bad svg { inline-size: 15px; block-size: 15px; }
.conv-none { padding: var(--sp-5); text-align: center; color: var(--text-4); font-size: 13.5px; }
.conv-problems { padding: var(--sp-3); }
.failures-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-block-end: var(--sp-3); color: var(--text-3); font: var(--t-footnote); }
@media (max-width: 480px) {
  .failures-actions { align-items: stretch; flex-direction: column; }
  .failures-actions .btn { justify-content: center; }
}

.thread-col { min-inline-size: 0; border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--surface); overflow: hidden; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px var(--sp-4);
  border-block-end: 1px solid var(--border-soft); background: var(--surface-2); }
.thread-id { min-inline-size: 0; margin-inline-end: auto; line-height: 1.35; }
.thread-id b { display: block; font-size: 14.5px; font-weight: 600; unicode-bidi: isolate; }
.thread-id small { font-size: 12px; color: var(--text-4); }
.thread-body { margin: 0; padding: var(--sp-4); list-style: none; display: grid; gap: 10px;
  max-block-size: 60vh; overflow-y: auto; }
.thread-empty { display: grid; place-items: center; min-block-size: 240px; padding: var(--sp-6);
  text-align: center; color: var(--text-4); font-size: 14px; }
@media (max-width: 900px) { .inbox { grid-template-columns: 1fr; } .conv-list { max-block-size: 42vh; } }

/* ── Flatter rows: one border, no nested tinted boxes ─────────────── */
.rows { display: grid; gap: 0; border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; background: var(--surface); }
.rows > * + * { border-block-start: 1px solid var(--border-soft); }
.row { display: flex; align-items: center; gap: var(--sp-3); inline-size: 100%;
  padding: 13px var(--sp-4); border: 0; background: none; cursor: pointer;
  font: inherit; text-align: start; color: var(--text); text-decoration: none; }
.row:hover { background: var(--surface-2); text-decoration: none; }
.row-ic { display: inline-flex; flex: none; color: var(--text-4); }
.row-ic svg { inline-size: 17px; block-size: 17px; }
.row-label { display: grid; gap: 2px; min-inline-size: 0; margin-inline-end: auto;
  font-size: 14px; font-weight: 500; line-height: 1.45; }
.row-label small { font-size: 12.5px; font-weight: 400; color: var(--text-3); }
.row-hint { display: inline-flex; flex: none; color: var(--text-4); }
.row-hint svg { inline-size: 16px; block-size: 16px; }
.row.is-danger, .rows .is-danger { color: var(--red-ink); }
.row.is-danger .row-ic, .rows .is-danger .row-ic { color: var(--red); }

/* ── Small screens: tabs become a sheet ───────────────────────────── */
@media (max-width: 1040px) {
  .bar .tabs { display: none; }
  .bar-menu { display: inline-flex; }
  .tabs-sheet { display: none; position: sticky; inset-block-start: 56px; z-index: 45;
    padding: 8px clamp(16px, 3vw, 28px) 12px; gap: 4px; flex-wrap: wrap;
    background: var(--canvas); border-block-end: 1px solid var(--border-soft); }
  .tabs-sheet.is-open { display: flex; }
}
@media (max-width: 640px) {
  .bar { gap: var(--sp-2); padding-inline: 14px; }
  .bar-brand span { display: none; }
  .conn-chip span:not(.sr-only) { display: none; }
}

/* ── Message bubbles (inside a thread, one contact only) ──────────── */
.msg { display: flex; }
.msg-out { justify-content: flex-end; }
.bubble { max-inline-size: min(520px, 82%); padding: 9px 13px 7px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2); min-inline-size: 0; }
.b-out { background: var(--brand-500); border-color: var(--brand-600); border-end-end-radius: 5px; }
.b-in { border-end-start-radius: 5px; }
.bubble-text { margin: 0; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.b-out .bubble-text { color: #fff; }
.bubble-text.is-empty { display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-4); }
.b-out .bubble-text.is-empty { color: rgba(255, 255, 255, .8); }
.bubble-text.is-empty svg { inline-size: 14px; block-size: 14px; flex: none; }
.bubble-foot { display: flex; align-items: center; gap: 6px; margin-block-start: 3px;
  font-size: 11px; color: var(--text-4); }
.b-out .bubble-foot { color: rgba(255, 255, 255, .75); justify-content: flex-end; }
.b-out .bubble-foot svg { color: currentColor; }
.media-chip { display: inline-flex; align-items: center; gap: 6px; margin-block-start: 6px;
  padding: 5px 9px; border-radius: 8px; font-size: 12.5px; text-decoration: none;
  background: var(--glass-1); color: inherit; }
.media-chip svg { inline-size: 14px; block-size: 14px; }
.b-out .media-chip { background: rgba(255, 255, 255, .16); }

/* ── Connection chip ──────────────────────────────────────────────── */
.conn-chip { display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 5px 10px; border-radius: var(--r-pill); font: var(--t-caption);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-3); }
.conn-chip i { inline-size: 6px; block-size: 6px; border-radius: 50%; background: var(--text-4); }
.conn-chip.is-live i { background: var(--green); }
.conn-chip.is-stale i { background: var(--orange); }
.conn-chip.is-down i { background: var(--red); }

/* ── Account menu ─────────────────────────────────────────────────── */
.account { position: relative; flex: none; }
.account-btn { display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  padding: 4px 7px 4px 5px; border-radius: 10px; font: inherit;
  background: none; border: 1px solid transparent; color: var(--text); }
.account-btn:hover { border-color: var(--border); background: var(--surface); }
.account-btn svg { inline-size: 14px; block-size: 14px; color: var(--text-4); }
.account-menu { position: fixed; inset: auto; margin: 0;
  inline-size: min(260px, calc(100vw - 24px)); max-block-size: min(420px, calc(100dvh - 24px));
  overflow-y: auto; overscroll-behavior: contain; padding: 6px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--lift-3); }
.account-menu:popover-open { position: fixed; }
.menu-item { display: flex; align-items: center; gap: 10px; inline-size: 100%;
  padding: 9px 10px; border: 0; border-radius: 9px; cursor: pointer; font: inherit;
  font-size: 14px; text-align: start; background: none; color: var(--text); text-decoration: none; }
.menu-item:hover { background: var(--glass-1); text-decoration: none; }
.menu-item svg { inline-size: 16px; block-size: 16px; flex: none; color: var(--text-4); }
.menu-item span { margin-inline-end: auto; }
.menu-item.is-danger { color: var(--red-ink); }
.menu-item.is-danger svg { color: var(--red); }
.menu-sep { block-size: 1px; margin: 5px 0; background: var(--border-soft); }

/* ── Scrim behind an open menu on small screens ───────────────────── */
.scrim { position: fixed; inset: 0; z-index: 44; border: 0; padding: 0;
  background: rgba(22, 24, 27, .28); }
@media (min-width: 1041px) { .scrim { display: none; } }

@media (max-width: 620px) {
  .status-card { flex-wrap: wrap; }
  .status-text { flex: 1 1 100%; }
  .status-card .btn { inline-size: 100%; }
  .page-head { gap: var(--sp-3); }
}

/* MCP access management, retained in the redesigned Connect workspace. */
.mcp-endpoint-line { margin-top: 18px; }
.mcp-steps { display: grid; gap: 10px; margin: 18px 0; padding-inline-start: 24px; color: var(--text-2); }
.mcp-steps li { padding-inline-start: 4px; }
.mcp-grants-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 24px 0 10px; }
.mcp-grants-head h3 { margin: 0; font-size: 1rem; }
.mcp-grant-list { display: grid; gap: 10px; }
.mcp-grant { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.mcp-grant > div { min-width: 0; display: grid; gap: 4px; }
.mcp-grant b, .mcp-grant small { overflow-wrap: anywhere; }
.mcp-grant small { color: var(--text-3); }
.mcp-grant .btn { flex: 0 0 auto; }
@media (max-width: 620px) {
  .mcp-grant { align-items: flex-start; flex-direction: column; }
  .mcp-grant .btn { align-self: stretch; }
}
