:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #edf1f6;
  --ink: #17202a;
  --ink-2: #52606d;
  --ink-3: #8792a0;
  --line: #dde3ea;
  --line-soft: #e9edf2;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-soft: #e8f0ff;
  --profit: #159a63;
  --profit-soft: #e7f7f0;
  --loss: #d64550;
  --loss-soft: #fff0f1;
  --warning: #b7791f;
  --warning-soft: #fff7e8;
  --violet: #7c3aed;
  --sidebar: #111827;
  --sidebar-ink: #cbd5e1;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .16);
  --radius: 14px;
  --spring: cubic-bezier(.2, .8, .2, 1);
  --col: #9db8f7;
}

[data-theme="dark"] {
  --bg: #0d1420;
  --surface: #151f2d;
  --surface-2: #1a2635;
  --surface-3: #233143;
  --ink: #f3f5f8;
  --ink-2: #b2bdca;
  --ink-3: #7d8998;
  --line: #2d3a4c;
  --line-soft: #253246;
  --brand: #7aa2ff;
  --brand-2: #a9c1ff;
  --brand-soft: rgba(122, 162, 255, .14);
  --profit: #4ade80;
  --profit-soft: rgba(74, 222, 128, .12);
  --loss: #fb7185;
  --loss-soft: rgba(251, 113, 133, .12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, .12);
  --violet: #a78bfa;
  --sidebar: #080e17;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 30px rgba(0, 0, 0, .16);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .4);
  --col: #5574b8;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
svg { display: block; }

.web-page {
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background .3s ease;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 22px;
  background:
    radial-gradient(circle at 20% 2%, rgba(37, 99, 235, .24), transparent 28%),
    var(--sidebar);
  color: var(--sidebar-ink);
  overflow: hidden;
}

.sidebar::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -120px;
  bottom: 12%;
  border: 1px solid rgba(122, 162, 255, .08);
  border-radius: 50%;
  box-shadow: 0 0 0 40px rgba(122, 162, 255, .025), 0 0 0 80px rgba(122, 162, 255, .018);
  pointer-events: none;
}

