@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Sora:wght@600;700&display=swap");

@view-transition {
  navigation: auto;
}

:root {
  --bg: #f4f7fb;
  --bg-strong: #ecf0f7;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-soft: #f0f3f9;
  --surface-tint: #e8eef7;
  --surface-emphasis: #dfe8f5;
  --text: #0d1a30;
  --text-strong: #081528;
  --muted: #5c6e84;
  --muted-strong: #3e5168;
  --line: rgba(10, 24, 48, 0.07);
  --line-strong: rgba(10, 24, 48, 0.12);
  --accent: #2d5ee0;
  --accent-strong: #2050cc;
  --accent-soft: rgba(45, 94, 224, 0.08);
  --mint: #14b8b4;
  --mint-soft: rgba(20, 184, 180, 0.08);
  --amber: #c88c10;
  --amber-soft: rgba(200, 140, 16, 0.08);
  --rose: #d44058;
  --rose-soft: rgba(212, 64, 88, 0.08);
  --violet: #4c5ee8;
  --violet-soft: rgba(76, 94, 232, 0.08);
  --cyan: #28b8c0;
  --cyan-soft: rgba(40, 184, 192, 0.07);
  --sidebar-bg: #edf1f8;
  --sidebar-line: rgba(10, 24, 48, 0.08);
  --sidebar-text: #5c6e84;
  --sidebar-heading: #0d1a30;
  --sidebar-sub: #5c6e84;
  --sidebar-hover: rgba(10, 24, 48, 0.05);
  --sidebar-active-bg: rgba(45, 94, 224, 0.08);
  --sidebar-active-text: #0d1a30;
  --shadow-sm: 0 4px 16px rgba(10, 24, 48, 0.04);
  --shadow-md: 0 12px 32px rgba(10, 24, 48, 0.06);
  --shadow-lg: 0 24px 56px rgba(10, 24, 48, 0.08);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --radius-pill: 4px;
  --fs-2xs: 0.6rem;
  --fs-xs: 0.68rem;
  --fs-sm: 0.76rem;
  --fs-base: 0.84rem;
  --fs-md: 0.92rem;
  --fs-lg: 1.04rem;
  --fs-xl: 1.3rem;
  --accent-dim: #1b58cf;
  --mint-bright: #22ddd9;
  --cyan-bright: #1cc4d0;
  --amber-bright: #e6a112;
  --warning: #ffbf47;
  --tooltip-bg: #0a1730;
  --tooltip-text: #f8fbff;
  --ltv-handle-bg: #d8e4f8;
  --ltv-handle-border: #1B58CF;
  --ltv-handle-hover: #c0d0f0;
  --ltv-handle-glow: #2E66E6;
  --ltv-handle-drag: #a8bce8;
  --ltv-handle-glow-strong: #1B58CF;
  --ltv-label: #1B58CF;
  --ltv-zone-safe: #e8f4fb;
  --ltv-zone-target: #dbeaff;
  --ltv-zone-target-border: #3b70ff;
  --ltv-zone-target-text: #1B58CF;
  --ltv-zone-warn: #f5ecd8;
  --ltv-zone-warn-border: #c88c10;
  --ltv-zone-danger: #fce8ea;
  --ltv-zone-danger-border: #d44058;
  --range-track: #d8e0ee;
  --content-grid-ratio: minmax(0, 1.1fr) minmax(280px, 0.9fr);
}

html[data-theme="dark"] {
  --bg: #0c0c14;
  --bg-strong: #101018;
  --surface: #16161e;
  --surface-strong: #1c1c26;
  --surface-soft: #121218;
  --surface-tint: #1a1a24;
  --surface-emphasis: #1e1e2c;
  --text: #d0d4e0;
  --text-strong: #f0f2f8;
  --muted: #8890a0;
  --muted-strong: #a0a8b8;
  --line: #1a1e2a;
  --line-strong: #252a38;
  --accent: #3b70ff;
  --accent-strong: #2f5fe0;
  --accent-soft: #121d38;
  --mint: #5eecc0;
  --mint-soft: #0c2420;
  --amber: #f7c86c;
  --amber-soft: #28200e;
  --rose: #ff8a98;
  --rose-soft: #281018;
  --violet: #a78bfa;
  --violet-soft: #1a1430;
  --cyan: #39D7DB;
  --cyan-soft: #0c2830;
  --sidebar-bg: #0c0c14;
  --sidebar-line: rgba(255, 255, 255, 0.06);
  --sidebar-text: rgba(255, 255, 255, 0.6);
  --sidebar-heading: rgba(255, 255, 255, 0.85);
  --sidebar-sub: rgba(255, 255, 255, 0.55);
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-active-bg: rgba(59, 112, 255, 0.08);
  --sidebar-active-text: #fff;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --accent-dim: #3b70ff;
  --ltv-handle-bg: #0e3038;
  --ltv-handle-border: #22DDD9;
  --ltv-handle-hover: #124550;
  --ltv-handle-glow: #1CC4D0;
  --ltv-handle-drag: #186068;
  --ltv-handle-glow-strong: #22DDD9;
  --ltv-label: #39D7DB;
  --ltv-zone-safe: #0B1732;
  --ltv-zone-target: #113D8F;
  --ltv-zone-target-border: #22DDD9;
  --ltv-zone-target-text: #E7FCFF;
  --ltv-zone-warn: #1a2d50;
  --ltv-zone-warn-border: #2a4a70;
  --ltv-zone-danger: #1c1030;
  --ltv-zone-danger-border: #3a2048;
  --range-track: #1e2538;
  --tooltip-bg: #1a2a48;
  --tooltip-text: #f0f4ff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: #0c0c14;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  display: grid;
  align-content: start;
  gap: 0.65rem;
  min-height: 100vh;
  padding: 0.85rem 0.75rem;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
}

.brand-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.2rem 0.6rem;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid var(--sidebar-line);
  box-shadow: none;
}

.brand-card img {
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
}

.brand-name,
.brand-tag,
.eyebrow,
.section-label,
.choice-eyebrow,
.micro-label,
.metric-card span,
.note-card span,
.hero-chip,
.saved-card-meta span,
.saved-row p,
.scenario-band-head span,
.state-badge,
.token-chip span:first-of-type,
.route-score,
.list-meta span,
.sidebar-position-row span,
.sidebar-route span {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-name {
  display: block;
  color: var(--sidebar-heading);
  font-size: 0.88rem;
  font-weight: 800;
}

.brand-tag {
  display: block;
  margin-top: 0.12rem;
  color: var(--sidebar-sub);
  font-size: var(--fs-2xs);
  font-weight: 700;
}

/* --- Wallet sidebar --- */

.sidebar-wallet {
  padding: 0 0.6rem;
}

.wallet-connect-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: #fff;
  font: 600 var(--fs-xs) / 1.3 var(--ff);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.wallet-connect-btn:hover {
  background: var(--accent-strong);
}
.wallet-connect-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.wallet-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}

.wallet-connected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--sidebar-line);
  border-radius: var(--radius-xs);
  background: var(--sidebar-hover);
}

.wallet-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.wallet-details {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.wallet-address {
  font: 500 var(--fs-xs) / 1.2 var(--ff-mono, var(--ff));
  color: var(--sidebar-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-balance {
  font: 600 var(--fs-2xs) / 1.2 var(--ff);
  color: var(--mint);
}

.wallet-disconnect {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--sidebar-sub);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.wallet-disconnect:hover {
  color: var(--warning, #f87171);
  background: rgba(248, 113, 113, 0.1);
}
.wallet-disconnect svg {
  width: 16px;
  height: 16px;
}

/* Setup collateral selector */
.field-collateral {
  position: relative;
  z-index: 2;
  gap: 0.36rem;
  min-width: 0;
  overflow: visible;
  grid-column: span 2;
  align-content: start;
}

.field-collateral-head {
  display: grid;
  gap: 0.08rem;
}

.field-collateral-title {
  color: var(--muted-strong);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.field-collateral-note {
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-collateral-input {
  display: grid;
  grid-template-columns: minmax(8.75rem, 0.68fr) minmax(15.5rem, 1.32fr);
  gap: 0.52rem;
  align-items: start;
}

.field-collateral-input input[name="btcUnits"] {
  min-width: 0;
  text-align: left;
  min-height: 2.55rem;
  width: 100%;
}

.collateral-picker {
  position: relative;
  min-width: 0;
  width: 100%;
  z-index: 200;
}

.collateral-picker[open] {
  z-index: 2147483000;
}

.collateral-picker > summary {
  list-style: none;
}

.collateral-picker > summary::-webkit-details-marker {
  display: none;
}

.collateral-asset-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  width: 100%;
  min-width: 0;
  min-height: 2.78rem;
  padding: 0 0.88rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-strong);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease;
}

.collateral-asset-trigger-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.collateral-picker[open] .collateral-asset-trigger,
.collateral-asset-trigger:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.collateral-picker.is-disabled .collateral-asset-trigger {
  opacity: 0.7;
  pointer-events: none;
  cursor: default;
}

.collateral-asset-trigger-copy {
  display: grid;
  gap: 0.04rem;
  min-width: 0;
  flex: 1 1 auto;
}

.collateral-asset-symbol {
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collateral-asset-balance {
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 600;
  line-height: 1.1;
}

.collateral-asset-trigger svg {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
  color: var(--muted);
}

.collateral-asset-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2147483000;
  width: min(40rem, calc(100vw - 2rem));
  min-width: min(20rem, calc(100vw - 2rem));
  display: grid;
  gap: 0.5rem;
  max-height: min(28rem, 72vh);
  overflow-y: auto;
  padding: 0.95rem;
  border: 1px solid rgba(121, 132, 165, 0.28);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface-strong) 98.5%, #04060c 1.5%);
  backdrop-filter: blur(18px) saturate(112%);
  box-shadow: 0 28px 56px rgba(0, 0, 0, 0.42);
  isolation: isolate;
}

.collateral-asset-section-label {
  padding: 0.1rem 0.2rem 0;
  color: var(--muted-strong);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.collateral-asset-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.82rem;
  width: 100%;
  min-height: 4.05rem;
  padding: 0.72rem 0.82rem;
  border: 1px solid rgba(121, 132, 165, 0.18);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-soft) 88%, transparent 12%);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease;
}

.collateral-asset-option:hover,
.collateral-asset-option.is-selected {
  border-color: rgba(82, 194, 255, 0.38);
  background: rgba(57, 78, 130, 0.22);
}

.collateral-asset-option-leading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.collateral-asset-option-copy {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.collateral-asset-option-symbol-row {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
}

.collateral-asset-option-symbol {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.05;
}

.collateral-asset-option-title {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collateral-asset-option-type {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: none;
}

.collateral-asset-option-trailing {
  display: grid;
  justify-items: end;
  gap: 0.24rem;
  min-width: 5rem;
}

.collateral-asset-option-value {
  color: var(--text-strong);
  font-size: 1.15rem;
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.collateral-asset-option-value.is-manual {
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.collateral-asset-option-value.is-zero {
  color: var(--muted-strong);
}

.collateral-asset-option-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.28rem;
  max-width: 11rem;
  padding: 0 0.42rem;
  border: 1px solid rgba(121, 132, 165, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collateral-asset-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(121, 132, 165, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.collateral-asset-mark-image {
  width: 1.9rem;
  height: 1.9rem;
  object-fit: contain;
}

body[data-page="setup"] .surface.surface-collateral-open {
  position: relative;
  z-index: 1000;
  overflow: visible;
  isolation: auto;
}

body[data-page="setup"] .surface[data-section="intent"],
body[data-page="setup"] .surface[data-section="intent"] .strategy-panel,
body[data-page="setup"] .surface[data-section="intent"] .strategy-position,
body[data-page="setup"] .surface[data-section="intent"] .position-row {
  position: relative;
  z-index: 40;
  overflow: visible;
}

body[data-page="setup"] .surface[data-section="guardrails"] {
  position: relative;
  z-index: 1;
}

body[data-page="setup"] .setup-layout,
body[data-page="setup"] .setup-main,
body[data-page="setup"] .page-stack,
body[data-page="setup"] .strategy-panel,
body[data-page="setup"] .strategy-position {
  overflow: visible;
}

.collateral-balance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.5rem;
  min-height: 0;
  margin-top: 0.08rem;
}

.collateral-balance-copy {
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
  min-width: 0;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.collateral-balance-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex: 0 0 auto;
  min-width: 0;
}

.collateral-balance-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  max-width: 9rem;
  padding: 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  color: var(--muted-strong);
  font: 700 0.68rem / 1 var(--ff);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.collateral-use-max {
  flex: 0 0 auto;
  min-height: 1.5rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(82, 194, 255, 0.24);
  border-radius: var(--radius-pill);
  background: rgba(33, 107, 255, 0.12);
  color: var(--accent);
  font: 700 0.68rem / 1 var(--ff);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease;
}

.collateral-use-max:hover:not(:disabled) {
  border-color: rgba(82, 194, 255, 0.38);
  background: rgba(33, 107, 255, 0.18);
}

.collateral-use-max:disabled {
  opacity: 0.65;
  cursor: default;
}

/* --- Wallet modal --- */

.wm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.wm-overlay.wm-visible {
  opacity: 1;
}

.wm-modal {
  width: 90vw;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.18s ease;
}
.wm-visible .wm-modal {
  transform: translateY(0) scale(1);
}

.wm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.3rem 0.8rem;
}

.wm-title {
  margin: 0;
  font: 600 1.05rem / 1.3 var(--ff);
  color: var(--text-strong);
}

.wm-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.wm-close:hover {
  background: var(--surface-emphasis);
  color: var(--text-strong);
}
.wm-close svg {
  width: 16px;
  height: 16px;
}

.wm-body {
  padding: 0.4rem 1.3rem 1.3rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.wm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.wm-wallet-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.wm-wallet-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.wm-wallet-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
}

.wm-wallet-name {
  font: 500 var(--fs-2xs) / 1.3 var(--ff);
  text-align: center;
  word-break: break-word;
}

.wm-install-tag {
  font: 600 0.55rem / 1 var(--ff);
  color: var(--accent);
  opacity: 0.7;
}

.wm-divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1rem 0 0.6rem;
}
.wm-divider::before,
.wm-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.wm-divider span {
  font: 500 var(--fs-2xs) / 1 var(--ff);
  color: var(--muted);
  white-space: nowrap;
}

.wm-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: var(--fs-sm);
}

@media (max-width: 480px) {
  .wm-grid { grid-template-columns: repeat(2, 1fr); }
  .wm-modal { max-width: 95vw; }
}

.sidebar-nav {
  display: grid;
  gap: 0.2rem;
}

.sidebar-nav a {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0 0.6rem;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-xs);
  color: var(--sidebar-text);
  transition:
    background-color 200ms ease,
    color 200ms ease,
    box-shadow 200ms ease,
    transform 120ms ease;
}

.nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  opacity: 0.4;
  transition: opacity 200ms ease;
  align-self: center;
}

.sidebar-nav a:hover .nav-icon {
  opacity: 0.85;
}

body[data-page="workspace"] .sidebar-nav [data-nav="workspace"] .nav-icon,
body[data-page="setup"] .sidebar-nav [data-nav="setup"] .nav-icon,
body[data-page="live"] .sidebar-nav [data-nav="live"] .nav-icon,
body[data-page="results"] .sidebar-nav [data-nav="results"] .nav-icon,
body[data-page="library"] .sidebar-nav [data-nav="library"] .nav-icon {
  opacity: 1;
  color: var(--accent);
}

.sidebar-nav a > div {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.sidebar-nav a strong {
  display: block;
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--sidebar-heading);
  line-height: 1.2;
}

.sidebar-nav a span {
  display: block;
  font-size: var(--fs-2xs);
  color: var(--sidebar-sub);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  transform: translateX(1px);
}

.sidebar-nav a.is-disabled,
.sidebar-nav a.is-disabled:hover,
.sidebar-nav a.is-disabled:active {
  opacity: 0.54;
  background: transparent;
  transform: none;
  cursor: not-allowed;
}

.sidebar-nav a:active {
  transform: translateX(0) scale(0.99);
}

body[data-page="workspace"] .sidebar-nav [data-nav="workspace"],
body[data-page="overview"] .sidebar-nav [data-nav="workspace"],
body[data-page="setup"] .sidebar-nav [data-nav="setup"],
body[data-page="live"] .sidebar-nav [data-nav="live"],
body[data-page="results"] .sidebar-nav [data-nav="results"],
body[data-page="library"] .sidebar-nav [data-nav="library"] {
  background: var(--sidebar-active-bg);
  box-shadow: inset 2px 0 0 var(--accent);
}

body[data-page="workspace"] .sidebar-nav [data-nav="workspace"] strong,
body[data-page="setup"] .sidebar-nav [data-nav="setup"] strong,
body[data-page="live"] .sidebar-nav [data-nav="live"] strong,
body[data-page="results"] .sidebar-nav [data-nav="results"] strong,
body[data-page="library"] .sidebar-nav [data-nav="library"] strong {
  color: var(--sidebar-active-text);
}

.theme-panel,
.sidebar-panel {
  display: grid;
  gap: 0.5rem;
  padding: 0.6rem 0 0;
  border-radius: 0;
  border-top: 1px solid var(--sidebar-line);
  background: transparent;
}

.theme-panel {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.38rem;
  margin-top: auto;
  padding-top: 0.35rem;
  border-top: 0;
}

.theme-panel .micro-label {
  display: none;
}

.micro-label {
  color: var(--sidebar-sub);
  font-size: var(--fs-xs);
  font-weight: 800;
}

.theme-toggle {
  display: flex;
  gap: 0.3rem;
  padding: 0.1rem;
  border-radius: var(--radius-xs);
  background: var(--sidebar-hover);
}

.theme-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--sidebar-text);
  padding: 0;
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

