/* Carlos · Terminal oceano. Shared tokens keep both themes complete. */
.topbar .mobile-brand { display: none; }
.main:focus { outline: none; }
.asset-logo { background: transparent !important; }
.asset-logo img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.page-view.no-entry { animation: none; }
.market-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 230px; gap: 12px; color: var(--muted); text-align: center; padding: 25px; }
.market-empty > svg { width: 30px; height: 30px; color: var(--accent); }
.market-empty p { max-width: 320px; font-size: 12px; }
.market-stats > .stat-card:first-child > .asset-logo { width: 40px; height: 40px; flex-basis: 40px; }
.market-update { font-size: 19px; }
.quote-unit { font-size: 12px; color: var(--muted); }
.loader-count { min-width: 44px; text-align: right; }
body.is-loading { overflow: hidden; }
@media (max-width: 720px) {
  .loader-topbar { position: sticky !important; top: 0; background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(12px); }
  .topbar { position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--line); }
}
@media (max-width: 960px) {
  .topbar .desktop-crumb { display: none; }
  .topbar .mobile-brand { display: inline-flex; gap: 8px; }
  .topbar .mobile-brand .brand-name { font-size: 24px; }
  .topbar .mobile-brand .brand-mark, .topbar .mobile-brand .brand-mark svg { width: 29px; height: 29px; flex-basis: 29px; }
}
@media (max-width: 520px) {
  .loader-footer .simulation-badge { font-size: 9px !important; }
}
:root {
  color-scheme: dark;
  --bg: #08151e;
  --surface: #0e202b;
  --surface2: #132b37;
  --surface3: #193642;
  --text: #edf6f8;
  --muted: #97adb8;
  --line: #213b47;
  --accent: #52e4c4;
  --accent-ink: #06271f;
  --accent-soft: #163b37;
  --violet: #b4a0fc;
  --violet-soft: #29273f;
  --positive: #63e5bf;
  --negative: #ff8b9d;
  --chart-grid: #203540;
  --chart-text: #8da7b4;
  --shadow: 0 16px 48px #00000014;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --radius: 22px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f7f8;
  --surface: #ffffff;
  --surface2: #edf4f5;
  --surface3: #e3eef0;
  --text: #142b37;
  --muted: #5c7480;
  --line: #dbe7eb;
  --accent: #077d6b;
  --accent-ink: #ffffff;
  --accent-soft: #dff4ee;
  --violet: #6950c5;
  --violet-soft: #eee9fc;
  --positive: #08795e;
  --negative: #c33d5b;
  --chart-grid: #e0e9ed;
  --chart-text: #647b87;
  --shadow: 0 16px 48px #24445108;
}

* { box-sizing: border-box; }
html { min-width: 280px; scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-width: 280px; color: var(--text); background: var(--bg); font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
svg { flex-shrink: 0; }
button svg, .nav-icon svg, .stat-icon svg { width: 20px; height: 20px; }
h1, h2, h3, h4, p { margin: 0; }
button, a, input, select, textarea { outline-offset: 4px; }
:focus-visible { outline: 3px solid var(--accent); }
::selection { color: var(--accent-ink); background: var(--accent); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.muted { color: var(--muted); }
.app-shell { display: flex; min-height: 100dvh; }
.workspace, .app-content { flex: 1; min-width: 0; }

/* Desktop navigation */
.sidebar { position: sticky; top: 0; display: flex; flex: 0 0 220px; flex-direction: column; width: 220px; height: 100dvh; padding: 35px 19px 25px; border-right: 1px solid var(--line); background: var(--bg); z-index: 10; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 43px; }
.sidebar .brand { padding-left: 11px; }
.brand-mark { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; color: var(--accent); }
.brand-mark svg { width: 36px; height: 36px; }
.brand-name { color: var(--text); font-size: 26px; font-weight: 760; letter-spacing: -1.3px; line-height: 1.05; }
.brand-subtitle { display: block; color: var(--muted); font-size: 9px; font-weight: 500; letter-spacing: 1.6px; line-height: 1.4; text-transform: uppercase; margin-top: 6px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 8px; margin-top: 49px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 49px; padding: 12px 15px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; font-weight: 550; transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease; }
.nav-item.active { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 10%, transparent); }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 21px; height: 21px; }
.nav-item .nav-arrow { margin-left: auto; width: 14px; height: 14px; }
.sidebar-footer { margin-top: auto; padding: 20px 13px 0; }
.sidebar-footer .info-note { margin-bottom: 18px; padding: 13px; font-size: 11px; line-height: 1.6; }
.sidebar-footer > p { color: var(--muted); font-size: 10px; line-height: 1.8; }
.sidebar-footer .footer-link { color: var(--muted); font-size: 11px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 94px; max-width: 1264px; margin: 0 auto; padding: 22px 32px; }
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb span { color: var(--text); }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 42px; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); font-size: 12px; font-weight: 550; white-space: nowrap; transition: background-color 150ms ease, border-color 150ms ease, transform 120ms var(--ease-out); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle:active { transform: scale(.97); }
.avatar { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 50%; color: var(--violet); border: 1px solid color-mix(in srgb, var(--violet) 25%, var(--line)); background: var(--violet-soft); font-size: 12px; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.main { max-width: 1264px; padding: 8px 32px 35px; margin: 0 auto; }
.page, .page-view { animation: page-in 220ms var(--ease-out) both; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 29px; }
.page-header .eyebrow { margin-bottom: 9px; }
.page-title { font-size: clamp(26px, 2.4vw, 35px); font-weight: 650; line-height: 1.2; letter-spacing: -1.25px; }
.page-description { margin-top: 10px; color: var(--muted); font-size: 13px; max-width: 610px; line-height: 1.65; }
.badge, .simulation-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 27px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--surface); font-size: 10px; font-weight: 500; white-space: nowrap; }
.simulation-badge { color: var(--violet); background: var(--violet-soft); border-color: transparent; }
.status-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--accent); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 12px 20px; border: 1px solid transparent; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 12px; line-height: 1.4; text-align: center; transition: transform 120ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease; }
.button.primary { color: var(--accent-ink); background: var(--accent); }
.button.secondary { color: var(--text); border-color: var(--line); background: var(--surface2); }
.button.ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button.small { min-height: 35px; padding: 8px 12px; border-radius: 8px; font-size: 11px; }
.button.danger { background: color-mix(in srgb, var(--negative) 12%, var(--surface)); color: var(--negative); border-color: color-mix(in srgb, var(--negative) 25%, transparent); }
.button.full, .full-width { width: 100%; }
.button:active:not(:disabled), .icon-button:active:not(:disabled) { transform: scale(.98); }
.button svg { width: 17px; height: 17px; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; transition: background-color 150ms ease, transform 120ms var(--ease-out); }