.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; position: relative; z-index: 1; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(145deg, #3b82f6, #1d4ed8); display: grid; place-items: center; box-shadow: 0 10px 24px rgba(37, 99, 235, .25); }
.brand-mark svg { width: 23px; height: 23px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand b { display: block; font-size: 18px; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 2px; color: #8fa1b8; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

.side-nav { display: grid; gap: 7px; margin-top: 44px; position: relative; z-index: 1; }
.side-nav button {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #8fa1b8;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.side-nav button:hover { color: #fff; background: rgba(255, 255, 255, .055); transform: translateX(2px); }
.side-nav button.active { color: #fff; background: rgba(59, 130, 246, .18); box-shadow: inset 3px 0 #60a5fa; }
.side-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.side-note { margin-top: 32px; padding: 15px; display: flex; gap: 10px; border: 1px solid rgba(255, 255, 255, .07); border-radius: 12px; background: rgba(255, 255, 255, .035); position: relative; z-index: 1; }
.live-dot { width: 8px; height: 8px; flex: 0 0 auto; margin-top: 4px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .1); }
.side-note b { display: block; color: #d8e1eb; font-size: 12px; }
.side-note small { display: block; color: #6f8197; font-size: 11px; margin-top: 4px; }

.sidebar-bottom { margin-top: auto; position: relative; z-index: 1; }
.mobile-link { display: flex; align-items: center; gap: 9px; color: #cbd5e1; text-decoration: none; font-size: 12px; font-weight: 650; padding: 11px 12px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 9px; transition: .2s ease; }
.mobile-link:hover { color: #fff; border-color: rgba(122, 162, 255, .45); background: rgba(122, 162, 255, .08); }
.mobile-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-bottom p { margin: 14px 4px 0; color: #596b80; font-size: 11px; line-height: 1.55; }

.main-content { min-width: 0; max-width: 1600px; width: 100%; margin: 0 auto; padding: 26px 34px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.topbar h1 { margin: 5px 0 0; font-size: 25px; line-height: 1.2; letter-spacing: -.04em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.market-badge { display: inline-flex; align-items: center; gap: 9px; height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 700; box-shadow: var(--shadow); }
.market-badge .live-dot { margin: 0; width: 7px; height: 7px; }
.market-badge-link { text-decoration: none; transition: color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.market-badge-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.market-badge-link:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: 0 8px 20px rgba(37, 99, 235, .12); transform: translateY(-1px); }
.market-badge-link:hover svg { transform: translateX(2px); }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); background: var(--surface); box-shadow: var(--shadow); }
.icon-button:hover { color: var(--brand); border-color: var(--brand); }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.moon-icon, [data-theme="dark"] .sun-icon { display: none !important; }
[data-theme="dark"] .moon-icon { display: block !important; }

.hero {
  min-height: 190px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 34px 42px;
  color: #fff;
  border-radius: 18px;
  background:
    linear-gradient(110deg, rgba(10, 29, 65, .05), rgba(10, 29, 65, .55)),
    linear-gradient(135deg, #2563eb, #183e9e 58%, #132a66);
  box-shadow: 0 18px 45px rgba(37, 99, 235, .2);
}
.hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 70% 20%, rgba(255, 255, 255, .15), transparent 26%); }
.hero > div:first-child { position: relative; z-index: 2; }
.hero-kicker { display: inline-flex; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 12px; font-weight: 700; }
.hero-value { margin-top: 13px; font-size: clamp(34px, 4vw, 52px); line-height: 1; font-weight: 850; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.hero p { margin: 14px 0 0; color: rgba(255, 255, 255, .7); font-size: 14px; }
.hero-orbit { position: absolute; width: 300px; height: 300px; right: 2%; top: 50%; transform: translateY(-50%); }
.orbit { position: absolute; inset: 38px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 50%; }
.orbit-two { inset: 76px; border-style: dashed; animation: spin 28s linear infinite; }
.hero-symbol { position: absolute; inset: 106px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .18); border-radius: 50%; background: rgba(255, 255, 255, .12); backdrop-filter: blur(8px); }
.hero-symbol svg { width: 38px; height: 38px; fill: none; stroke: #fff; stroke-width: 1.3; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.planner-panel { margin-top: 22px; padding: 25px 27px; scroll-margin-top: 20px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-bottom: 19px; border-bottom: 1px solid var(--line-soft); }
.section-heading > div { display: flex; align-items: center; gap: 10px; }
.section-heading .step { color: var(--brand); font-size: 12px; font-weight: 850; }
.section-heading h2, .card-heading h2, .ai-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.section-heading p { margin: 0; color: var(--ink-3); font-size: 12px; }

.planner-grid { display: grid; grid-template-columns: 1.05fr 1.5fr 1.15fr 1.25fr; gap: 18px; padding: 21px 0 19px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.field > span:first-child { color: var(--ink-2); font-size: 12px; font-weight: 750; }
.field > span:first-child small { color: var(--brand); font-size: 10px; }
.field-hint { min-height: 14px; overflow: hidden; color: var(--ink-3); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.money-input { height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); transition: .2s ease; }
.money-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--surface); }
.money-input b { color: var(--brand); font-size: 14px; }
.money-input input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.field select { width: 100%; height: 44px; padding: 0 35px 0 13px; outline: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface-2); font-size: 13px; font-weight: 650; cursor: pointer; }
.field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tier-switch { height: 44px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.tier-switch button { min-width: 0; border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); font-size: 11.5px; font-weight: 700; }
.tier-switch button.active { color: #fff; background: var(--brand); box-shadow: 0 4px 10px rgba(37, 99, 235, .18); }

.planner-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 17px; border-top: 1px solid var(--line-soft); }
.quick-goals { display: flex; align-items: center; gap: 6px; }
.quick-goals > span { margin-right: 3px; color: var(--ink-3); font-size: 11px; font-weight: 700; }
.quick-goals button { height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-2); background: var(--surface-2); font-size: 11px; font-weight: 700; }
.quick-goals button:hover, .quick-goals button.active { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9px; font-weight: 750; transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease; }
.primary-button { min-width: 190px; height: 43px; padding: 0 18px; color: #fff; background: var(--brand); box-shadow: 0 8px 18px rgba(37, 99, 235, .18); font-size: 13px; }
.primary-button:hover { transform: translateY(-1px); background: var(--brand-2); box-shadow: 0 12px 24px rgba(37, 99, 235, .24); }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: .65; transform: none; }
.primary-button svg, .secondary-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.status-message { max-height: 0; overflow: hidden; opacity: 0; margin-top: 0; padding: 0 15px; border-radius: 9px; color: var(--loss); background: var(--loss-soft); font-size: 12px; transition: .25s ease; }
.status-message.show { max-height: 60px; opacity: 1; margin-top: 12px; padding: 11px 15px; border: 1px solid color-mix(in srgb, var(--loss) 30%, transparent); }
.status-message.success { color: var(--profit); background: var(--profit-soft); border-color: color-mix(in srgb, var(--profit) 30%, transparent); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-top: 18px; }
.metric-card { min-width: 0; min-height: 112px; display: flex; align-items: center; gap: 14px; padding: 20px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.metric-card.primary-metric { border-color: color-mix(in srgb, var(--brand) 22%, var(--line-soft)); }
.metric-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; color: var(--brand); background: var(--brand-soft); }
.metric-icon.green { color: var(--profit); background: var(--profit-soft); }
.metric-icon.amber { color: var(--warning); background: var(--warning-soft); }
.metric-icon.violet { color: var(--violet); background: color-mix(in srgb, var(--violet) 11%, transparent); }
.metric-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.metric-card p { margin: 0 0 7px; color: var(--ink-3); font-size: 11px; font-weight: 700; }
.metric-card strong { max-width: 100%; display: block; overflow: hidden; color: var(--ink); font-size: clamp(17px, 1.65vw, 23px); letter-spacing: -.035em; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.metric-card small { display: block; max-width: 180px; margin-top: 6px; overflow: hidden; color: var(--ink-3); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.content-grid { display: grid; grid-template-columns: minmax(0, .96fr) minmax(0, 1.04fr); gap: 17px; margin-top: 17px; scroll-margin-top: 20px; }
.allocation-panel, .ai-panel, .cashflow-panel, .holdings-panel { min-width: 0; padding: 23px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-heading .eyebrow { margin-bottom: 5px; }
.pill { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; color: var(--ink-2); background: var(--surface-3); font-size: 10.5px; font-weight: 700; }
.allocation-body { min-height: 215px; display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 23px; padding-top: 18px; }
.donut-wrap { width: 180px; height: 180px; position: relative; display: grid; place-items: center; }
.donut-wrap .chart-donut { width: 180px; height: 180px; filter: drop-shadow(0 8px 14px rgba(15, 23, 42, .08)); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center strong { font-size: 21px; letter-spacing: -.04em; }
.donut-center span { margin-top: 4px; color: var(--ink-3); font-size: 10px; }
.allocation-legend { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 15px; }
.legend-item { min-width: 0; display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.legend-color { width: 9px; height: 9px; border-radius: 3px; }
.legend-name { min-width: 0; overflow: hidden; }
.legend-name b { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.legend-name small { display: block; margin-top: 2px; overflow: hidden; color: var(--ink-3); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.legend-weight { color: var(--ink-2); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.risk-strip { margin-top: 5px; padding: 12px 13px; border: 1px solid color-mix(in srgb, var(--loss) 30%, transparent); border-radius: 9px; color: var(--loss); background: var(--loss-soft); font-size: 11px; font-weight: 650; line-height: 1.5; }

.ai-panel { background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--brand-soft) 50%, var(--surface))); border-color: color-mix(in srgb, var(--brand) 22%, var(--line-soft)); }
.ai-heading { display: flex; align-items: center; gap: 11px; }
.ai-mark { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(145deg, var(--brand), var(--violet)); box-shadow: 0 8px 18px rgba(37, 99, 235, .18); }
.ai-mark svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.confidence { margin-left: auto; padding: 5px 8px; border-radius: 6px; color: var(--brand); background: var(--brand-soft); font-size: 10px; font-weight: 800; }
.ai-summary { margin: 20px 0 0; color: var(--ink-2); font-size: 13px; font-weight: 550; line-height: 1.75; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.badge-row span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); background: var(--surface); font-size: 9.5px; font-weight: 700; }
.ai-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 21px; margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.ai-columns h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; color: var(--ink-2); font-size: 11px; }
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.good { background: var(--profit); }
.dot.warning { background: var(--warning); }
.insight-list { display: grid; gap: 7px; }
.insight-list p { position: relative; margin: 0; padding-left: 11px; color: var(--ink-2); font-size: 10.5px; line-height: 1.55; }
.insight-list p::before { content: ""; position: absolute; left: 0; top: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3); }
.disclaimer { margin: 16px 0 0; color: var(--ink-3); font-size: 9.5px; }

.lower-grid { grid-template-columns: minmax(0, 1.12fr) minmax(340px, .88fr); }
.wide-chart { width: 100%; min-height: 190px; margin-top: 18px; }
.cashflow-panel .chart-cols { width: 100%; height: 190px; overflow: visible; }
.chart-grid { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-grid.base { stroke: var(--line); stroke-dasharray: none; }
.chart-avg-line { stroke: var(--warning); stroke-width: 1.1; stroke-dasharray: 4 4; }
.chart-avg-label, .col-val, .chart-end-label { fill: var(--ink-2); font-family: inherit; font-size: 10px; font-weight: 700; }
.col-lbl { fill: var(--ink-3); font-family: inherit; font-size: 9px; }
.col-bar { transition: y .8s var(--spring), height .8s var(--spring); }
.chart-footer { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 12px; padding-top: 15px; border-top: 1px solid var(--line-soft); }
.chart-footer > div { padding: 0 14px; border-right: 1px solid var(--line-soft); }
.chart-footer > div:first-child { padding-left: 0; }
.chart-footer > div:last-child { border: 0; }
.chart-footer span { display: block; color: var(--ink-3); font-size: 10px; }
.chart-footer strong { display: block; margin-top: 5px; font-size: 14px; font-variant-numeric: tabular-nums; }

.holdings-panel .card-heading small { color: var(--ink-3); font-size: 10px; }
.holdings-table { margin-top: 15px; }
.holding-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1.3fr) .7fr .7fr 24px; align-items: center; gap: 9px; padding: 11px 7px; border: 0; border-bottom: 1px solid var(--line-soft); color: var(--ink); background: transparent; text-align: left; }
.holding-row:last-child { border-bottom: 0; }
.holding-row:hover { background: var(--surface-2); }
.holding-main { min-width: 0; display: flex; align-items: center; gap: 9px; }
.ticker-mark { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: #fff; font-size: 9.5px; font-weight: 850; }
.holding-main b { display: block; font-size: 11.5px; }
.holding-main small { display: block; max-width: 150px; margin-top: 2px; overflow: hidden; color: var(--ink-3); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.holding-stat { color: var(--ink-3); font-size: 9px; }
.holding-stat b { display: block; margin-top: 3px; color: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.holding-stat .profit { color: var(--profit); }
.holding-chevron { color: var(--ink-3); font-size: 17px; }

.backtest-panel { margin-top: 17px; padding: 24px; scroll-margin-top: 20px; }
.backtest-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.backtest-actions { display: flex; align-items: center; gap: 10px; }
.period-switch { height: 35px; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.period-switch button { min-width: 44px; border: 0; border-radius: 5px; color: var(--ink-3); background: transparent; font-size: 10px; font-weight: 700; }
.period-switch button.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.secondary-button { height: 35px; padding: 0 13px; border: 1px solid var(--brand); color: var(--brand); background: var(--brand-soft); font-size: 11px; }
.secondary-button:hover { color: #fff; background: var(--brand); }
.backtest-content { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 27px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.chart-legend { display: flex; justify-content: flex-end; gap: 16px; color: var(--ink-3); font-size: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 16px; height: 3px; border-radius: 2px; background: var(--brand); }
.chart-legend i.spy { background: var(--ink-3); }
.backtest-chart { min-height: 220px; }
.backtest-chart .chart-line { width: 100%; height: 220px; overflow: visible; }
.line-port { stroke: var(--brand); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.line-bm { stroke: var(--ink-3); stroke-width: 1.6; stroke-dasharray: 5 4; stroke-linecap: round; stroke-linejoin: round; }
.line-dot.port { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }
.line-dot.bm { fill: var(--ink-3); }
.chart-end-label.brand { fill: var(--brand); }
.empty-chart { height: 210px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-3); background: var(--surface-2); font-size: 11px; }
.backtest-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.backtest-metrics > div { min-width: 0; display: flex; flex-direction: column; justify-content: center; min-height: 84px; padding: 13px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface-2); }
.backtest-metrics span { color: var(--ink-3); font-size: 9.5px; }
.backtest-metrics strong { margin-top: 6px; color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.backtest-metrics strong.positive { color: var(--profit); }
.backtest-metrics strong.negative { color: var(--loss); }

.web-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 26px; padding: 0 3px; color: var(--ink-3); font-size: 10px; }
.web-footer span { font-weight: 800; }
.web-footer p { margin: 0; text-align: right; }

.detail-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(9, 15, 25, .45); backdrop-filter: blur(3px); }
.stock-detail { position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(420px, 100vw); padding: 32px 28px; overflow-y: auto; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .32s var(--spring); }
.stock-detail.open { transform: translateX(0); }
.detail-close { position: absolute; top: 18px; right: 20px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-2); background: var(--surface-2); font-size: 21px; line-height: 1; }
.detail-symbol { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: var(--brand); font-size: 12px; font-weight: 850; }
.detail-title { display: flex; align-items: center; gap: 13px; margin-top: 20px; }
.detail-title h2 { margin: 0; font-size: 22px; }
.detail-title p { margin: 4px 0 0; color: var(--ink-3); font-size: 11px; }
.detail-yield { margin-top: 24px; padding: 20px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--brand), #23449e); }
.detail-yield span { font-size: 11px; opacity: .7; }
.detail-yield strong { display: block; margin-top: 7px; font-size: 28px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.detail-grid div { padding: 15px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface-2); }
.detail-grid span { color: var(--ink-3); font-size: 10px; }
.detail-grid strong { display: block; margin-top: 6px; font-size: 15px; }
.detail-section { margin-top: 24px; }
.detail-section h3 { margin: 0 0 12px; font-size: 14px; }
.score-bar { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.score-bar i { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--warning), var(--profit)); }
.detail-loading { min-height: 300px; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }

.chart-placeholder:empty::before { content: "데이터를 계산하는 중입니다"; min-height: 150px; display: grid; place-items: center; color: var(--ink-3); font-size: 11px; }
.is-loading { position: relative; pointer-events: none; }
.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.is-loading span, .is-loading svg { display: none; }

@media (max-width: 1240px) {
  .web-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .main-content { padding-left: 24px; padding-right: 24px; }
  .planner-grid { grid-template-columns: 1fr 1.35fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .content-grid, .lower-grid { grid-template-columns: 1fr; }
  .holdings-main small { max-width: 280px; }
}

@media (max-width: 860px) {
  .web-shell { display: block; }
  .sidebar { position: sticky; height: auto; padding: 13px 18px; flex-direction: row; align-items: center; gap: 20px; }
  .sidebar::after, .side-note, .sidebar-bottom { display: none; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand small { display: none; }
  .side-nav { display: flex; margin: 0 0 0 auto; gap: 3px; }
  .side-nav button { width: auto; height: 36px; padding: 0 10px; font-size: 11px; }
  .side-nav button.active { box-shadow: none; }
  .side-nav svg { width: 16px; height: 16px; }
  .main-content { padding: 20px 18px 32px; }
  .topbar { margin-bottom: 18px; }
  .hero { min-height: 170px; padding: 28px; }
  .hero-orbit { right: -70px; }
  .backtest-content { grid-template-columns: 1fr; }
  .backtest-metrics { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 650px) {
  .sidebar { overflow-x: auto; gap: 10px; }
  .brand span:last-child { display: none; }
  .side-nav { margin-left: 0; }
  .side-nav button { min-width: 38px; justify-content: center; padding: 0 9px; font-size: 0; }
  .topbar h1 { font-size: 21px; }
  .market-badge { display: none; }
  .hero { min-height: 160px; padding: 25px 22px; }
  .hero p { max-width: 260px; line-height: 1.5; }
  .hero-orbit { opacity: .55; right: -120px; }
  .planner-panel, .allocation-panel, .ai-panel, .cashflow-panel, .holdings-panel, .backtest-panel { padding: 19px; }
  .section-heading { align-items: flex-start; }
  .section-heading p { display: none; }
  .planner-grid { grid-template-columns: 1fr; gap: 15px; }
  .planner-footer { align-items: stretch; flex-direction: column; }
  .quick-goals { overflow-x: auto; }
  .primary-button { width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 94px; }
  .allocation-body { grid-template-columns: 1fr; justify-items: center; }
  .allocation-legend { width: 100%; }
  .ai-columns { grid-template-columns: 1fr; }
  .chart-footer { grid-template-columns: 1fr 1fr; gap: 12px; }
  .chart-footer > div { padding: 0; border: 0; }
  .chart-footer > div:last-child { grid-column: 1 / -1; }
  .holding-row { grid-template-columns: minmax(0, 1.3fr) .65fr .65fr 14px; }
  .backtest-top { align-items: flex-start; flex-direction: column; }
  .backtest-actions { width: 100%; justify-content: space-between; }
  .period-switch { overflow-x: auto; }
  .backtest-metrics { grid-template-columns: 1fr 1fr; }
  .web-footer { flex-direction: column; }
  .web-footer p { text-align: left; }
}