.theme-toggle button:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-heading);
}

.theme-toggle button.is-active {
  background: var(--sidebar-active-bg);
  box-shadow: inset 0 0 0 1px var(--sidebar-line);
  color: var(--sidebar-active-text);
}

.theme-icon {
  width: 1.05rem;
  height: 1.05rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sidebar-scenario-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.sidebar-scenario-head > div,
.sidebar-route,
.page-tools,
.section-head > div,
.saved-card-head > div,
.route-card-head > :first-child,
.scenario-band-head > div,
.list-row > :first-child {
  min-width: 0;
}

.sidebar-scenario-head h2,
.sidebar-btc-price {
  margin: 0;
  color: var(--sidebar-active-text);
  font-size: 1rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.sidebar-scenario-head p,
.sidebar-route p {
  margin: 0.15rem 0 0;
  color: var(--sidebar-sub);
  font-size: 0.68rem;
  line-height: 1.45;
}

.sidebar-position {
  display: grid;
  gap: 0;
}

.sidebar-position-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--sidebar-line);
}

.sidebar-position-row:last-child {
  border-bottom: 0;
}

.sidebar-position-row span {
  color: var(--sidebar-sub);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-position-row strong {
  color: var(--sidebar-heading);
  font-size: 0.92rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Keep old sidebar-kpis for backwards compat */
.sidebar-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.sidebar-kpis span {
  display: block;
  color: var(--sidebar-sub);
  font-size: var(--fs-2xs);
  font-weight: 800;
}

.sidebar-kpis strong {
  display: block;
  color: var(--sidebar-heading);
  font-size: 0.78rem;
  font-weight: 800;
}

.sidebar-route strong {
  display: block;
  margin-top: 0.1rem;
  color: var(--sidebar-heading);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.sidebar-route {
  display: grid;
  gap: 0.1rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--sidebar-line);
}

.app-main {
  padding: 0.75rem 1.2rem 1.4rem;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0;
  border-bottom: 0;
}

.page-tools {
  display: grid;
  justify-items: end;
  gap: 0.55rem;
  align-self: start;
}

.page-heading {
  display: grid;
  gap: 0.16rem;
  min-width: 0;
  flex: 1;
}

.eyebrow,
.section-label,
.choice-eyebrow,
.micro-label,
.metric-card span,
.note-card span,
.scenario-band-head span,
.saved-card-meta span,
.saved-row p,
.list-meta span,
.route-score {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 800;
}

h1,
h2,
h3,
strong {
  color: var(--text-strong);
}

h1,
h2 {
  margin: 0;
  font-family: "Sora", "Manrope", sans-serif;
}

h1 {
  max-width: none;
  font-size: clamp(1rem, 1.15vw, 1.2rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(0.92rem, 1.05vw, 1.12rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.page-copy,
.surface-copy,
.choice-copy,
.note-card p,
.metric-card p,
.saved-card p,
.saved-row p,
.status-line,
.empty-copy,
.empty-panel p,
.route-card p,
.log-card p {
  color: var(--muted);
  line-height: 1.65;
}

.page-copy {
  max-width: 62ch;
  margin: 0.2rem 0 0;
  font-size: var(--fs-base);
  line-height: 1.4;
}

body[data-page="setup"] h1 {
  font-size: clamp(1rem, 1.15vw, 1.25rem);
}

body[data-page="setup"] .page-copy {
  max-width: none;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.status-line {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
  max-width: 50ch;
}

.status-line.is-error {
  color: var(--rose);
}

.action-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  min-width: 0;
}

.workspace-actions {
  margin-top: 0.8rem;
}

.action-cluster-compact .button {
  min-width: 5.5rem;
  min-height: 2.2rem;
  padding-inline: 0.85rem;
  font-size: var(--fs-sm);
  white-space: normal;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 2.15rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 10px;
  font-size: var(--fs-base);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    transform 100ms ease;
}

.button:active {
  transform: scale(0.97);
}

.button-primary {
  background: var(--accent);
  color: #fff;
  border: 0;
}

.button-primary:hover {
  background: var(--accent-strong);
  box-shadow: none;
}

.button-secondary {
  background: var(--surface-strong);
  color: var(--text-strong);
  border: 1px solid var(--line);
}

.button-secondary:hover {
  background: var(--surface-tint);
  border-color: var(--line-strong);
}

.button-ghost {
  background: transparent;
  color: var(--muted-strong);
}

.button-ghost:hover {
  background: var(--surface-soft);
}

.button-ghost.is-danger {
  color: var(--rose);
}

body[data-page="workspace"] .surface:not(.surface-hero),
body[data-page="overview"] .surface:not(.surface-hero),
body[data-page="live"] .surface:not(.surface-hero),
body[data-page="results"] .surface:not(.surface-hero),
body[data-page="library"] .surface:not(.surface-hero) {
  padding: 0.4rem 1.1rem;
  border: none;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
  box-shadow: none;
}

body[data-page="setup"] .surface {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
}


body[data-page="setup"] .page-stack {
  gap: 1.25rem;
  padding-bottom: 1rem;
}

body[data-page="setup"] .content-grid-setup {
  grid-template-columns: minmax(0, 1.7fr) minmax(286px, 0.66fr);
  gap: 0.9rem;
}

body[data-page="setup"] .sticky-panel {
  top: 0;
}

body[data-page="setup"] .choice-block {
  margin-top: 0.5rem;
}

body[data-page="setup"] .metric-card,
body[data-page="setup"] .note-card {
  background: var(--surface-soft);
}

body[data-page="setup"] #setup-brief .hero-metric-grid {
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

body[data-page="setup"] #setup-brief .metric-card {
  gap: 0.16rem;
  padding: 0.58rem 0 0.08rem;
  border-radius: 0;
  background: transparent;
  border-top: 1px solid var(--line);
}

body[data-page="setup"] #setup-brief .hero-metric-grid .metric-card:first-child {
  border-top: 0;
}

body[data-page="setup"] #setup-brief .metric-card strong {
  font-size: 1.02rem;
}

body[data-page="setup"] #setup-brief .metric-card p,
body[data-page="setup"] #setup-brief .callout-row .surface-copy {
  margin-top: 0.16rem;
  font-size: 0.76rem;
  line-height: 1.42;
}

body[data-page="setup"] #setup-brief .callout-row {
  gap: 0.3rem;
  margin-top: 0.8rem;
}

body[data-page="setup"] #setup-brief .visual-mark-md {
  width: 1.85rem;
  height: 1.85rem;
}

body[data-page="setup"] #setup-brief .entity-copy strong {
  font-size: 0.92rem;
}

body[data-page="setup"] #setup-brief .entity-copy span {
  font-size: 0.76rem;
}

body[data-page="setup"] #setup-notes .note-card {
  padding: 0.76rem 0;
  border-radius: 0;
  background: transparent;
  border-top: 1px solid var(--line);
}

body[data-page="setup"] #setup-notes .note-card:first-child {
  padding-top: 0;
  border-top: 0;
}

.page-stack {
  display: grid;
  gap: 0.9rem;
}

.content-grid {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.content-grid-main {
  grid-template-columns: var(--content-grid-ratio);
}

body[data-page="results"] .content-grid-main {
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, 0.98fr);
}

.content-grid-setup {
  grid-template-columns: minmax(0, 1.24fr) minmax(320px, 0.76fr);
  align-items: start;
}