/* Content, balances, charts */
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.content-grid > * { min-width: 0; }
.primary-column, .secondary-column { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 22px 24px 0; }
.panel-title { font-size: 14px; font-weight: 600; letter-spacing: -.15px; }
.panel-subtitle { color: var(--muted); font-size: 11px; margin-top: 5px; }
.balance-panel { position: relative; padding: 24px 26px; overflow: hidden; background: linear-gradient(120deg, var(--surface2), var(--surface)); }
.balance-panel::after { position: absolute; content: ''; width: 170px; height: 170px; border: 1px solid color-mix(in srgb, var(--accent) 9%, transparent); border-radius: 50%; right: -50px; top: -90px; pointer-events: none; }
.balance-panel .stat-label { color: var(--muted); }
.balance-value { margin-top: 10px; color: var(--text); font-size: clamp(29px, 3.2vw, 40px); font-weight: 620; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.balance-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 13px; font-size: 11px; color: var(--muted); }
.balance-meta .positive { display: inline-flex; align-items: center; gap: 4px; }
.balance-panel .balance-icon { position: absolute; right: 25px; top: 26px; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; color: var(--accent); background: var(--surface); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; min-width: 0; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.stat-label { font-size: 11px; font-weight: 450; color: var(--muted); }
.stat-value { font-size: 21px; font-weight: 600; letter-spacing: -.65px; line-height: 1.2; font-variant-numeric: tabular-nums; margin-top: 7px; }
.stat-card small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.stat-icon { display: grid; place-items: center; width: 35px; height: 35px; flex: 0 0 35px; border-radius: 11px; color: var(--accent); background: var(--accent-soft); }
.stat-icon.violet { color: var(--violet); background: var(--violet-soft); }
.chart-panel { padding-bottom: 0; }
.chart-toolbar { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 18px; padding: 23px 24px 0; }
.asset-tabs { display: flex; align-items: center; gap: 6px; }
.asset-tab { display: inline-flex; align-items: center; gap: 7px; min-height: 35px; padding: 7px 9px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease; }
.asset-tab.active { color: var(--text); background: var(--surface2); border-color: var(--line); }
.asset-logo { display: inline-grid; place-items: center; flex: 0 0 25px; width: 25px; height: 25px; border-radius: 50%; color: #fff; font-size: 15px; font-weight: 650; line-height: 1; }
.asset-logo.btc { background: #ed9b2d; }
.asset-logo.eth { background: #6e7aca; }
.asset-logo.sol { background: #202c42; color: #83efd3; }
.chart-price { font-size: 26px; line-height: 1.15; font-weight: 600; letter-spacing: -.9px; font-variant-numeric: tabular-nums; margin-top: 21px; }
.chart-change { display: inline-flex; align-items: center; gap: 4px; margin-top: 7px; font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-change span { color: var(--muted); }
.segment-control { display: inline-flex; align-items: center; flex-shrink: 0; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.segment { min-width: 34px; min-height: 28px; padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 550; transition: color 150ms ease, background-color 150ms ease; }
.segment.active { background: var(--surface3); color: var(--text); }
.chart-container { position: relative; min-height: 260px; padding: 12px 16px 2px; margin-top: 10px; }
.chart-container svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-container svg text { font-family: inherit; font-size: 10px; fill: var(--chart-text); font-variant-numeric: tabular-nums; }
.chart-container canvas { display: block; width: 100%; }
.chart-container .chart-grid { stroke: var(--chart-grid); }
.chart-line { stroke: var(--accent); }
.chart-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 2px; padding: 15px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.chart-legend { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.legend-dot.violet { background: var(--violet); }
.legend-dot.negative { background: var(--negative); }
.assistant-panel { position: relative; padding: 24px; overflow: hidden; background: linear-gradient(165deg, var(--surface2), var(--surface) 70%); }
.assistant-panel .eyebrow { color: var(--violet); }
.assistant-art { display: block; width: 230px; height: 215px; margin: -3px auto -4px; object-fit: contain; filter: drop-shadow(0 12px 20px #00000015); }
.assistant-copy h2, .assistant-copy h3 { font-size: 20px; font-weight: 600; letter-spacing: -.6px; line-height: 1.3; }
.assistant-copy p { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.assistant-copy .button { width: 100%; margin-top: 21px; }
.assistant-tip { display: flex; align-items: flex-start; gap: 11px; margin-top: 20px; padding-top: 19px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.65; }
.tip-number { display: grid; place-items: center; width: 23px; height: 23px; flex: 0 0 23px; border: 1px solid var(--line); border-radius: 7px; color: var(--violet); font-size: 10px; font-weight: 600; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.action-card { display: flex; align-items: center; gap: 13px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-align: left; transition: border-color 150ms ease, background-color 150ms ease; }
.action-card h3, .action-card strong { display: block; font-size: 12px; font-weight: 600; }
.action-card p, .action-card small { display: block; color: var(--muted); font-size: 10px; margin-top: 5px; line-height: 1.6; }
.action-card > svg:last-child { margin-left: auto; width: 16px; color: var(--muted); }
.asset-list { padding: 0 23px 5px; }
.asset-row { display: flex; align-items: center; gap: 11px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.asset-row:last-child { border-bottom: 0; }
.asset-info { min-width: 0; }
.asset-info strong { display: block; font-size: 12px; font-weight: 550; }
.asset-info small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.asset-row .asset-price { margin-left: auto; text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.asset-row .asset-price small { display: block; margin-top: 5px; font-size: 9px; }
.sparkline { width: 58px; height: 27px; margin-left: auto; }
.sparkline svg { display: block; width: 100%; height: 100%; }
.page-section { margin-top: 28px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 15px; }
.section-heading h2, .section-heading h3 { font-size: 15px; font-weight: 600; letter-spacing: -.3px; }
.section-heading > p, .section-heading > span { color: var(--muted); font-size: 11px; }
.footer-note { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 28px; color: var(--muted); font-size: 10px; line-height: 1.7; text-align: center; }
.footer-note svg { width: 13px; height: 13px; }

/* Strategy selection and scenario controls */
.strategy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.strategy-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-height: 236px; padding: 23px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-align: left; transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease; }
.strategy-card.selected { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent); }
.strategy-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); margin-bottom: 19px; }
.strategy-icon svg { width: 22px; height: 22px; }
.strategy-card:nth-child(2) .strategy-icon { color: var(--violet); background: var(--violet-soft); }
.strategy-card h2, .strategy-card h3 { font-size: 16px; font-weight: 600; letter-spacing: -.4px; }
.strategy-card p { color: var(--muted); font-size: 11px; line-height: 1.7; margin-top: 9px; }
.strategy-card .selected-check { position: absolute; top: 20px; right: 20px; color: var(--accent); }
.strategy-tag { display: inline-flex; align-items: center; padding: 4px 7px; border-radius: 5px; background: var(--surface2); color: var(--muted); font-size: 9px; margin-top: 17px; }
.strategy-features { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 18px; color: var(--muted); font-size: 10px; }
.strategy-features span { padding: 4px 7px; background: var(--surface2); border-radius: 5px; }
.config-panel { padding: 25px; }
.config-panel > h2 { font-size: 16px; letter-spacing: -.4px; font-weight: 600; margin-bottom: 23px; }
.form-label { display: block; color: var(--text); font-size: 12px; font-weight: 550; margin-bottom: 11px; }
.form-label small { color: var(--muted); font-size: 10px; font-weight: 400; margin-left: 6px; }
.form-group { margin-bottom: 24px; }
.amount-field { display: flex; align-items: center; gap: 10px; min-height: 67px; padding: 13px 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.amount-field > span { color: var(--muted); font-size: 20px; }
.amount-field input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 25px; font-weight: 600; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.amount-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.amount-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.amount-preset { padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--surface); font-size: 10px; transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease; }
.amount-preset.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.range-input, input[type="range"] { width: 100%; height: 5px; accent-color: var(--accent); margin: 19px 0 8px; cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.info-note { display: flex; gap: 8px; align-items: flex-start; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface2); font-size: 11px; line-height: 1.7; }
.info-note svg { flex: 0 0 15px; width: 15px; height: 15px; margin-top: 2px; color: var(--violet); }
.scenario-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.scenario-tab { min-height: 43px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 11px; transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease; }
.scenario-tab.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.strategy-summary { padding: 24px; }
.strategy-summary h2, .strategy-summary h3 { font-size: 14px; font-weight: 600; margin-bottom: 22px; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.summary-row > span:first-child { color: var(--muted); }
.summary-row > strong, .summary-row > span:last-child { text-align: right; font-weight: 550; font-variant-numeric: tabular-nums; }
.summary-row:last-of-type { border-bottom: 0; }
.strategy-summary .button { width: 100%; margin-top: 20px; }
.strategy-summary .info-note { margin-top: 20px; }
select.form-input { appearance: auto; }

/* Operation replay and result */
.trade-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.trade-layout > * { min-width: 0; }
.trade-status { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; color: var(--accent); background: var(--accent-soft); border-radius: 7px; font-size: 10px; }
.trade-status.complete { color: var(--violet); background: var(--violet-soft); }
.timeline { display: flex; flex-direction: column; padding: 6px 23px 22px; }
.timeline-item { position: relative; display: flex; gap: 12px; padding-top: 22px; color: var(--muted); font-size: 11px; }
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 7px; top: 34px; bottom: -23px; width: 1px; background: var(--line); }
.timeline-dot { position: relative; z-index: 1; display: grid; place-items: center; flex: 0 0 15px; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); margin-top: 2px; }
.timeline-item.active .timeline-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-item.complete .timeline-dot { color: var(--accent-ink); border-color: var(--accent); background: var(--accent); }
.timeline-dot svg { width: 10px; height: 10px; }
.timeline-item h3, .timeline-item strong { display: block; font-size: 11px; font-weight: 550; color: var(--text); }
.timeline-item p { margin-top: 5px; font-size: 10px; line-height: 1.7; }
.timeline-item time { display: block; color: var(--muted); font-size: 9px; margin-top: 5px; }
.trade-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 18px 24px; border-top: 1px solid var(--line); }
.trade-controls .button { min-width: 110px; }
.trade-controls > p, .trade-controls > span { color: var(--muted); font-size: 10px; }
.progress-track { height: 5px; overflow: hidden; background: var(--surface3); border-radius: 99px; }
.progress-fill { width: 100%; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left center; transform: scaleX(0); transition: transform 240ms linear; }
.trade-progress { padding: 0 24px 22px; }
.trade-progress .progress-track { height: 4px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.result-grid > * { min-width: 0; }
.result-hero { padding: 30px; text-align: center; background: radial-gradient(ellipse at top, var(--accent-soft), transparent 70%), var(--surface); }
.result-hero.negative { background: radial-gradient(ellipse at top, color-mix(in srgb, var(--negative) 9%, var(--surface)), transparent 70%), var(--surface); color: var(--text); }
.outcome-label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 10px; color: var(--muted); background: var(--surface); }
.result-hero > h2 { margin-top: 21px; color: var(--muted); font-size: 12px; font-weight: 450; }
.result-amount { margin-top: 7px; font-size: clamp(35px, 4.2vw, 52px); font-weight: 600; letter-spacing: -2px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.result-hero > p { color: var(--muted); font-size: 11px; margin-top: 9px; line-height: 1.7; }
.result-hero .result-chart { margin-top: 24px; }
.result-detail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 25px; border-top: 1px solid var(--line); padding-top: 23px; }
.result-detail > div { padding: 0 12px; border-right: 1px solid var(--line); }
.result-detail > div:last-child { border-right: 0; }
.result-detail span { display: block; color: var(--muted); font-size: 10px; }
.result-detail strong { display: block; font-size: 14px; font-weight: 550; margin-top: 7px; font-variant-numeric: tabular-nums; }
.result-actions { display: flex; align-items: center; justify-content: center; gap: 11px; margin-top: 26px; }
.history-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 11px; }
.history-table th { padding: 16px 22px 13px; color: var(--muted); font-size: 10px; font-weight: 500; border-bottom: 1px solid var(--line); white-space: nowrap; }
.history-table td { padding: 17px 22px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-table tr:last-child td { border-bottom: 0; }
.history-table .asset-logo { width: 22px; height: 22px; flex-basis: 22px; font-size: 13px; margin-right: 7px; vertical-align: middle; }
.table-scroll { overflow-x: auto; }
.empty-state { padding: 48px 25px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.8; }
.empty-state svg { width: 33px; height: 33px; color: var(--violet); margin-bottom: 13px; }
.empty-state h2, .empty-state h3 { color: var(--text); font-size: 16px; font-weight: 550; margin-bottom: 7px; }
.empty-state .button { margin-top: 20px; }
.mobile-nav { display: none; }

/* Deliberate 15-second presentation; independent theme control stays usable. */
.loader-screen { position: fixed; inset: 0; z-index: 100; min-width: 280px; height: 100dvh; overflow-y: auto; background: var(--bg); color: var(--text); isolation: isolate; }
.loader-screen::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 73% 44%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 43%), radial-gradient(ellipse at 38% 100%, color-mix(in srgb, var(--violet) 4%, transparent), transparent 48%); }
.loader-topbar { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 18px; width: min(1140px, 100%); margin: 0 auto; min-height: 108px; padding: 25px 42px; }
.loader-brand { display: inline-flex; align-items: center; gap: 10px; }
.loader-theme { position: relative; z-index: 5; }
.loader-layout { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 30px; width: min(1060px, 100%); min-height: calc(100dvh - 192px); margin: 0 auto; padding: 28px 42px 48px; }
.loader-copy { position: relative; z-index: 2; }
.loader-kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 26px; color: var(--accent); font-size: 10px; font-weight: 650; letter-spacing: 2px; text-transform: uppercase; }
.loader-title { max-width: 530px; font-size: clamp(38px, 4.7vw, 65px); font-weight: 620; line-height: 1.08; letter-spacing: -2.7px; }
.loader-title span, .loader-title em { color: var(--accent); font-style: normal; }
.loader-description { color: var(--muted); font-size: 14px; line-height: 1.8; max-width: 390px; margin-top: 22px; }
.loader-scene { position: relative; display: grid; align-items: center; justify-items: center; min-width: 0; min-height: 400px; }
.loader-art { position: relative; z-index: 2; display: block; width: min(500px, 100%); max-height: 470px; object-fit: contain; filter: drop-shadow(0 30px 40px #00000018); animation: float 5s var(--ease-in-out) infinite; }
.loader-glow { position: absolute; width: 75%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 10%, transparent), transparent 68%); pointer-events: none; }
.orbit { position: absolute; width: 92%; aspect-ratio: 1; border: 1px solid color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 50%; transform: rotate(-18deg) scaleY(.7); pointer-events: none; }
.orbit::after { content: ''; position: absolute; right: 18%; top: 5%; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.loader-progress { max-width: 400px; margin-top: 34px; }
.loader-progress-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; margin-bottom: 12px; }
.loader-count { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.loader-progress .progress-track { height: 5px; background: var(--surface3); }
.loader-progress .progress-fill { background: var(--accent); }
.loader-steps { display: flex; flex-direction: column; gap: 15px; margin-top: 26px; }
.loader-step { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 11px; transition: color 160ms ease; }
.loader-step.active { color: var(--text); }
.loader-step.complete { color: var(--accent); }
.loader-step-icon { display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--surface); font-size: 9px; }
.loader-step-icon svg { width: 13px; height: 13px; }
.loader-step.active .loader-step-icon, .loader-step.complete .loader-step-icon { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); background: var(--accent-soft); }
.loader-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: min(1140px, 100%); min-height: 70px; margin: 0 auto; padding: 20px 42px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.loader-footer > span, .loader-footer > p { display: inline-flex; align-items: center; gap: 6px; }
.loader-footer svg { width: 13px; height: 13px; }

/* Native dialog, local interest and metrics. */
.interest-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 0; color: var(--text); border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: 0 32px 100px #00000040; }
.interest-dialog::backdrop { background: #061118a8; backdrop-filter: blur(8px); }
.dialog-body { padding: 34px; }
.dialog-close { position: absolute; right: 17px; top: 17px; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; color: var(--muted); background: var(--surface2); }
.dialog-close svg { width: 16px; height: 16px; }
.dialog-body > h2 { font-size: 25px; font-weight: 600; letter-spacing: -.9px; line-height: 1.25; margin: 13px 25px 12px 0; }
.dialog-body > p { font-size: 12px; line-height: 1.8; color: var(--muted); margin-bottom: 24px; }
.dialog-body form { display: flex; flex-direction: column; gap: 13px; }
.form-input { width: 100%; min-height: 45px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--bg); font-size: 12px; }
.form-input::placeholder { color: var(--muted); opacity: .8; }
.form-input:focus { border-color: var(--accent); }
.form-error { color: var(--negative); font-size: 11px; line-height: 1.6; }
.checkbox-label { display: flex; align-items: flex-start; gap: 9px; font-size: 10px; color: var(--muted); line-height: 1.8; }
.checkbox-label input { margin-top: 3px; accent-color: var(--accent); }
.dialog-body .info-note { margin: 17px 0 0; font-size: 10px; }
.toast { position: fixed; left: 50%; bottom: 30px; z-index: 150; display: flex; align-items: center; gap: 9px; width: max-content; max-width: calc(100vw - 32px); padding: 13px 18px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface2); box-shadow: 0 12px 48px #00000025; font-size: 12px; transform: translateX(-50%); }
.toast svg { width: 16px; height: 16px; color: var(--accent); }
.metrics-panel { padding: 25px; }
.metrics-panel h2 { font-size: 16px; font-weight: 600; }
.metrics-panel > p { margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.metric-grid > div { padding: 17px; background: var(--surface2); border-radius: 12px; border: 1px solid var(--line); }
.metric-grid span { display: block; color: var(--muted); font-size: 10px; }
.metric-grid strong { display: block; font-size: 23px; font-weight: 600; letter-spacing: -.7px; margin-top: 9px; font-variant-numeric: tabular-nums; }

@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover { color: var(--text); background: var(--surface); }
  .nav-item.active:hover { color: var(--accent); background: var(--accent-soft); }
  .button.primary:hover, .button:not(.secondary):not(.ghost):not(.danger):hover { box-shadow: 0 4px 18px color-mix(in srgb, var(--accent) 12%, transparent); background: color-mix(in srgb, var(--accent) 90%, white); }
  .button.secondary:hover, .button.ghost:hover, .theme-toggle:hover, .icon-button:hover { background: var(--surface3); border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
  .action-card:hover, .strategy-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
  .asset-tab:hover, .segment:hover, .amount-preset:hover, .scenario-tab:hover { color: var(--text); background: var(--surface2); }
  .amount-preset.active:hover, .scenario-tab.active:hover { color: var(--accent); background: var(--accent-soft); }
}

@media (min-width: 1600px) {
  .sidebar { flex-basis: 240px; width: 240px; padding-left: 28px; padding-right: 28px; }
  .topbar { min-height: 110px; }
  .main { padding-top: 15px; }
}

@media (max-width: 1180px) {
  .sidebar { flex-basis: 196px; width: 196px; padding-left: 13px; padding-right: 13px; }
  .main { padding-left: 25px; padding-right: 25px; }
  .topbar { padding-left: 25px; padding-right: 25px; }
  .content-grid, .trade-layout { grid-template-columns: minmax(0, 1fr) 265px; gap: 16px; }
  .result-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
  .assistant-panel { padding: 20px; }
  .assistant-art { width: 200px; height: 190px; }
  .assistant-copy h2, .assistant-copy h3 { font-size: 18px; }
  .stat-card { padding: 17px 16px; }
  .stat-value { font-size: 19px; }
  .strategy-card { padding: 20px; }
  .history-table td, .history-table th { padding-left: 17px; padding-right: 17px; }
}

@media (max-width: 960px) {
  .sidebar { display: none; }
  .topbar { min-height: 81px; }
  .topbar .brand.mobile-brand { display: inline-flex; }
  .main { padding-bottom: 108px; }
  .mobile-nav { position: fixed; z-index: 30; display: flex; align-items: stretch; justify-content: space-around; left: 0; right: 0; bottom: 0; min-height: 71px; padding: 7px 10px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(18px); }
  .mobile-nav-item { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 7px 4px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 9px; font-weight: 500; line-height: 1.3; }
  .mobile-nav-item svg { width: 20px; height: 20px; }
  .mobile-nav-item.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
  .toast { bottom: 92px; }
  .loader-layout { max-width: 900px; gap: 18px; padding-left: 35px; padding-right: 35px; }
  .loader-topbar, .loader-footer { padding-left: 35px; padding-right: 35px; }
  .loader-title { font-size: 50px; letter-spacing: -2px; }
}

@media (max-width: 720px) {
  .content-grid, .trade-layout, .result-grid { grid-template-columns: minmax(0, 1fr); }
  .content-grid .secondary-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .assistant-panel { padding: 21px; }
  .assistant-art { width: 185px; height: 165px; }
  .assistant-copy h2, .assistant-copy h3 { font-size: 19px; }
  .assistant-copy p { font-size: 11px; }
  .assistant-panel .assistant-tip { display: none; }
  .chart-container { min-height: 235px; }
  .trade-layout .secondary-column { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .strategy-grid { gap: 10px; }
  .strategy-card { min-height: 255px; padding: 17px; }
  .strategy-card h2, .strategy-card h3 { font-size: 14px; }
  .strategy-card p { font-size: 10px; }
  .strategy-icon { width: 35px; height: 35px; }
  .strategy-tag { font-size: 8px; }
  .strategy-summary .summary-row { padding-top: 12px; padding-bottom: 12px; }
  .loader-topbar { min-height: 85px; padding: 20px 25px; }
  .loader-layout { position: relative; grid-template-columns: 1fr; min-height: calc(100dvh - 152px); gap: 0; padding: 15px 25px 35px; }
  .loader-copy { display: contents; }
  .loader-kicker { justify-self: center; margin-bottom: 17px; font-size: 9px; }
  .loader-title { max-width: 450px; margin: 0 auto; font-size: 43px; text-align: center; letter-spacing: -1.9px; }
  .loader-description { max-width: 350px; margin: 14px auto 0; font-size: 12px; text-align: center; }
  .loader-scene { order: 1; min-height: 0; height: 230px; margin-top: 10px; }
  .loader-art { width: 265px; max-height: 260px; }
  .orbit { width: 250px; }
  .loader-glow { width: 250px; }
  .loader-progress { order: 2; width: 100%; max-width: 380px; margin: 10px auto 0; }
  .loader-steps { order: 3; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; max-width: 430px; margin: 25px auto 0; }
  .loader-step { flex-direction: column; align-items: center; gap: 8px; font-size: 9px; text-align: center; line-height: 1.6; }
  .loader-step-icon { width: 27px; height: 27px; flex-basis: 27px; }
  .loader-footer { justify-content: center; min-height: 67px; padding: 18px 25px; font-size: 9px; text-align: center; }
  .loader-footer > :last-child:not(:first-child) { display: none; }
}

@media (max-width: 520px) {
  :root { --radius: 18px; }
  .topbar { min-height: 77px; padding: max(19px, env(safe-area-inset-top)) 20px 17px; gap: 10px; }
  .breadcrumb { font-size: 10px; }
  .topbar-actions { gap: 8px; }
  .topbar-actions .simulation-badge { display: none; }
  .theme-toggle { min-width: 38px; min-height: 38px; padding: 9px; border-radius: 11px; font-size: 10px; }
  .theme-toggle .theme-label, .theme-toggle .desktop-label { display: none; }
  .theme-toggle svg { width: 17px; height: 17px; }
  .avatar { width: 34px; height: 34px; font-size: 10px; }
  .main { padding: 7px 19px 104px; }
  .page-header { margin-bottom: 22px; gap: 12px; }
  .page-title { font-size: 28px; letter-spacing: -1px; }
  .page-description { font-size: 11px; margin-top: 9px; line-height: 1.75; }
  .page-header .eyebrow { font-size: 9px; margin-bottom: 8px; }
  .page-header > .button { min-height: 34px; padding: 8px 10px; font-size: 9px; }
  .page-header > .badge { margin-top: 5px; font-size: 8px; padding: 4px 6px; }
  .stat-grid { gap: 8px; margin-bottom: 16px; }
  .stat-card { display: block; padding: 14px 12px; border-radius: 12px; }
  .stat-icon { display: none; }
  .stat-label { font-size: 9px; }
  .stat-value { margin-top: 6px; font-size: 17px; letter-spacing: -.5px; }
  .stat-card small { margin-top: 5px; font-size: 8px; }
  .content-grid, .primary-column, .secondary-column { gap: 16px; }
  .balance-panel { padding: 22px; }
  .balance-value { font-size: 34px; }
  .balance-meta { font-size: 10px; }
  .content-grid .secondary-column { display: flex; flex-direction: column; gap: 16px; }
  .assistant-panel { min-height: 220px; padding: 23px; }
  .assistant-art { position: absolute; right: -19px; top: 26px; width: 175px; height: 180px; opacity: .95; pointer-events: none; }
  .assistant-copy { position: relative; z-index: 1; max-width: 62%; }
  .assistant-copy h2, .assistant-copy h3 { font-size: 21px; line-height: 1.25; }
  .assistant-copy p { font-size: 10px; line-height: 1.8; }
  .assistant-copy .button { width: auto; min-height: 38px; padding: 10px 13px; font-size: 10px; margin-top: 16px; }
  .assistant-panel .eyebrow { margin-bottom: 13px; font-size: 8px; }
  .chart-toolbar { padding: 20px 18px 0; gap: 13px; }
  .asset-tabs { gap: 3px; }
  .asset-tab { padding: 5px 6px; gap: 5px; font-size: 10px; min-height: 31px; }
  .asset-tab .asset-logo { width: 20px; height: 20px; flex-basis: 20px; font-size: 12px; }
  .segment-control { padding: 2px; }
  .segment { min-width: 26px; min-height: 26px; padding: 4px 6px; font-size: 9px; }
  .chart-price { margin-top: 17px; font-size: 25px; }
  .chart-change { font-size: 10px; }
  .chart-container { padding: 12px 9px 2px; min-height: 190px; margin-top: 5px; }
  .chart-container svg text { font-size: 10px; }
  .chart-footer { padding: 13px 18px; font-size: 8px; gap: 8px; }
  .panel-header { padding: 19px 20px 0; }
  .panel-title { font-size: 13px; }
  .panel-subtitle { font-size: 10px; }
  .quick-actions { gap: 9px; margin-top: 16px; }
  .action-card { display: block; padding: 16px; border-radius: 13px; }
  .action-card .stat-icon { display: grid; width: 31px; height: 31px; margin-bottom: 12px; }
  .action-card h3, .action-card strong { font-size: 11px; }
  .action-card p, .action-card small { font-size: 9px; }
  .action-card > svg:last-child { display: none; }
  .asset-list { padding: 0 20px 2px; }
  .asset-row { padding: 14px 0; }
  .asset-row .sparkline { width: 66px; }
  .page-section { margin-top: 24px; }
  .section-heading h2, .section-heading h3 { font-size: 14px; }
  .section-heading > p, .section-heading > span { font-size: 9px; }
  .strategy-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
  .strategy-card { min-height: 0; padding: 18px 19px 18px 77px; }
  .strategy-icon { position: absolute; left: 19px; top: 20px; width: 39px; height: 39px; margin: 0; }
  .strategy-card h2, .strategy-card h3 { font-size: 15px; padding-right: 20px; }
  .strategy-card p { margin-top: 7px; font-size: 10px; }
  .strategy-tag { margin-top: 11px; }
  .strategy-features { padding-top: 11px; font-size: 9px; }
  .strategy-card .selected-check { top: 20px; right: 17px; }
  .config-panel, .strategy-summary { padding: 22px; }
  .config-panel > h2 { font-size: 15px; margin-bottom: 22px; }
  .form-label { font-size: 11px; }
  .scenario-tabs { gap: 7px; }
  .scenario-tab { font-size: 10px; padding: 9px 7px; min-height: 40px; }
  .amount-field { min-height: 61px; }
  .amount-field input { font-size: 24px; }
  .info-note { padding: 12px; font-size: 10px; }
  .trade-layout .secondary-column { display: flex; flex-direction: column; }
  .trade-status { font-size: 9px; }
  .trade-controls { padding: 15px 18px; gap: 9px; }
  .trade-controls .button { min-width: 0; min-height: 38px; font-size: 10px; padding: 10px 12px; }
  .trade-controls > p, .trade-controls > span { font-size: 9px; }
  .trade-progress { padding: 0 18px 18px; }
  .timeline { padding-left: 21px; padding-right: 21px; }
  .result-hero { padding: 26px 20px; }
  .result-amount { font-size: 42px; letter-spacing: -1.5px; }
  .result-detail { padding-top: 20px; margin-top: 22px; }
  .result-detail > div { padding: 0 7px; }
  .result-detail span { font-size: 8px; }
  .result-detail strong { font-size: 12px; }
  .result-actions { flex-direction: column; align-items: stretch; gap: 9px; }
  .history-table td, .history-table th { padding: 14px 16px; font-size: 10px; }
  .history-table .asset-logo { width: 20px; height: 20px; flex-basis: 20px; font-size: 12px; }
  .history-table .hide-mobile { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .metrics-panel { padding: 21px; }
  .metrics-panel > p { font-size: 11px; }
  .metric-grid > div { padding: 14px; }
  .metric-grid strong { font-size: 21px; }
  .dialog-body { padding: 29px 24px; }
  .dialog-body > h2 { font-size: 24px; }
  .footer-note { font-size: 9px; margin-top: 23px; }
  .loader-topbar { min-height: 81px; padding: max(19px, env(safe-area-inset-top)) 23px 18px; }
  .loader-topbar .brand-name { font-size: 25px; }
  .loader-topbar .brand-subtitle { font-size: 8px; letter-spacing: 1.35px; }
  .loader-topbar .brand-mark { width: 31px; height: 31px; flex-basis: 31px; }
  .loader-topbar .brand-mark svg { width: 31px; height: 31px; }
  .loader-topbar .theme-toggle { padding-left: 11px; padding-right: 11px; }
  .loader-topbar .theme-toggle span { display: inline; }
  .loader-layout { padding: 17px 27px 32px; min-height: calc(100dvh - 144px); }
  .loader-kicker { font-size: 8px; letter-spacing: 1.7px; margin-bottom: 18px; }
  .loader-title { max-width: 350px; font-size: clamp(35px, 9.8vw, 44px); letter-spacing: -1.65px; }
  .loader-description { max-width: 290px; font-size: 11px; margin-top: 15px; line-height: 1.8; }
  .loader-scene { height: 225px; margin-top: 5px; }
  .loader-art { width: 255px; max-height: 245px; }
  .loader-progress { margin-top: 6px; }
  .loader-progress-label { font-size: 10px; }
  .loader-steps { margin-top: 24px; gap: 10px; }
  .loader-step { font-size: 8px; }
  .loader-footer { min-height: 63px; padding: 17px 22px max(17px, env(safe-area-inset-bottom)); font-size: 9px; }
}

@media (max-width: 370px) {
  .main { padding-left: 15px; padding-right: 15px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .page-title { font-size: 26px; }
  .stat-grid { gap: 6px; }
  .stat-card { padding-left: 10px; padding-right: 10px; }
  .stat-value { font-size: 15px; }
  .asset-tab { padding-left: 4px; padding-right: 4px; font-size: 9px; }
  .segment { min-width: 24px; padding-left: 5px; padding-right: 5px; }
  .assistant-copy { max-width: 64%; }
  .assistant-art { width: 155px; right: -16px; }
  .loader-layout { padding-left: 23px; padding-right: 23px; }
  .loader-title { font-size: 34px; }
}

@media (max-height: 760px) and (min-width: 721px) {
  .loader-topbar { min-height: 85px; }
  .loader-layout { min-height: calc(100dvh - 150px); padding-top: 10px; padding-bottom: 25px; }
  .loader-title { font-size: 52px; }
  .loader-art { max-height: 380px; }
  .loader-scene { min-height: 350px; }
  .loader-description { margin-top: 17px; }
  .loader-progress { margin-top: 24px; }
  .loader-steps { margin-top: 20px; gap: 11px; }
  .loader-footer { min-height: 65px; }
}

@media (max-height: 730px) and (max-width: 720px) {
  .loader-topbar { min-height: 70px; padding-top: 15px; padding-bottom: 12px; }
  .loader-layout { min-height: calc(100dvh - 124px); padding-top: 10px; padding-bottom: 23px; }
  .loader-kicker { margin-bottom: 12px; }
  .loader-title { font-size: 35px; }
  .loader-description { margin-top: 10px; }
  .loader-scene { height: 175px; }
  .loader-art { width: 205px; max-height: 195px; }
  .orbit { width: 210px; }
  .loader-progress { margin-top: 5px; }
  .loader-steps { margin-top: 19px; }
  .loader-footer { min-height: 54px; padding-top: 14px; padding-bottom: 14px; font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .page, .page-view { animation: none; }
  .loader-art { animation: none; }
  .button, .theme-toggle, .icon-button { transition: background-color 150ms ease, border-color 150ms ease; }
  .button:active:not(:disabled), .icon-button:active:not(:disabled), .theme-toggle:active { transform: none; }
  .progress-fill { transition: none; }
}

/* Application bindings: the real page compositions share the tokens above. */
.brand-period { color: var(--accent); }
.sidebar > .brand-subtitle { padding-left: 12px; margin-top: 13px; font-size: 7px; letter-spacing: 1.65px; }
.sidebar-helper { padding: 17px 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.helper-orb { display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: 13px; border-radius: 9px; color: var(--violet); background: var(--violet-soft); font-size: 17px; }
.sidebar-helper > b { display: block; font-size: 11px; font-weight: 550; line-height: 1.6; }
.sidebar-helper > p { margin: 7px 0 14px; color: var(--muted); font-size: 10px; line-height: 1.8; }
.sidebar-helper .button { justify-content: space-between; width: 100%; font-size: 9px; }
.sidebar-disclaimer { margin: 23px 0 0; color: var(--muted); font-size: 9px; line-height: 1.8; }
.sidebar-disclaimer span { font-size: 8px; opacity: .85; }
.sidebar-footer { padding-left: 7px; padding-right: 7px; }
.breadcrumb { display: inline-flex; align-items: center; gap: 8px; }
.breadcrumb .status-dot { background: var(--muted); }
.status-dot { display: inline-block; }
.badge svg, .simulation-badge svg, .outcome-label svg { width: 14px; height: 14px; }
.chart-change > svg { width: 13px; height: 13px; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--muted); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--muted) 40%, transparent); text-underline-offset: 4px; font-size: inherit; }
.workspace > .footer-note { justify-content: space-between; flex-wrap: wrap; gap: 12px; max-width: 1264px; margin: 0 auto; padding: 0 32px 28px; font-size: 9px; }
.progress-fill { display: block; }
.chart-tooltip { position: absolute; z-index: 4; top: 16px; left: 30px; padding: 8px 11px; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: var(--surface2); box-shadow: var(--shadow); font-size: 10px; font-variant-numeric: tabular-nums; pointer-events: none; }
.asset-row-button { width: 100%; min-width: 0; gap: 9px; border-top: 0; border-left: 0; border-right: 0; border-radius: 0; background: transparent; text-align: left; }
.asset-row-button .asset-info { flex-shrink: 0; }
.asset-row-button .sparkline { width: 43px; height: 25px; flex: 0 1 43px; min-width: 25px; }
.asset-values { flex-shrink: 0; margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.asset-values b { display: block; font-size: 10px; font-weight: 550; }
.asset-values small { display: block; margin-top: 4px; font-size: 9px; }
.strategy-card .strategy-tag { position: absolute; top: 25px; right: 20px; margin: 0; font-size: 8px; }
.strategy-card .strategy-features { flex-direction: column; align-items: flex-start; padding-right: 17px; gap: 7px; }
.strategy-features span { display: inline-flex; align-items: center; gap: 5px; }
.strategy-features svg { width: 11px; height: 11px; color: var(--accent); }
.selection-dot { position: absolute; right: 20px; bottom: 22px; display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent-ink); background: var(--bg); font-size: 10px; }
.strategy-card.selected .selection-dot { color: var(--accent-ink); border-color: var(--accent); background: var(--accent); }
.strategy-config .section-heading { align-items: flex-start; flex-direction: column; gap: 9px; margin-bottom: 25px; }
.strategy-config .section-heading h2 { font-size: 20px; letter-spacing: -.65px; }
.strategy-config .config-panel > .asset-tabs { margin-bottom: 25px; }
.strategy-config .form-label { margin-top: 22px; }
.strategy-config .section-heading + .form-label { margin-top: 0; }
.strategy-config .amount-field > span:last-child { font-size: 9px; letter-spacing: .8px; text-transform: uppercase; }
.field-help { margin-top: 12px; color: var(--muted); font-size: 10px; line-height: 1.8; }
.strategy-config .info-note { margin-top: 24px; }
.config-panel > .eyebrow + h2 { margin: 11px 0 0; font-size: 21px; font-weight: 550; letter-spacing: -.65px; line-height: 1.35; }
.summary-asset { display: flex; align-items: center; gap: 12px; margin: 25px 0 12px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.summary-asset .asset-logo { width: 36px; height: 36px; flex-basis: 36px; font-size: 22px; }
.summary-asset strong { display: block; font-size: 13px; font-weight: 550; }
.summary-asset div > span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.summary-row > b { max-width: 56%; text-align: right; font-size: 11px; line-height: 1.65; font-weight: 550; font-variant-numeric: tabular-nums; }
.summary-disclaimer { margin-top: 15px; color: var(--muted); font-size: 9px; line-height: 1.8; text-align: center; }
.trade-asset { display: flex; align-items: center; gap: 10px; min-width: 0; }
.trade-asset .asset-logo { width: 31px; height: 31px; flex-basis: 31px; font-size: 19px; }
.trade-asset .panel-subtitle { max-width: 260px; }
.trade-stats { gap: 10px; margin-bottom: 0; }
.trade-stats .stat-card { display: block; padding: 17px 14px; }
.trade-stats .stat-value { font-size: clamp(12px, 1.25vw, 17px); letter-spacing: -.4px; white-space: nowrap; }
.trade-stats .stat-label { font-size: 9px; }
.trade-progress.progress-track { height: 4px; padding: 0; margin: 0 24px 22px; }
.config-panel .timeline { padding-left: 0; padding-right: 0; }
.timeline-item b { display: block; color: var(--text); font-size: 11px; font-weight: 550; }
.config-panel > .info-note + .button { margin-top: 20px; }
.result-hero .outcome-label { margin-bottom: 24px; }
.result-hero > .stat-label { display: block; }
.result-percent { margin-top: 8px; font-size: 11px; font-variant-numeric: tabular-nums; }
.result-disclosure { display: block; margin-top: 23px; color: var(--muted); font-size: 9px; line-height: 1.8; }
.result-detail { display: block; margin: 0; padding: 24px; border-top: 1px solid var(--line); text-align: left; }
.result-detail h2 { margin-bottom: 17px; color: var(--text); font-size: 15px; font-weight: 550; letter-spacing: -.3px; }
.result-detail .summary-row > span { font-size: 10px; }
.result-detail .summary-row > b { font-size: 10px; }
.result-detail .summary-row:last-child { padding-bottom: 0; }
.history-panel { margin-top: 24px; }
.history-panel .panel-header { padding-bottom: 6px; }
.table-asset { display: inline-flex; align-items: center; gap: 7px; }
.table-asset .asset-logo { margin: 0; }
.table-asset strong { font-size: 11px; font-weight: 550; }
.takeaway-panel { display: flex; align-items: center; gap: 17px; padding: 24px; margin-top: 24px; }
.takeaway-panel > div { min-width: 0; }
.takeaway-panel h2 { color: var(--text); font-size: 14px; font-weight: 550; letter-spacing: -.25px; }
.takeaway-panel p { max-width: 620px; color: var(--muted); font-size: 11px; line-height: 1.8; margin-top: 7px; }
.takeaway-panel .button { margin-left: auto; flex-shrink: 0; }
.dialog-symbol { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 24px; border-radius: 13px; background: var(--violet-soft); color: var(--violet); }
.dialog-symbol svg { width: 23px; height: 23px; }
.dialog-symbol.success { color: var(--accent); background: var(--accent-soft); }
.dialog-steps { display: flex; flex-direction: column; gap: 15px; margin: 22px 0; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface2); }
.dialog-steps p { color: var(--muted); font-size: 11px; line-height: 1.9; }
.dialog-steps b { color: var(--text); font-weight: 550; }
.dialog-body > .button { margin-top: 17px; }
.dialog-body > .button + .button { margin-top: 10px; }
.dialog-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.interest-note { margin: 22px 0; padding: 18px; border-radius: 12px; color: var(--text); border: 1px solid var(--line); background: var(--surface2); }
.interest-note > b { display: block; font-size: 12px; font-weight: 550; }
.interest-note > p { color: var(--muted); font-size: 11px; line-height: 1.8; margin-top: 7px; }
.dialog-body > .privacy-current { color: var(--muted); font-size: 10px; margin-top: 20px; margin-bottom: 0; }
.privacy-current b { color: var(--text); font-weight: 550; }
.dialog-body .form-error { margin-top: 13px; }
.consent-banner { position: fixed; z-index: 90; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 25px; max-width: min(750px, calc(100vw - 48px)); padding: 22px 24px; border: 1px solid var(--line); border-radius: 17px; color: var(--text); background: var(--surface); box-shadow: 0 16px 70px #00000032; }
.consent-banner b { font-size: 12px; font-weight: 600; }
.consent-banner p { margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.8; max-width: 330px; }
.consent-actions { display: flex; flex-shrink: 0; flex-direction: column; align-items: stretch; gap: 7px; }
.consent-actions .button { min-height: 34px; font-size: 10px; }
.loader-title em { color: var(--accent); font-style: normal; }
.loader-progress-note { margin-top: 11px; color: var(--muted); font-size: 9px; }
.loader-steps { max-width: 355px; }
.step-check { margin-left: auto; color: var(--accent); font-size: 11px; opacity: 0; }
.loader-step.complete .step-check { opacity: 1; }
.floating-chip { position: absolute; z-index: 3; display: flex; align-items: center; gap: 11px; min-height: 65px; padding: 13px 17px; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(12px); box-shadow: 0 14px 35px #00000010; transform: rotate(-4deg); }
.floating-chip b { display: block; color: var(--text); font-size: 10px; font-weight: 550; white-space: nowrap; }
.floating-chip small { display: block; color: var(--muted); font-size: 8px; line-height: 1.8; }
.chip-top { left: -7px; top: 19px; }
.chip-bottom { right: -10px; bottom: 15px; transform: rotate(3deg); }
.chip-bottom b { margin-bottom: 2px; }
.mini-bars { display: flex; flex: 0 0 28px; align-items: flex-end; justify-content: center; gap: 3px; width: 28px; height: 25px; }
.mini-bars i { width: 4px; height: 10px; border-radius: 2px; background: var(--accent); }
.mini-bars i:nth-child(2) { height: 16px; opacity: .7; }
.mini-bars i:nth-child(3) { height: 13px; }
.mini-bars i:nth-child(4) { height: 23px; opacity: .8; }
.chip-shield { display: grid; place-items: center; width: 30px; height: 32px; flex: 0 0 30px; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 10px 10px 14px 14px; background: var(--accent-soft); font-size: 14px; }
.scene-ring { position: absolute; width: 95%; aspect-ratio: 1; border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 50%; transform: rotate(-21deg) scaleY(.65); pointer-events: none; }
.scene-ring.ring-two { width: 115%; border-color: color-mix(in srgb, var(--violet) 7%, transparent); transform: rotate(20deg) scaleY(.7); }
.scene-ring.ring-one::after { position: absolute; content: ''; left: 18%; top: 8%; width: 7px; height: 7px; border-radius: 50%; background: var(--violet); }
.draw-line { animation: draw-line 700ms var(--ease-out) both; }
@keyframes draw-line { from { clip-path: inset(0 100% 0 0); opacity: .3; } to { clip-path: inset(0 0 0 0); opacity: 1; } }

@media (max-width: 1180px) {
  .sidebar-helper { padding: 14px 11px; }
  .sidebar-helper > b { font-size: 10px; }
  .asset-row-button .sparkline { width: 33px; flex-basis: 33px; }
  .asset-row-button .asset-info small { font-size: 9px; }
  .asset-values b { font-size: 9px; }
  .asset-values small { font-size: 8px; }
  .asset-row-button { gap: 7px; }
  .trade-stats .stat-card { padding: 15px 11px; }
  .takeaway-panel { flex-wrap: wrap; }
  .takeaway-panel > div { flex: 1; min-width: 200px; }
  .takeaway-panel .button { margin-left: 52px; }
}
@media (max-width: 960px) {
  .workspace > .footer-note { padding: 0 25px 106px; font-size: 8px; }
  .workspace > .main { padding-bottom: 32px; }
  .consent-banner { bottom: 90px; max-width: min(640px, calc(100vw - 40px)); right: 20px; }
}
@media (max-width: 720px) {
  .loader-steps { max-width: 400px; }
  .step-check { display: none; }
  .scene-ring { width: 250px; }
  .scene-ring.ring-two { width: 300px; }
  .floating-chip { padding: 10px 12px; min-height: 50px; gap: 8px; }
  .floating-chip b { font-size: 8px; }
  .floating-chip small { font-size: 7px; }
  .chip-top { top: 14px; left: calc(50% - 198px); }
  .chip-bottom { right: calc(50% - 205px); bottom: 12px; }
  .floating-chip .mini-bars { width: 20px; flex-basis: 20px; height: 20px; gap: 2px; }
  .floating-chip .mini-bars i { width: 3px; }
  .floating-chip .chip-shield { width: 24px; height: 27px; flex-basis: 24px; font-size: 11px; }
  .result-detail { padding: 24px; }
  .result-detail .summary-row { padding: 13px 0; }
  .trade-stats .stat-value { font-size: 17px; }
  .asset-row-button .sparkline { width: 58px; flex-basis: 58px; }
  .asset-values b { font-size: 10px; }
  .asset-values small { font-size: 9px; }
}
@media (max-width: 520px) {
  .workspace > .footer-note { justify-content: center; gap: 10px 20px; padding: 0 25px 106px; }
  .workspace > .footer-note > span:last-child { width: 100%; text-align: center; }
  .loader-progress-note { font-size: 8px; line-height: 1.8; }
  .floating-chip { display: none; }
  .loader-footer .simulation-badge { font-size: 8px; }
  .loader-steps { max-width: 365px; }
  .loader-title em { color: var(--accent); }
  .strategy-card .strategy-tag { position: static; order: 3; align-self: flex-start; margin-top: 11px; padding: 3px 6px; font-size: 8px; }
  .strategy-card h2 { order: 1; }
  .strategy-card p { order: 2; }
  .strategy-card .strategy-features { order: 4; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 5px; padding-right: 0; }
  .strategy-features span { font-size: 8px; padding-left: 5px; padding-right: 5px; }
  .strategy-features svg { width: 9px; height: 9px; }
  .selection-dot { top: 21px; bottom: auto; right: 17px; width: 16px; height: 16px; font-size: 9px; }
  .strategy-config .section-heading h2 { font-size: 19px; }
  .strategy-config .section-heading .eyebrow { font-size: 8px; }
  .strategy-config .config-panel > .asset-tabs { margin-bottom: 23px; }
  .field-help { font-size: 9px; }
  .config-panel > .eyebrow + h2 { font-size: 20px; }
  .summary-asset { margin-top: 21px; }
  .trade-asset .panel-title { font-size: 12px; }
  .trade-asset .panel-subtitle { font-size: 9px; max-width: 180px; }
  .trade-status { font-size: 8px; padding: 5px 7px; max-width: 105px; line-height: 1.5; }
  .trade-stats { gap: 7px; }
  .trade-stats .stat-card { padding: 14px 10px; }
  .trade-stats .stat-value { font-size: 13px; letter-spacing: -.45px; }
  .trade-stats .stat-label { font-size: 8px; line-height: 1.7; display: block; min-height: 27px; }
  .trade-progress.progress-track { margin: 0 18px 18px; }
  .result-hero { padding-top: 26px; }
  .result-hero .outcome-label { margin-bottom: 20px; }
  .result-percent { font-size: 10px; }
  .result-detail { padding: 22px; }
  .result-detail h2 { font-size: 14px; }
  .result-detail .summary-row > b { font-size: 10px; }
  .result-disclosure { font-size: 8px; }
  .takeaway-panel { gap: 13px; padding: 21px; }
  .takeaway-panel > .stat-icon { display: grid; width: 31px; height: 31px; flex-basis: 31px; }
  .takeaway-panel > div { min-width: 200px; }
  .takeaway-panel h2 { font-size: 12px; }
  .takeaway-panel p { font-size: 10px; }
  .takeaway-panel .button { width: 100%; margin-left: 0; }
  .asset-row-button .sparkline { width: 65px; flex-basis: 65px; }
  .dialog-steps { padding: 17px; }
  .dialog-steps p { font-size: 10px; }
  .consent-banner { align-items: stretch; flex-direction: column; bottom: 87px; left: 16px; right: 16px; max-width: none; gap: 15px; padding: 18px; border-radius: 15px; }
  .consent-banner b { font-size: 11px; }
  .consent-banner p { font-size: 9px; max-width: none; }
  .consent-actions { flex-direction: row; gap: 8px; }
  .consent-actions .button { flex: 1; padding-left: 8px; padding-right: 8px; font-size: 9px; }
}
@media (max-width: 370px) {
  .trade-stats .stat-value { font-size: 11px; letter-spacing: -.4px; }
  .trade-stats .stat-card { padding-left: 9px; padding-right: 9px; }
  .trade-asset { gap: 7px; }
  .trade-asset .asset-logo { width: 26px; height: 26px; flex-basis: 26px; font-size: 15px; }
  .asset-row-button .sparkline { width: 47px; flex-basis: 47px; }
}
@media (prefers-reduced-motion: reduce) {
  .draw-line { animation: none; clip-path: none; }
  .floating-chip { transform: none; }
}

/* Small screens retain the balance hierarchy instead of squeezing three sums. */
@media (max-width: 520px) {
  .page-header { flex-direction: column; align-items: flex-start; gap: 14px; }
  .page-header > div { width: 100%; min-width: 0; }
  .page-header > .button, .page-header > .badge { align-self: flex-start; margin-top: 0; }
  .stat-grid:not(.trade-stats) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-grid:not(.trade-stats) > .stat-card:first-child { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 20px; }
  .stat-grid:not(.trade-stats) > .stat-card:first-child .stat-value { font-size: 31px; letter-spacing: -1.1px; }
  .stat-grid:not(.trade-stats) > .stat-card:first-child .stat-label { font-size: 10px; }
  .stat-grid:not(.trade-stats) > .stat-card:first-child .stat-icon { display: grid; width: 42px; height: 42px; flex-basis: 42px; border-radius: 13px; }
  .stat-grid:not(.trade-stats) > .stat-card:not(:first-child) { padding: 16px; }
  .stat-grid:not(.trade-stats) > .stat-card:not(:first-child) .stat-value { font-size: 21px; }
  .trade-stats .stat-value { font-size: 12px; }
}
@media (max-width: 370px) {
  .loader-topbar { min-height: 66px; padding: max(14px, env(safe-area-inset-top)) 19px 13px; }
  .loader-topbar .brand-name { font-size: 23px; }
  .loader-topbar .brand-mark, .loader-topbar .brand-mark svg { width: 28px; height: 28px; flex-basis: 28px; }
  .loader-topbar .theme-toggle { min-height: 35px; padding: 8px 10px; font-size: 9px; }
  .loader-layout { min-height: calc(100dvh - 116px); padding: 9px 21px 22px; }
  .loader-kicker { margin-bottom: 13px; font-size: 7px; letter-spacing: 1.3px; }
  .loader-title { font-size: 32px; letter-spacing: -1.35px; max-width: 290px; }
  .loader-description { max-width: 270px; margin-top: 12px; font-size: 10px; }
  .loader-scene { height: 150px; margin-top: 2px; }
  .loader-art { width: 175px; max-height: 175px; }
  .scene-ring { width: 185px; }
  .scene-ring.ring-two { width: 225px; }
  .loader-progress { margin-top: 4px; }
  .loader-progress-label { margin-bottom: 9px; font-size: 9px; }
  .loader-progress-note { margin-top: 7px; font-size: 7px; }
  .loader-steps { margin-top: 17px; gap: 6px; }
  .loader-step { gap: 7px; font-size: 7px; }
  .loader-step-icon { width: 23px; height: 23px; flex-basis: 23px; font-size: 8px; }
  .loader-footer { min-height: 50px; padding: 12px 18px max(12px, env(safe-area-inset-bottom)); }
  .loader-footer .simulation-badge { font-size: 7px; padding: 5px 7px; }
  .trade-stats .stat-value { font-size: 11px; }
  .stat-grid:not(.trade-stats) > .stat-card:not(:first-child) .stat-value { font-size: 19px; }
}

/* Keep the overview's first chart in reach on a phone. */
@media (max-width: 520px) {
  .page-view > .stat-grid { gap: 10px; margin-bottom: 16px; }
  .page-view > .stat-grid > .stat-card:first-child { padding: 16px; }
  .page-view > .stat-grid > .stat-card:first-child .stat-value { margin-top: 7px; font-size: 28px; line-height: 1.15; }
  .page-view > .stat-grid > .stat-card:first-child .stat-icon { width: 37px; height: 37px; flex-basis: 37px; border-radius: 11px; }
  .page-view > .stat-grid > .stat-card small { display: none; }
  .page-view > .stat-grid > .stat-card:not(:first-child) { min-height: 60px; padding: 12px 14px; }
  .page-view > .stat-grid > .stat-card:not(:first-child) > div { display: flex; align-items: center; justify-content: space-between; gap: 9px; width: 100%; }
  .page-view > .stat-grid > .stat-card:not(:first-child) .stat-label { max-width: 82px; font-size: 8px; line-height: 1.65; }
  .page-view > .stat-grid > .stat-card:not(:first-child) .stat-value { flex-shrink: 0; font-size: 18px; letter-spacing: -.6px; margin-top: 0; }
  .page-view:has(> .stat-grid) > .page-header { gap: 10px; margin-bottom: 18px; }
  .page-view:has(> .stat-grid) > .page-header .page-title { font-size: 27px; line-height: 1.17; }
  .page-view:has(> .stat-grid) > .page-header .page-description { margin-top: 7px; font-size: 11px; line-height: 1.65; }
  .page-view:has(> .stat-grid) > .page-header > .button { min-height: 30px; padding: 6px 10px; }
  .page-view:has(> .stat-grid) .chart-panel .panel-header { padding-top: 18px; }
  .page-view:has(> .stat-grid) .chart-panel .panel-header .panel-subtitle { display: none; }
  .page-view:has(> .stat-grid) .chart-toolbar { padding-top: 17px; }
  .page-view:has(> .stat-grid) .chart-price { margin-top: 12px; }
  .page-view:has(> .stat-grid) .chart-change { margin-top: 5px; }
}
@media (max-width: 370px) {
  .page-view > .stat-grid > .stat-card:not(:first-child) { padding-left: 11px; padding-right: 11px; }
  .page-view > .stat-grid > .stat-card:not(:first-child) .stat-value { font-size: 16px; }
  .page-view > .stat-grid > .stat-card:not(:first-child) .stat-label { font-size: 7px; }
}

/* Phone-first touch targets. Desktop keeps its denser pointer controls. */
.mobile-start { display: none; }
@media (max-width: 520px) {
  .mobile-start { display: inline-flex; width: 100%; }
  .page-view > .page-header > .mobile-start.button { min-height: 46px; padding: 12px 16px; font-size: 12px; }
  .desktop-help { display: none; }
  .overview-stats.is-new .stat-card:not(:first-child) { display: none; }
  .theme-toggle, .loader-topbar .theme-toggle { min-height: 44px; min-width: 44px; padding: 10px 11px; }
  .icon-button, .dialog-close { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .dialog-close { right: 13px; top: 13px; }
  .asset-tabs { flex-wrap: wrap; }
  .asset-tab { min-height: 44px; padding: 9px 12px; }
  .segment { min-height: 44px; min-width: 32px; padding: 7px 5px; }
  .amount-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .amount-preset { min-height: 44px; padding: 10px; }
  .scenario-tab { min-height: 44px; padding: 10px 7px; }
  .range-input, input[type="range"] { height: 44px; margin: 8px 0 0; padding: 0; touch-action: pan-y; }
  .text-button { display: inline-flex; align-items: center; min-height: 44px; }
  .chart-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 0; }
  .chart-toolbar > div:first-child { display: contents; }
  .chart-toolbar .asset-tabs { grid-column: 1 / -1; grid-row: 1; margin-bottom: 13px; }
  .chart-toolbar .chart-price { grid-column: 1; grid-row: 2; align-self: center; min-width: 0; margin-top: 0; font-size: 24px; white-space: nowrap; }
  .chart-toolbar .chart-change { grid-column: 1 / -1; grid-row: 3; margin-top: 4px; }
  .chart-toolbar .segment-control { grid-column: 2; grid-row: 2; align-self: center; }
  .page-view:has(> .stat-grid) .chart-price { margin-top: 0; }
  .page-view:has(> .stat-grid) .chart-change { margin-top: 4px; }
  .asset-row-button { min-height: 64px; }
  .consent-actions .button { min-height: 44px; }
}
@media (max-width: 370px) {
  .asset-tab { padding-left: 11px; padding-right: 11px; }
  .chart-toolbar { grid-template-columns: minmax(0, 1fr); }
  .chart-toolbar .chart-price { grid-column: 1; font-size: 23px; }
  .chart-toolbar .chart-change { grid-column: 1; }
  .chart-toolbar .segment-control { grid-column: 1; grid-row: 4; display: flex; width: 100%; margin-top: 11px; }
  .chart-toolbar .segment-control .segment { flex: 1; }
  .loader-topbar .theme-toggle { min-height: 44px; min-width: 44px; font-size: 9px; }
}

/* Telegram content and device insets also cover native WebView chrome. */
@media (max-width: 520px) {
  .market-stats > .stat-card:first-child { display: none !important; }
  .market-stats > .stat-card:not(:first-child) { display: block !important; min-height: 78px; }
  .market-stats .stat-value { margin-top: 7px !important; font-size: 21px !important; }
  .market-stats .stat-icon { display: none; }
  .market-stats .market-update { font-size: 19px !important; }
  .chart-toolbar { grid-template-columns: minmax(0,1fr); }
  .chart-toolbar .chart-price { grid-column: 1; grid-row: 2; font-size: 25px; }
  .chart-toolbar .chart-change { grid-column: 1; grid-row: 3; }
  .chart-toolbar .segment-control { grid-column: 1; grid-row: 4; display: flex; width: 100%; margin-top: 10px; }
  .chart-toolbar .segment { flex: 1; }
  .trade-stats .stat-value { white-space: normal !important; overflow-wrap: normal; line-height: 1.4; }
}
@media (max-width: 520px) {
  .chart-container svg text { font-size: 16px; }
}
@media (max-width: 960px) {
  .topbar { padding-top: max(19px, env(safe-area-inset-top), calc(var(--tg-safe-top, 0px) + 12px)); }
  .loader-topbar { padding-top: max(14px, env(safe-area-inset-top), calc(var(--tg-safe-top, 0px) + 12px)); }
  .mobile-nav { padding-bottom: max(7px, env(safe-area-inset-bottom), var(--tg-safe-bottom, 0px)); }
  .main { padding-bottom: calc(104px + var(--tg-safe-bottom, 0px)); }
  .footer-note { padding-bottom: calc(95px + var(--tg-safe-bottom, 0px)); }
  .loader-footer { padding-bottom: max(12px, env(safe-area-inset-bottom), var(--tg-safe-bottom, 0px)); }
}
