:root {
  --bg: #090b0e;
  --surface: #11151a;
  --surface-strong: #171d23;
  --surface-soft: #0e1216;
  --line: #273039;
  --text: #f3f5f7;
  --muted: #8e9aa5;
  --gold: #d9b45d;
  --gold-soft: #f0d486;
  --green: #39d5a5;
  --red: #ff6f7e;
  --blue: #72a8ff;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "Microsoft JhengHei UI", "Noto Sans TC", system-ui, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
.app-shell { min-height: 100vh; display: flex; background: var(--bg); }
.sidebar { position: sticky; top: 0; width: 258px; min-width: 258px; height: 100vh; padding: 30px 20px 20px; border-right: 1px solid var(--line); background: #0c1014; display: flex; flex-direction: column; }
.brand-lockup { display: flex; align-items: center; gap: 14px; padding: 0 6px; }
.brand-mark { width: 64px; height: 64px; flex: 0 0 64px; display: block; object-fit: cover; object-position: center; border: 0; border-radius: 50%; background: #14264c; box-shadow: 0 0 0 4px rgba(217, 180, 93, .08); }
.brand-lockup strong { display: block; font-size: 24px; letter-spacing: .08em; }
.brand-lockup span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: .16em; }
.nav-list { display: grid; gap: 8px; margin-top: 48px; }
.nav-button { width: 100%; padding: 13px 16px; border: 0; border-left: 3px solid transparent; border-radius: 7px; background: transparent; color: #b5c0c8; text-align: left; transition: background .18s, color .18s, transform .18s; }
.nav-button:hover { background: var(--surface-strong); color: var(--gold-soft); transform: translateX(2px); }
.nav-button.active { border-left-color: var(--gold); background: #262016; color: var(--gold-soft); }
.nav-button-pro { margin-top: 8px; border: 1px solid rgba(217, 180, 93, .28); background: linear-gradient(135deg, rgba(75, 59, 23, .72), rgba(25, 31, 37, .92)); color: var(--gold-soft); }
.nav-button-pro:hover, .nav-button-pro.active { border-left-color: var(--gold); border-color: var(--gold); background: linear-gradient(135deg, #4b3b17, #20251d); color: #fff0bd; }
.safety-box { margin-top: auto; padding: 14px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 12px; line-height: 1.65; background: var(--surface-soft); }
.safety-box small { display: block; margin-top: 5px; color: #74808a; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(57, 213, 165, .7); }
.workspace { flex: 1; min-width: 0; padding: 30px 42px 54px; }
.topbar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.topbar.overview-topbar { min-height: 0; height: 0; overflow: hidden; }
.topbar > div:first-child { min-width: 250px; }
.topbar h2 { margin: 0; font-size: 22px; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-status { color: var(--muted); font-size: 12px; }
.mode-tag { padding: 9px 13px; border: 1px solid #66521e; border-radius: 5px; color: var(--gold-soft); background: #282113; font-size: 12px; }
.global-symbol { min-width: 220px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: var(--surface); }
.notice { margin: 15px 0 20px; padding: 12px 14px; border-left: 3px solid var(--gold); background: #1b1810; color: #d7c995; font-size: 13px; line-height: 1.55; }
.notice.error { border-left-color: var(--red); background: #241417; color: #ffc5cb; }
.hidden { display: none !important; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 12px 0 22px; }
.page-heading h1 { margin: 0; font-size: 34px; letter-spacing: .01em; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; align-items: center; gap: 9px; }
.overview-market-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 18px; }
.overview-market-select { display: flex; align-items: center; gap: 14px; min-width: 0; }
.overview-market-select > span { color: var(--muted); font-size: 15px; white-space: nowrap; }
.overview-market-select select { width: min(360px, 42vw); min-width: 220px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; outline: 0; color: var(--text); background: var(--surface); }
.overview-market-select select:focus { border-color: var(--gold); }
.overview-market-select small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.overview-toast { padding: 13px 18px; border: 1px solid #66521e; border-radius: 7px; color: var(--gold-soft); background: #282113; font-size: 13px; white-space: nowrap; }
.chart-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.chart-tool-group { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.chart-tool-group + .chart-tool-group { padding-left: 20px; border-left: 1px solid var(--line); }
.chart-tool-label { margin-right: 3px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.chart-symbol-button, .chart-interval-button, .chart-icon-button { min-height: 34px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-strong); color: #c5cdd3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-symbol-button:hover, .chart-interval-button:hover, .chart-icon-button:hover { border-color: var(--gold); color: var(--gold-soft); }
.chart-symbol-button.active, .chart-interval-button.active { border-color: var(--gold); background: var(--gold); color: #17130a; font-weight: 700; }
.chart-icon-button { width: 34px; padding: 4px 0; color: var(--gold-soft); font-size: 18px; line-height: 1; }
.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.panel-header h3 { margin: 0; font-size: 16px; }
.panel-header span { color: var(--muted); font-size: 12px; }
.panel-body { padding: 18px 19px; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { min-height: 112px; padding: 17px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.metric:first-child { border-color: #806523; box-shadow: inset 0 0 0 1px rgba(217, 180, 93, .1); }
.metric span { display: block; min-height: 35px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.metric strong { display: block; margin-top: 13px; font-size: 23px; font-variant-numeric: tabular-nums; }
.metric small { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.strategy-metric strong { display: flex; align-items: center; gap: 8px; }
.up { color: var(--green) !important; }
.down { color: var(--red) !important; }
.muted { color: var(--muted) !important; }
.gold { color: var(--gold-soft) !important; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(330px, .9fr); gap: 16px; }
.market-browser { margin-top: 16px; }
.overview-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 62px; margin: 0 0 16px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 7px; color: #c9d0d5; background: var(--surface-strong); font-size: 13px; }
.overview-banner strong { color: var(--gold-soft); font-size: 12px; font-weight: 500; white-space: nowrap; }
.overview-banner.error { border-color: #72333d; color: #ffc5cb; background: #241417; }
.overview-banner.error strong { color: #ffb1ba; }
.overview-banner.running { border-color: #1c725c; color: #bdeedf; background: #10231f; }
.overview-banner.running strong { color: #9cf0d4; }
.market-tools { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(160px, .7fr) minmax(160px, .7fr); gap: 12px; margin-bottom: 16px; }
.market-browser-summary { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.chart-panel { min-height: 470px; }
.chart-wrap { padding: 12px 18px 16px; }
.chart-canvas { display: block; width: 100%; height: 390px; cursor: crosshair; touch-action: none; }
.chart-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.quote-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 0 0 10px; padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.quote-stat { min-width: 0; }
.quote-stat span { display: block; color: var(--muted); font-size: 11px; }
.quote-stat strong { display: block; margin-top: 5px; overflow: hidden; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.realtime-warning { margin: 0 0 10px; color: #d8c580; font-size: 11px; line-height: 1.5; }
.realtime-status { color: var(--green) !important; }
.holdings-list { display: block; overflow-x: auto; overflow-y: hidden; padding-bottom: 9px; scrollbar-color: #7d8790 #171d23; scrollbar-width: auto; }
.holdings-list::-webkit-scrollbar { height: 12px; }
.holdings-list::-webkit-scrollbar-track { background: #171d23; }
.holdings-list::-webkit-scrollbar-thumb { border: 2px solid #171d23; border-radius: 6px; background: #7d8790; }
.holdings-panel, .holdings-panel * { font-family: inherit; letter-spacing: 0; }
.holding-row { display: grid; grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(116px, 1fr)); min-width: 760px; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid rgba(39, 48, 57, .68); }
.holding-row:last-child { border-bottom: 0; }
.holding-row strong, .holding-row small { display: block; }
.holding-row strong { color: var(--text); font-size: 13px; font-weight: 500; }
.holding-row small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.holding-main { min-width: 210px; flex: 1.5; }
.holding-stat { min-width: 92px; }
.holding-stat span { display: block; color: var(--muted); font-size: 10px; }
.holding-stat strong { margin-top: 5px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.holding-value { text-align: right; }
.holdings-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 7px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.holdings-summary span { display: block; color: var(--muted); font-size: 11px; }
.holdings-summary strong { display: block; margin-top: 5px; color: var(--text); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.strategy-overview-panel { margin-bottom: 16px; }
.strategy-overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.strategy-overview-grid > div { min-width: 0; padding: 12px; border: 1px solid var(--line); background: var(--surface-soft); }
.strategy-overview-grid span, .strategy-overview-grid strong, .strategy-overview-grid small { display: block; }
.strategy-overview-grid span { color: var(--muted); font-size: 11px; }
.strategy-overview-grid strong { margin-top: 7px; overflow: hidden; color: var(--text); font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.strategy-overview-grid small { margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; background: var(--surface-soft); }
td { color: #d8dde1; }
tbody tr:hover { background: var(--surface-strong); }
.button { padding: 10px 14px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-strong); color: var(--text); }
.button:hover { border-color: var(--gold); color: var(--gold-soft); }
.button.primary { border-color: #8e6e24; background: #4b3b17; color: var(--gold-soft); }
.button.danger { border-color: #72333d; background: #3c1c22; color: #ffb1ba; }
.button.success { border-color: #1c725c; background: #123c33; color: #9cf0d4; }
.button.small { padding: 6px 9px; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-field { display: grid; align-content: start; gap: 7px; color: var(--muted); font-size: 12px; }
.form-field.full { grid-column: 1 / -1; }
.form-field input, .form-field select { width: 100%; min-height: 43px; box-sizing: border-box; padding: 11px 12px; border: 1px solid var(--line); border-radius: 5px; outline: 0; color: var(--text); background: #0c1014; }
.form-field input:focus, .form-field select:focus { border-color: var(--gold); }
.form-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.field-help { color: #6f7b84; font-size: 11px; line-height: 1.5; }
.select-wide { min-width: 280px; }
.status-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.status-banner strong { display: block; font-size: 14px; }
.status-banner span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.status-light { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #66727b; vertical-align: middle; }
.status-light.on { background: var(--green); box-shadow: 0 0 12px rgba(57, 213, 165, .75); }
.strategy-top-status { white-space: nowrap; }
.strategy-run-state { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.strategy-status-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 82px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.strategy-status-card.running { border-color: #1c725c; background: #10231f; }
.strategy-status-card strong { display: block; font-size: 15px; }
.strategy-status-card span, .strategy-status-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.strategy-status-card small { color: #71808a; font-size: 11px; }
.strategy-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.strategy-action-button { min-height: 42px; font-size: 14px; font-weight: 600; }
.strategy-scope-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.strategy-scope-grid > div { padding: 11px 12px; border: 1px solid var(--line); border-radius: 5px; background: #0c1014; }
.strategy-scope-grid span, .strategy-scope-grid strong { display: block; }
.strategy-scope-grid span { color: var(--muted); font-size: 11px; }
.strategy-scope-grid strong { margin-top: 6px; color: var(--text); font-size: 12px; font-weight: 500; }
.signal-pill { display: inline-block; padding: 4px 7px; border: 1px solid #66521e; border-radius: 4px; color: var(--gold-soft); background: #282113; font-size: 11px; }
.signal-pill.holding { border-color: #1c725c; color: #9cf0d4; background: #123c33; }
.signal-pill.risk { border-color: #72333d; color: #ffb1ba; background: #3c1c22; }
.table-subtext { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.switch { position: relative; width: 44px; height: 24px; border: 0; border-radius: 20px; background: #303a42; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: #b4bec4; transition: transform .18s; }
.switch.on { background: #16745d; }
.switch.on::after { transform: translateX(20px); background: #c9ffed; }
.strategy-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, .85fr); gap: 16px; }
.strategy-list { margin-top: 16px; }
.empty-state { padding: 28px 12px; color: var(--muted); text-align: center; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.result-item { padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.result-item span { display: block; color: var(--muted); font-size: 11px; }
.result-item strong { display: block; margin-top: 8px; font-size: 18px; }
.backtest-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; padding: 14px; border: 1px solid var(--line); background: var(--surface-soft); }
.backtest-summary span { display: block; color: var(--muted); font-size: 11px; }
.backtest-summary strong { display: block; margin-top: 6px; color: var(--text); font-size: 13px; font-weight: 500; }
.backtest-detail { margin-top: 16px; }
.backtest-trades { margin-top: 16px; }
.backtest-trust { display: grid; grid-template-columns: minmax(220px, .75fr) minmax(0, 1.25fr); gap: 18px; margin-top: 16px; padding: 17px; border: 1px solid #66521e; border-radius: 7px; background: #1b1810; }
.backtest-trust.success { border-color: #245d4e; background: #10231f; }
.backtest-trust > div > span, .backtest-trust-grid span { display: block; color: var(--muted); font-size: 11px; }
.backtest-trust > div > strong { display: block; margin-top: 7px; color: #e2d39a; font-size: 14px; line-height: 1.55; }
.backtest-trust.success > div > strong { color: #bdeedf; }
.backtest-trust ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; color: #aeb8be; font-size: 11px; line-height: 1.55; }
.backtest-trust li { padding-left: 16px; }
.backtest-trust li::before { content: "•"; margin-left: -16px; margin-right: 10px; color: var(--gold-soft); }
.backtest-trust-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.backtest-trust-grid > div { padding: 10px; border: 1px solid rgba(57, 213, 165, .17); border-radius: 5px; background: rgba(0, 0, 0, .14); }
.backtest-trust-grid strong { display: block; margin-top: 6px; color: var(--text); font-size: 12px; line-height: 1.4; }
.backtest-trust-grid small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.pro-hero { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .72fr); gap: 26px; margin-bottom: 16px; padding: 32px; border: 1px solid #6f5922; border-radius: 10px; background: radial-gradient(circle at 85% 12%, rgba(217, 180, 93, .16), transparent 32%), linear-gradient(120deg, #16150e, #10171a 58%, #11151a); box-shadow: var(--shadow); }
.pro-eyebrow { display: block; color: var(--gold-soft); font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.pro-hero h2 { max-width: 710px; margin: 12px 0 11px; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.025em; line-height: 1.18; }
.pro-hero p { max-width: 720px; margin: 0; color: #b9c1c7; font-size: 14px; line-height: 1.75; }
.pro-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.pro-hero-actions .button { min-height: 42px; }
.pro-hero-note { align-self: stretch; padding: 19px; border: 1px solid rgba(217, 180, 93, .28); border-radius: 8px; background: rgba(9, 11, 14, .46); }
.pro-hero-note span, .pro-hero-note small { display: block; color: var(--muted); font-size: 11px; line-height: 1.55; }
.pro-hero-note strong { display: block; margin-top: 10px; color: var(--gold-soft); font-size: 20px; }
.pro-hero-note p { margin: 10px 0 16px; color: #d6dce0; font-size: 12px; line-height: 1.6; }
.pro-proof-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.pro-proof-card { min-height: 142px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.pro-proof-card span, .pro-proof-card small { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; }
.pro-proof-card strong { display: block; margin: 12px 0 8px; color: var(--text); font-size: 20px; font-variant-numeric: tabular-nums; }
.pro-proof-card small { color: #8f9ba3; }
.pro-workflow, .pro-plans { margin-top: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.section-heading h3 { margin: 8px 0 0; font-size: 22px; }
.section-heading > p { max-width: 440px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.pro-workflow-grid, .pro-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pro-workflow-grid article { min-height: 188px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.pro-workflow-grid article > span { display: inline-grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: #17130a; background: var(--gold); font-size: 11px; font-weight: 800; }
.pro-workflow-grid h4 { margin: 15px 0 8px; font-size: 16px; }
.pro-workflow-grid p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.pro-plan { position: relative; display: flex; min-height: 426px; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.pro-plan.featured { border-color: #92752a; background: linear-gradient(160deg, #29200e, #11181a 70%); box-shadow: inset 0 0 0 1px rgba(217, 180, 93, .08); }
.plan-label { display: inline-flex; width: fit-content; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255, 255, 255, .025); font-size: 10px; }
.featured .plan-label { border-color: #806523; color: var(--gold-soft); background: #3b3014; }
.pro-plan h4 { margin: 17px 0 8px; font-size: 20px; }
.pro-plan > strong { font-size: 30px; letter-spacing: -.025em; }
.pro-plan > strong span { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.pro-plan > p { min-height: 45px; margin: 12px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.pro-plan ul { display: grid; gap: 10px; margin: 0 0 19px; padding: 0; list-style: none; }
.pro-plan li { padding-left: 18px; color: #c8d0d5; font-size: 12px; line-height: 1.45; }
.pro-plan li::before { content: "✓"; margin-left: -18px; margin-right: 8px; color: var(--green); font-weight: 700; }
.plan-status { min-height: 43px; margin-top: auto; padding: 9px 10px; border: 1px solid rgba(217, 180, 93, .22); border-radius: 5px; color: #c9bb84; background: rgba(75, 59, 23, .35); font-size: 11px; line-height: 1.5; }
.pro-plan .button { width: 100%; margin-top: 11px; }
.source-list { display: grid; gap: 12px; }
.source-line { display: flex; justify-content: space-between; gap: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.source-line span { color: var(--muted); }
.source-line strong { color: var(--text); font-weight: 500; text-align: right; }
.toast { position: fixed; top: 98px; right: 48px; z-index: 4; max-width: 390px; padding: 13px 16px; border: 1px solid #866a28; border-radius: 6px; color: var(--gold-soft); background: #2b2414; box-shadow: var(--shadow); font-size: 13px; }
.data-warning { color: #d8c580; }
.subtle-link { border: 0; background: transparent; color: var(--blue); }
.mono { font-variant-numeric: tabular-nums; }
.instrument-picker { position: relative; min-width: 250px; }
.picker-search { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; outline: 0; color: var(--text); background: var(--surface); }
.picker-search:focus { border-color: var(--gold); }
.picker-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 8; display: none; max-height: 290px; overflow: auto; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: #12181d; box-shadow: var(--shadow); }
.instrument-picker:focus-within .picker-results { display: grid; }
.picker-option { display: grid; gap: 3px; padding: 9px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--text); text-align: left; }
.picker-option:hover, .picker-option.selected { background: #282113; color: var(--gold-soft); }
.picker-option strong { font-size: 12px; font-weight: 600; }
.picker-option span { color: var(--muted); font-size: 10px; }
.picker-empty { padding: 12px 10px; color: var(--muted); font-size: 12px; }
.topbar-picker { min-width: 250px; }
.quote-depth { display: grid; gap: 5px; margin: 0 0 10px; padding: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.quote-depth strong { color: var(--text); font-size: 11px; font-weight: 500; }
.quote-depth small { color: var(--muted); }
.toggle-row { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 15px; color: var(--muted); font-size: 12px; }
.toggle-row input { accent-color: var(--gold); }
.market-status { color: var(--gold-soft); }
.condition-section, .condition-section *, .condition-drawer, .condition-drawer * { font-family: inherit; letter-spacing: 0; }
.condition-section { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.condition-section:first-of-type { margin-top: 18px; }
.condition-section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 11px; }
.condition-section-header h4 { margin: 0; color: var(--text); font-size: 14px; }
.condition-section-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.condition-summary { display: grid; gap: 8px; }
.condition-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 5px 18px rgba(0,0,0,.12); }
.condition-card + .condition-card { margin-top: 10px; }
.condition-card.disabled { opacity: .55; }
.condition-card-main { min-width: 0; }
.condition-card-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--text); font-size: 13px; font-weight: 600; }
.condition-card-title .condition-category { color: var(--gold-soft); font-size: 11px; font-weight: 500; }
.condition-card-detail { margin-top: 6px; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.condition-card-actions { display: flex; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.condition-card-actions .button { min-height: 30px; padding: 5px 8px; font-size: 11px; }
.condition-enable { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.condition-enable input { accent-color: var(--gold); }
.condition-connector { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 6px 0; color: var(--muted); font-size: 10px; }
.condition-connector select { min-height: 28px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--gold-soft); background: var(--surface-strong); font-size: 11px; }
.condition-empty { padding: 15px 12px; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); background: rgba(255,255,255,.01); font-size: 12px; }
.condition-add-button { width: 100%; margin-top: 10px; border-style: dashed; }
.condition-drawer-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.58); }
.condition-drawer { position: fixed; top: 0; right: 0; z-index: 21; display: flex; width: min(560px, 100vw); height: 100vh; flex-direction: column; border-left: 1px solid var(--line); background: #11171c; box-shadow: -18px 0 42px rgba(0,0,0,.42); }
.condition-drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 19px 21px; border-bottom: 1px solid var(--line); }
.condition-drawer-header h3 { margin: 0; font-size: 17px; }
.condition-drawer-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.condition-drawer-close { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 5px; color: var(--gold-soft); background: var(--surface-strong); font-size: 20px; line-height: 1; }
.condition-drawer-body { flex: 1; overflow: auto; padding: 20px 21px 30px; }
.condition-drawer-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 21px; border-top: 1px solid var(--line); background: var(--surface); }
.condition-builder-step { margin-bottom: 18px; }
.condition-builder-step > label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.condition-builder-step select, .condition-builder-step input[type="number"] { width: 100%; min-height: 42px; box-sizing: border-box; padding: 10px 11px; border: 1px solid var(--line); border-radius: 5px; outline: 0; color: var(--text); background: #0c1014; }
.condition-builder-step select:focus, .condition-builder-step input[type="number"]:focus { border-color: var(--gold); }
.condition-parameter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.condition-parameter { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.condition-parameter.full { grid-column: 1 / -1; }
.condition-parameter output { color: var(--gold-soft); font-variant-numeric: tabular-nums; }
.condition-parameter input[type="range"] { width: 100%; accent-color: var(--gold); }
.condition-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; background: #0c1014; }
.condition-toggle input { width: 18px; height: 18px; accent-color: var(--gold); }
.condition-disabled-note { padding: 11px 12px; border: 1px solid #66521e; border-radius: 5px; color: var(--gold-soft); background: #282113; font-size: 11px; line-height: 1.5; }
.condition-preview { margin-top: 5px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--surface-soft); font-size: 11px; line-height: 1.5; }
body:has(.condition-drawer) { overflow: hidden; }

/* AI analysis workspace */
.ai-analysis-page { display: grid; gap: 16px; }
.ai-toolbar { display: grid; grid-template-columns: minmax(230px, .85fr) minmax(210px, 1fr) auto; align-items: end; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.ai-toolbar-select { display: grid; gap: 7px; }
.ai-toolbar-select label { color: var(--muted); font-size: 11px; }
.ai-toolbar-select select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; outline: 0; color: var(--text); background: var(--surface-strong); }
.ai-toolbar-select select:focus { border-color: var(--gold); }
.ai-toolbar-meta { display: grid; gap: 4px; align-self: center; color: var(--text); font-size: 12px; }
.ai-toolbar-meta small { color: var(--muted); font-size: 11px; }
.ai-toolbar-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ai-dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.ai-panel { min-width: 0; }
.ai-sentiment-panel { grid-column: span 4; }
.ai-market-panel { grid-column: span 8; }
.ai-flow-panel { grid-column: span 4; }
.ai-technical-panel { grid-column: span 8; }
.ai-news-panel { grid-column: span 4; }
.ai-opinion-panel { grid-column: span 8; }
.ai-draft-panel { grid-column: 1 / -1; }
.ai-sentiment-body { display: flex; align-items: center; gap: 20px; min-height: 180px; }
.ai-gauge { --score: 50; display: grid; width: 138px; min-width: 138px; aspect-ratio: 1; place-items: center; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--score) * 1%), #303840 0); position: relative; }
.ai-gauge::after { position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); content: ""; }
.ai-gauge > div { z-index: 1; text-align: center; }
.ai-gauge strong { display: block; color: var(--text); font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.ai-gauge span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.ai-sentiment-summary { display: grid; gap: 10px; min-width: 0; }
.ai-sentiment-summary strong { font-size: 22px; }
.ai-sentiment-summary span { color: var(--muted); font-size: 12px; }
.ai-sentiment-summary small { color: var(--muted); font-size: 11px; line-height: 1.55; }
.ai-index-strip { display: grid; grid-template-columns: 125px minmax(0, 1fr); align-items: center; gap: 16px; min-height: 92px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.ai-index-strip span { display: block; color: var(--muted); font-size: 11px; }
.ai-index-strip strong { display: block; margin-top: 7px; font-size: 24px; font-variant-numeric: tabular-nums; }
.ai-spark-bars { display: flex; align-items: end; gap: 4px; height: 62px; padding: 4px 0; }
.ai-spark-bars i { display: block; flex: 1; min-width: 3px; border-radius: 2px 2px 0 0; background: #2c9b81; opacity: .86; }
.ai-no-chart { color: var(--muted); font-size: 12px; }
.ai-breadth { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.ai-breadth > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.ai-breadth span, .ai-tech-grid span, .ai-draft-risk span { display: block; color: var(--muted); font-size: 10px; }
.ai-breadth strong { display: block; margin-top: 6px; font-size: 18px; font-variant-numeric: tabular-nums; }
.ai-sector-list, .ai-flow-list { display: grid; gap: 0; }
.ai-sector-row, .ai-flow-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(39, 48, 57, .68); }
.ai-sector-row:last-child, .ai-flow-row:last-child { border-bottom: 0; }
.ai-sector-row span, .ai-flow-row span { overflow: hidden; color: #c7d0d6; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ai-sector-row strong, .ai-flow-row strong { flex: 0 0 auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.ai-empty-row { padding: 13px 0; color: var(--muted); font-size: 12px; }
.ai-panel-footnote { display: block; margin-top: 12px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.ai-tech-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ai-tech-grid > div { min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.ai-tech-grid strong { display: block; margin-top: 6px; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ai-risk-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.ai-risk-strip strong { color: var(--text); font-size: 12px; }
.ai-news-list { display: grid; gap: 0; }
.ai-news-row { display: grid; gap: 6px; padding: 11px 0; border-bottom: 1px solid rgba(39, 48, 57, .68); color: var(--text); text-decoration: none; }
.ai-news-row:last-child { border-bottom: 0; }
.ai-news-row:hover strong { color: var(--gold-soft); }
.ai-news-row strong { color: #d7dde1; font-size: 12px; font-weight: 500; line-height: 1.45; }
.ai-news-row small { color: var(--muted); font-size: 10px; }
.ai-summary { margin: 0 0 16px; color: #dce2e6; font-size: 14px; line-height: 1.7; }
.ai-opinion-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.ai-opinion-columns h4, .ai-draft-grid h4 { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 500; }
.ai-opinion-columns ul, .ai-draft-grid ol { margin: 0; padding-left: 18px; color: #cad2d7; font-size: 12px; line-height: 1.7; }
.ai-risk-list { color: #ffb5bd !important; }
.ai-invalidation { display: grid; gap: 5px; margin-top: 16px; padding: 11px 12px; border-left: 2px solid var(--gold); background: #1b1810; }
.ai-invalidation span { color: var(--muted); font-size: 10px; }
.ai-invalidation strong { color: var(--gold-soft); font-size: 12px; font-weight: 500; }
.ai-scenarios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.ai-scenario { display: grid; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.ai-scenario strong { color: #d6dde1; font-size: 11px; }
.ai-scenario span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.ai-draft-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.ai-draft-grid ol { color: #d8e0e4; }
.ai-draft-risk { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.ai-draft-risk > div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.ai-draft-risk strong { display: block; margin-top: 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.ai-confirmation { display: grid; gap: 7px; margin-top: 16px; padding: 13px 14px; border: 1px solid #66521e; border-radius: 6px; background: #282113; }
.ai-confirmation strong { color: var(--gold-soft); font-size: 13px; }
.ai-confirmation span { color: #d7c995; font-size: 11px; line-height: 1.5; }
.ai-inline-error { padding: 11px 13px; border: 1px solid #72333d; border-radius: 6px; color: #ffc5cb; background: #241417; font-size: 12px; line-height: 1.5; }
.ai-page-error { margin-bottom: 0; }
.ai-login-shell { display: grid; place-items: center; min-height: 420px; }
.ai-login-panel { width: min(520px, 100%); }
.ai-login-copy { margin: 0 0 18px; color: #d1d8dd; font-size: 13px; line-height: 1.65; }
.ai-login-form { display: grid; gap: 13px; }
.ai-login-form .button { width: 100%; }
.ai-loading-line { display: flex; gap: 7px; padding: 16px 0; }
.ai-loading-line span { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: ai-loading 1s infinite ease-in-out; }
.ai-loading-line span:nth-child(2) { animation-delay: .12s; }
.ai-loading-line span:nth-child(3) { animation-delay: .24s; }
@keyframes ai-loading { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-5px); opacity: 1; } }

@media (max-width: 1120px) {
  .workspace { padding: 24px 24px 44px; }
  .sidebar { width: 224px; min-width: 224px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .topbar > div:first-child { flex: 1 1 260px; }
  .topbar-right { flex: 1 1 100%; justify-content: flex-end; }
  .overview-grid, .strategy-layout { grid-template-columns: 1fr; }
  .pro-hero { grid-template-columns: 1fr; }
  .pro-proof-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .backtest-trust { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .strategy-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-tools { grid-template-columns: 1fr 1fr; }
  .chart-tool-group + .chart-tool-group { padding-left: 0; border-left: 0; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; min-width: 0; height: auto; padding: 15px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-list { display: flex; overflow-x: auto; gap: 6px; margin-top: 18px; padding-bottom: 2px; }
  .nav-button { min-width: max-content; padding: 9px 12px; border-left: 0; border-bottom: 2px solid transparent; text-align: center; }
  .nav-button.active { border-bottom-color: var(--gold); border-left-color: transparent; }
  .safety-box { display: none; }
  .workspace { padding: 18px 14px 35px; }
  .topbar, .page-heading { align-items: flex-start; flex-direction: column; }
  .topbar > div:first-child { min-width: 0; }
  .topbar-right { width: 100%; flex-wrap: wrap; }
  .global-symbol { flex: 1; min-width: 190px; }
  .topbar-picker, .instrument-picker { width: 100%; min-width: 0; }
  .overview-market-row { align-items: flex-start; flex-direction: column; }
  .overview-market-select { width: 100%; flex-wrap: wrap; }
  .overview-market-select select { flex: 1; width: auto; }
  .overview-toast { align-self: flex-end; }
  .overview-market-select small { width: 100%; white-space: normal; }
  .toast { top: 78px; right: 14px; left: 14px; max-width: none; }
  .chart-toolbar { align-items: flex-start; flex-direction: column; gap: 13px; }
  .chart-tool-group { width: 100%; }
  .chart-symbol-button, .chart-interval-button { flex: 0 0 auto; }
  .metric-grid, .result-grid, .backtest-summary, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pro-proof-grid, .pro-workflow-grid, .pro-plan-grid { grid-template-columns: 1fr; }
  .backtest-trust-grid { grid-template-columns: 1fr; }
  .pro-hero, .pro-workflow, .pro-plans { padding: 18px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .section-heading > p { max-width: none; }
  .market-tools { grid-template-columns: 1fr; }
  .market-browser-summary { align-items: flex-start; flex-direction: column; }
  .chart-canvas { height: 300px; }
  .quote-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 11px; }
  .holdings-summary, .strategy-scope-grid, .strategy-overview-grid { grid-template-columns: 1fr; }
  .holding-row { grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(116px, 1fr)); gap: 12px; align-items: start; }
  .holding-value { grid-column: auto; }
  .panel-header, .panel-body { padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 520px) {
  .holding-row { grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(116px, 1fr)); }
  .holding-value { grid-column: auto; }
  .condition-parameter-grid { grid-template-columns: 1fr; }
  .condition-parameter.full { grid-column: auto; }
  .condition-card { grid-template-columns: 1fr; }
  .condition-card-actions { justify-content: flex-start; }
  .condition-drawer-header, .condition-drawer-body, .condition-drawer-footer { padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 1120px) {
  .ai-sentiment-panel, .ai-market-panel, .ai-flow-panel, .ai-technical-panel, .ai-news-panel, .ai-opinion-panel { grid-column: span 6; }
  .ai-draft-panel { grid-column: 1 / -1; }
  .ai-toolbar { grid-template-columns: 1fr 1fr; }
  .ai-toolbar-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 760px) {
  .ai-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .ai-toolbar-actions { grid-column: auto; }
  .ai-toolbar-actions .button { flex: 1; }
  .ai-sentiment-panel, .ai-market-panel, .ai-flow-panel, .ai-technical-panel, .ai-news-panel, .ai-opinion-panel, .ai-draft-panel { grid-column: 1 / -1; }
  .ai-sentiment-body { align-items: flex-start; flex-direction: column; }
  .ai-gauge { width: 116px; min-width: 116px; }
  .ai-opinion-columns, .ai-draft-grid { grid-template-columns: 1fr; gap: 16px; }
  .ai-scenarios { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .ai-tech-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-draft-risk { grid-template-columns: 1fr; }
  .ai-index-strip { grid-template-columns: 1fr; }
}