.surface {
  position: relative;
  z-index: 1;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: none;
  transition: border-color 200ms ease;
}

body[data-page="results"] .page-stack {
  gap: 0.55rem;
}

body[data-page="results"] .surface-hero {
  padding: 0.65rem 1.15rem 0.55rem;
}

.surface-hero {
  position: relative;
  padding: 0.85rem 1.25rem 0.75rem 1.15rem;
  background: var(--surface);
  box-shadow: none;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--text);
  overflow: visible;
}

.surface-hero::before {
  content: none;
}

.surface-hero h2,
.surface-hero strong {
  color: var(--text-strong);
}

.surface-hero .section-label,
.surface-hero .surface-copy,
.surface-hero .hero-copy-block .surface-copy,
.surface-hero .metric-card span,
.surface-hero .metric-card p {
  color: var(--muted);
}

.surface-hero .metric-card,
.surface-hero .note-card {
  border-color: var(--line);
  background: transparent;
}

.surface-headline {
  margin-bottom: 1rem;
}

.posture-stack {
  display: grid;
  gap: 1rem;
}

.section-subtitle {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 400;
  line-height: 1.4;
  max-width: 48ch;
  opacity: 0.75;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0;
  border-bottom: none;
}

body[data-page="results"] .section-head {
  margin-bottom: 0.75rem;
}

.section-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  color: var(--muted);
  opacity: 0.5;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.92fr);
  gap: 1.4rem;
  align-items: center;
}

.hero-layout-overview {
  gap: 1.6rem;
}

.hero-copy-block h2 {
  font-size: clamp(1.1rem, 1.4vw, 1.55rem);
}

.hero-copy-block .surface-copy {
  margin-top: 0.9rem;
}

.hero-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.live-hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  align-self: start;
}

.hero-rail-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 1.3rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: var(--fs-2xs);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.hero-metric-grid,
.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0 0.75rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.metric-card,
.note-card,
.route-card,
.empty-panel,
.saved-card,
.log-card {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.6rem 0.5rem;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  transition: background-color 200ms ease;
}

.hero-metric-grid .metric-card {
  position: relative;
  padding: 0.35rem 0;
  border-radius: 0;
  background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  padding-right: 0.75rem;
}

body[data-page="results"] .hero-metric-grid .metric-card strong {
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
}


.hero-metric-grid .metric-card:last-child {
  border-right: none;
  padding-right: 0;
}

.metric-card span {
  display: block;
}

.metric-card strong,
.note-card strong,
.route-card strong,
.saved-card strong,
.log-card strong,
.scenario-band strong,
.list-row strong,
.saved-row strong {
  display: block;
  margin-top: 0.35rem;
  font-weight: 800;
  min-width: 0;
  overflow-wrap: anywhere;
}

.metric-card strong {
  font-size: clamp(1.3rem, 2vw, 1.75rem);
  line-height: 1.05;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.metric-card-cyan strong { color: var(--cyan); }
.metric-card-mint strong { color: var(--mint); }
.metric-card-amber strong { color: var(--amber); }
.metric-card-rose strong { color: var(--rose); }
.metric-card-accent strong { color: var(--accent); }

.metric-card p,
.note-card p,
.route-card p,
.log-card p {
  margin: 0.3rem 0 0;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.metric-card-good {
  background: var(--mint-soft);
}

.metric-card-warn {
  background: var(--amber-soft);
}

.callout-row {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.callout-row-route {
  gap: 0.5rem;
}

.route-inline-brief {
  display: grid;
  gap: 0.7rem;
}

.rail-pack-status {
  display: grid;
  gap: 0.38rem;
  padding: 0.9rem 0 0.15rem;
}

.rail-pack-status strong {
  font-size: 1rem;
}

.rail-pack-status p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.rail-pack-actions {
  margin-top: 0.75rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.module-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-card,
.readiness-item {
  position: relative;
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.7rem 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  overflow: hidden;
  transition: background-color 200ms ease, transform 200ms ease;
}

.module-card:hover {
  background: var(--surface-tint);
}

.module-card::before,
.readiness-item::before {
  content: none;
}

.module-card-accent::before,
.readiness-item-accent::before {
  background: var(--accent-dim);
}

.module-card-mint::before {
  background: var(--mint-bright);
}

.module-card-cyan::before {
  background: var(--cyan-bright);
}

.module-card-amber::before {
  background: var(--amber-bright);
}

.module-card-head,
.readiness-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.module-card-head .section-label {
  flex: 1 1 auto;
}

.module-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  opacity: 0.5;
}

.module-card:hover .module-icon {
  opacity: 0.85;
}

a.module-card {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.module-card h3 {
  margin: 0;
  color: var(--text-strong);
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 0.92rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.module-card p,
.readiness-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.module-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.module-card-meta span,
.asset-meta {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  line-height: 1.35;
}

.asset-meta {
  color: var(--muted);
  font-size: 0.76rem;
}

.workspace-coverage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.workspace-coverage-row {
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  background: var(--bg-strong);
  border: 1px solid var(--line);
  transition: background-color 150ms ease, border-color 150ms ease;
}

.workspace-coverage-row:hover {
  background: var(--surface-tint);
  border-color: var(--line-strong);
}

.readiness-list {
  display: grid;
  gap: 0.85rem;
}

.readiness-item strong {
  margin: 0;
}

.route-inline,
.token-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.route-card .route-card-head {
  align-items: flex-start;
}

.route-card .token-row {
  margin-top: 0.9rem;
}

.note-card-highlight {
  background: var(--accent-soft);
}

.note-card-action {
  gap: 0.3rem;
  background: var(--surface-soft);
}

.note-card-good {
  background: var(--mint-soft);
}

.note-card-warn {
  background: var(--amber-soft);
}

.form-grid {
  display: grid;
  gap: 0.6rem;
}

.form-grid-intent {
  margin-top: 0.6rem;
}

/* ── Strategy panel ── */
.strategy-intro {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
  max-width: 70ch;
}

.strategy-panel {
  display: grid;
  gap: 1.2rem;
}

.create-scope-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.create-scope-panel.intent-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem 0.95rem;
}

.intent-row-mode-line {
  display: flex;
  align-items: center;
}

.intent-row-line {
  display: grid;
  grid-template-columns: minmax(7rem, 0.8fr) minmax(12rem, 1.2fr);
  align-items: stretch;
  gap: 0.7rem;
}

.intent-row-mode {
  width: auto;
}

.intent-row-amount {
  min-height: 2.78rem;
  width: 100%;
}

.intent-row-coin {
  min-width: 0;
  position: relative;
  z-index: 2;
  overflow: visible;
}

.intent-row-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.intent-row-status .collateral-balance-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.intent-row-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--amber);
  flex: 1 1 100%;
}

.intent-row-hint[hidden] { display: none; }

@media (max-width: 560px) {
  .intent-row-line {
    grid-template-columns: 1fr;
  }
}

.create-scope-panel.intent-swap-unused {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.8rem 0.9rem;
}

.intent-swap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.intent-swap-mode {
  width: auto;
  flex: 0 0 auto;
}

.intent-swap-balance {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 0;
}

.intent-swap-balance .collateral-balance-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intent-swap-balance .collateral-use-max {
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.intent-swap-balance .collateral-use-max:hover {
  border-color: var(--line-strong);
  background: var(--bg-strong);
}

.intent-swap-card {
  position: relative;
  z-index: 2;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  padding: 0.85rem 0.95rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 94%, transparent 6%), var(--surface-soft));
}

.intent-swap-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-strong);
}

.intent-swap-body {
  display: grid;
  grid-template-columns: minmax(11rem, 0.9fr) minmax(10rem, 1.1fr);
  align-items: center;
  gap: 0.85rem;
}

.intent-swap-coin {
  min-width: 0;
}

.intent-swap-coin .collateral-asset-trigger {
  min-height: 3rem;
  border-radius: 999px;
  padding: 0.3rem 0.7rem 0.3rem 0.5rem;
  background: var(--bg-strong);
}

.intent-swap-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.18rem;
  min-width: 0;
}

.intent-swap-amount-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  color: var(--text);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
  outline: none;
  letter-spacing: -0.01em;
}

.intent-swap-amount-input::placeholder {
  color: var(--muted);
  opacity: 0.55;
}

.intent-swap-usd {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.intent-swap-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--amber);
}

.intent-swap-hint[hidden] { display: none; }

@media (max-width: 620px) {
  .intent-swap-body {
    grid-template-columns: 1fr;
  }
  .intent-swap-amount {
    align-items: flex-start;
  }
  .intent-swap-amount-input {
    text-align: left;
  }
}

.create-scope-copy {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.create-scope-hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 600;
  line-height: 1.45;
}

.create-scope-hint[data-tone="good"] {
  color: var(--mint);
}

.create-scope-hint[data-tone="warn"] {
  color: var(--amber);
}

.create-scope-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 12px;
  background: var(--bg-strong);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.create-scope-option {
  position: relative;
  min-width: 0;
}

.create-scope-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.create-scope-option span {
  display: grid;
  gap: 0.08rem;
  min-width: 11rem;
  padding: 0.62rem 0.85rem;
  border-radius: 10px;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 700;
  transition:
    background-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

.create-scope-option em {
  color: inherit;
  font-size: var(--fs-2xs);
  font-style: normal;
  font-weight: 600;
  opacity: 0.82;
}

.create-scope-option input:checked + span {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 75%, transparent);
}

.create-scope-panel.is-live {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.create-scope-panel.is-ready {
  border-color: color-mix(in srgb, var(--mint) 30%, var(--line));
}

.create-scope-panel.is-blocked {
  border-color: color-mix(in srgb, var(--amber) 45%, var(--line));
}

.strategy-top {
  display: flex;
  align-items: flex-start;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.strategy-controls {
  flex: 1 1 auto;
  display: flex;
  gap: 0.6rem;
  min-width: 0;
}

.strategy-seg-pair {
  flex: 1 1 0;
  min-width: 0;
}

.strategy-numbers {
  flex: 1 1 auto;
  display: flex;
  gap: 0.8rem;
  align-items: flex-end;
  padding-top: 0.3rem;
  min-width: 0;
}

.strategy-position {
  margin-top: 0.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.position-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  align-items: start;
  overflow: visible;
}

.position-row-6 {
  grid-template-columns: minmax(24rem, 2.1fr) repeat(5, minmax(7.6rem, 1fr));
}

.position-row-collateral {
  grid-template-columns: minmax(0, 1fr);
}

/* ── Market forecast comparison card (/setup) ── */
.mfc {
  display: grid;
  gap: 0.85rem;
}

.mfc-empty {
  padding: 0.9rem 1rem;
  color: var(--muted);
  font-size: var(--fs-xs);
  border: 1px dashed rgba(121, 132, 165, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
}

.mfc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem 0.9rem;
}

.mfc-title {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.mfc-sub {
  color: var(--muted);
  font-size: 0.78rem;
}

.mfc-badges {
  display: inline-flex;
  gap: 0.4rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.mfc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(121, 132, 165, 0.22);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted-strong);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mfc-badge.is-stale {
  border-color: rgba(255, 176, 75, 0.4);
  color: #ffb04b;
  background: rgba(255, 176, 75, 0.08);
}

.mfc-band {
  position: relative;
  height: 3.4rem;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    rgba(255, 96, 96, 0.22) 0%,
    rgba(255, 176, 75, 0.18) 25%,
    rgba(120, 200, 255, 0.18) 50%,
    rgba(96, 220, 160, 0.18) 75%,
    rgba(96, 220, 160, 0.26) 100%
  );
  border: 1px solid rgba(121, 132, 165, 0.22);
  overflow: visible;
}

.mfc-band-axis {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1.1rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.66rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mfc-band-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1px dashed rgba(255, 255, 255, 0.22);
}

.mfc-band-tick-label {
  position: absolute;
  top: -1rem;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted-strong);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mfc-band-pin {
  position: absolute;
  top: -0.4rem;
  bottom: -0.4rem;
  width: 0;
  border-left: 2px solid var(--accent);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 60%, transparent));
}

.mfc-band-pin::before {
  content: "";
  position: absolute;
  top: -0.35rem;
  left: -0.42rem;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface-strong);
}

.mfc-band-pin-label {
  position: absolute;
  bottom: -2.3rem;
  left: 0;
  transform: translateX(-50%);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: #04060c;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mfc-band-wrap {
  padding: 0.9rem 0 2.6rem 0;
}

.mfc-table {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}

