:root {
  color-scheme: dark;
  --bg: #071018;
  --panel: #0d1923;
  --panel-solid: #0d1923;
  --panel-soft: #132431;
  --line: var(--site-border, rgba(148, 163, 184, 0.14));
  --line-strong: rgba(148, 163, 184, 0.26);
  --text: var(--site-fg, #f3f7fa);
  --muted: var(--site-muted, #c3d0da);
  --faint: #8fa3b3;
  --teal: var(--site-accent, #45c8d8);
  --teal-soft: rgba(69, 200, 216, 0.12);
  --blue: #8cc8ff;
  --orange: #f2b84b;
  --red: #f06167;
  --green: #2ebd85;
  --purple: #8cc8ff;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  --font-ui: var(--site-font, "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif);
  --font-number: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --font-caption: calc(12px * var(--site-type, 1));
  --font-metric-line: calc(13px * var(--site-type, 1));
  --font-body: calc(14px * var(--site-type, 1));
  --font-heading: calc(18px * var(--site-type, 1));
  --font-metric: calc(24px * var(--site-type, 1));
  --font-display: calc(32px * var(--site-type, 1));
  --mono: var(--font-number);
  font-family: var(--font-ui);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: var(--font-body); line-height: 1.55; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.topbar { height: 72px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(11,18,32,.96); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 255px; }
.brand strong { display: block; font-size: var(--font-heading); letter-spacing: .5px; }
.brand small { display: block; color: var(--faint); font-size: var(--font-caption); letter-spacing: 2.1px; margin-top: 1px; }
.brand-mark { width: 36px; height: 36px; border: 1px solid rgba(91,157,255,.4); border-radius: 10px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 8px; background: var(--teal-soft); }
.brand-mark span { width: 3px; background: var(--teal); border-radius: 2px; }
.brand-mark span:nth-child(1) { height: 7px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 13px; opacity: .72; }
.brand-mark span:nth-child(3) { height: 10px; opacity: .85; }
.brand-mark span:nth-child(4) { height: 18px; }
.nav { display: flex; height: 100%; gap: 30px; }
.nav a { position: relative; display: flex; align-items: center; color: var(--muted); font-size: var(--font-caption); transition: color .2s; }
.nav a:hover, .nav a.active { color: var(--text); }
.nav a.active::after { content: ""; position: absolute; height: 2px; left: 0; right: 0; bottom: -1px; background: var(--teal); }
.top-actions { display: flex; align-items: center; gap: 18px; min-width: 255px; justify-content: flex-end; }
.topbar .top-actions { width: 100%; min-width: 0; justify-content: space-between; }
.global-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: var(--font-caption); }
.global-status i, .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.global-status.warn { color: var(--orange); }
.global-status.warn i { background: var(--orange); }
.global-status.error { color: var(--red); }
.global-status.error i { background: var(--red); }
.clock { font-variant-numeric: tabular-nums; font-family: var(--font-number); font-size: var(--font-caption); color: #b9c8d6; letter-spacing: .7px; }

main { max-width: 1660px; margin: 0 auto; padding: 34px 34px 24px; position: relative; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 25px; }
.eyebrow { color: var(--faint); font-size: var(--font-caption); letter-spacing: 1.2px; font-weight: 600; }
h1 { margin: 7px 0 5px; font-size: var(--font-display); font-weight: 650; letter-spacing: .3px; }
h1 span { color: var(--teal); margin: 0 5px; }
.page-heading p { margin: 0; color: var(--muted); font-size: var(--font-caption); }
.heading-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.layout-controls { display: flex; align-items: center; justify-content: flex-end; gap: 13px; }
.layout-hint { color: var(--faint); font-size: var(--font-caption); white-space: nowrap; }
.auto-status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: var(--font-caption); white-space: nowrap; }
.auto-status i { width: 1px; height: 12px; background: var(--line-strong); margin: 0 2px; }
.btn { border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font-size: var(--font-caption); font-weight: 600; transition: background .2s, border-color .2s, color .2s; white-space: nowrap; }
.btn.primary { background: var(--teal); color: #06152b; }
.btn.primary:hover { background: #8cc4ff; }
.btn.secondary { background: var(--panel-soft); border-color: var(--line-strong); color: var(--muted); }
.btn.secondary:hover { background: #1a3150; color: var(--text); }
.btn.tiny { padding: 5px 10px; font-size: var(--font-caption); line-height: 1.2; border-radius: 6px; }
.btn .icon { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; }
.btn:disabled { opacity: .5; cursor: wait; }

.mode-strip { display: flex; align-items: center; gap: 17px; padding: 14px 18px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: 12px; margin-bottom: 18px; }
.mode-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: var(--teal-soft); color: var(--teal); font-weight: 800; font-size: var(--font-body); }
.mode-strip > div:nth-child(2) { flex: 1; }
.mode-strip strong { display: block; font-size: var(--font-caption); }
.mode-strip span { display: block; color: var(--muted); font-size: var(--font-caption); }
.mode-meta { min-width: 112px; padding-left: 20px; border-left: 1px solid var(--line); }
.mode-meta strong { margin-top: 2px; color: #d0dce7; font-size: var(--font-caption); font-variant-numeric: tabular-nums; }
.mode-meta strong.state-ok { color: var(--teal); }
.mode-meta strong.state-error { color: var(--red); }

.metrics { display: grid; grid-template-columns: 1.25fr repeat(4, 1fr) 1.05fr; gap: 13px; margin-bottom: 18px; }
.metric-card { position: relative; min-height: 122px; overflow: hidden; padding: 17px 18px 15px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(145deg, #1b2a42, #152136); box-shadow: var(--shadow); }
.metric-card::after { content: ""; position: absolute; top: 0; left: 18px; width: 30px; height: 2px; background: var(--teal); }
.metric-card.featured { border-color: rgba(91,157,255,.24); }
.metric-card.accent::after { background: var(--orange); }
.metric-label { color: var(--muted); font-size: var(--font-caption); display: flex; align-items: center; justify-content: space-between; }
.metric-label > span:last-child { color: var(--faint); font-size: var(--font-caption); letter-spacing: 1px; }
.label-with-icon { display: inline-flex; align-items: center; gap: 7px; }
.label-with-icon .icon { width: 16px; height: 16px; color: var(--teal); }
.metric-card:nth-child(2) .label-with-icon .icon { color: var(--green); }
.metric-card:nth-child(3) .label-with-icon .icon { color: var(--purple); }
.metric-card:nth-child(4) .label-with-icon .icon { color: var(--orange); }
.metric-card:nth-child(5) .label-with-icon .icon { color: var(--blue); }
.metric-card:nth-child(6) .label-with-icon .icon { color: var(--orange); }
.metric-value { margin-top: 10px; font-size: var(--font-metric); font-weight: 650; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.metric-value.small { font-size: var(--font-metric); margin-top: 13px; }
.metric-foot { display: flex; align-items: baseline; gap: 7px; margin-top: 8px; }
.metric-foot span { font-size: var(--font-caption); color: var(--muted); font-variant-numeric: tabular-nums; }
.metric-foot small { font-size: var(--font-caption); color: var(--faint); }
.positive { color: var(--red) !important; }
.negative { color: var(--green) !important; }
.neutral { color: var(--muted) !important; }
.risk-track { height: 3px; background: rgba(255,255,255,.06); border-radius: 2px; margin-top: 14px; overflow: hidden; }
.risk-track span { display: block; width: 10%; height: 100%; background: var(--teal); transition: width .4s; }

.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 26px rgba(0,0,0,.14); overflow: hidden; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.panel-header { min-height: 48px; padding: 9px 19px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.panel h2 { margin: 0; font-size: var(--font-body); line-height: 1.2; font-weight: 650; letter-spacing: .3px; display: flex; align-items: center; gap: 7px; color: var(--text); }
.panel h2 .icon { width: 17px; height: 17px; color: var(--teal); }
.panel-tools { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--font-caption); }
.icon-btn { width: 27px; height: 27px; border-radius: 7px; border: 1px solid var(--line); background: rgba(255,255,255,.025); color: var(--muted); font-size: var(--font-body); }
.icon-btn:hover { color: var(--teal); border-color: rgba(91,157,255,.3); }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 6px; font-size: var(--font-caption); line-height: 1.2; color: var(--orange); background: rgba(251,191,36,.09); border: 1px solid rgba(251,191,36,.16); white-space: nowrap; }
.status-chip.teal { color: var(--teal); background: var(--teal-soft); border-color: rgba(91,157,255,.16); }
.status-chip.warning { color: var(--orange); background: rgba(251,191,36,.09); border-color: rgba(251,191,36,.16); }
.status-chip.red { color: var(--red); background: rgba(255,107,107,.08); border-color: rgba(255,107,107,.18); }
.status-chip.unknown { color: var(--muted); background: rgba(148,163,184,.08); border-color: var(--line); }
.subtle-label { color: var(--faint); font-size: var(--font-caption); }
.panel-footer { min-height: 39px; padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: var(--font-caption); }
.text-btn { padding: 0; border: 0; background: transparent; color: var(--teal); font-size: var(--font-caption); }
.text-btn:hover { color: #c6e2ff; }

.signal-summary { display: grid; grid-template-columns: repeat(4, 1fr); padding: 14px 10px; border-bottom: 1px solid var(--line); }
.signal-summary > div { display: grid; grid-template-columns: 31px auto; grid-template-rows: auto auto; column-gap: 9px; padding: 0 12px; border-right: 1px solid var(--line); }
.signal-summary > div:last-child { border-right: 0; }
.summary-icon { grid-row: span 2; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; }
.summary-icon .icon { width: 16px; height: 16px; }
.summary-icon.teal { color: var(--teal); background: var(--teal-soft); }
.summary-icon.blue { color: var(--blue); background: rgba(147,197,253,.1); }
.summary-icon.orange { color: var(--orange); background: rgba(251,191,36,.1); }
.summary-icon.purple { color: var(--purple); background: rgba(125,211,252,.1); }
.signal-summary strong { font-size: var(--font-body); line-height: 1.2; font-variant-numeric: tabular-nums; }
.signal-summary small { color: var(--faint); font-size: var(--font-caption); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--font-caption); }
th { padding: 10px 14px; color: var(--muted); font-weight: 550; text-align: left; background: rgba(148,163,184,.055); white-space: nowrap; }
td { padding: 11px 14px; border-top: 1px solid rgba(148,163,184,.09); color: #e2e8f0; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(147,197,253,.035); }
td strong { color: var(--text); font-weight: 600; }
td .sub { display: block; color: var(--faint); font-size: var(--font-caption); margin-top: 2px; }
.stock-link { color: var(--text); background: none; border: 0; padding: 0; text-align: left; font-size: var(--font-caption); }
.stock-link:hover { color: var(--teal); }
.rank { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 8px; border-radius: 5px; color: var(--faint); background: rgba(255,255,255,.035); font-size: var(--font-caption); }
.rank.top { color: #06152b; background: var(--teal); font-weight: 700; }
.score-cell { min-width: 100px; }
.score-value { font-size: var(--font-caption); font-weight: 650; color: var(--teal); }
.score-track { width: 68px; height: 3px; background: rgba(255,255,255,.06); border-radius: 2px; display: inline-block; vertical-align: middle; margin-left: 7px; }
.score-track span { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, var(--teal)); border-radius: 2px; }
.signal-tag, .side-tag { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 5px; font-size: var(--font-caption); }
.signal-tag.buy, .side-tag.buy { color: var(--red); background: rgba(255,107,107,.1); }
.signal-tag.watch { color: var(--muted); background: rgba(148,163,184,.08); }
.side-tag.sell { color: var(--green); background: rgba(52,211,153,.1); }
.empty { text-align: center !important; color: var(--faint) !important; padding: 32px 16px !important; font-size: var(--font-caption); }

.health-score { display: flex; align-items: center; gap: 16px; padding: 19px; }
.health-ring { --progress: 0deg; width: 70px; height: 70px; flex: 0 0 70px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: conic-gradient(var(--teal) var(--progress), rgba(255,255,255,.05) 0); position: relative; }
.health-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--panel-solid); }
.health-ring span, .health-ring small { position: relative; z-index: 1; }
.health-ring span { font-size: var(--font-heading); font-weight: 650; line-height: 1.1; }
.health-ring small { font-size: var(--font-caption); color: var(--faint); }
.health-score strong { font-size: var(--font-caption); }
.health-score p { margin: 4px 0 0; color: var(--muted); font-size: var(--font-caption); line-height: 1.7; }
.health-list { padding: 0 19px; }
.health-item { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-top: 1px solid rgba(148,163,184,.08); }
.health-item i { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); }
.health-item.degraded i { background: var(--orange); }
.health-item.critical i { background: var(--red); }
.health-item span { color: var(--muted); font-size: var(--font-caption); flex: 1; }
.health-item small { color: var(--faint); font-size: var(--font-caption); }
.system-mini { margin: 11px 19px 14px; display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.system-mini div { padding: 8px; border-radius: 7px; background: rgba(255,255,255,.025); }
.system-mini span { display: block; color: var(--faint); font-size: var(--font-caption); }
.system-mini strong { font-size: var(--font-caption); font-weight: 550; }

.plan-list { max-height: 287px; overflow-y: auto; }
.plan-item { padding: 12px 17px; border-bottom: 1px solid rgba(148,163,184,.075); }
.plan-item:last-child { border-bottom: 0; }
.plan-main { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.plan-main > * { flex: 0 0 auto; }
.plan-name { color: var(--text); font-size: var(--font-caption); font-weight: 600; white-space: nowrap; }
.plan-symbol, .plan-quote, .plan-time { color: var(--muted); font-size: var(--font-caption); white-space: nowrap; }
.plan-quote { font-family: var(--font-number); font-variant-numeric: tabular-nums; }
.plan-main .plan-status { position: sticky; right: 0; margin-left: auto; padding-left: 7px; background: var(--panel-solid); }
.plan-subline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 5px; }
.plan-reason { flex: 1 1 auto; min-width: 0; color: var(--faint); font-size: var(--font-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-time { flex: 0 0 auto; color: var(--muted); font-size: var(--font-caption); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-meta { display: flex; justify-content: space-between; margin-top: 7px; color: var(--faint); font-size: var(--font-caption); }
.plan-status { color: var(--blue); }
.plan-status.completed { color: var(--teal); }
.plan-status.rejected, .plan-status.cancelled { color: var(--orange); }
.log-table { table-layout: fixed; }
.log-table th:nth-child(1) { width: 170px; }
.log-table th:nth-child(2) { width: 90px; }
.log-table th:nth-child(3) { width: 190px; }
.log-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-level { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 4px; background: rgba(148,163,184,.1); color: var(--muted); font-size: var(--font-caption); }
.log-level.info { color: var(--teal); background: var(--teal-soft); }
.log-level.warning { color: var(--orange); background: rgba(251,191,36,.1); }
.log-level.error, .log-level.critical { color: var(--red); background: rgba(255,107,107,.1); }
.log-source { color: var(--muted); }
.log-table td.log-message { color: var(--text); white-space: normal; overflow-wrap: anywhere; line-height: 1.55; vertical-align: top; }

.logic-flow { padding: 12px 18px 8px; }
.logic-step { display: grid; grid-template-columns: 23px 1fr; gap: 10px; position: relative; padding-bottom: 13px; }
.logic-step:not(:last-child)::after { content: ""; position: absolute; left: 10px; top: 24px; bottom: 1px; width: 1px; background: linear-gradient(var(--line-strong), transparent); }
.logic-step b { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; color: var(--teal); background: var(--teal-soft); font-size: var(--font-caption); font-weight: 600; }
.logic-step strong { display: block; font-size: var(--font-caption); color: #d0dce7; font-weight: 550; }
.logic-step span { display: block; color: var(--faint); font-size: var(--font-caption); line-height: 1.6; margin-top: 2px; }
.weight-title { padding: 8px 18px 5px; display: flex; justify-content: space-between; color: var(--muted); font-size: var(--font-caption); border-top: 1px solid var(--line); }
.weight-title small { color: var(--faint); font-size: var(--font-caption); }
.weights { padding: 0 18px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 15px; }
.weight-row { display: grid; grid-template-columns: 62px 1fr 28px; align-items: center; gap: 7px; font-size: var(--font-caption); color: var(--muted); }
.weight-track { height: 3px; background: rgba(255,255,255,.05); border-radius: 2px; overflow: hidden; }
.weight-track span { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, var(--teal)); }
.weight-row b { color: var(--muted); font-weight: 500; text-align: right; }

.timeline { max-height: 305px; overflow-y: auto; padding: 6px 19px 12px; }
.timeline-item { display: grid; grid-template-columns: 63px 12px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(148,163,184,.06); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-time { color: var(--faint); font-family: var(--font-number); font-size: var(--font-caption); padding-top: 2px; }
.timeline-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-top: 5px; box-shadow: 0 0 0 3px rgba(147,197,253,.08); }
.timeline-dot.success { background: var(--teal); box-shadow: 0 0 0 3px rgba(91,157,255,.08); }
.timeline-dot.warning { background: var(--orange); box-shadow: 0 0 0 3px rgba(251,191,36,.08); }
.timeline-dot.error { background: var(--red); box-shadow: 0 0 0 3px rgba(255,107,107,.08); }
.timeline-body strong { display: block; color: #e2e8f0; font-size: var(--font-caption); font-weight: 500; }
.timeline-body small { display: block; color: var(--faint); font-size: var(--font-caption); margin-top: 2px; }

.learning-overview { display: grid; grid-template-columns: repeat(3,1fr); padding: 19px 19px 12px; }
.learning-overview > div { border-right: 1px solid var(--line); padding: 0 14px; }
.learning-overview > div:first-child { padding-left: 0; }
.learning-overview > div:last-child { border-right: 0; }
.learning-overview span { display: block; color: var(--muted); font-size: var(--font-caption); }
.learning-overview strong { display: inline-block; font-size: var(--font-heading); margin-top: 5px; font-weight: 600; }
.learning-overview strong.version-text { font-size: var(--font-caption); color: var(--teal); }
.learning-overview small { color: var(--faint); font-size: var(--font-caption); margin-left: 4px; }
.learning-track { height: 3px; margin: 0 19px 14px; background: rgba(255,255,255,.05); border-radius: 3px; overflow: hidden; }
.learning-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--teal)); transition: width .5s; }
.learning-list { max-height: 160px; overflow-y: auto; border-top: 1px solid var(--line); }
.learning-item { display: flex; gap: 10px; padding: 10px 18px; border-bottom: 1px solid rgba(148,163,184,.06); }
.learning-item .status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); margin-top: 5px; flex: 0 0 5px; }
.learning-item.waiting .status-dot, .learning-item.rejected .status-dot { background: var(--orange); }
.learning-item strong { display: block; color: #e2e8f0; font-size: var(--font-caption); font-weight: 500; }
.learning-item p { margin: 2px 0 0; color: var(--faint); font-size: var(--font-caption); }
.suggestion-section { flex: 1 1 62%; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.suggestion-heading { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 6px; color: var(--muted); }
.suggestion-heading strong { color: var(--text); font-size: var(--font-caption); font-weight: 600; }
.suggestion-heading span { font-size: var(--font-caption); }
.suggestion-list { flex: 1 1 auto; min-height: 0; max-height: 260px; overflow-y: auto; }
.suggestion-item { padding: 9px 18px 10px; border-bottom: 1px solid rgba(148,163,184,.06); }
.suggestion-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.suggestion-top strong { color: #e2e8f0; font-size: var(--font-body); font-weight: 600; line-height: 1.35; }
.suggestion-status { flex: 0 0 auto; padding: 2px 6px; border-radius: 4px; background: var(--teal-soft); color: var(--teal); font-size: var(--font-caption); white-space: nowrap; }
.suggestion-status.observing { background: rgba(148,163,184,.1); color: var(--muted); }
.suggestion-status.data_gap { background: rgba(251,191,36,.1); color: var(--orange); }
.suggestion-item p { margin: 4px 0 5px; color: var(--muted); font-size: var(--font-caption); line-height: 1.55; }
.suggestion-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; color: var(--faint); font-size: var(--font-caption); line-height: 1.4; }
.suggestion-meta span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-meta span:last-child { flex: 0 0 auto; white-space: nowrap; }
.risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 17px 18px; }
.risk-grid div { padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.02); }
.risk-grid span { display: block; color: var(--muted); font-size: var(--font-caption); }
.risk-grid strong { display: block; margin-top: 4px; font-size: var(--font-body); font-weight: 600; color: #f1f5f9; }
.risk-events { max-height: 143px; overflow-y: auto; border-top: 1px solid var(--line); }
.risk-event { padding: 10px 18px; border-bottom: 1px solid rgba(148,163,184,.06); }
.risk-event strong { display: block; color: var(--orange); font-size: var(--font-caption); font-weight: 500; }
.risk-event span { color: var(--faint); font-size: var(--font-caption); }

.footer { display: flex; justify-content: space-between; padding: 24px 2px 0; color: var(--faint); font-size: var(--font-caption); }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 30px; background: rgba(2,8,16,.78); backdrop-filter: blur(8px); }
.modal-backdrop.open { display: flex; }
.stock-modal { width: min(1180px, 94vw); max-height: 92vh; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 15px; background: var(--panel-solid); box-shadow: 0 35px 120px rgba(0,0,0,.55); }
.stock-header { display: flex; align-items: center; gap: 24px; padding: 20px 23px; border-bottom: 1px solid var(--line); }
.stock-identity { display: flex; align-items: center; gap: 12px; flex: 1; }
.stock-badge { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(145deg, rgba(91,157,255,.18), rgba(91,157,255,.03)); color: var(--teal); font-weight: 700; font-size: var(--font-caption); }
.stock-header h2 { margin: 0; font-size: var(--font-heading); }
.stock-header p { margin: 2px 0 0; color: var(--faint); font-size: var(--font-caption); }
.stock-price { text-align: right; min-width: 110px; }
.stock-price strong { display: block; font-size: var(--font-metric); font-variant-numeric: tabular-nums; }
.stock-price span { font-size: var(--font-caption); }
.chart-tabs { display: flex; padding: 3px; border-radius: 8px; background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.chart-tabs button { padding: 6px 15px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: var(--font-caption); }
.chart-tabs button.active { color: var(--text); background: rgba(91,157,255,.13); }
.modal-close { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: var(--font-metric); line-height: 1; }
.modal-close:hover { color: var(--red); }
.stock-stats { display: grid; grid-template-columns: repeat(6,1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.stock-stats div { padding: 12px 18px; background: var(--panel-solid); }
.stock-stats span { display: block; color: var(--faint); font-size: var(--font-caption); }
.stock-stats strong { display: block; margin-top: 3px; font-size: var(--font-caption); font-weight: 550; }
.chart-container { padding: 12px 16px 9px; min-height: 390px; }
.chart-shell { width: 100%; }
.chart-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; padding: 0 4px 8px; }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-width: 0; color: var(--muted); font-family: var(--mono); font-size: var(--font-caption); font-variant-numeric: tabular-nums; }
.chart-legend strong { color: var(--text); font-weight: 600; }
.chart-legend .ma5 { color: var(--blue); }
.chart-legend .ma20 { color: var(--orange); }
.chart-legend .volume { color: var(--faint); }
.chart-reset { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; padding: 5px 8px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--faint); font-size: var(--font-caption); }
.chart-reset .icon { width: 14px; height: 14px; }
.chart-reset:hover { color: var(--teal); border-color: var(--line-strong); background: var(--teal-soft); }
.chart-canvas { position: relative; width: 100%; height: 430px; min-width: 0; touch-action: none; }
.chart-canvas:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.chart-canvas canvas { display: block; }
.chart-hint { display: flex; justify-content: space-between; gap: 12px; padding: 8px 4px 0; color: var(--faint); font-size: var(--font-caption); }
.chart-hint span { display: inline-flex; align-items: center; gap: 5px; }
.chart-hint .icon { width: 13px; height: 13px; color: var(--teal); }
#chartRange { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.chart-loading { height: 100%; min-height: 360px; display: grid; place-items: center; color: var(--faint); text-align: center; padding: 24px; }
.stock-lower { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 5px 22px 22px; }
.stock-lower > div { border: 1px solid var(--line); border-radius: 9px; padding: 13px 15px; }
.stock-lower h3 { margin: 0 0 8px; font-size: var(--font-caption); color: var(--muted); font-weight: 500; }
.stock-lower div div { color: var(--muted); font-size: var(--font-body); line-height: 1.8; }
.chart-axis { fill: var(--faint); font-size: var(--font-caption); font-family: var(--font-number); }
.chart-grid { stroke: rgba(148,163,184,.10); stroke-width: 1; }
.chart-cross { stroke: rgba(148,163,184,.35); stroke-dasharray: 4 4; }

.toast { position: fixed; right: 28px; bottom: 28px; z-index: 80; max-width: 380px; padding: 12px 17px; border: 1px solid rgba(91,157,255,.3); border-radius: 9px; background: rgba(17,26,34,.97); color: #d8e8f5; box-shadow: var(--shadow); font-size: var(--font-caption); opacity: 0; transform: translateY(12px); transition: all .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,107,107,.4); }

.market-tape { position: sticky; top: 82px; z-index: 19; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; min-height: 54px; border-bottom: 1px solid var(--line-strong); background: rgba(7,16,24,.97); backdrop-filter: blur(12px); }
.tape-label { align-self: stretch; display: flex; align-items: center; gap: 8px; padding: 0 20px 0 34px; border-right: 1px solid var(--line-strong); color: var(--teal); font-size: var(--font-caption); font-weight: 650; letter-spacing: .5px; white-space: nowrap; }
.tape-label .icon { width: 16px; height: 16px; }
.tape-track { display: flex; align-items: stretch; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tape-track::-webkit-scrollbar { display: none; }
.tape-item { flex: 0 0 auto; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 7px 20px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; }
.tape-item:hover { background: rgba(69,200,216,.06); }
.tape-name { grid-row: span 2; font-size: var(--font-caption); font-weight: 600; white-space: nowrap; }
.tape-name small { display: block; margin-top: 1px; color: var(--faint); font-family: var(--mono); font-size: var(--font-caption); font-weight: 400; letter-spacing: .2px; }
.tape-item strong { font-family: var(--mono); font-size: var(--font-body); font-variant-numeric: tabular-nums; }
.tape-change { font-family: var(--mono); font-size: var(--font-caption); font-variant-numeric: tabular-nums; }
.tape-empty { padding: 0 20px; color: var(--faint); font-size: var(--font-caption); white-space: nowrap; }
.tape-status { display: flex; align-items: center; gap: 10px; padding: 0 34px 0 20px; color: var(--faint); font-size: var(--font-caption); white-space: nowrap; }
.tape-status i { width: 1px; height: 14px; background: var(--line-strong); }
#dataUpdated, #refreshState { font-family: var(--mono); font-variant-numeric: tabular-nums; }
#refreshState { display: inline-block; flex: 0 0 8em; width: 8em; text-align: right; }

.topbar { background: rgba(7,16,24,.97); border-bottom-color: var(--line-strong); }
.brand-mark { border-radius: 6px; }
.nav a.active::after { background: var(--teal); box-shadow: 0 -2px 12px rgba(69,200,216,.25); }
main { padding-top: 26px; }
.page-heading { margin-bottom: 20px; }
.eyebrow { font-family: var(--font-ui); }
.mode-strip, .metric-card, .panel, .stock-modal { border-radius: 8px; }
.mode-strip { background: #0a1620; border-left-color: var(--teal); }
.metric-card { background: #0d1923; box-shadow: none; }
.metric-card.featured { background: #10212b; border-color: rgba(69,200,216,.28); }
.metric-card::after { width: 44px; background: var(--teal); }
.metric-value, .metric-foot span, .clock, .score-value, .plan-price, .tape-item strong { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.panel { box-shadow: none; }
.panel-header { background: rgba(255,255,255,.012); }
.panel-footer { background: rgba(255,255,255,.012); }
th { background: #0a1620; font-size: var(--font-caption); letter-spacing: .2px; }
td { border-top-color: var(--line); }
tbody tr:hover { background: rgba(69,200,216,.045); }
.signal-tag, .side-tag, .status-chip { border-radius: 4px; font-weight: 600; }
#process .timeline { max-height: 610px; }
.timeline { padding-left: 16px; padding-right: 16px; }
.timeline-item { grid-template-columns: 62px 10px 1fr; gap: 9px; }
.timeline-dot { border-radius: 2px; transform: rotate(45deg); box-shadow: none; }
.timeline-body strong { color: var(--text); }
.timeline-body small { line-height: 1.65; }
.health-score { padding: 17px; }
.health-list { padding: 0 17px; }
.health-item { align-items: flex-start; }
.health-item i { margin-top: 8px; flex: 0 0 5px; }
.health-item span { flex: 0 0 66px; }
.health-item small { text-align: right; line-height: 1.55; }
.health-ring::before { background: var(--panel-solid); }
.stock-link { font-weight: 600; }
.score-track { background: #1a2b37; }
.risk-track, .weight-track, .learning-track { background: #1a2b37; }
body.modal-open { overflow: hidden; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,.18); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.3); }

@media (max-width: 1380px) {
  .nav { gap: 19px; }
  .brand, .top-actions { min-width: 220px; }
  .metric-value { font-size: var(--font-metric); }
  .signal-summary > div { padding: 0 8px; }
  th, td { padding-left: 10px; padding-right: 10px; }
}

body { font-size: var(--font-body); }
.topbar { height: 82px; }
.brand strong { font-size: var(--font-heading); }
.brand small { font-size: var(--font-caption); letter-spacing: 1.4px; }
.nav { gap: 26px; }
.nav a { font-size: var(--font-body); }
.global-status { font-size: var(--font-caption); }
.clock { font-size: var(--font-body); }
.eyebrow { font-size: var(--font-caption); letter-spacing: 1.5px; }
h1 { font-size: var(--font-display); }
.page-heading p { font-size: var(--font-body); }
.auto-status { font-size: var(--font-caption); }
.btn { padding: 10px 18px; font-size: var(--font-body); }
.btn.tiny { padding: 5px 11px; font-size: var(--font-caption); }
.mode-strip strong { font-size: var(--font-body); }
.mode-strip span { font-size: var(--font-caption); }
.mode-meta strong { font-size: var(--font-body); }
.metric-card { min-height: 144px; }
.metric-label { font-size: var(--font-caption); }
.metric-label span { font-size: var(--font-caption); }
.metric-value { font-size: var(--font-display); }
.metric-value.small { font-size: var(--font-metric); }
.metric-foot span { font-size: var(--font-caption); }
.metric-foot small { font-size: var(--font-caption); }
.panel-header { min-height: 48px; padding: 9px 21px; }
.panel h2 { font-size: var(--font-heading); }
.panel-tools { font-size: var(--font-caption); }
.icon-btn { width: 33px; height: 33px; font-size: var(--font-heading); }
.status-chip { padding: 5px 10px; font-size: var(--font-caption); }
.subtle-label { font-size: var(--font-caption); }
.panel-footer { min-height: 47px; font-size: var(--font-caption); }
.text-btn { font-size: var(--font-caption); }
.signal-summary { padding: 17px 10px; }
.signal-summary strong { font-size: var(--font-metric); }
.signal-summary small { font-size: var(--font-caption); }
.summary-icon { font-size: var(--font-heading); }
table { font-size: var(--font-body); }
th { padding: 12px 14px; }
td { padding: 13px 14px; line-height: 1.5; }
td .sub { font-size: var(--font-caption); }
.stock-link { font-size: var(--font-body); }
.rank { width: 24px; height: 24px; font-size: var(--font-caption); }
.score-value { font-size: var(--font-body); }
.signal-tag, .side-tag { padding: 4px 8px; font-size: var(--font-caption); }
.empty { font-size: var(--font-caption); }
.trade-logic { min-width: 280px; max-width: 390px; white-space: normal; overflow-wrap: anywhere; }
.health-ring span { font-size: var(--font-metric); }
.health-ring small { font-size: var(--font-caption); }
.health-score strong { font-size: var(--font-body); }
.health-score p { font-size: var(--font-caption); }
.health-item { padding: 11px 0; }
.health-item span { font-size: var(--font-caption); }
.health-item small { font-size: var(--font-caption); }
.system-mini span { font-size: var(--font-caption); }
.system-mini strong { font-size: var(--font-caption); }
.plan-list { max-height: 380px; }
.plan-item { padding: 14px 19px; }
.plan-name { font-size: var(--font-body); }
.plan-price { font-size: var(--font-caption); }
.plan-reason { margin-top: 7px; color: var(--muted); font-size: var(--font-body); line-height: 1.6; white-space: normal; overflow: visible; }
.plan-meta { margin-top: 8px; font-size: var(--font-caption); }
.plan-item, .plan-item * { font-size: var(--font-body); }
.plan-list .empty { font-size: var(--font-body) !important; }
.logic-flow { padding: 15px 21px 10px; }
.logic-step { grid-template-columns: 27px 1fr; gap: 12px; padding-bottom: 16px; }
.logic-step:not(:last-child)::after { left: 13px; top: 28px; }
.logic-step b { width: 26px; height: 26px; font-size: var(--font-caption); }
.logic-step strong { font-size: var(--font-caption); }
.logic-step span { font-size: var(--font-caption); line-height: 1.65; }
.weight-title { padding: 10px 21px 6px; font-size: var(--font-caption); }
.weight-title small { font-size: var(--font-caption); }
.weights { padding: 0 21px 17px; gap: 10px 16px; }
.weight-row { grid-template-columns: 80px 1fr 34px; font-size: var(--font-caption); }
.timeline { max-height: 395px; padding: 8px 21px 14px; }
.timeline-item { grid-template-columns: 75px 12px 1fr; gap: 11px; padding: 12px 0; }
.timeline-time { font-size: var(--font-caption); }
.timeline-body strong { font-size: var(--font-caption); }
.timeline-body small { font-size: var(--font-caption); line-height: 1.55; }
.learning-overview { padding: 21px 21px 14px; }
.learning-overview span { font-size: var(--font-caption); }
.learning-overview strong { font-size: var(--font-metric); }
.learning-overview strong.version-text { font-size: var(--font-body); }
.learning-overview small { font-size: var(--font-caption); }
.learning-list { max-height: 210px; }
.learning-item { padding: 12px 20px; }
.learning-item strong { font-size: var(--font-caption); }
.learning-item p { font-size: var(--font-caption); line-height: 1.55; }
.risk-grid { padding: 19px 20px; }
.risk-grid div { padding: 13px; }
.risk-grid span { font-size: var(--font-caption); }
.risk-grid strong { font-size: var(--font-metric); }
.risk-events { max-height: 205px; }
.risk-event { padding: 12px 20px; }
.risk-event strong { font-size: var(--font-caption); }
.risk-event span { font-size: var(--font-caption); line-height: 1.55; }
.footer { font-size: var(--font-caption); }
.stock-header h2 { font-size: var(--font-heading); }
.stock-header p { font-size: var(--font-caption); }
.stock-badge { font-size: var(--font-body); }
.stock-price strong { font-size: var(--font-display); }
.stock-price span { font-size: var(--font-caption); }
.chart-tabs button { padding: 7px 17px; font-size: var(--font-caption); }
.stock-stats div { padding: 14px 20px; }
.stock-stats span { font-size: var(--font-caption); }
.stock-stats strong { font-size: var(--font-body); }
.stock-lower { padding: 7px 24px 24px; }
.stock-lower > div { padding: 15px 17px; }
.stock-lower h3 { font-size: var(--font-body); }
.stock-lower div div { font-size: var(--font-caption); }
.chart-axis { font-size: var(--font-caption); }
.chart-loading { font-size: var(--font-body); }
.toast { max-width: 460px; padding: 14px 19px; font-size: var(--font-body); }

@media (max-width: 1380px) {
  .metric-value { font-size: var(--font-display); }
  .nav { gap: 18px; }
  .nav a { font-size: var(--font-body); }
  .brand strong { font-size: var(--font-heading); }
}

@media (max-width: 1180px) {
  .topbar { padding-left: 22px; padding-right: 22px; }
  .brand, .top-actions { min-width: 0; }
  .nav { gap: 16px; }
  main { padding: 28px 22px 22px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tape-label { padding-left: 22px; }
  .tape-status { padding-right: 22px; }
  #tapeSource, .tape-status i { display: none; }
}

@media (max-width: 1024px) {
  .market-tape { top: 0; }
  .topbar { height: auto; min-height: 78px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 0; }
  .brand, .top-actions { height: 54px; }
  .nav { order: 3; width: 100%; height: 42px; gap: 24px; overflow-x: auto; }
  .nav a { flex: 0 0 auto; }
  .span-4, .span-5, .span-7, .span-8 { grid-column: span 6; }
  .span-12 { grid-column: span 12; }
  .page-heading { align-items: flex-start; gap: 16px; }
}

@media (max-width: 900px) {
  .page-heading { flex-direction: column; align-items: flex-start; }
  .mode-strip { flex-wrap: wrap; }
  .mode-strip > div:nth-child(2) { flex-basis: calc(100% - 60px); }
  .mode-meta { flex: 1; min-width: 0; padding-left: 14px; }
  .mode-meta strong { overflow-wrap: anywhere; }
}

@media (max-width: 768px) {
  .market-tape { grid-template-columns: minmax(0, 1fr) auto; }
  .tape-label { display: none; }
  .tape-status { padding-left: 12px; padding-right: 16px; }
  .tape-item { padding-left: 14px; padding-right: 14px; }
  #process .timeline { max-height: 430px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .brand { gap: 9px; }
  .brand strong { font-size: var(--font-heading); }
  .brand small { font-size: var(--font-caption); letter-spacing: .6px; }
  .top-actions { gap: 10px; }
  .global-status { font-size: var(--font-caption); }
  main { padding: 22px 16px; }
  h1 { font-size: var(--font-display); }
  .page-heading p { font-size: var(--font-body); }
  .auto-status { font-size: var(--font-caption); }
  .btn { padding-left: 13px; padding-right: 13px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .metric-card { min-height: 138px; padding: 15px; }
  .metric-value, .metric-value.small { font-size: var(--font-metric); }
  .metric-foot { flex-wrap: wrap; gap: 3px 7px; }
  .dashboard-grid { gap: 14px; }
  .span-4, .span-5, .span-7, .span-8, .span-12 { grid-column: span 12; }
  .panel-header { padding-left: 16px; padding-right: 16px; }
  .signal-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
  .signal-summary > div:nth-child(2) { border-right: 0; }
  .panel-footer { align-items: flex-start; }
  .footer { flex-direction: column; gap: 6px; }
  .modal-backdrop { padding: 10px; }
  .stock-modal { width: 100%; max-height: 95vh; }
  .stock-header { flex-wrap: wrap; gap: 14px; padding: 16px; }
  .stock-identity { flex-basis: 100%; }
  .stock-price { min-width: 0; text-align: left; }
  .chart-tabs { margin-left: auto; }
  .stock-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stock-stats div { padding: 12px 14px; }
  .chart-container { padding-left: 10px; padding-right: 10px; }
  .chart-canvas { height: 390px; }
  .chart-legend { gap: 5px 10px; font-size: var(--font-caption); }
  .chart-hint { font-size: var(--font-caption); }
  .chart-hint span:nth-child(2) { display: none; }
  .stock-lower { grid-template-columns: 1fr; padding: 5px 16px 18px; }
}

#dashboardGrid.grid-stack { display: block; }
#dashboardGrid > .grid-stack-item { min-width: 0; }
#dashboardGrid > .grid-stack-item > .grid-stack-item-content { inset: 0; overflow: hidden; border-radius: 8px; }
#dashboardGrid .topbar, #dashboardGrid .market-tape, #dashboardGrid .page-heading, #dashboardGrid .mode-strip, #dashboardGrid .metric-card { height: 100%; min-height: 0; }
#dashboardGrid .topbar { position: relative; top: auto; z-index: auto; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
#dashboardGrid .market-tape { position: relative; top: auto; z-index: auto; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
#dashboardGrid .page-heading { margin: 0; padding: 18px 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: rgba(13,25,35,.91); }
#dashboardGrid .mode-strip { margin: 0; overflow: hidden; }
#dashboardGrid .metric-card { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 4px; padding: 2px 4px 2px 1px; font-family: var(--font-ui); font-size: var(--font-metric-line); line-height: 1.2; }
#dashboardGrid .metric-card * { font-family: var(--font-ui); font-size: var(--font-metric-line); line-height: 1.2; letter-spacing: -.3px; }
#dashboardGrid .metric-label { flex: 0 0 auto; min-width: 0; gap: 0; white-space: nowrap; }
#dashboardGrid .metric-label .icon { width: 8px; height: 8px; }
#dashboardGrid .label-with-icon { gap: 0; white-space: nowrap; }
#metricTotalAssets .metric-label > span:last-child { display: none; }
#dashboardGrid .metric-value { flex: 0 0 auto; margin: 0; white-space: nowrap; }
#dashboardGrid .metric-foot { flex: 0 0 auto; display: flex; align-items: baseline; gap: 2px; margin: 0; white-space: nowrap; }
#dashboardGrid .metric-foot small { margin: 0; color: var(--muted); }
#dashboardGrid .metric-card .risk-track { position: absolute; left: 5px; right: 5px; bottom: 4px; height: 2px; margin: 0; }
#dashboardGrid .topbar, #dashboardGrid .market-tape, #dashboardGrid .page-heading, #dashboardGrid .mode-strip, #dashboardGrid .metric-card { cursor: grab; user-select: none; touch-action: none; }
#dashboardGrid .topbar:active, #dashboardGrid .market-tape:active, #dashboardGrid .page-heading:active, #dashboardGrid .mode-strip:active, #dashboardGrid .metric-card:active { cursor: grabbing; }
#dashboardGrid .topbar a, #dashboardGrid .topbar button, #dashboardGrid .market-tape button, #dashboardGrid .page-heading button { cursor: pointer; }
#metricAvailableCash .label-with-icon .icon { color: var(--green); }
#metricMarketValue .label-with-icon .icon { color: var(--purple); }
#metricDayPnl .label-with-icon .icon { color: var(--orange); }
#metricUnrealizedPnl .label-with-icon .icon { color: var(--blue); }
#metricRisk .label-with-icon .icon { color: var(--orange); }
#dashboardGrid .panel { height: 100%; display: flex; flex-direction: column; }
#dashboardGrid .panel-header { flex: 0 0 auto; cursor: grab; user-select: none; touch-action: none; }
#dashboardGrid .panel-header:active { cursor: grabbing; }
#dashboardGrid .panel-header::after { content: ""; width: 12px; height: 16px; flex: 0 0 12px; margin-left: 10px; color: var(--faint); background-image: radial-gradient(circle, currentColor 1px, transparent 1.2px); background-size: 4px 4px; opacity: .38; }
#dashboardGrid .panel-header button, #dashboardGrid .panel-header a { cursor: pointer; }
#dashboardGrid .signal-summary, #dashboardGrid .panel-footer, #dashboardGrid .weight-title, #dashboardGrid .weights, #dashboardGrid .health-score, #dashboardGrid .system-mini, #dashboardGrid .learning-overview, #dashboardGrid .learning-track, #dashboardGrid .suggestion-heading, #dashboardGrid .risk-grid { flex: 0 0 auto; }
#dashboardGrid .table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; }
#dashboardGrid .timeline, #dashboardGrid .plan-list, #dashboardGrid .health-list, #dashboardGrid .logic-flow, #dashboardGrid .risk-events { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
#dashboardGrid .learning-list { flex: 0 1 38%; min-height: 42px; max-height: none; overflow-y: auto; }
#dashboardGrid .suggestion-section { flex: 1 1 62%; min-height: 0; }
#dashboardGrid .suggestion-list { max-height: none; }
#dashboardGrid > .grid-stack-item > .ui-resizable-ne, #dashboardGrid > .grid-stack-item > .ui-resizable-se, #dashboardGrid > .grid-stack-item > .ui-resizable-sw, #dashboardGrid > .grid-stack-item > .ui-resizable-nw { width: 13px; height: 13px; opacity: .38; background: linear-gradient(135deg, transparent 42%, var(--teal) 44%, var(--teal) 52%, transparent 54%, transparent 66%, var(--teal) 68%, var(--teal) 76%, transparent 78%); transform: none; }
#dashboardGrid > .grid-stack-item > .ui-resizable-ne { top: 3px; right: 3px; }
#dashboardGrid > .grid-stack-item > .ui-resizable-se { right: 3px; bottom: 3px; }
#dashboardGrid > .grid-stack-item > .ui-resizable-sw { bottom: 3px; left: 3px; }
#dashboardGrid > .grid-stack-item > .ui-resizable-nw { top: 3px; left: 3px; }
#dashboardGrid > .grid-stack-item > .ui-resizable-n, #dashboardGrid > .grid-stack-item > .ui-resizable-s { left: 18px; right: 18px; height: 9px; opacity: .28; background: linear-gradient(var(--teal), var(--teal)) center / 52px 2px no-repeat; }
#dashboardGrid > .grid-stack-item > .ui-resizable-n { top: 2px; }
#dashboardGrid > .grid-stack-item > .ui-resizable-s { bottom: 2px; }
#dashboardGrid > .grid-stack-item > .ui-resizable-e, #dashboardGrid > .grid-stack-item > .ui-resizable-w { top: 18px; bottom: 18px; width: 9px; opacity: .28; background: linear-gradient(var(--teal), var(--teal)) center / 2px 52px no-repeat; }
#dashboardGrid > .grid-stack-item > .ui-resizable-e { right: 2px; }
#dashboardGrid > .grid-stack-item > .ui-resizable-w { left: 2px; }
#dashboardGrid > .grid-stack-item:hover > .ui-resizable-handle { opacity: .85; }
#dashboardGrid > .grid-stack-item.ui-draggable-dragging { z-index: 30; }
#dashboardGrid > .grid-stack-item.ui-draggable-dragging .grid-stack-item-content > * { border-color: rgba(69,200,216,.5); box-shadow: 0 18px 42px rgba(0,0,0,.4); }
#dashboardGrid > .grid-stack-item.ui-resizable-resizing { z-index: 25; }
#dashboardGrid > .grid-stack-placeholder > .placeholder-content { border: 1px solid rgba(69,200,216,.55); background: var(--teal-soft); border-radius: 8px; }
#dashboardGrid.layout-locked > .grid-stack-item > .ui-resizable-handle { display: none; }
#dashboardGrid.layout-locked .panel-header, #dashboardGrid.layout-locked .topbar, #dashboardGrid.layout-locked .market-tape, #dashboardGrid.layout-locked .page-heading, #dashboardGrid.layout-locked .mode-strip, #dashboardGrid.layout-locked .metric-card { cursor: default; touch-action: auto; }
#dashboardGrid.layout-locked .panel-header::after { opacity: .18; }

@media (max-width: 1100px) {
  .heading-actions { width: 100%; align-items: flex-start; }
  .layout-controls { justify-content: flex-start; flex-wrap: wrap; gap: 9px 12px; }
}

@media (max-width: 768px) {
  .layout-hint { width: 100%; }
  #dashboardGrid .panel-header::after { margin-left: 6px; }
}

body {
  background:
    radial-gradient(ellipse at 8% -8%, rgba(69, 200, 216, .10), transparent 38%),
    radial-gradient(ellipse at 96% 4%, rgba(91, 157, 255, .07), transparent 30%),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(148, 163, 184, .13) .8px, transparent .8px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.72), transparent 72%);
}
main { z-index: 1; max-width: none; padding-left: 0; padding-right: 0; }
.mode-strip, .metric-card, .panel {
  background-color: rgba(13, 25, 35, .91);
  background-image: linear-gradient(145deg, rgba(255,255,255,.025), transparent 58%);
  backdrop-filter: blur(12px);
}
.metric-card.featured { background-color: rgba(16, 33, 43, .94); }
.panel { border-color: rgba(148, 163, 184, .18); }
.panel-header { background: rgba(7, 16, 24, .28); }

.tape-label {
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
}
.tape-label:hover, .tape-label[aria-expanded="true"] { background: rgba(69, 200, 216, .07); }
.tape-count {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border: 1px solid rgba(69, 200, 216, .22);
  border-radius: 11px;
  background: var(--teal-soft);
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--font-caption);
  letter-spacing: 0;
}

.watchlist-drawer {
  position: fixed;
  top: 148px;
  right: 34px;
  z-index: 35;
  width: min(440px, calc(100vw - 32px));
  max-height: min(690px, calc(100vh - 170px));
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, .26);
  border-radius: 12px;
  background: rgba(10, 22, 32, .97);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .48);
  backdrop-filter: blur(20px);
  animation: drawer-in .18s ease-out;
}
.watchlist-drawer[hidden] { display: none; }
.watchlist-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 19px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 22, 32, .97);
}
.watchlist-header h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: var(--font-heading); line-height: 1.2; }
.watchlist-header h2 .icon { color: var(--teal); }
.watchlist-overview { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.watchlist-overview div { padding: 13px 17px; border-right: 1px solid var(--line); }
.watchlist-overview div:last-child { border-right: 0; }
.watchlist-overview span { display: block; color: var(--faint); font-size: var(--font-caption); }
.watchlist-overview strong { display: block; margin-top: 3px; font-family: var(--mono); font-size: var(--font-metric); }
.watchlist-overview strong.shortcut { color: var(--teal); font-size: var(--font-body); line-height: 28px; }
.watchlist-section { padding: 14px 17px 4px; }
.watchlist-section + .watchlist-section { border-top: 1px solid var(--line); }
.watchlist-section h3 { margin: 0 0 8px; color: var(--muted); font-size: var(--font-caption); font-weight: 600; }
.watchlist-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 11px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.watchlist-item + .watchlist-item { border-top: 1px solid rgba(148, 163, 184, .08); }
.watchlist-item:hover { background: rgba(69, 200, 216, .07); }
.watchlist-name { min-width: 0; }
.watchlist-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-body); }
.watchlist-name small { display: block; margin-top: 2px; color: var(--faint); font-family: var(--mono); font-size: var(--font-caption); }
.watchlist-quote { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.watchlist-quote strong { display: block; font-size: var(--font-body); }
.watchlist-quote small { display: block; margin-top: 2px; font-size: var(--font-caption); }
.watchlist-empty { padding: 15px 10px 18px; color: var(--faint); font-size: var(--font-caption); text-align: center; }

.command-deck {
  position: sticky;
  top: 10px;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 10px 12px 0;
  padding: 0 4px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(7, 16, 24, .97);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
  backdrop-filter: blur(16px);
}
.command-metrics { min-width: 0; }
.command-deck .metrics {
  display: grid;
  grid-template-columns: 83fr 74fr 77fr 74fr 90fr 82fr;
  gap: 0;
  margin: 0;
}
.command-deck .metric-card {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, .25vw, 7px);
  min-width: 0;
  height: 58px;
  min-height: 58px;
  padding: 2px 6px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-family: var(--font-ui);
  font-size: clamp(13px, .62vw, 16px);
  line-height: 1.2;
}
.command-deck .metric-card + .metric-card { border-left: 1px solid var(--line); }
.command-deck .metric-card::after { display: none; }
.command-deck .metric-card * {
  font-family: var(--font-ui);
  font-size: clamp(13px, .62vw, 16px);
  line-height: 1.2;
  letter-spacing: -.2px;
}
.command-deck .metric-label { flex: 0 0 auto; min-width: 0; gap: 0; white-space: nowrap; }
.command-deck .metric-label .icon { width: clamp(9px, .5vw, 13px); height: clamp(9px, .5vw, 13px); }
.command-deck .label-with-icon { gap: 0; white-space: nowrap; }
.command-deck #metricTotalAssets .metric-label > span:last-child { display: none; }
.command-deck .metric-value { flex: 0 0 auto; margin: 0; white-space: nowrap; }
.command-deck .metric-foot { flex: 0 0 auto; display: flex; align-items: baseline; gap: clamp(2px, .12vw, 4px); margin: 0; white-space: nowrap; }
.command-deck .metric-foot small { margin: 0; color: var(--muted); }
.command-deck .metric-card .risk-track { position: absolute; left: 5px; right: 5px; bottom: 4px; height: 2px; margin: 0; }
.billing-bar {
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 46px;
  border-top: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(69, 200, 216, .055), transparent 42%);
}
.billing-summary {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.billing-summary:hover { background: rgba(69, 200, 216, .055); }
.billing-summary:focus-visible, .account-logout:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.billing-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(69, 200, 216, .25);
  border-radius: 7px;
  background: rgba(69, 200, 216, .08);
  color: var(--teal);
}
.billing-icon .icon { width: 15px; height: 15px; }
.billing-copy { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
.billing-line { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: var(--font-caption); white-space: nowrap; }
.billing-line strong { overflow: hidden; color: var(--teal); font-size: var(--font-caption); font-weight: 650; text-overflow: ellipsis; }
.billing-summary.is-billing .billing-icon, .billing-summary.is-billing .billing-line strong { color: var(--orange); }
.billing-summary.is-billing .billing-icon { border-color: rgba(242, 184, 75, .3); background: rgba(242, 184, 75, .08); }
.billing-summary.is-low .billing-icon, .billing-summary.is-low .billing-line strong { color: var(--red); }
.billing-summary.is-low .billing-icon { border-color: rgba(240, 97, 103, .3); background: rgba(240, 97, 103, .08); }
.billing-line > span:last-child { overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.billing-separator { color: var(--faint); }
.billing-copy small { overflow: hidden; color: var(--faint); font-size: var(--font-caption); text-overflow: ellipsis; white-space: nowrap; }
.billing-chevron { flex: 0 0 auto; width: 12px; height: 12px; color: var(--faint); transform: rotate(45deg); }
.billing-rate { display: flex; flex: 0 0 auto; align-items: baseline; gap: 3px; align-self: center; padding: 0 14px; border-right: 1px solid var(--line); color: var(--faint); font-size: var(--font-caption); white-space: nowrap; }
.billing-rate strong { color: var(--text); font-family: var(--mono); font-size: var(--font-body); }
.billing-bar > .account-logout { align-self: center; margin: 0 12px 0 10px; }
.command-context { display: flex; flex-wrap: wrap; align-items: stretch; min-width: 0; border-top: 1px solid var(--line); }
.command-deck .mode-strip {
  flex: 1 1 420px;
  min-width: 0;
  margin: 0;
  padding: 6px 12px;
  gap: 10px;
  border: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.command-deck .mode-icon { flex: 0 0 auto; width: 30px; height: 30px; font-size: 12px; letter-spacing: .2px; }
.command-deck .mode-strip > div:nth-child(2) { min-width: 0; }
.command-deck .mode-strip strong, .command-deck .mode-strip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-deck .mode-meta { flex: 0 1 88px; min-width: 72px; padding-left: 10px; }
.command-deck .topbar {
  position: static;
  flex: 1 1 280px;
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.command-deck .top-actions { justify-content: flex-end; min-width: 0; width: 100%; gap: 10px; }
@media (min-width: 1366px) {
  .command-deck { grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
  .command-metrics { border-right: 1px solid var(--line); }
  .billing-bar { width: 320px; min-width: 320px; max-width: 320px; border-top: 0; border-left: 1px solid var(--line); }
  .billing-summary { overflow: hidden; }
  .command-context { grid-column: 1 / -1; }
}
@media (min-width: 1366px) and (max-width: 1600px) {
  .command-deck .metric-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    justify-content: stretch;
    gap: 2px 6px;
    padding-inline: 8px;
  }
  .command-deck .metric-label { grid-column: 1 / -1; justify-content: space-between; font-size: 11px; }
  .command-deck .metric-value { grid-column: 1; grid-row: 2; font-size: 13px; }
  .command-deck .metric-foot { grid-column: 2; grid-row: 2; justify-content: flex-end; font-size: 10px; }
  .command-deck .metric-foot small { display: none; }
}
@media (max-width: 1180px) {
  .command-deck .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .command-deck .metric-card { height: 48px; min-height: 48px; justify-content: flex-start; padding-inline: 10px; }
  .command-deck .metric-card:nth-child(4) { border-left: 0; }
  .command-deck .metric-card:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 768px) {
  .command-deck { position: relative; top: auto; margin: 8px 8px 0; }
  .command-deck .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .command-deck .metric-card { padding-inline: 8px; }
  .command-deck .metric-card:nth-child(odd) { border-left: 0; }
  .command-deck .metric-card:nth-child(n+3) { border-top: 1px solid var(--line); }
  .billing-summary { padding-inline: 9px; gap: 8px; }
  .billing-icon { width: 28px; height: 28px; }
  .billing-rate { padding-inline: 10px; }
  .billing-bar > .account-logout { margin: 0 9px 0 7px; }
  .command-deck .mode-strip { flex-basis: 100%; padding-inline: 9px; gap: 7px; }
  .command-deck .mode-meta { flex: 1 1 0; min-width: 0; padding-left: 7px; }
  .command-deck .topbar { flex-basis: 100%; padding-inline: 9px; border-top: 1px solid var(--line); border-left: 0; }
}
@media (max-width: 480px) {
  .billing-rate { display: none; }
  .billing-line { gap: 4px; }
  .layout-toggle span { display: none; }
}
.layout-toggle { flex: 0 0 auto; }
.layout-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(69, 200, 216, .28);
  border-radius: 6px;
  background: rgba(69, 200, 216, .07);
  color: var(--teal);
  font-family: var(--font-ui);
  font-size: var(--font-caption);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.layout-toggle .icon { width: 13px; height: 13px; }
.layout-toggle:hover, .layout-toggle.active { border-color: rgba(69, 200, 216, .58); background: rgba(69, 200, 216, .15); }
#dashboardGrid.custom-layout-active > .grid-stack-item > .grid-stack-item-content { outline: 1px dashed rgba(69, 200, 216, .22); outline-offset: -3px; }
#dashboardGrid.layout-locked > .grid-stack-item > .ui-resizable-handle { display: none !important; }

.watchlist-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: var(--font-caption);
}

.chart-controls { display: flex; align-items: center; gap: 10px; }
.chart-expand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  font-size: var(--font-caption);
  white-space: nowrap;
}
.chart-expand .icon { width: 15px; height: 15px; }

.exit-monitor-table { min-width: 1100px; }
.exit-monitor-table th { white-space: nowrap; }
.exit-monitor-table td { vertical-align: middle; }
.exit-monitor-table td > strong, .exit-monitor-table td > .sub, .exit-status { display: block; }
.exit-return-cell > strong { font-size: var(--font-body); }
.exit-targets { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.exit-targets span { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; color: var(--muted); }
.exit-targets b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.exit-status { width: fit-content; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 5px; font-size: var(--font-caption); font-weight: 650; white-space: nowrap; }
.exit-status.critical { color: var(--red); border-color: rgba(255,107,107,.38); background: rgba(255,107,107,.09); }
.exit-status.warning { color: var(--orange); border-color: rgba(240,173,78,.34); background: rgba(240,173,78,.08); }
.exit-status.success { color: var(--teal); border-color: rgba(69,200,216,.32); background: var(--teal-soft); }
.exit-status.neutral { color: var(--muted); background: rgba(255,255,255,.025); }
.exit-status-detail { margin-top: 5px; }
.muted-value { color: var(--faint); }

.position-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.position-title h2 { margin: 0; white-space: nowrap; }
.t1-guard { display: inline-grid; place-items: center; width: 14px; height: 14px; flex: 0 0 14px; }
.t1-guard i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(69, 200, 216, .42);
  animation: t1-breathe 2.4s ease-in-out infinite;
}
@keyframes t1-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(69, 200, 216, .42); opacity: .78; }
  50% { box-shadow: 0 0 0 5px rgba(69, 200, 216, 0); opacity: 1; }
}
.panel-header-status { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 18px; min-width: 0; }
.header-status { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: var(--font-caption); white-space: nowrap; }
.header-status i { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: var(--teal); }
.header-status strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.source-status-list { display: inline-flex; align-items: center; gap: 14px; min-width: 0; }
.source-status { color: var(--text); }
.header-status.source-status.warn i { background: var(--orange); }
@media (prefers-reduced-motion: reduce) {
  .t1-guard i { animation: none; box-shadow: 0 0 0 3px rgba(69, 200, 216, .12); }
}
.chart-expand:hover, .chart-expand[aria-pressed="true"] { color: var(--teal); border-color: rgba(69,200,216,.35); background: var(--teal-soft); }
.stock-modal { animation: modal-in .18s ease-out; }
.stock-modal.chart-focused { width: min(1440px, 97vw); }
.stock-modal.chart-focused .stock-stats,
.stock-modal.chart-focused .stock-lower { display: none; }
.stock-modal.chart-focused .chart-container { min-height: min(720px, calc(92vh - 100px)); display: flex; flex-direction: column; justify-content: center; }
.stock-modal.chart-focused .chart-canvas { height: min(680px, calc(92vh - 190px)); }
.stock-modal.chart-focused .chart-loading { width: 100%; }

@keyframes drawer-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 1024px) {
  .watchlist-drawer { top: 190px; right: 22px; max-height: calc(100vh - 212px); }
}
@media (max-width: 768px) {
  .watchlist-drawer { top: 188px; right: 16px; max-height: calc(100vh - 208px); }
  .watchlist-overview div { padding: 11px 12px; }
  .chart-controls { width: 100%; justify-content: space-between; }
  .chart-expand span { display: none; }
  .chart-expand { padding: 8px 10px; }
  .stock-modal.chart-focused { width: 100%; }
  .stock-modal.chart-focused .chart-container { min-height: calc(95vh - 150px); }
  .stock-modal.chart-focused .chart-canvas { height: calc(95vh - 220px); min-height: 360px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

:root {
  --bg: var(--site-bg, #071018);
  --panel: var(--site-surface, #0d1923);
  --panel-solid: var(--site-surface, #0d1923);
  --text: var(--site-fg, #f3f7fa);
  --muted: var(--site-muted, #c3d0da);
  --teal: var(--site-accent, #45c8d8);
  --site-radius-local: calc(8px + var(--site-radius, 0px));
}

#local-app[hidden], #auth-view[hidden], .wallet-backdrop[hidden] { display: none !important; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 50% 0%, rgba(69,200,216,.13), transparent 42%), var(--bg); }
.auth-panel { width: min(460px, 100%); }
.auth-card { padding: calc(30px * var(--site-space, 1)); border: 1px solid var(--line-strong); border-radius: var(--site-radius-local); background: rgba(13,25,35,.96); box-shadow: 0 28px 90px rgba(0,0,0,.38); }
.auth-brand { display: grid; grid-template-columns: 42px 1fr; column-gap: 12px; align-items: center; margin-bottom: 28px; }
.auth-brand .brand-mark { grid-row: span 2; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(69,200,216,.35); border-radius: 10px; background: var(--teal-soft); color: var(--teal); font-weight: 800; }
.auth-brand strong { font-size: var(--font-heading); }
.auth-brand small { color: var(--faint); letter-spacing: 2px; }
.auth-heading h1 { margin: 0 0 5px; font-size: calc(26px * var(--site-type, 1)); }
.auth-heading p { margin: 0 0 22px; color: var(--muted); font-size: var(--font-caption); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); }
.auth-tabs button { padding: 9px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.auth-tabs button.active { background: var(--teal-soft); color: var(--teal); font-weight: 650; }
.auth-card label { display: block; margin: 14px 0 7px; color: var(--muted); font-size: var(--font-caption); }
.auth-card input { width: 100%; padding: 12px 13px; border: 1px solid var(--line-strong); border-radius: 8px; outline: none; background: #09141d; color: var(--text); }
.auth-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(69,200,216,.09); }
.auth-error { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(240,97,103,.3); border-radius: 7px; background: rgba(240,97,103,.08); color: #ff9da2; font-size: var(--font-caption); }
.auth-notice { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(69,200,216,.3); border-radius: 7px; background: var(--teal-soft); color: var(--teal); font-size: var(--font-caption); line-height: 1.6; }
.auth-secondary { padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--teal); cursor: pointer; }
.auth-secondary:hover { background: var(--teal-soft); }
.auth-secondary:disabled { opacity: .5; cursor: not-allowed; }
.full-width { width: 100%; margin-top: 10px; }
.referral-summary { display: flex; align-items: center; gap: 20px; padding: 15px 22px; border-bottom: 1px solid var(--line); background: rgba(69,200,216,.04); }
.referral-summary > div { flex: 1; }
.referral-summary span { display: block; color: var(--faint); font-size: var(--font-caption); }
.referral-summary strong { display: block; margin-top: 5px; color: var(--text); font-size: var(--font-caption); }
.referral-summary #referralCode { color: var(--teal); font-family: var(--mono); letter-spacing: 1px; }
.referral-summary button { padding: 9px 12px; border: 1px solid rgba(69,200,216,.35); border-radius: 7px; background: var(--teal-soft); color: var(--teal); cursor: pointer; }
.auth-primary { margin-top: 18px; padding: 12px 16px; border: 0; border-radius: 8px; background: var(--teal); color: var(--site-on-accent, #06151d); font-weight: 700; cursor: pointer; transition: filter calc(180ms * var(--site-motion, 1)); }
.auth-primary:hover { filter: brightness(1.08); }
.auth-primary:disabled { opacity: .5; cursor: not-allowed; }
.full-width { width: 100%; }
.auth-note { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: var(--font-caption); line-height: 1.7; }
.auth-foot { margin-top: 16px; text-align: center; color: var(--faint); font-size: var(--font-caption); }
.account-logout { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--muted); font-size: var(--font-caption); cursor: pointer; }
.account-logout:hover { color: var(--text); border-color: var(--teal); }
.wallet-backdrop { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: rgba(2,8,16,.8); backdrop-filter: blur(8px); }
.wallet-modal { width: min(900px, 96vw); max-height: 92vh; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: var(--site-radius-local); background: var(--panel-solid); box-shadow: 0 35px 120px rgba(0,0,0,.55); }
.wallet-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 23px; border-bottom: 1px solid var(--line); }
.wallet-modal-header h2 { margin: 0; font-size: var(--font-heading); }
.wallet-modal-header p { margin: 4px 0 0; color: var(--faint); font-size: var(--font-caption); }
.wallet-summary { display: grid; grid-template-columns: repeat(3,1fr); border-bottom: 1px solid var(--line); }
.wallet-summary > div { padding: 16px 22px; border-right: 1px solid var(--line); }
.wallet-summary > div:last-child { border-right: 0; }
.wallet-summary span { display: block; color: var(--faint); font-size: var(--font-caption); }
.wallet-summary strong { display: block; margin-top: 5px; font-size: var(--font-body); font-variant-numeric: tabular-nums; }
.wallet-body { display: grid; grid-template-columns: 1fr 1fr; gap: calc(22px * var(--site-space, 1)); padding: calc(22px * var(--site-space, 1)); }
.wallet-body h3 { margin: 0 0 10px; font-size: var(--font-body); }
.wallet-body p { margin: 0 0 14px; color: var(--faint); font-size: var(--font-caption); line-height: 1.6; }
.wallet-amounts { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.wallet-amounts button { padding: 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(255,255,255,.025); color: var(--muted); }
.wallet-amounts button.selected { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }
.wallet-channels { display: flex; gap: 18px; margin: 16px 0 0; color: var(--muted); font-size: var(--font-caption); }
.wallet-channels label { display: inline-flex; align-items: center; gap: 6px; }
.wallet-channels label.unavailable { opacity: .45; }
.payment-checkout { margin-top: 16px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.025); text-align: center; }
.payment-checkout[hidden] { display: none; }
.payment-checkout img { display: block; width: 220px; height: 220px; max-width: 100%; margin: 0 auto 10px; border-radius: 4px; background: #fff; }
.payment-checkout img[hidden] { display: none; }
.payment-checkout strong { display: block; color: var(--teal); }
.payment-checkout p { margin: 7px 0 12px; }
.payment-checkout-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.payment-checkout-actions button { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--muted); font-size: var(--font-caption); cursor: pointer; }
.payment-checkout-actions button:hover { border-color: var(--teal); color: var(--teal); }
.wallet-ledger-list { max-height: 330px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.wallet-ledger-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.wallet-ledger-item:last-child { border-bottom: 0; }
.wallet-ledger-item strong { display: block; font-size: var(--font-caption); font-weight: 550; }
.wallet-ledger-item small { display: block; margin-top: 3px; color: var(--faint); font-size: var(--font-caption); }
.wallet-ledger-amount { flex: 0 0 auto; font-family: var(--mono); font-size: var(--font-caption); }
.wallet-ledger-amount.credit { color: var(--red); }
.wallet-ledger-amount.debit { color: var(--green); }
.wallet-header-actions { display: flex; align-items: center; gap: 10px; }
.wallet-header-actions > button:not(.modal-close) { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--teal); font-size: var(--font-caption); cursor: pointer; }
.payment-order-info { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; margin: 12px 0; text-align: left; }
.payment-order-info > div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.025); }
.payment-order-info span { display: block; color: var(--faint); font-size: var(--font-caption); }
.payment-order-info strong { display: block; margin-top: 5px; color: var(--text); font-family: var(--mono); font-size: var(--font-caption); overflow-wrap: anywhere; }
.payment-claim-form { margin-top: 12px; text-align: left; }
.payment-claim-form label { display: block; margin: 9px 0 5px; color: var(--muted); font-size: var(--font-caption); }
.payment-claim-form input { width: 100%; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; background: #09141d; color: var(--text); }
.payment-claim-form input:focus { border-color: var(--teal); }
.payment-claim-form button { width: 100%; margin-top: 12px; padding: 10px; border: 0; border-radius: 6px; background: var(--teal); color: var(--site-on-accent, #06151d); font-weight: 700; cursor: pointer; }
.payment-claim-form button:disabled { opacity: .5; cursor: default; }
.admin-payments { padding: 20px 22px; border-top: 1px solid var(--line); }
.admin-payments[hidden] { display: none; }
.admin-payments-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-payments-heading h3 { margin: 0; }
.admin-payments-heading button { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--teal); cursor: pointer; }
.admin-payments > p { margin: 8px 0 14px; color: var(--faint); font-size: var(--font-caption); }
.admin-payment-list { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; }
.admin-payment-item { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.025); }
.admin-payment-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-payment-title strong { font-size: var(--font-caption); overflow-wrap: anywhere; }
.admin-payment-status { flex: 0 0 auto; padding: 3px 7px; border-radius: 10px; background: var(--teal-soft); color: var(--teal); font-size: var(--font-caption); }
.admin-payment-details, .admin-payment-item > p { margin: 7px 0 0; color: var(--faint); font-size: var(--font-caption); line-height: 1.5; overflow-wrap: anywhere; }
.admin-payment-item > .payment-checkout-actions { justify-content: flex-start; margin-top: 10px; }
body.modal-open { overflow: hidden; }
@media (max-width: 768px) {
  .auth-shell { padding: 16px; }
  .auth-card { padding: 22px; }
  .billing-bar > .account-logout { padding-inline: 8px; }
  .wallet-backdrop { padding: 10px; }
  .referral-summary { align-items: stretch; flex-direction: column; gap: 10px; padding: 14px 16px; }
  .wallet-summary { grid-template-columns: 1fr; }
  .wallet-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .wallet-summary > div:last-child { border-bottom: 0; }
  .wallet-body { grid-template-columns: 1fr; padding: 16px; }
}