.mfc-table-cell {
  padding: 0.55rem 0.6rem;
  border: 1px solid rgba(121, 132, 165, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 0.12rem;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.mfc-table-cell:hover {
  border-color: rgba(121, 132, 165, 0.42);
  background: rgba(255, 255, 255, 0.045);
}

.mfc-table-cell:active {
  transform: translateY(1px);
}

.mfc-table-cell.is-active,
.mfc-table-cell.is-user {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

.mfc-table-q {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.mfc-table-price {
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}

.mfc-table-dd {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mfc-table-dd.is-up { color: #60dca0; }
.mfc-table-dd.is-dn { color: #ff8080; }

.mfc-warn {
  margin-top: 0.4rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(255, 176, 75, 0.3);
  background: rgba(255, 176, 75, 0.06);
  color: #ffcc88;
  border-radius: 10px;
  font-size: 0.75rem;
  line-height: 1.35;
}

.mfc-legend {
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.mfc-legend-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  margin-right: 0.3rem;
  vertical-align: middle;
  background: var(--accent);
}

.mfc-legend-dot-stress { background: #ff7a7a; }

.mfc-band-pin-stress {
  border-left-color: #ff7a7a;
  filter: drop-shadow(0 0 6px rgba(255, 122, 122, 0.55));
}

.mfc-band-pin-stress::before {
  background: #ff7a7a;
}

.mfc-band-pin-label-stress {
  background: #ff7a7a;
  color: #1a0505;
  bottom: -3.6rem;
}

.mfc-hint {
  margin-top: 0.2rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid rgba(120, 200, 255, 0.25);
  background: rgba(120, 200, 255, 0.07);
  color: color-mix(in srgb, var(--text) 85%, transparent 15%);
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.4;
}

@media (max-width: 860px) {
  .mfc-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.position-row-metrics {
  grid-template-columns: repeat(5, minmax(7.2rem, 1fr));
  margin-top: 0.55rem;
}

.field-compact {
  gap: 0.2rem;
}

.field-compact span {
  font-size: var(--fs-xs);
}

.field-compact input {
  min-height: 2rem;
  font-variant-numeric: tabular-nums;
}

.guardrails-details {
  margin-top: 0.6rem;
  overflow: hidden;
}


.guardrails-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem 0.65rem;
  margin-top: 0.85rem;
}

@media (max-width: 760px) {
  .guardrails-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .collateral-balance-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .collateral-balance-copy {
    white-space: normal;
  }

  .collateral-balance-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.field-dollar-hint {
  display: block;
  margin-top: -0.1rem;
  color: var(--cyan);
  font-size: var(--fs-2xs);
  font-weight: 600;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.intent-sub {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-size: var(--fs-2xs);
}

.intent-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted-strong);
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 0;
  min-width: 0;
}

.field-inline span {
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
}

.field-inline input {
  width: 100%;
  min-width: 4rem;
  min-height: 1.8rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.field-unit {
  color: var(--muted) !important;
  font-size: var(--fs-xs) !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
}

.form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-span-2 {
  grid-column: span 2;
}

.field {
  display: grid;
  gap: 0.35rem;
  position: relative;
}

.field span {
  color: var(--muted-strong);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.field small {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 0.45rem 0.6rem;
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  transition-delay: 0s;
}

.field:hover small,
.field:focus-within small {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 1.5s;
}

.field input,
.field select,
.text-area {
  width: 100%;
  min-height: 2.4rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-strong);
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 500;
  transition:
    border-color 150ms ease,
    background-color 150ms ease;
}

.field input:hover,
.field select:hover,
.text-area:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.field input:focus,
.field select:focus,
.text-area:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: var(--surface-soft);
}

/* ── Number input spinners ── */
.field input[type="number"] {
  -moz-appearance: textfield;
}

.field input[type="number"]::-webkit-inner-spin-button,
.field input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.field input[type="number"]:hover {
  -moz-appearance: auto;
}

.field input[type="number"]:hover::-webkit-inner-spin-button,
.field input[type="number"]:hover::-webkit-outer-spin-button {
  -webkit-appearance: inner-spin-button;
  appearance: auto;
  opacity: 0.6;
  height: 1.6rem;
  cursor: pointer;
}

.field input[type="number"]:hover::-webkit-inner-spin-button:hover,
.field input[type="number"]:hover::-webkit-outer-spin-button:hover {
  opacity: 1;
}

/* Range slider dual-control */
.range-combo {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.6rem;
}

.range-combo input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  outline: none;
  cursor: pointer;
  border: none;
  min-height: unset;
  padding: 0;
}

html[data-theme="dark"] .range-combo input[type="range"] {
  background: var(--range-track);
}

.range-combo input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: grab;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.range-combo input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.range-combo input[type="range"]::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.05);
}

.range-combo input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: grab;
}

.range-combo .range-value {
  min-width: 3.2rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  background: var(--surface-tint);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.range-combo .range-value-input {
  width: 3.8rem;
  min-height: 1.7rem;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface-tint);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  transition: border-color 150ms ease, background 150ms ease;
}

.range-combo .range-value-input:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.range-combo .range-value-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: var(--surface-soft);
}

/* Hide spin buttons on range-value-input */
.range-value-input::-webkit-inner-spin-button,
.range-value-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.range-value-input { -moz-appearance: textfield; }

.text-area {
  min-height: 6rem;
  padding: 0.82rem 0.88rem;
  resize: vertical;
}

.inline-title-field {
  display: grid;
  gap: 0.35rem;
}

.inline-title-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inline-title-shell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.2rem;
  padding: 0 0.1rem 0 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.inline-title-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.inline-title-shell input {
  width: 100%;
  min-width: 0;
  min-height: 1.8rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-strong);
  font-size: 1.04rem;
  font-weight: 700;
  line-height: 1.1;
}

.inline-title-shell input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.inline-title-shell:focus-within {
  color: var(--accent);
  border-bottom-color: var(--accent-soft);
}

.inline-title-shell input:focus {
  outline: none;
  box-shadow: none;
}

body[data-page="setup"] [data-section] .section-label,
body[data-page="setup"] .disclosure-head .section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

body[data-page="setup"] [data-section] .section-label::before,
body[data-page="setup"] .disclosure-head .section-label::before {
  content: "";
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
  opacity: 0.82;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

body[data-page="setup"] [data-section="intent"] .section-label::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%231b58cf' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='10' r='7'/%3E%3Ccircle cx='10' cy='10' r='3'/%3E%3Ccircle cx='10' cy='10' r='0.8' fill='%231b58cf'/%3E%3C/svg%3E");
}

body[data-page="setup"] [data-section="treasury"] .section-label::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2322ddd9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='14' height='11' rx='2'/%3E%3Cpath d='M3 9h14'/%3E%3Cpath d='M7 13h3'/%3E%3C/svg%3E");
}

body[data-page="setup"] [data-section="guardrails"] .section-label::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%231cc4d0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 2.5l6 3v4.5c0 3.2-2.4 6-6 7.5-3.6-1.5-6-4.3-6-7.5V5.5l6-3Z'/%3E%3Cpath d='M7.5 10l1.8 1.8 3.2-3.6'/%3E%3C/svg%3E");
}

body[data-page="setup"] [data-section="advanced-rail"] .section-label::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23113d8f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='10' r='3'/%3E%3Cpath d='M10 3v4M10 13v4M3 10h4M13 10h4M5.05 5.05l2.83 2.83M12.12 12.12l2.83 2.83M5.05 14.95l2.83-2.83M12.12 7.88l2.83-2.83'/%3E%3C/svg%3E");
}

body[data-page="setup"] [data-section="advanced-market"] .section-label::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23113d8f' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 14l4-4 3 2.5 7-7'/%3E%3Cpath d='M14 5.5h3v3'/%3E%3C/svg%3E");
}

.choice-block {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.choice-head span {
  display: block;
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 800;
}

.choice-head p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.choice-grid {
  display: grid;
  gap: 0.35rem;
}

.choice-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-card {
  display: block;
}

.choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-card-body {
  display: grid;
  gap: 0.1rem;
  align-content: center;
  text-align: center;
  min-height: 100%;
  padding: 0.55rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-strong);
  cursor: pointer;
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

.choice-card-body:hover {
  border-color: var(--line-strong);
  background: var(--surface-tint);
}

.choice-card input:checked + .choice-card-body {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.choice-card input:checked + .choice-card-body strong,
.choice-card input:checked + .choice-card-body .choice-eyebrow,
.choice-card input:checked + .choice-card-body .choice-copy {
  color: #fff;
}

.choice-card-body strong {
  font-size: 0.82rem;
}

.choice-copy {
  display: block;
  margin: 0;
  font-size: var(--fs-2xs);
  line-height: 1.34;
  color: var(--muted);
}

.choice-card-compact .choice-card-body {
  min-height: 0;
  padding: 0.4rem 0.55rem;
  gap: 0.06rem;
}

.choice-card-compact .choice-card-body strong {
  font-size: 0.78rem;
}

.toggle-stack {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.toggle-row {
  display: block;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-row span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.6rem;
  row-gap: 0.12rem;
  align-items: start;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-strong);
  cursor: pointer;
  position: relative;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.toggle-row span:hover {
  background: var(--surface-tint);
  border-color: var(--line-strong);
}

.toggle-row span::before {
  content: "";
  grid-row: 1 / span 2;
  width: 2.5rem;
  height: 1.35rem;
  margin-top: 0.05rem;
  border-radius: 0.7rem;
  background: var(--line-strong);
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle-row span::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  top: 0.8rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s ease;
  pointer-events: none;
}

.toggle-row input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.toggle-row input:checked + span::before {
  background: var(--accent);
}

.toggle-row input:checked + span::after {
  transform: translateX(1.15rem);
}

.toggle-row strong,
.toggle-row small {
  grid-column: 2;
}

.toggle-row small {
  color: var(--muted);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 0.72rem;
  line-height: 1.5;
  transition:
    max-height 160ms ease,
    opacity 160ms ease,
    margin-top 160ms ease;
}

.toggle-row:hover small,
.toggle-row:focus-within small,
.toggle-row input:checked + span small {
  max-height: 4rem;
  margin-top: 0.08rem;
  opacity: 1;
}

.disclosure {
  overflow: hidden;
}

.disclosure-head {
  display: flex;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  transition: opacity 200ms ease;
}

.disclosure-head:hover {
  opacity: 0.8;
}

.disclosure-head::-webkit-details-marker {
  display: none;
}

.disclosure-head::after {
  content: "+";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  flex: 0 0 auto;
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  transition: transform 200ms ease, background-color 200ms ease;
}

.disclosure[open] .disclosure-head::after {
  content: "-";
  transform: none;
  background: var(--accent-soft);
  color: var(--accent);
}

.disclosure[open] .disclosure-head {
  margin-bottom: 1rem;
}

.sticky-panel {
  position: sticky;
  top: 2rem;
}

.visual-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  border: 0;
  background: var(--surface-soft);
  box-shadow: none;
}

.visual-mark.is-fallback {
  border-radius: 999px;
  background: var(--surface-emphasis);
}

.visual-mark-image {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
}

.visual-mark-md {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
}

.visual-mark-sm {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
}

.entity-inline {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  width: 100%;
}

.entity-copy {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.entity-copy strong,
.entity-copy span {
  display: block;
}

.entity-copy strong,
.entity-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-copy span {
  color: var(--muted);
  font-size: 0.88rem;
}

.token-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  gap: 0.36rem;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-strong);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

.token-chip .visual-mark {
  background: transparent;
  border-radius: 50%;
}

.token-chip-label {
  min-width: 0;
  line-height: 1.08;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-grid {
  display: grid;
  gap: 0.85rem;
}

.route-card {
  position: relative;
  padding: 0.2rem 0 0.2rem 0.85rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.route-grid .route-card + .route-card {
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.route-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.1rem;
  bottom: 0.1rem;
  width: 2px;
  border-radius: 999px;
  background: var(--line-strong);
}

.route-card-primary::before {
  background: var(--accent);
}

.route-card-backup::before {
  background: rgba(71, 215, 232, 0.72);
}

.route-card-title {
  display: grid;
  gap: 0.52rem;
  min-width: 0;
}

.route-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.route-role {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 1.15rem;
  padding: 0 0.38rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.route-card-backup .route-role {
  background: rgba(71, 215, 232, 0.12);
  color: var(--cyan);
}

.route-card-head,
.scenario-band-head,
.saved-card-head,
.log-card-head,
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.route-score,
.state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 1.3rem;
  padding: 0.1rem 0.45rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  font-size: var(--fs-2xs);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-card-meta,
.scenario-band-meta,
.list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  margin-top: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.route-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.route-metrics > div,
.scenario-band-grid > div {
  min-width: 0;
}

.route-metrics strong,
.scenario-band-grid strong {
  margin-top: 0.25rem;
}

.route-card-copy {
  margin: 0.86rem 0 0;
  padding-top: 0.86rem;
  border-top: 1px solid var(--line);
}

.list-stack,
.scenario-band-stack {
  display: grid;
  gap: 0;
}

.list-row {
  padding: 0.65rem 0.5rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  transition: background-color 200ms ease;
}

.list-row:hover {
  background: var(--surface-tint);
}

.list-meta {
  justify-content: flex-end;
  margin-top: 0;
}

.saved-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.55rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  transition: background-color 200ms ease;
}

.saved-row:hover {
  background: var(--surface-tint);
}

.saved-row p {
  margin: 0.2rem 0 0;
  font-size: 0.74rem;
}

.saved-card-meta span {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  max-width: 100%;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.scenario-band {
  padding: 0.75rem 0.5rem;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  transition: background-color 200ms ease;
}

.scenario-band:hover {
  background: var(--surface-soft);
}

.scenario-band-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.6rem;
}

.scenario-band-grid span {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scenario-band-grid strong {
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.empty-panel {
  display: grid;
  gap: 0.8rem;
  min-height: 180px;
  align-content: center;
  background: var(--surface-soft);
}

.log-card,
.note-card {
  background: transparent;
  padding: 0.5rem 0 0.5rem 0.65rem;
  border-left: 2px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.log-card[data-state="Observe"] { border-left-color: var(--cyan); }
.log-card[data-state="Maintain"] { border-left-color: var(--mint); }
.log-card[data-state="BuildBuffer"] { border-left-color: var(--amber); }
.log-card[data-state="DeRisk"] { border-left-color: var(--violet); }
.log-card[data-state="StressLockdown"] { border-left-color: var(--rose); }

#saved-scenarios {
  gap: 0;
}

.saved-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.3rem 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  align-items: center;
}

.saved-card-head {
  grid-column: 1;
}

.saved-card-meta {
  grid-column: 1;
}

.saved-card .action-cluster {
  grid-column: 2;
  grid-row: 1 / -1;
}

.saved-card:last-child {
  border-bottom: 0;
}

.saved-card p,
.saved-card-head p {
  margin: 0.2rem 0 0;
  overflow-wrap: anywhere;
}

.delta {
  display: inline-flex;
  align-items: center;
  margin-top: 0.45rem;
  min-height: 1.5rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 800;
}

.delta.positive {
  background: var(--mint-soft);
  color: var(--mint);
}

.delta.negative {
  background: var(--rose-soft);
  color: var(--rose);
}

.delta.neutral {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.review-summary {
  display: grid;
  gap: 0.4rem;
  padding: 0.7rem 0.8rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-strong);
}

.review-hero {
  display: grid;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-strong);
}

.review-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.review-hero-top strong {
  font-size: 1.3rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.review-progress {
  overflow: hidden;
  width: 100%;
  height: 0.38rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.review-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.85;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.review-hero-warn {
  background: var(--amber-soft);
}

.review-hero-good {
  background: var(--mint-soft);
}

.review-hero-neutral {
  background: var(--accent-soft);
}

.review-summary-good {
  background: var(--mint-soft);
}

.review-summary-warn {
  background: var(--amber-soft);
}

.review-summary-neutral {
  background: var(--accent-soft);
}

.review-badge,
.review-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.55rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-badge {
  border: 0;
  gap: 0.32rem;
}

.badge-icon {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
}

.review-badge-good {
  background: var(--mint-soft);
  color: var(--mint);
}

.review-badge-warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.review-badge-neutral {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.review-flag {
  background: transparent;
  color: var(--amber);
  flex: 0 0 auto;
}

.operator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(280px, 0.86fr);
  gap: 1.2rem;
  align-items: start;
  margin-top: 0.8rem;
}

.operator-stack {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
}

.operator-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1rem;
  margin-top: 0;
  padding-top: 0.15rem;
  border-top: 0;
}

.operator-fact {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.05rem 0 0.55rem;
  border-bottom: 1px solid var(--line);
}

.operator-fact span {
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.operator-fact strong {
  margin: 0.05rem 0 0;
  font-size: 1rem;
  line-height: 1.1;
}

.operator-fact p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.review-list-shell {
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.review-list {
  display: grid;
  gap: 0;
}

.review-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.7rem;
  min-width: 0;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
  background: transparent;
}

.review-item.is-first {
  border-top: 0;
  padding-top: 0;
}

.review-item input {
  position: static;
  opacity: 1;
  pointer-events: auto;
}

.review-check {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  flex: 0 0 auto;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.review-check:hover {
  box-shadow: inset 0 0 0 1.5px rgba(107, 151, 255, 0.42);
}

.review-check:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 1.5px rgba(107, 151, 255, 0.42),
    0 0 0 3px rgba(107, 151, 255, 0.14);
}

.review-check:checked,
.review-item.is-done .review-check {
  border-color: transparent;
  background:
    center / 0.7rem 0.7rem no-repeat
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.4 6.4 11.4 12.6 4.8' fill='none' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2'/%3E%3C/svg%3E"),
    var(--accent);
  box-shadow: none;
}

.review-copy {
  display: grid;
  gap: 0.24rem;
  min-width: 0;
}

.review-copy strong,
.review-copy small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.review-copy small {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.review-item.is-done {
  background: transparent;
}

.review-item.is-done .review-copy small {
  color: var(--muted-strong);
}

.operator-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.operator-form-shell {
  padding-top: 0.4rem;
  border-top: 1px solid var(--line);
}

.operator-actions {
  padding-top: 0.45rem;
}

.review-flag {
  width: 1.25rem;
  height: 1.25rem;
  min-height: auto;
  padding: 0;
  border-radius: 0;
  font-size: 0;
  position: relative;
  background: transparent;
  color: var(--warning);
  cursor: help;
  align-self: start;
  margin-top: 0.18rem;
  filter: none;
}

.review-flag svg {
  width: 1.25rem;
  height: 1.25rem;
}

.review-flag::after {
  content: attr(data-tooltip);
  position: absolute;
  right: -0.25rem;
  bottom: calc(100% + 0.45rem);
  min-width: max-content;
  max-width: 18rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition:
    opacity 150ms ease,
    transform 150ms ease;
  z-index: 10;
}

.review-flag:hover::after,
.review-flag:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.state-panel {
  display: grid;
  gap: 0.45rem;
  padding: 0 0 0.6rem;
  border-bottom: 1px solid var(--line);
}

.state-panel-prominent {
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.3rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-strong);
}

.state-panel-prominent p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

body[data-page="results"] #results-route {
  padding-top: 0.05rem;
}

.state-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.state-panel-head span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.state-panel-head strong {
  display: block;
  margin-top: 0.1rem;
  font-size: clamp(0.95rem, 1.1vw, 1.15rem);
  line-height: 1.1;
}

.section-footnote {
  margin: 0.55rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.section-footnote strong {
  color: var(--text-strong);
}

.readback-list {
  display: grid;
  gap: 0;
}

.live-monitor-stack {
  display: grid;
  gap: 0.75rem;
}

.live-feed-list {
  display: grid;
  gap: 0;
}

.live-feed-row {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.live-feed-list .live-feed-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.live-feed-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.live-feed-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.live-feed-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.live-feed-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
}

.live-feed-stats strong {
  color: var(--text-strong);
  font-size: 0.82rem;
}

.live-feed-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.live-feed-disclosure {
  margin-top: 0.6rem;
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
}

.live-feed-disclosure summary {
  cursor: pointer;
  color: var(--text-strong);
  font-size: 0.78rem;
  font-weight: 700;
  list-style: none;
}

.live-feed-disclosure summary::-webkit-details-marker {
  display: none;
}

.live-feed-disclosure summary::after {
  content: " +";
  color: var(--muted);
}

.live-feed-disclosure[open] summary::after {
  content: " -";
}

.live-feed-disclosure .live-feed-list {
  margin-top: 0.55rem;
}

.readback-row {
  display: grid;
  gap: 0.2rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}

.readback-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.readback-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.readback-row strong {
  margin: 0;
  font-size: 0.9rem;
}

.readback-row p {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.5;
}

.readback-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 1.28rem;
  padding: 0 0.48rem;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.readback-row-good strong {
  color: var(--mint);
}

.fact-list {
  display: grid;
  gap: 0;
}

.fact-list-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.4rem;
  margin-top: 0.6rem;
}

.fact-row-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 2rem;
}

.fact-row-grid .fact-row {
  padding: 0.5rem 0;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  background: transparent;
}

.fact-row {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
  padding: 0.55rem 0.5rem 0.6rem;
  border-top: 1px solid var(--line);
}

.fact-list .fact-row:first-child,
.fact-list-compact .fact-row:nth-child(-n + 2) {
  padding-top: 0;
  border-top: 0;
}

.fact-row span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fact-row-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.compare-header {
  margin-bottom: 0.3rem;
}

.fact-row strong {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.fact-row p {
  margin: 0.08rem 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

/* State-specific border-bottom accent for scenario bands */
[data-state="Observe"] {
  border-bottom-color: rgba(71, 215, 232, 0.18);
}

[data-state="Maintain"] {
  border-bottom-color: rgba(39, 212, 160, 0.16);
}

[data-state="BuildBuffer"] {
  border-bottom-color: rgba(243, 162, 39, 0.18);
}

[data-state="DeRisk"] {
  border-bottom-color: rgba(129, 102, 255, 0.20);
}

[data-state="StressLockdown"] {
  border-bottom-color: rgba(236, 93, 119, 0.20);
}

[data-state="Observe"] .state-badge {
  background: var(--cyan-soft);
  color: var(--cyan);
  border-color: var(--cyan-soft);
}

[data-state="Maintain"] .state-badge {
  background: var(--mint-soft);
  color: var(--mint);
  border-color: var(--mint-soft);
}

[data-state="BuildBuffer"] .state-badge {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber-soft);
}

[data-state="DeRisk"] .state-badge {
  background: var(--violet-soft);
  color: var(--violet);
  border-color: var(--violet-soft);
}

[data-state="StressLockdown"] .state-badge {
  background: var(--rose-soft);
  color: var(--rose);
  border-color: var(--rose-soft);
}

/* ─── Setup toolbar & LTV bar ─── */

.setup-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.setup-toolbar-actions {
  display: flex;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.setup-toolbar-actions .button {
  min-height: 1.85rem;
  padding: 0 0.6rem;
  font-size: 0.74rem;
}

.setup-ltv-bar {
  margin: 0 0 0.8rem;
}

.setup-ltv-inline {
  margin: 0 0 0.65rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.policy-ltv-strip-large {
  position: relative;
  height: 28px;
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  overflow: visible;
  margin: 0;
}

.policy-ltv-strip-large .policy-ltv-zone {
  height: 100%;
  border-radius: 6px;
  font-size: 0.6rem;
  font-weight: 700;
}

.policy-ltv-strip-large .policy-ltv-marker {
  top: -6px;
  bottom: -6px;
  width: 2px;
}

.policy-ltv-strip-large .policy-ltv-marker::after {
  font-size: 0.6rem;
  bottom: calc(100% + 4px);
}

/* ─── Draggable LTV handles ─── */

.policy-ltv-interactive {
  overflow: visible;
  cursor: default;
}

.ltv-handle {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 14px;
  margin-left: -7px;
  z-index: 5;
  cursor: ew-resize;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--ltv-handle-bg);
  border: 2px solid var(--ltv-handle-border);
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.ltv-handle::before {
  content: "";
  width: 2px;
  height: 10px;
  border-radius: 1px;
  background: var(--ltv-handle-border);
}

.ltv-handle:hover {
  background: var(--ltv-handle-hover);
  transform: scaleX(1.15);
  box-shadow: 0 0 8px var(--ltv-handle-glow);
}

.ltv-handle.is-dragging {
  background: var(--ltv-handle-drag);
  transform: scaleX(1.3);
  box-shadow: 0 0 14px var(--ltv-handle-glow-strong);
  z-index: 10;
}

.policy-ltv-strip-large.is-dragging {
  user-select: none;
}

.ltv-handle-label {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--fs-2xs);
  font-weight: 800;
  color: var(--ltv-label);
  white-space: nowrap;
  opacity: 1;
  pointer-events: none;
}

.ltv-handle.is-dragging .ltv-handle-label {
  color: #fff;
}

/* Make the strip taller when interactive for better grab targets */
.policy-ltv-interactive {
  height: 36px;
  margin-bottom: 1rem;
}

/* ─── Interactive affordances ─── */

/* All buttons and links get pointer and lift on hover */
a.button, button.button, a.module-card, a[data-nav],
.choice-card, .toggle-row, .saved-card [data-action],
[data-review-check], [data-theme-value] {
  cursor: pointer;
}

/* Informational badges — no cursor, flatter look */
.hero-chip, .state-badge, .metric-card, .note-card,
.policy-canvas-metric, .fact-row, .readback-row {
  cursor: default;
}

/* Clickable cards get a subtle hover lift */
a.module-card:hover, .saved-card [data-action]:hover {
  transform: translateY(-1px);
}

.page-header-compact {
  padding-bottom: 0.1rem;
  margin-bottom: 0.15rem;
}

.page-header-compact .inline-title-shell {
  border-bottom: 1px dashed transparent;
  transition: border-color 0.2s ease;
}

.page-header-compact .inline-title-shell:hover {
  border-bottom-color: var(--line-strong);
}

.page-header-compact .inline-title-shell:focus-within {
  border-bottom-color: var(--accent);
  border-bottom-style: solid;
}

.page-header-compact .inline-title-shell input {
  font-size: 0.98rem;
  font-weight: 700;
  font-family: "Sora", "Manrope", sans-serif;
  letter-spacing: -0.03em;
}

/* ─── Results hero (compact) ─── */

.results-glance-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.results-glance-title {
  flex: 1 1 auto;
  min-width: 0;
}

.results-glance-title h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.results-glance-title .surface-copy {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.3;
}

.results-glance-chips {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.results-glance-action {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-xs);
  border-left: 3px solid var(--accent);
  background: var(--bg-strong);
  flex: 0 1 auto;
  max-width: 420px;
  min-width: 0;
}

.results-glance-action-text {
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.results-glance-action-amber { border-left-color: var(--amber); }
.results-glance-action-rose { border-left-color: var(--rose); }

/* Results metric grid — compact like workspace */
.results-glance-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 0.8fr 0.7fr 0.8fr;
  align-items: center;
  gap: 0.6rem;
  padding-top: 0.45rem;
  margin-top: 0.4rem;
  border-top: 1px solid var(--line);
}

.rg-cell {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.rg-label {
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.rg-cell strong {
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.rg-sub {
  color: var(--muted);
  font-size: var(--fs-2xs);
}

/* legacy alias kept for mobile breakpoint */
.results-hero-action-amber {
  border-left-color: var(--amber);
}

/* Recommendation block */
.recommendation-list {
  display: grid;
  gap: 0.35rem;
}

.recommendation-list-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.recommendation-list-inline .recommendation-item {
  flex: 1 1 auto;
  min-width: 0;
}

.recommendation-item {
  margin: 0;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-xs);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.5;
  border-left: 3px solid var(--muted);
  background: var(--surface-soft);
}

.recommendation-mint {
  border-left-color: var(--mint);
  color: var(--mint);
}

.recommendation-amber {
  border-left-color: var(--amber);
  color: var(--amber);
}

.recommendation-rose {
  border-left-color: var(--rose);
  color: var(--rose);
}

/* ─── Visual components ─── */

/* LTV Gauge (arc) */
.ltv-gauge {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0;
  margin-bottom: 0.4rem;
}

.ltv-gauge svg {
  flex: 0 0 auto;
}

.ltv-gauge-labels {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.ltv-gauge-labels strong {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: "Sora", "Manrope", sans-serif;
  line-height: 1;
  letter-spacing: -0.03em;
}

.ltv-gauge-labels span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ltv-gauge-labels p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Health ring large */
.health-ring-block {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
}

.health-ring-block .health-ring {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
}

/* State flow diagram */
.state-flow {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.6rem 0;
  overflow-x: auto;
}

.state-flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  min-width: 72px;
  text-align: center;
  transition: background 200ms, box-shadow 200ms;
  position: relative;
  z-index: 1;
}

.state-flow-node strong {
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.state-flow-node span {
  font-size: var(--fs-2xs);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.state-flow-node.is-active {
  background: color-mix(in srgb, var(--flow-color, var(--accent)) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--flow-color, var(--accent)) 25%, transparent);
}

.state-flow-node[data-flow-state="Observe"] { --flow-color: var(--cyan); }
.state-flow-node[data-flow-state="Maintain"] { --flow-color: var(--mint); }
.state-flow-node[data-flow-state="BuildBuffer"] { --flow-color: var(--amber); }
.state-flow-node[data-flow-state="DeRisk"] { --flow-color: var(--violet); }
.state-flow-node[data-flow-state="StressLockdown"] { --flow-color: var(--rose); }

.state-flow-node .flow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--flow-color, var(--muted));
  opacity: 0.5;
}

.state-flow-node.is-active .flow-dot {
  opacity: 1;
  box-shadow: 0 0 6px var(--flow-color, var(--accent));
}

.state-flow-arrow {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0 0.25rem;
  color: var(--muted);
  opacity: 0.3;
}

.state-flow-arrow svg {
  width: 18px;
  height: 18px;
}

/* Stress ladder sparkline */
.stress-spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 48px;
  padding: 0.6rem 0.5rem;
}

.stress-spark-bar {
  flex: 1;
  min-width: 0;
  border-radius: var(--radius-pill) var(--radius-pill) 0 0;
  background: var(--accent);
  opacity: 0.85;
  transition: opacity 200ms, background 200ms;
  position: relative;
}

.stress-spark-bar:hover {
  opacity: 1;
}

.stress-spark-bar[data-spark-state="Observe"] { background: var(--cyan); }
.stress-spark-bar[data-spark-state="Maintain"] { background: var(--mint); }
.stress-spark-bar[data-spark-state="BuildBuffer"] { background: var(--amber); }
.stress-spark-bar[data-spark-state="DeRisk"] { background: var(--violet); }
.stress-spark-bar[data-spark-state="StressLockdown"] { background: var(--rose); }

.stress-spark-bar.is-selected {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--text-strong);
  border-radius: var(--radius-pill) var(--radius-pill) 0 0;
}

.spark-detail-popup {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-md);
  animation: fadeSlideIn 0.15s ease;
}

.spark-detail-popup[hidden] { display: none; }

.spark-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.spark-detail-head strong {
  font-size: var(--fs-base);
}

.spark-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem 0.6rem;
}

.spark-detail-grid div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.spark-detail-grid span {
  font-size: var(--fs-2xs);
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.spark-detail-grid strong {
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.spark-detail-explain {
  margin: 0.4rem 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.5;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sidebar mini gauge */
.sidebar-gauge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.sidebar-gauge svg {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
}

.sidebar-gauge-copy {
  display: grid;
  gap: 0.05rem;
}

.sidebar-gauge-copy strong {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--sidebar-active-text);
  font-family: "Sora", "Manrope", sans-serif;
}

.sidebar-gauge-copy span {
  font-size: var(--fs-2xs);
  font-weight: 700;
  color: var(--sidebar-sub);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Scenario band visual enhancements */
.scenario-band-visual {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.8rem;
  align-items: start;
}

.scenario-mini-ring {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
}

/* Payout range bar */
.payout-range-bar {
  position: relative;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  overflow: hidden;
  margin: 0.4rem 0;
}

.payout-range-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--mint), var(--accent));
  transition: width 0.6s ease;
}

/* Policy viz card */
.policy-viz {
  display: grid;
  gap: 0.6rem;
  padding: 0.6rem 0;
}

.policy-ltv-strip {
  position: relative;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  overflow: hidden;
}

.policy-ltv-zone {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-2xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.85);
}

/* LTV zone colors — resolved via tokens, no per-theme overrides needed */
.policy-ltv-zone-safe {
  background: var(--ltv-zone-safe);
}

.policy-ltv-zone-target {
  background: var(--ltv-zone-target);
  border-left: 2px solid var(--ltv-zone-target-border);
  border-right: 2px solid var(--ltv-zone-target-border);
  color: var(--ltv-zone-target-text);
}

.policy-ltv-zone-warn {
  background: var(--ltv-zone-warn);
  border-left: 1px solid var(--ltv-zone-warn-border);
}

.policy-ltv-zone-danger {
  background: var(--ltv-zone-danger);
  border-left: 1px solid var(--ltv-zone-danger-border);
}

.policy-ltv-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  border-radius: 2px;
  background: var(--text-strong);
  z-index: 2;
  transition: left 0.4s ease;
}

.policy-ltv-marker::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 800;
  white-space: nowrap;
  color: var(--text-strong);
}

.policy-ltv-strip-labels {
  display: flex;
  justify-content: space-between;
  padding: 0.15rem 0.15rem 0;
}

.policy-ltv-strip-labels span {
  font-size: 0.52rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.position-row-6 {
  grid-template-columns: minmax(27rem, 1.9fr) repeat(5, minmax(6.35rem, 0.72fr));
}

/* Buffer runway bar */
.buffer-bar-shell {
  display: grid;
  gap: 0.25rem;
  padding: 0.3rem 0;
}

.buffer-bar {
  height: 10px;
  border-radius: 5px;
  background: var(--surface-soft);
  overflow: hidden;
}

.buffer-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}

.buffer-bar-fill.tone-good { background: var(--mint); }
.buffer-bar-fill.tone-warn { background: var(--amber); }
.buffer-bar-fill.tone-bad { background: var(--rose); }

.buffer-bar-labels {
  display: flex;
  justify-content: space-between;
}

.buffer-bar-labels span {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
}

/* Compare sparkline */
.compare-delta-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
}

.compare-delta-bar .bar-track {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  position: relative;
}

.compare-delta-bar .bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: var(--radius-pill);
}

.compare-delta-bar .bar-fill.positive { background: var(--mint); }
.compare-delta-bar .bar-fill.negative { background: var(--rose); }

.compare-delta-bar em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Workspace dashboard grid */
.dashboard-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.dash-cell {
  display: grid;
  gap: 0.5rem;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
}

.dash-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dash-cell-head span {
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Scenario band enhanced with mini ring */
.scenario-band-enhanced {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0.8rem;
  align-items: center;
}

.scenario-band-enhanced .scenario-band-content {
  min-width: 0;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    min-height: auto;
  }

  .sidebar-position {
    gap: 0;
  }
}

@media (max-width: 1080px) {
  body[data-page="setup"] .page-copy {
    white-space: normal;
  }

  .page-header,
  .page-tools,
  .section-head,
  .route-card-head,
  .live-feed-head,
  .saved-card-head,
  .log-card-head,
  .scenario-band-head,
  .saved-row,
  .list-row {
    flex-direction: column;
    align-items: stretch;
  }

  .content-grid-main,
  .content-grid-setup,
  .hero-layout,
  .live-hero-metrics,
  .hero-rail-row,
  .hero-metric-grid,
  .mini-grid,
  .module-grid,
  .module-grid-3,
  .workspace-coverage-grid,
  .fact-list-compact,
  .operator-grid,
  .operator-facts {
    grid-template-columns: 1fr;
  }

  .policy-canvas-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-tools {
    justify-items: start;
  }

  .scenario-band-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-metrics {
    grid-template-columns: 1fr;
  }

  .form-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .review-item .review-flag {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 1024px) {
  .content-grid-setup {
    grid-template-columns: 1fr;
  }

  body[data-page="setup"] .content-grid-setup {
    grid-template-columns: 1fr;
  }

  body[data-page="results"] .content-grid-main {
    grid-template-columns: 1fr;
  }

  .operator-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-main,
  .app-sidebar {
    padding: 0.75rem;
  }

  h1 {
    font-size: 1.35rem;
    max-width: none;
  }

  .brand-card,
  .surface {
    border-radius: var(--radius-sm);
  }

  .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-kpis,
  .form-grid-2,
  .form-grid-3,
  .choice-grid-2,
  .choice-grid-4,
  .scenario-band-grid,
  .operator-form-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: span 1;
  }

  .action-cluster,
  .route-inline,
  .hero-chip-row {
    width: 100%;
  }

  .review-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .review-item .review-flag {
    grid-column: 2;
    justify-self: start;
  }

  .button {
    width: 100%;
  }

  .policy-canvas {
    padding: 1rem;
  }
  .policy-canvas-head {
    flex-direction: column;
    align-items: stretch;
  }
  .policy-canvas-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .policy-canvas-actions {
    justify-content: stretch;
  }
  .policy-canvas-actions .button {
    flex: 1;
  }
  .results-glance-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .results-glance-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Micro-animations ── */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 112, 255, 0); }
  50% { box-shadow: 0 0 0 6px rgba(59, 112, 255, 0.12); }
}

.surface {
  animation: fadeSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.page-stack > *:nth-child(1) { animation-delay: 0s; }
.page-stack > *:nth-child(2) { animation-delay: 0.06s; }
.page-stack > *:nth-child(3) { animation-delay: 0.12s; }
.page-stack > *:nth-child(4) { animation-delay: 0.18s; }
.page-stack > *:nth-child(5) { animation-delay: 0.24s; }
.content-grid > *:nth-child(1) { animation-delay: 0.08s; }
.content-grid > *:nth-child(2) { animation-delay: 0.14s; }

.metric-card {
  transition: transform 0.15s ease;
}

.module-card {
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.button-primary:active {
  transform: scale(0.97);
}
.button-secondary:active {
  transform: scale(0.97);
}

.button[disabled] {
  opacity: 0.6;
  pointer-events: none;
}

.choice-card {
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.choice-card:hover {
  border-color: var(--line-strong);
}

.scenario-band {
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.scenario-band:hover {
  background: var(--surface-soft);
}

.saved-card {
  transition: background-color 0.2s ease;
}

/* Inline validation */
.field.field-error input,
.field.field-error select {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px var(--rose-soft);
}
.field.field-error small {
  color: var(--rose);
}

.field.field-warn input,
.field.field-warn select {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

/* Status line pulse */
.status-line[data-status="running"] {
  animation: pulseGlow 1.5s ease-in-out infinite;
}

/* Button spinner */
.btn-spinner {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
  vertical-align: middle;
}

.button.is-running {
  pointer-events: none;
}

@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

/* How it works (post-run) */
.ws-how-it-works {
  border-top: 1px solid var(--line);
  padding-top: 0.35rem;
}

.ws-how-it-works summary {
  cursor: pointer;
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  list-style: none;
  user-select: none;
}

.ws-how-it-works summary::-webkit-details-marker { display: none; }
.ws-how-it-works summary::before { content: "? "; }

.ws-step-list-compact {
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.ws-step-list-compact .ws-step p {
  font-size: var(--fs-2xs);
  margin: 0;
}

.ws-step-list-compact .ws-step strong {
  font-size: var(--fs-sm);
}

/* Focus states handled above in .field input:focus */

/* ── Onboarding hero ── */
/* ── Workspace dashboard (active run) ── */
.ws-dashboard {
  display: grid;
  gap: 0.75rem;
}

.ws-dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ws-dashboard-health {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.ws-dashboard-health strong {
  display: block;
  font-size: 1rem;
}

.ws-dashboard-health .surface-copy {
  margin: 0.1rem 0 0;
  font-size: 0.76rem;
}

.ws-dashboard-actions {
  display: flex;
  gap: 0.35rem;
}

/* Dashboard route chips */
.ws-route-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.ws-route-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--surface-soft);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.ws-route-chip em {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
}

.ws-route-chip-alt {
  opacity: 0.7;
}

/* Dashboard metrics row */
.ws-dash-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr 0.8fr 1.1fr;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.ws-dash-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  min-width: 0;
}

.ws-dash-cell strong {
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.ws-dash-ltv-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.ws-dash-ltv-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  flex: 0 0 auto;
}

.ws-dash-ltv-gauge .ws-dash-label {
  margin: -0.15rem 0 0;
}

.ws-dash-ltv-row svg {
  flex: 0 0 auto;
  display: block;
}

.ws-dash-ltv-row strong {
  display: block;
  font-size: 1rem;
}

.ws-dash-ltv-row .ws-dash-sub {
  display: block;
  margin-top: 0.05rem;
}


/* State flow — secondary strip below metrics */
.ws-dash-flow-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.ws-dash-flow-row .state-flow {
  font-size: 0.6rem;
}

@media (max-width: 960px) {
  .ws-dash-grid { flex-wrap: wrap; gap: 0.75rem; }
  .ws-dash-cell { min-width: 120px; }
  .ws-dash-flow-row { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .ws-dash-grid { flex-direction: column; gap: 0.65rem; }
  .ws-dash-flow-row { flex-direction: column; align-items: flex-start; }
  .ws-dashboard-head { flex-direction: column; align-items: flex-start; }
}

/* ── Workspace shared label ── */
.ws-dash-label {
  display: block;
  color: var(--muted);
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
}

.ws-dash-sub {
  color: var(--muted);
  font-size: var(--fs-xs);
}

/* ── Workspace risk column (left) ── */
.ws-risk-stack {
  display: grid;
  gap: 1rem;
}

.ws-risk-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.ws-risk-row strong {
  font-size: 0.82rem;
  margin-left: 0.15rem;
}

.ws-risk-payout-row {
  display: grid;
  gap: 0.25rem;
}

.ws-risk-payout-row strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

/* ── Workspace ops column (right) ── */
.ws-ops-stack {
  display: grid;
  gap: 1rem;
}

.ws-next-actions {
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.ws-ops-route-row {
  display: grid;
  gap: 0.5rem;
}

.ws-ops-route-card {
  display: grid;
  gap: 0.15rem;
}

.ws-saved-compact {
  display: grid;
  gap: 0;
}

.ws-saved-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
}

.ws-saved-item:last-child {
  border-bottom: none;
}

.ws-saved-item strong {
  font-size: 0.78rem;
}

.ws-saved-item span {
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

@media (max-width: 760px) {
  .ws-nav-bar { flex-direction: column; align-items: flex-start; }
  .ws-risk-row { flex-direction: column; gap: 0.3rem; }
}

/* ── Workspace onboarding ── */
.ws-onboard {
  display: grid;
  gap: 1rem;
}

.ws-onboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.ws-onboard-head h2 {
  font-size: 1.15rem;
}

.ws-onboard-sub {
  margin: 0.25rem 0 0;
  max-width: 44ch;
}

/* Position cards strip */
.ws-onboard-position {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.ws-pos-card {
  display: grid;
  gap: 0.15rem;
  padding: 0.65rem 0.7rem;
  background: var(--surface-tint);
  border-radius: 10px;
  border: 1px solid var(--line);
}

.ws-pos-card-btc {
  border-color: var(--cyan);
  background: rgba(71, 215, 232, 0.06);
}

.ws-pos-label {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ws-pos-value {
  font-size: clamp(0.95rem, 1.6vw, 1.2rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.ws-pos-ltv {
  color: var(--cyan);
}

.ws-pos-sub {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.ws-onboard-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

.ws-onboard-ltv {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
}

.ws-ltv-caption {
  text-align: center;
  display: grid;
  gap: 0.05rem;
}

.ws-ltv-caption strong {
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.ws-ltv-caption span {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.ws-onboard-what {
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

/* Step list */
.ws-step-list {
  display: grid;
  gap: 0;
}

.ws-step {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.ws-step:last-child {
  border-bottom: none;
}

.ws-step-num {
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cyan);
  color: #0c0c14;
  font-size: var(--fs-xs);
  font-weight: 800;
  flex-shrink: 0;
}

.ws-step strong {
  display: block;
  font-size: 0.8rem;
}

.ws-step p {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

@media (max-width: 960px) {
  .ws-onboard-position { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .ws-onboard-grid { grid-template-columns: 1fr; }
  .ws-onboard-position { grid-template-columns: repeat(2, 1fr); }
  .ws-dashboard-head { flex-direction: column; align-items: flex-start; }
}

/* ── Workspace: positions hub ── */

.ws-summary {
  display: grid;
  gap: 1rem;
}

.ws-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.ws-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
}

.ws-summary-cell {
  display: grid;
  gap: 0.25rem;
}

.ws-summary-cell strong {
  font-size: var(--fs-lg);
  letter-spacing: -0.03em;
}

.ws-summary-counts {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding-top: 0.15rem;
}

.ws-count-badge {
  font-size: var(--fs-2xs);
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ws-count-draft {
  background: var(--surface-emphasis);
  color: var(--muted-strong);
}

.ws-count-current {
  background: var(--accent-soft);
  color: var(--accent);
}

.ws-count-saved {
  background: var(--mint-soft);
  color: var(--mint);
}

/* ── Filter bar ── */

.ws-filter-bar {
  padding: 0;
  background: none;
  box-shadow: none;
}

.ws-filter-row {
  display: flex;
  gap: 0.3rem;
}

.ws-filter-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ws-filter-btn:hover {
  background: var(--surface-tint);
  color: var(--text);
}

.ws-filter-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.ws-filter-count {
  font-size: var(--fs-2xs);
  opacity: 0.7;
}

/* ── Position cards ── */

.ws-position-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
}

.ws-position-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.ws-position-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.ws-position-title strong {
  font-size: var(--fs-base);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-position-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ws-position-date {
  font-size: var(--fs-2xs);
  color: var(--muted);
}

.ws-type-badge {
  font-size: var(--fs-2xs);
  font-weight: 800;
  padding: 0.12rem 0.45rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.ws-badge-draft {
  background: var(--surface-emphasis);
  color: var(--muted-strong);
}

.ws-badge-current {
  background: var(--accent-soft);
  color: var(--accent);
}

.ws-badge-saved {
  background: var(--mint-soft);
  color: var(--mint);
}

.ws-position-metrics {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.6rem 1rem;
}

.ws-position-metrics > div {
  display: grid;
  gap: 0.1rem;
}

.ws-position-metrics strong {
  font-size: var(--fs-sm);
  letter-spacing: -0.02em;
}

.ws-dash-empty {
  color: var(--muted);
  opacity: 0.4;
}

.ws-position-actions {
  display: flex;
  gap: 0.35rem;
  padding-top: 0.2rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 1080px) {
  .ws-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .ws-summary-grid {
    grid-template-columns: 1fr;
  }
  .ws-summary-head {
    flex-direction: column;
  }
  .ws-filter-row {
    flex-wrap: wrap;
  }
  .ws-position-metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

.onboarding-hero {
  display: grid;
  gap: 0.85rem;
  padding: 0;
}

.onboarding-intro {
  max-width: 52ch;
}

.onboarding-intro h2 {
  font-size: clamp(1.1rem, 1.4vw, 1.4rem);
  letter-spacing: -0.04em;
}

.onboarding-intro .surface-copy {
  margin-top: 0.35rem;
  font-size: 0.84rem;
  line-height: 1.5;
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.onboarding-step {
  display: flex;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-xs);
  background: transparent;
  border: 1px solid var(--line);
  animation: fadeSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: border-color 150ms ease, background 150ms ease;
}

.onboarding-step:hover {
  border-color: var(--line-strong);
  background: var(--bg-strong);
}

.onboarding-step:nth-child(1) { animation-delay: 0.1s; }
.onboarding-step:nth-child(2) { animation-delay: 0.2s; }
.onboarding-step:nth-child(3) { animation-delay: 0.3s; }

.onboarding-step-icon {
  flex: 0 0 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

.onboarding-step-icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.onboarding-step:nth-child(2) .onboarding-step-icon {
  background: var(--mint-soft);
  color: var(--mint-bright);
}

.onboarding-step:nth-child(3) .onboarding-step-icon {
  background: var(--cyan-soft);
  color: var(--cyan-bright);
}

.onboarding-step-body {
  display: grid;
  gap: 0.3rem;
}

.onboarding-step-body strong {
  font-size: 0.78rem;
  letter-spacing: -0.01em;
}

.onboarding-step-body p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.button-lg {
  min-height: 2.65rem;
  padding: 0 1.5rem;
  font-size: 0.88rem;
  border-radius: 12px;
}

/* ── Scenario band improvements ── */
.scenario-band {
  position: relative;
  overflow: hidden;
}

.scenario-band::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
}

[data-state="Observe"] .scenario-band::before,
.scenario-band[data-state="Observe"]::before {
  background: rgba(71, 215, 232, 0.72);
}

.scenario-band[data-state="Maintain"]::before {
  background: rgba(27, 184, 154, 0.72);
}

.scenario-band[data-state="BuildBuffer"]::before {
  background: rgba(230, 161, 18, 0.72);
}

.scenario-band[data-state="DeRisk"]::before {
  background: rgba(129, 102, 255, 0.72);
}

.scenario-band[data-state="StressLockdown"]::before {
  background: rgba(240, 91, 114, 0.72);
}

/* ── Log card left accent ── */
.log-card {
  position: relative;
  overflow: hidden;
  padding-left: 1.3rem;
}

.log-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
}

.log-card[data-state="Observe"]::before { background: rgba(71, 215, 232, 0.72); }
.log-card[data-state="Maintain"]::before { background: rgba(27, 184, 154, 0.72); }
.log-card[data-state="BuildBuffer"]::before { background: rgba(230, 161, 18, 0.72); }
.log-card[data-state="DeRisk"]::before { background: rgba(129, 102, 255, 0.72); }
.log-card[data-state="StressLockdown"]::before { background: rgba(240, 91, 114, 0.72); }

/* ── State panel ── */
.state-panel-prominent::after {
  content: none;
}

/* ── Note card type icons ── */
.note-card {
  position: relative;
  padding-left: 1.1rem;
  border-left: 3px solid var(--line);
}

.note-card-warn {
  border-left-color: var(--amber);
}

.note-card-good,
.note-card-highlight {
  border-left-color: var(--accent);
}

/* ── Readback improvements ── */
.readback-row {
  position: relative;
  padding-left: 0.8rem;
  border-left: 2px solid var(--line);
}

.readback-row-warn {
  border-left-color: var(--amber);
}

.readback-row-good {
  border-left-color: var(--mint);
}

/* ── Disclosure/details polish ── */
.disclosure {
  transition: box-shadow 0.2s ease;
}

.disclosure[open] {
  box-shadow: var(--shadow-sm);
}

.disclosure-head {
  cursor: pointer;
  list-style: none;
  user-select: none;
  position: relative;
  padding-right: 2rem;
}

.disclosure-head::-webkit-details-marker {
  display: none;
}

.disclosure-head::after {
  content: "";
  position: absolute;
  right: 0.5rem;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.2s ease;
}

.disclosure[open] > .disclosure-head::after {
  transform: translateY(-35%) rotate(-135deg);
}

/* ── Empty state polish ── */
.empty-panel {
  text-align: center;
  padding: 1.5rem 1rem;
}

.empty-panel h3 {
  font-size: 0.95rem;
  margin: 0 0 0.3rem;
}

.empty-panel p {
  max-width: 38ch;
  margin: 0 auto;
  font-size: 0.8rem;
}

/* ── Health ring ── */
.metric-card-health {
  display: grid;
  gap: 0.5rem;
}

.health-ring-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.health-ring {
  width: 4.5rem;
  height: 4.5rem;
  flex: 0 0 auto;
}

.health-ring-label {
  display: grid;
  gap: 0.15rem;
}

.health-ring-label strong {
  font-size: 1rem;
  margin: 0;
}

.health-ring-label p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

/* ── Empty results hero ── */
.empty-results-hero {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  padding: 1.5rem 1rem;
  text-align: center;
}

.empty-results-hero h2 {
  font-size: 1.1rem;
}

.empty-results-hero .surface-copy {
  max-width: 40ch;
  margin: 0;
  font-size: 0.8rem;
}

.empty-results-icon {
  opacity: 0.5;
  margin-bottom: 0.15rem;
}

/* ── Responsive onboarding ── */
@media (max-width: 1080px) {
  .onboarding-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .onboarding-steps {
    grid-template-columns: 1fr;
  }

  .onboarding-step {
    gap: 0.65rem;
    padding: 0.85rem;
  }
}

/* ─── Setup two-column layout ─── */

.setup-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1rem;
  align-items: start;
}

.setup-main {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.setup-aside {
  display: grid;
  gap: 1rem;
  min-width: 0;
  position: sticky;
  top: 1rem;
}

.form-grid-1 {
  grid-template-columns: 1fr;
}

/* ─── Setup section title ─── */

.setup-section-title {
  margin: 0 0 0.75rem;
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}

/* ─── Segmented control (tab-bar selector) ─── */

.segmented-control {
  display: grid;
  gap: 0;
  background: var(--bg-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  position: relative;
}

.segmented-4 {
  grid-template-columns: repeat(4, 1fr);
}

.seg-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.seg-item input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.seg-item span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.4rem 0.5rem 0.35rem;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
  line-height: 1.3;
  gap: 0.1rem;
}

.seg-item span em {
  font-style: normal;
  font-size: 0.52rem;
  font-weight: 600;
  opacity: 0.6;
  letter-spacing: 0.02em;
}

.seg-item input:checked + span em {
  opacity: 0.85;
}

.seg-item:hover span {
  color: var(--text);
}

.seg-item input:checked + span {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.seg-item input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ─── Segmented hint (mode / priority description) ─── */

.seg-hint {
  margin: 0.35rem 0 0;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.4;
  min-height: 1.2em;
  transition: color 0.2s ease;
}

.seg-hint:not(:empty) {
  color: var(--text);
}

/* ─── Toggle stack (setup guardrails) ─── */

.toggle-stack {
  display: grid;
  gap: 0.35rem;
  margin-top: 1rem;
}

/* ─── Disclosure tweaks for setup aside ─── */

.setup-aside .disclosure {
  border: 1px solid var(--line);
}

.setup-aside .disclosure[open] {
  border-color: var(--line-strong);
}

.setup-aside .disclosure-head {
  padding: 0.65rem 0.75rem;
}

.setup-aside .form-grid {
  padding: 0 0.75rem 0.75rem;
}

.setup-aside .form-grid-1 > .form-grid {
  padding: 0;
}

@media (max-width: 960px) {
  .setup-layout {
    grid-template-columns: 1fr;
  }
  .setup-aside {
    position: static;
  }
  .strategy-controls {
    flex-direction: column;
  }
  .strategy-top {
    flex-direction: column;
    gap: 0.6rem;
  }
  .create-scope-panel {
    flex-direction: column;
    align-items: stretch;
  }
  .create-scope-toggle {
    width: 100%;
  }
  .create-scope-option span {
    min-width: 0;
  }
  .position-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .position-row-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .position-row-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .field-collateral {
    grid-column: 1 / -1;
  }
  .field-collateral-input {
    grid-template-columns: minmax(8rem, 0.74fr) minmax(14rem, 1.26fr);
  }
}

@media (max-width: 760px) {
  .state-flow {
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .state-flow-arrow { display: none; }
  .state-flow-node { min-width: 60px; padding: 0.4rem 0.5rem; }
  .ltv-gauge { flex-direction: column; align-items: flex-start; }
  .dashboard-trio { grid-template-columns: 1fr; }
  .scenario-band-enhanced { grid-template-columns: 36px 1fr; gap: 0.5rem; }
  .segmented-4 { grid-template-columns: repeat(2, 1fr); }
  .create-scope-toggle {
    grid-template-columns: 1fr;
  }
  .field-collateral-input { grid-template-columns: 1fr; }
  .collateral-asset-menu {
    width: min(calc(100vw - 2rem), 100%);
    min-width: 0;
  }
  .collateral-asset-option {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .collateral-asset-option-trailing {
    grid-column: 2;
    justify-items: start;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Dark theme scrollbar ── */
html[data-theme="dark"] {
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

html[data-theme="dark"] ::-webkit-scrollbar { width: 6px; height: 6px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: var(--radius-pill); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

/* ── Review checkmark uses accent ── */
html[data-theme="dark"] .review-check:checked,
html[data-theme="dark"] .review-item.is-done .review-check {
  background:
    center / 0.7rem 0.7rem no-repeat
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.4 6.4 11.4 12.6 4.8' fill='none' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2'/%3E%3C/svg%3E"),
    var(--accent);
}

/* ── Onboarding step icons use accent ── */
html[data-theme="dark"] .onboarding-step-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

html[data-theme="dark"] .onboarding-step:nth-child(2) .onboarding-step-icon {
  background: var(--mint-soft);
  color: var(--mint);
}

html[data-theme="dark"] .onboarding-step:nth-child(3) .onboarding-step-icon {
  background: var(--cyan-soft);
  color: var(--cyan);
}

/* ================================================================== */
/*  Live Execution UI                                                  */
/* ================================================================== */

/* ── Execution panel ── */

#live-execute {
  overflow: visible;
}

.exec-header-actions {
  display: flex;
  gap: 0.5rem;
}

.exec-portfolio {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-soft);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.exec-portfolio-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 140px;
}

.exec-portfolio-row span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.exec-portfolio-row strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-strong);
}

.exec-portfolio-ts {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ── Action card ── */

.exec-action-card {
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  padding: 1.25rem;
  background: var(--surface);
}

.exec-tone-neutral { border-left: 3px solid var(--muted); }
.exec-tone-accent  { border-left: 3px solid var(--accent); }
.exec-tone-warn    { border-left: 3px solid var(--amber); }
.exec-tone-danger  { border-left: 3px solid var(--rose); }

.exec-action-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.exec-action-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.exec-badge-neutral { background: var(--surface-soft); color: var(--muted); }
.exec-badge-accent  { background: var(--accent-soft); color: var(--accent); }
.exec-badge-warn    { background: var(--amber-soft); color: var(--amber); }
.exec-badge-danger  { background: var(--rose-soft); color: var(--rose); }

.exec-action-amount {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-strong);
  font-family: "Sora", sans-serif;
}

.exec-action-reason {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0.5rem 0;
}

.exec-action-route {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.exec-action-route span {
  color: var(--muted);
}

.exec-action-route strong {
  color: var(--text-strong);
}

.exec-action-error {
  color: var(--rose);
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  background: var(--rose-soft);
  border-radius: 0.375rem;
  margin: 0.5rem 0;
}

.exec-action-skip {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
  margin: 0.5rem 0;
}

.exec-action-note {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.5rem 0;
}

.exec-action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--muted);
}

.exec-action-cta {
  padding-top: 0.75rem;
}

.exec-sign-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  font-size: 0.88rem;
  font-weight: 700;
}

/* ── Risk checks ── */

.exec-risk-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  margin-top: 0.75rem;
}

.exec-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
}

.exec-check::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.exec-check-ok {
  color: var(--mint);
  background: var(--mint-soft);
}

.exec-check-ok::before {
  background: var(--mint);
}

.exec-check-warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.exec-check-warn::before {
  background: var(--amber);
}

/* ── Transaction history ── */

.exec-tx-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.exec-tx-row {
  display: grid;
  grid-template-columns: 20px 1fr auto auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}

.exec-tx-row:last-child {
  border-bottom: none;
}

.exec-tx-status {
  display: flex;
  align-items: center;
  justify-content: center;
}

.exec-tx-action {
  font-weight: 600;
  color: var(--text-strong);
}

.exec-tx-protocol {
  color: var(--muted);
  font-size: 0.75rem;
}

.exec-tx-link {
  color: var(--accent);
  text-decoration: none;
  font-family: monospace;
  font-size: 0.75rem;
}

.exec-tx-link:hover {
  text-decoration: underline;
}

.exec-tx-na {
  color: var(--muted);
  font-size: 0.75rem;
}

.exec-tx-time {
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

/* ── Dark theme overrides for execution UI ── */

html[data-theme="dark"] .exec-portfolio {
  background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .exec-action-card {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .exec-tone-neutral { border-left-color: rgba(255, 255, 255, 0.2); }
html[data-theme="dark"] .exec-tone-accent  { border-left-color: var(--accent); }
html[data-theme="dark"] .exec-tone-warn    { border-left-color: var(--amber); }
html[data-theme="dark"] .exec-tone-danger  { border-left-color: var(--rose); }

html[data-theme="dark"] .exec-tx-row {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

/* Market-implied scenario band (prediction-market consensus) */
.hero-chip-market {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-strong));
  color: var(--accent);
}
.hero-chip-warn {
  border-color: color-mix(in srgb, var(--warning, #d08a2a) 55%, var(--line));
  background: color-mix(in srgb, var(--warning, #d08a2a) 12%, var(--surface-strong));
  color: var(--warning, #d08a2a);
}

.market-band-surface {
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.market-band-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.market-band-head h3 {
  margin: 0;
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
}
.market-band-meta {
  font-size: var(--fs-2xs);
  color: var(--text-muted);
  text-transform: lowercase;
}
.market-band-copy {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.market-band-rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.market-band-row {
  display: grid;
  grid-template-columns: 2.2rem 6.5rem 1fr 5rem 5.5rem;
  align-items: center;
  gap: 0.55rem;
  font-size: var(--fs-xs);
}
.market-band-q {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
}
.market-band-price {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.market-band-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-strong));
  overflow: hidden;
}
.market-band-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 60%, transparent), var(--accent));
  border-radius: inherit;
}
.market-band-payout {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
}
.market-band-state {
  font-size: var(--fs-2xs);
  color: var(--text-muted);
  text-align: right;
}
.market-band-warnings {
  margin: 0.15rem 0 0;
  padding-left: 1.1rem;
  font-size: var(--fs-2xs);
  color: var(--text-muted);
}
@media (max-width: 640px) {
  .market-band-row {
    grid-template-columns: 2rem 1fr 5rem;
    row-gap: 0.15rem;
  }
  .market-band-price,
  .market-band-state {
    grid-column: 2 / -1;
    text-align: left;
  }
  .market-band-track {
    grid-column: 1 / -1;
  }
}
