:root {
  --bg: #07111e;
  --panel: rgba(12, 27, 44, 0.76);
  --panel-strong: #0e2136;
  --line: rgba(143, 174, 202, 0.14);
  --text: #f1f7fb;
  --muted: #8fa7bb;
  --cyan: #42d9d0;
  --violet: #a88bff;
  --lime: #b6e66d;
  --amber: #ffbf69;
  --positive: #ff7184;
  --negative: #49d6b0;
  --radius: 22px;
  font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 50% -20%, #123253 0, var(--bg) 45%);
  background-size: 48px 48px, 48px 48px, auto;
  color: var(--text);
}

button, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  pointer-events: none;
}

.ambient-one { top: 8%; left: -180px; background: var(--cyan); }
.ambient-two { right: -220px; top: 48%; background: var(--violet); }

.shell { width: min(1400px, calc(100% - 48px)); margin: 0 auto; }

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(66, 217, 208, 0.32); border-radius: 13px; background: rgba(66, 217, 208, 0.08); }
.brand-mark svg { width: 30px; fill: none; stroke: var(--cyan); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font-size: 15px; letter-spacing: 0.16em; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; letter-spacing: 0.12em; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.status-pill { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 14px; background: rgba(12, 27, 44, 0.65); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 5px rgba(66, 217, 208, 0.09); }
.auth-button { border: 1px solid rgba(66, 217, 208, 0.24); color: var(--cyan); background: rgba(66, 217, 208, 0.06); }
.auth-button:hover { border-color: rgba(66, 217, 208, 0.44); background: rgba(66, 217, 208, 0.11); }
.auth-button.authenticated { color: #d9f8f5; background: rgba(66, 217, 208, 0.11); }
.topbar-feature-button { position: relative; display: flex; align-items: center; justify-content: center; height: 38px; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; color: #9eb3c4; background: rgba(12, 27, 44, 0.58); font-size: 13px; cursor: pointer; }
.topbar-feature-button:hover { border-color: rgba(143, 174, 202, 0.34); color: #e5edf3; background: rgba(22, 42, 62, 0.72); }
.topbar-feature-button.watchlist-button { border-color: rgba(255, 191, 105, 0.22); color: #e2bd7a; background: rgba(255, 191, 105, 0.05); }
.topbar-feature-button.watchlist-button:hover { border-color: rgba(255, 191, 105, 0.42); background: rgba(255, 191, 105, 0.1); }
.topbar-feature-button.notification-button { width: 42px; padding: 0; border-color: rgba(66, 217, 208, 0.2); color: #75d8d2; background: rgba(66, 217, 208, 0.045); }
.topbar-feature-button.notification-button > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.topbar-feature-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.notification-unread-badge { position: absolute; top: -5px; right: -4px; display: grid; place-items: center; min-width: 17px; height: 17px; border: 2px solid var(--bg); border-radius: 999px; padding: 0 4px; color: #fff; background: #ff5367; font-size: 10px; font-weight: 800; line-height: 1; }

.glass { border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(22px); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18); }

.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr); gap: 70px; align-items: center; padding: 82px 0 76px; }
.overline, .section-kicker { margin: 0 0 19px; color: var(--cyan); font-size: 13px; font-weight: 700; letter-spacing: 0.17em; }
.overline { display: flex; align-items: center; gap: 10px; }
.overline span { width: 30px; height: 1px; background: var(--cyan); }
.hero h1 { margin: 0; max-width: 820px; font-size: calc(clamp(42px, 5vw, 72px) + 2px); line-height: 1.12; letter-spacing: -0.045em; font-weight: 650; }
.hero h1 em { color: var(--cyan); font-style: normal; font-weight: 520; }
.hero-text { max-width: 710px; margin: 26px 0 0; color: var(--muted); font-size: 18px; line-height: 1.9; }

.market-card { position: relative; overflow: hidden; min-height: 300px; padding: 26px; border-radius: var(--radius); }
.market-card::after { content: ""; position: absolute; right: -70px; top: -100px; width: 220px; height: 220px; border: 1px solid rgba(66, 217, 208, 0.14); border-radius: 50%; box-shadow: 0 0 0 34px rgba(66, 217, 208, 0.025), 0 0 0 68px rgba(66, 217, 208, 0.018); }
.market-card-head { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.15em; }
.quality { padding: 6px 9px; color: var(--amber); border: 1px solid rgba(255, 191, 105, 0.25); border-radius: 999px; background: rgba(255, 191, 105, 0.06); }
.quality.pass { color: var(--cyan); border-color: rgba(66, 217, 208, 0.25); background: rgba(66, 217, 208, 0.06); }
.date-display { position: relative; z-index: 1; margin-top: 45px; font-variant-numeric: tabular-nums; font-size: calc(clamp(34px, 3.4vw, 50px) + 2px); letter-spacing: -0.04em; }
.market-card > p { margin: 7px 0 35px; color: var(--muted); font-size: 14px; }
.market-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border-top: 1px solid var(--line); padding-top: 20px; }
.market-stats div { min-width: 0; }
.market-stats strong { display: block; font-size: 21px; font-variant-numeric: tabular-nums; }
.market-stats span { display: block; overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }

.strategy-section { margin-bottom: 42px; }
.section-title-row { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.section-title-row h2 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
.section-title-row > p { color: var(--muted); font-size: 14px; }
.section-kicker { margin-bottom: 10px; }
.strategy-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.strategy-card { position: relative; overflow: hidden; min-height: 162px; padding: 21px; border: 1px solid var(--line); border-radius: 17px; background: rgba(12, 27, 44, 0.58); color: var(--text); text-align: left; cursor: pointer; transition: transform 160ms ease, border-color 160ms ease, background 160ms ease; }
.strategy-card:hover { transform: translateY(-3px); border-color: rgba(143, 174, 202, 0.28); }
.strategy-card[aria-selected="true"] { border-color: color-mix(in srgb, var(--card-accent) 50%, transparent); background: linear-gradient(145deg, color-mix(in srgb, var(--card-accent) 10%, transparent), rgba(12, 27, 44, 0.88)); }
.strategy-card[aria-selected="true"]::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 2px; background: var(--card-accent); box-shadow: 0 0 18px var(--card-accent); }
.strategy-top { display: flex; align-items: center; justify-content: space-between; color: var(--card-accent); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; }
.strategy-top span:last-child { color: var(--muted); letter-spacing: normal; }
.strategy-card-status { border: 1px solid rgba(143, 174, 202, 0.18); border-radius: 999px; padding: 3px 7px; color: #8f9aa5; background: rgba(143, 174, 202, 0.05); font-size: 11px; letter-spacing: 0; }
.strategy-card h3 { margin: 25px 0 8px; font-size: 22px; }
.strategy-card p { overflow: hidden; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; white-space: nowrap; text-overflow: ellipsis; }
.strategy-card .leader { margin-top: 14px; color: #cddae5; font-size: 13px; }
.strategy-card-edit { position: absolute; top: 13px; right: 14px; z-index: 1; border: 1px solid rgba(229, 216, 95, 0.3); border-radius: 999px; padding: 5px 10px; color: #e5d85f; background: linear-gradient(135deg, rgba(229, 216, 95, 0.13), rgba(229, 216, 95, 0.04)); box-shadow: inset 0 0 0 1px rgba(229, 216, 95, 0.04), 0 4px 12px rgba(0, 0, 0, 0.18); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; cursor: pointer; transition: border-color 140ms ease, background 140ms ease, transform 140ms ease; }
.strategy-card-edit:hover, .strategy-card-edit:focus-visible { transform: translateY(-1px); border-color: rgba(229, 216, 95, 0.62); background: linear-gradient(135deg, rgba(229, 216, 95, 0.2), rgba(229, 216, 95, 0.08)); outline: 0; }
.strategy-card.public .leader { color: #71ded7; }
.strategy-access-badge { display: inline-flex; align-items: center; gap: 5px; color: var(--cyan); }
.strategy-access-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(66, 217, 208, 0.07); }
.strategy-card-placeholder,
.strategy-card-placeholder:hover {
  transform: none;
  border-style: dashed;
  border-color: rgba(143, 174, 202, 0.12);
  background: rgba(8, 20, 34, 0.34);
  cursor: default;
  opacity: 0.55;
}
.strategy-card-placeholder .strategy-top,
.strategy-card-placeholder .leader { color: #6f8497; }

.results { overflow: hidden; min-height: 520px; margin-bottom: 30px; border-radius: var(--radius); }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 26px 28px; border-bottom: 1px solid var(--line); }
.market-head-controls { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.market-mode-toggle { display: inline-flex; align-items: center; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: rgba(0, 0, 0, 0.28); }
.market-mode-toggle button { min-height: 32px; border: 0; border-radius: 5px; padding: 0 11px; color: var(--muted); background: transparent; font: inherit; font-size: 13px; cursor: pointer; }
.market-mode-toggle button.active { color: #f0df5d; background: rgba(229, 216, 95, 0.1); box-shadow: inset 0 0 0 1px rgba(229, 216, 95, 0.28); }
.active-strategy { display: flex; align-items: center; gap: 18px; }
.strategy-eyebrow { display: grid; place-items: center; width: 54px; height: 54px; border: 1px solid rgba(66, 217, 208, 0.26); border-radius: 15px; color: var(--cyan); background: rgba(66, 217, 208, 0.07); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }
.active-strategy h2 { margin: 0; font-size: 24px; }
.active-strategy p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.results-actions { display: flex; align-items: center; gap: 10px; }
.refresh-list-button, .export-txt-button, .strategy-edit-button { display: flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 14px; border: 1px solid rgba(66, 217, 208, 0.25); border-radius: 12px; color: var(--cyan); background: rgba(66, 217, 208, 0.06); font-size: 14px; cursor: pointer; white-space: nowrap; }
.refresh-list-button:hover { border-color: rgba(66, 217, 208, 0.45); background: rgba(66, 217, 208, 0.1); }
.export-txt-button { border-color: rgba(168, 139, 255, 0.25); color: var(--violet); background: rgba(168, 139, 255, 0.06); }
.export-txt-button:hover { border-color: rgba(168, 139, 255, 0.45); background: rgba(168, 139, 255, 0.1); }
.strategy-edit-button { border-color: rgba(229, 216, 95, 0.3); color: #e5d85f; background: rgba(229, 216, 95, 0.06); }
.strategy-edit-button:hover, .strategy-edit-button.active { border-color: rgba(229, 216, 95, 0.58); background: rgba(229, 216, 95, 0.12); }
.refresh-list-button:disabled, .export-txt-button:disabled { cursor: wait; opacity: 0.65; }
.refresh-list-button svg, .export-txt-button svg, .strategy-edit-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.refresh-list-button.loading svg { animation: spin 0.8s linear infinite; }
.search-box { display: flex; align-items: center; width: min(280px, 100%); height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 14, 25, 0.55); }
.search-box:focus-within { border-color: rgba(66, 217, 208, 0.45); box-shadow: 0 0 0 3px rgba(66, 217, 208, 0.07); }
.search-box svg { width: 17px; fill: none; stroke: var(--muted); stroke-width: 1.7; }
.search-box input { width: 100%; border: 0; outline: 0; padding: 0 0 0 9px; color: var(--text); background: transparent; font-size: 14px; }
.search-box input::placeholder { color: #60778b; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1050px; }
th { padding: 14px 18px; color: #647d92; background: rgba(5, 16, 28, 0.35); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-align: left; white-space: nowrap; }
td { padding: 16px 18px; border-top: 1px solid rgba(143, 174, 202, 0.08); color: #cddae5; font-size: 14px; white-space: nowrap; }
tbody tr { transition: background 120ms ease; }
tbody tr:hover { background: rgba(66, 217, 208, 0.025); }
.rank { width: 34px; color: #7690a5; font-variant-numeric: tabular-nums; text-align: center; }
.rank.top { color: var(--cyan); font-weight: 800; }
.stock-cell { display: flex; align-items: center; gap: 12px; }
.stock-open-button { display: flex; align-items: center; gap: 12px; min-width: 0; border: 0; padding: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.stock-open-button:hover .stock-name { color: var(--cyan); }
.stock-open-button:focus-visible { outline: 2px solid rgba(66, 217, 208, 0.72); outline-offset: 5px; border-radius: 8px; }
.stock-initial { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--cyan); background: rgba(66, 217, 208, 0.07); font-weight: 700; }
.stock-name { display: block; color: var(--text); font-size: 15px; font-weight: 600; transition: color 120ms ease; }
.tail-confirmation-badge { display: inline-flex; align-items: center; margin-top: 4px; padding: 2px 6px; border: 1px solid rgba(128, 145, 160, 0.28); border-radius: 999px; color: #9aa8b6; font-size: 11px; font-weight: 700; line-height: 1.2; }
.tail-confirmation-badge.state-buy_point_confirmed { border-color: rgba(36, 196, 123, 0.42); color: #35d28a; background: rgba(36, 196, 123, 0.08); }
.tail-confirmation-badge.state-waiting_confirmation,
.tail-confirmation-badge.state-waiting_1450 { border-color: rgba(229, 216, 95, 0.36); color: #e5d85f; background: rgba(229, 216, 95, 0.06); }
.tail-confirmation-badge.state-trend_invalid { border-color: rgba(255, 77, 103, 0.38); color: #ff5f78; background: rgba(255, 77, 103, 0.07); }
.tail-confirmation-badge.state-data_unavailable { border-color: rgba(128, 145, 160, 0.28); color: #8795a3; }
.stock-code-line { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.stock-code { color: var(--muted); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 12px; user-select: all; }
.copy-button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 6px; color: #71899d; background: transparent; cursor: pointer; }
.copy-button:hover { color: var(--cyan); background: rgba(66, 217, 208, 0.08); }
.copy-button svg { width: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.watchlist-toggle { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 7px; padding: 0; color: #657e92; background: transparent; cursor: pointer; }
.watchlist-toggle:hover { color: var(--amber); background: rgba(255, 191, 105, 0.08); }
.watchlist-toggle.active { color: var(--amber); }
.watchlist-toggle svg { width: 15px; fill: transparent; stroke: currentColor; stroke-width: 1.55; stroke-linejoin: round; }
.watchlist-toggle.active svg { fill: currentColor; }
.score-wrap { display: flex; align-items: center; gap: 9px; }
.score { min-width: 30px; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 700; }
.score-track { width: 52px; height: 3px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.07); }
.score-track span { display: block; height: 100%; border-radius: inherit; background: var(--active-accent, var(--cyan)); }
.numeric { font-variant-numeric: tabular-nums; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.signal-list { display: flex; gap: 6px; }
.signal { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: #9fb2c2; background: rgba(255, 255, 255, 0.018); font-size: 12px; }

.loading-state, .error-state { min-height: 380px; display: flex; align-items: center; justify-content: center; gap: 17px; color: var(--muted); text-align: left; }
.loading-state strong, .error-state strong { color: var(--text); font-size: 16px; }
.loading-state p, .error-state p { margin: 6px 0 0; font-size: 13px; }
.loader { width: 34px; height: 34px; border: 2px solid rgba(66, 217, 208, 0.12); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.8s linear infinite; }
.error-state { flex-direction: column; text-align: center; }
.error-state button { margin-top: 8px; padding: 9px 16px; border: 1px solid rgba(66, 217, 208, 0.3); border-radius: 10px; color: var(--cyan); background: rgba(66, 217, 208, 0.06); cursor: pointer; }
.empty-state { padding: 70px 20px; color: var(--muted); text-align: center; }


footer { display: flex; justify-content: space-between; gap: 20px; padding: 10px 2px 38px; color: #5f788d; font-size: 12px; }
footer p { margin: 0; }
.icp-record-link { color: inherit; text-decoration: none; white-space: nowrap; }
.icp-record-link:hover, .icp-record-link:focus-visible { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
.toast { position: fixed; z-index: 10; right: 28px; bottom: 28px; transform: translateY(18px); padding: 12px 16px; border: 1px solid rgba(66, 217, 208, 0.28); border-radius: 11px; color: var(--text); background: #10283a; box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body.app-modal-open { overflow: hidden; }
.app-modal { position: fixed; z-index: 130; inset: 0; display: grid; place-items: center; padding: 24px; }
.app-modal-backdrop { position: absolute; inset: 0; background: rgba(1, 7, 13, 0.84); backdrop-filter: blur(12px); }
.app-dialog { position: relative; z-index: 1; overflow: hidden; width: min(720px, calc(100vw - 40px)); max-height: calc(100vh - 48px); border: 1px solid rgba(143, 174, 202, 0.22); border-radius: 21px; background: #0c1928; box-shadow: 0 34px 110px rgba(0, 0, 0, 0.58); animation: chart-dialog-in 180ms ease-out; }
.app-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 23px 25px; border-bottom: 1px solid var(--line); background: #102034; }
.app-dialog-head p { margin: 0 0 7px; color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: 0.16em; }
.app-dialog-head h2 { margin: 0; font-size: 24px; }
.app-dialog-close { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(4, 14, 25, 0.45); cursor: pointer; }
.app-dialog-close:hover { color: #fff; border-color: rgba(143, 174, 202, 0.33); }
.app-dialog-close svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.auth-dialog { width: min(520px, calc(100vw - 40px)); }
.auth-form { padding: 24px 25px 27px; }
.auth-intro { display: flex; align-items: center; gap: 13px; border: 1px solid rgba(66, 217, 208, 0.16); border-radius: 13px; padding: 13px 14px; background: rgba(66, 217, 208, 0.035); }
.auth-intro > span { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; color: var(--cyan); background: rgba(66, 217, 208, 0.1); font-size: 12px; font-weight: 800; }
.auth-intro strong { display: block; color: #dce9f1; font-size: 14px; }
.auth-intro p { margin: 5px 0 0; color: #71899c; font-size: 11px; line-height: 1.55; }
.auth-field { display: block; margin-top: 18px; }
.auth-field > span { display: block; margin-bottom: 8px; color: #9eb2c2; font-size: 12px; }
.auth-phone-input, .auth-code-input { display: flex; align-items: center; overflow: hidden; height: 48px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 14, 25, 0.48); }
.auth-phone-input:focus-within, .auth-code-input:focus-within { border-color: rgba(66, 217, 208, 0.46); box-shadow: 0 0 0 3px rgba(66, 217, 208, 0.06); }
.auth-phone-input b { display: grid; place-items: center; align-self: stretch; min-width: 58px; border-right: 1px solid var(--line); color: var(--cyan); font-size: 14px; }
.auth-phone-input input, .auth-code-input input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; padding: 0 13px; color: var(--text); background: transparent; font-size: 15px; letter-spacing: 0.04em; }
.auth-phone-input input::placeholder, .auth-code-input input::placeholder { color: #536c80; letter-spacing: normal; }
.auth-code-input button { align-self: stretch; min-width: 112px; border: 0; border-left: 1px solid var(--line); color: var(--cyan); background: rgba(66, 217, 208, 0.045); font-size: 12px; cursor: pointer; }
.auth-code-input button:disabled { color: #647d90; cursor: wait; }
.mock-code-hint { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px 16px; margin-top: 14px; border: 1px solid rgba(255, 191, 105, 0.22); border-radius: 11px; padding: 11px 13px; background: rgba(255, 191, 105, 0.055); }
.mock-code-hint span { color: #b39464; font-size: 11px; }
.mock-code-hint strong { color: var(--amber); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 20px; letter-spacing: 0.18em; }
.mock-code-hint small { grid-column: 1 / -1; color: #735f43; font-size: 10px; }
.auth-agreement { display: flex; align-items: flex-start; gap: 9px; margin-top: 16px; color: #72899c; font-size: 11px; line-height: 1.55; cursor: pointer; }
.auth-agreement input { width: 15px; height: 15px; margin: 0; accent-color: var(--cyan); }
.auth-security-note { margin: 12px 0 0; color: #526b7f; font-size: 10px; line-height: 1.6; text-align: center; }
.auth-account { padding: 34px 25px 30px; text-align: center; }
.auth-account-avatar { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 15px; border: 1px solid rgba(66, 217, 208, 0.3); border-radius: 21px; color: var(--cyan); background: rgba(66, 217, 208, 0.08); font-size: 19px; font-weight: 800; letter-spacing: 0.08em; }
.auth-account > p { margin: 0; color: #70879a; font-size: 11px; }
.auth-account h3 { margin: 8px 0 14px; font-size: 25px; font-variant-numeric: tabular-nums; }
.auth-account-meta { display: flex; justify-content: center; gap: 8px; }
.auth-account-meta span { border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; color: #8da3b5; background: rgba(4, 14, 25, 0.4); font-size: 10px; }
.auth-account .secondary-button { margin-top: 26px; }
.primary-button, .secondary-button { width: 100%; height: 48px; margin-top: 17px; border: 1px solid rgba(66, 217, 208, 0.42); border-radius: 13px; color: #06201e; background: linear-gradient(135deg, #52e5dc, #2bc3bc); font-size: 15px; font-weight: 800; cursor: pointer; }
.primary-button:hover:not(:disabled) { filter: brightness(1.06); }
.primary-button:disabled { color: #698092; border-color: var(--line); background: #132337; cursor: wait; }
.secondary-button { margin-top: 9px; border-color: var(--line); color: #8ea4b8; background: transparent; font-weight: 600; }
.form-error { margin: 13px 0 0; border: 1px solid rgba(255, 113, 132, 0.2); border-radius: 9px; padding: 9px 11px; color: #ff8b9b; background: rgba(255, 113, 132, 0.06); font-size: 12px; line-height: 1.5; }
.list-empty { margin: 80px 0; color: var(--muted); font-size: 13px; text-align: center; }
.user-list-dialog { width: min(820px, calc(100vw - 40px)); }
.user-list-head-actions { display: flex; align-items: center; gap: 10px; }
.user-list-head-actions > span { color: #7890a4; font-size: 12px; }
.mark-all-read { height: 34px; border: 1px solid rgba(66, 217, 208, 0.2); border-radius: 9px; padding: 0 11px; color: var(--cyan); background: rgba(66, 217, 208, 0.05); font-size: 11px; cursor: pointer; }
.mark-all-read:hover:not(:disabled) { border-color: rgba(66, 217, 208, 0.42); background: rgba(66, 217, 208, 0.1); }
.mark-all-read:disabled { color: #63798c; cursor: default; opacity: 0.66; }
.strategy-editor-dialog { overflow-y: auto; width: min(620px, calc(100vw - 40px)); }
.strategy-editor-form { padding: 22px 25px 25px; }
.strategy-editor-note { margin: 0 0 16px; color: #7f92a3; font-size: 12px; line-height: 1.7; }
.strategy-editor-fields { display: grid; gap: 10px; }
.strategy-parameter-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; min-height: 68px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 14px; background: rgba(4, 14, 25, 0.4); }
.strategy-parameter-field > span strong { display: block; color: #d9e3ea; font-size: 14px; }
.strategy-parameter-field > span small { display: block; margin-top: 5px; color: #667c8e; font-size: 11px; }
.strategy-parameter-stepper { display: grid; grid-template-columns: 34px 82px auto 34px; align-items: center; overflow: hidden; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #070f18; }
.strategy-parameter-stepper button { align-self: stretch; border: 0; color: #e5d85f; background: rgba(229, 216, 95, 0.045); font-size: 20px; cursor: pointer; }
.strategy-parameter-stepper button:hover { background: rgba(229, 216, 95, 0.12); }
.strategy-parameter-stepper input { width: 82px; height: 100%; border: 0; border-left: 1px solid var(--line); outline: 0; padding: 0 8px; color: #eef0e6; background: transparent; font: 700 15px "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; text-align: right; }
.strategy-parameter-stepper em { align-self: stretch; display: grid; place-items: center; min-width: 30px; border-right: 1px solid var(--line); color: #758798; font-size: 11px; font-style: normal; }
.strategy-editor-status { min-height: 18px; margin: 14px 0 0; color: #b7ac5f; font-size: 11px; line-height: 1.6; }
.strategy-editor-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 9px; margin-top: 16px; }
.strategy-editor-actions .primary-button, .strategy-editor-actions .secondary-button { height: 42px; margin: 0; border-radius: 9px; font-size: 12px; }
.user-feature-list { overflow-y: auto; min-height: 300px; max-height: calc(100vh - 160px); padding: 18px 22px 24px; }
.watchlist-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, auto); align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; background: rgba(4, 14, 25, 0.4); }
.watchlist-row + .watchlist-row, .notification-row + .notification-row { margin-top: 9px; }
.watchlist-open { display: flex; align-items: center; min-width: 0; gap: 11px; border: 0; padding: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.watchlist-open:hover h3 { color: var(--cyan); }
.watchlist-open h3 { overflow: hidden; margin: 0; color: #e3ebf1; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.watchlist-open p { margin: 5px 0 0; color: #6f8699; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.watchlist-quote { min-width: 68px; text-align: right; }
.watchlist-quote strong, .watchlist-quote span { display: block; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-variant-numeric: tabular-nums; }
.watchlist-quote strong { color: #dbe5ec; font-size: 14px; }
.watchlist-quote span { margin-top: 4px; font-size: 11px; }
.watchlist-remove { height: 32px; border: 1px solid rgba(255, 113, 132, 0.18); border-radius: 9px; padding: 0 10px; color: #d78592; background: rgba(255, 113, 132, 0.045); font-size: 11px; cursor: pointer; }
.watchlist-remove:hover { border-color: rgba(255, 113, 132, 0.4); color: #ff8b9b; }
.watchlist-history-dialog { width: min(1320px, calc(100vw - 40px)); height: min(86vh, 880px); display: grid; grid-template-rows: auto auto minmax(0, 1fr); background: #050505; }
.watchlist-view-tabs { display: flex; gap: 2px; padding: 10px 18px 0; border-bottom: 1px solid var(--line); background: #080808; }
.watchlist-view-tabs button { min-width: 110px; height: 34px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 12px; cursor: pointer; }
.watchlist-view-tabs button:hover { color: var(--text); }
.watchlist-view-tabs button.active { border-bottom-color: var(--cyan); color: var(--cyan); background: rgba(229, 216, 95, 0.045); }
.watchlist-history-view { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.watchlist-date-toolbar { display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px; align-items: stretch; gap: 8px; padding: 13px 18px; border-bottom: 1px solid var(--line); background: #030303; }
.watchlist-date-toolbar > button { border: 1px solid var(--line); border-radius: 4px; color: var(--cyan); background: #0b0b0b; cursor: pointer; }
.watchlist-date-toolbar > button:hover:not(:disabled) { border-color: var(--terminal-line-strong, var(--cyan)); background: rgba(229, 216, 95, 0.065); }
.watchlist-date-toolbar > button:disabled { color: var(--terminal-dim, #5e5f5b); cursor: default; opacity: 0.55; }
.watchlist-date-strip { min-width: 0; display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 7px; overflow-x: auto; }
.watchlist-date-card { min-width: 120px; border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; color: var(--muted); background: #070707; text-align: left; cursor: pointer; }
.watchlist-date-card strong, .watchlist-date-card span { display: block; white-space: nowrap; }
.watchlist-date-card strong { color: var(--text); font-size: 12px; }
.watchlist-date-card span { margin-top: 5px; color: var(--terminal-dim, #777); font-size: 10px; }
.watchlist-date-card:hover { border-color: rgba(229, 216, 95, 0.28); }
.watchlist-date-card.active { border-color: var(--terminal-line-strong, var(--cyan)); box-shadow: inset 0 -2px var(--cyan); background: rgba(229, 216, 95, 0.055); }
.watchlist-date-card.active strong { color: var(--cyan); }
.watchlist-history-content { min-height: 0; overflow: auto; padding: 16px 18px 20px; background: #000; }
.watchlist-history-summary { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 13px; padding: 0 2px; }
.watchlist-history-summary strong, .watchlist-history-summary span { display: block; }
.watchlist-history-summary strong { color: var(--cyan); font-size: 16px; }
.watchlist-history-summary span { margin-top: 6px; color: var(--muted); font-size: 11px; }
.watchlist-history-summary small { color: var(--terminal-dim, #777); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.watchlist-history-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 10px; }
.watchlist-history-group { min-width: 0; border: 1px solid var(--line); border-radius: 5px; background: #050505; }
.watchlist-history-group > header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 54px; padding: 9px 11px; border-bottom: 1px solid var(--line); background: #0a0a0a; }
.watchlist-history-group > header > span { color: var(--cyan); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 12px; font-weight: 700; }
.watchlist-history-group > header strong, .watchlist-history-group > header small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.watchlist-history-group > header strong { color: var(--text); font-size: 14px; }
.watchlist-history-group > header small { margin-top: 4px; color: var(--terminal-dim, #777); font-size: 10px; }
.watchlist-history-group > header b { color: var(--cyan); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.watchlist-history-stocks { min-height: 150px; }
.watchlist-history-stock { width: 100%; min-height: 51px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px; border: 0; border-bottom: 1px solid var(--line); padding: 7px 10px; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.watchlist-history-stock:last-child { border-bottom: 0; }
.watchlist-history-stock:hover { background: rgba(229, 216, 95, 0.05); }
.watchlist-history-rank { color: var(--terminal-dim, #777); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.watchlist-history-identity { min-width: 0; }
.watchlist-history-identity strong, .watchlist-history-identity small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.watchlist-history-identity strong { color: var(--text); font-size: 12px; }
.watchlist-history-identity small { margin-top: 4px; color: var(--terminal-dim, #777); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.watchlist-following { min-width: 42px; color: var(--cyan); font-size: 10px; text-align: center; }
.watchlist-history-price, .watchlist-history-change { font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.watchlist-history-price { color: var(--text); }
.watchlist-history-change.positive { color: var(--positive); }
.watchlist-history-change.negative { color: var(--negative); }
.watchlist-history-empty { margin: 58px 10px; color: var(--terminal-dim, #777); font-size: 11px; text-align: center; }
#watchlistCurrentView { min-height: 0; overflow: hidden; }
#watchlistCurrentView .user-feature-list { height: 100%; max-height: none; }
.notification-row { position: relative; border: 1px solid var(--line); border-radius: 13px; padding: 15px 16px 14px 19px; background: rgba(4, 14, 25, 0.4); }
.notification-row.unread { border-color: rgba(66, 217, 208, 0.2); background: rgba(66, 217, 208, 0.035); }
.notification-row.unread::before { content: ""; position: absolute; top: 18px; left: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px rgba(66, 217, 208, 0.06); }
.notification-row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.notification-row h3 { margin: 0; color: #dfe8ef; font-size: 14px; }
.notification-row time { flex: 0 0 auto; color: #637c90; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.notification-row p { margin: 8px 0 0; color: #8398aa; font-size: 12px; line-height: 1.65; }
.notification-read { margin-top: 10px; border: 0; padding: 0; color: var(--cyan); background: transparent; font-size: 11px; cursor: pointer; }

body.stock-chart-open { overflow: hidden; }

/* Each server-side page remains scrollable without creating 100 live DOM rows. */
.market-table-wrap {
  overflow: auto;
  max-height: min(72vh, 780px);
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(229, 216, 95, 0.45) #050505;
  contain: layout paint;
}
.market-ranking { position: relative; }
.market-order-update {
  position: absolute;
  z-index: 6;
  top: 10px;
  right: 28px;
  border: 1px solid rgba(229, 216, 95, .65);
  border-radius: 5px;
  padding: 6px 11px;
  color: #f6e966;
  background: #17170e;
  cursor: pointer;
  box-shadow: 0 3px 12px #0009;
}
.market-order-update[hidden] { display: none; }
.market-table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.market-table-wrap::-webkit-scrollbar-track { background: #050505; }
.market-table-wrap::-webkit-scrollbar-thumb { border: 2px solid #050505; border-radius: 999px; background: rgba(229, 216, 95, 0.45); }
.market-table {
  --market-grid-columns: 48px minmax(144px, 1.45fr) minmax(78px, 0.72fr) minmax(82px, 0.76fr) minmax(76px, 0.68fr) minmax(76px, 0.68fr) minmax(58px, 0.52fr) minmax(104px, 0.94fr) minmax(96px, 0.86fr) minmax(88px, 0.78fr) minmax(98px, 0.88fr) minmax(104px, 0.92fr) minmax(82px, 0.72fr);
  display: block;
  width: 100%;
  min-width: 1280px;
  table-layout: auto;
}
.market-close-mode .market-table {
  --market-grid-columns: 48px minmax(144px, 1.45fr) minmax(78px, 0.72fr) minmax(82px, 0.76fr) minmax(76px, 0.68fr) minmax(76px, 0.68fr) minmax(58px, 0.52fr) minmax(104px, 0.94fr) minmax(96px, 0.86fr) minmax(88px, 0.78fr) minmax(98px, 0.88fr) minmax(82px, 0.72fr);
  min-width: 1012px;
}
.market-close-mode .market-live-only { display: none; }
.market-table thead {
  position: sticky;
  z-index: 3;
  top: 0;
  display: block;
  width: 100%;
  background: #0d1621;
}
.market-table thead > tr,
.market-table #marketStockRows > .market-virtual-row {
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: var(--market-grid-columns);
  grid-template-rows: minmax(42px, auto);
  align-items: center;
  width: 100%;
}
.market-table thead > tr > th,
.market-table #marketStockRows > .market-virtual-row > td {
  box-sizing: border-box;
  overflow: hidden;
  width: auto;
  min-width: 0;
  padding-right: 4px;
  padding-left: 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.market-table thead > tr > :first-child,
.market-table #marketStockRows > .market-virtual-row > :first-child {
  padding-right: 2px;
  padding-left: 2px;
}
.market-table thead > tr > :nth-child(2),
.market-table #marketStockRows > .market-virtual-row > :nth-child(2) {
  padding-right: 2px;
  padding-left: 2px;
}
.market-table .stock-cell { gap: 4px; }
.market-table thead > tr > th:nth-child(n + 3) { text-align: right; }
.market-table thead > tr > th:nth-child(3),
.market-table #marketStockRows > .market-virtual-row > td:nth-child(3) {
  text-align: left;
}
.market-table thead > tr > th:nth-child(3) .market-sort-button {
  justify-content: flex-start;
}
.market-sort-button {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
.market-sort-button:hover,
.market-sort-button:focus-visible,
.market-sort-button.active { color: #eee05f; }
.market-sort-button:focus-visible { outline: 1px solid #8f8738; outline-offset: 4px; }
.market-sort-indicator { min-width: 10px; color: #66675f; font-size: 12px; }
.market-sort-button.active .market-sort-indicator { color: #eee05f; }
.market-table #marketStockRows { position: relative; display: block; width: 100%; }
.market-table #marketStockRows > .market-virtual-row {
  position: absolute;
  left: 0;
  right: 0;
  height: 56px;
}
.market-table #marketStockRows > .market-virtual-row > td { padding-top: 8px; padding-bottom: 8px; }

.market-industry { color: #d8ca61; }

.stock-quick-jump {
  position: fixed;
  z-index: 180;
  top: 88px;
  left: 50%;
  display: grid;
  min-width: 260px;
  transform: translateX(-50%);
  gap: 5px;
  border: 1px solid rgba(229, 216, 95, 0.46);
  border-radius: 9px;
  padding: 11px 16px;
  color: #eee9cf;
  background: rgba(5, 5, 4, 0.96);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.58);
  text-align: center;
  pointer-events: none;
}
.stock-quick-jump[hidden] { display: none; }
.stock-quick-jump span,
.stock-quick-jump small { color: #77746b; font-size: 12px; }
.stock-quick-jump strong { color: #e5d85f; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 20px; letter-spacing: 0.08em; }

.stock-chart-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
}

.stock-chart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 7, 13, 0.82);
  backdrop-filter: blur(10px);
}

.stock-chart-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: min(1540px, calc(100vw - 44px));
  height: min(900px, calc(100vh - 44px));
  max-height: calc(100vh - 44px);
  border: 1px solid rgba(143, 174, 202, 0.22);
  border-radius: 19px;
  background: #101722;
  box-shadow: 0 34px 120px rgba(0, 0, 0, 0.62);
  animation: chart-dialog-in 180ms ease-out;
}

.stock-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 82px;
  padding: 14px 18px 14px 20px;
  border-bottom: 1px solid rgba(143, 174, 202, 0.13);
  background: #171e2a;
}

.stock-chart-identity,
.stock-chart-head-actions,
.stock-chart-title-line,
.stock-chart-period-controls,
.stock-chart-periods { display: flex; align-items: center; }

.stock-chart-identity { min-width: 0; gap: 14px; }
.stock-chart-symbol { display: grid; place-items: center; min-width: 80px; height: 44px; padding: 0 12px; border: 1px solid rgba(66, 217, 208, 0.25); border-radius: 11px; color: var(--cyan); background: rgba(66, 217, 208, 0.07); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 14px; font-weight: 700; }
.stock-chart-title-line { gap: 10px; }
.stock-chart-title-line h2 { overflow: hidden; margin: 0; color: #f6f8fb; font-size: 22px; letter-spacing: -0.01em; white-space: nowrap; text-overflow: ellipsis; }
.stock-chart-identity p { margin: 6px 0 0; color: #7f8b9d; font-size: 13px; }
.stock-chart-sequence { margin-left: 8px; padding-left: 8px; border-left: 1px solid rgba(143, 174, 202, 0.18); color: #60d8d0; white-space: nowrap; }
.adjustment-badge { padding: 4px 7px; border: 1px solid rgba(255, 214, 73, 0.24); border-radius: 6px; color: #f7d849; background: rgba(247, 216, 73, 0.06); font-size: 11px; font-weight: 700; }

.stock-chart-head-actions { gap: 17px; }
.stock-chart-quote { min-width: 106px; text-align: right; }
.stock-chart-quote strong { display: block; color: #f6f8fb; font-size: 25px; font-variant-numeric: tabular-nums; }
.stock-chart-quote span { display: block; margin-top: 3px; color: #8b96a7; font-size: 13px; font-variant-numeric: tabular-nums; }
.stock-chart-quote span.positive { color: #ff4b60; }
.stock-chart-quote span.negative { color: #24dc78; }
.stock-chart-quote small { display: block; max-width: 190px; margin-top: 4px; color: #727d8d; font-size: 10px; line-height: 1.35; white-space: nowrap; }
.stock-chart-quote small.delayed { color: #e8b665; }

.stock-chart-period-controls { min-width: 0; gap: 8px; }
.stock-chart-wheel-mode { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 5px; font-size: 12px; color: #929eaa; }
.stock-chart-wheel-mode > span:first-child { color: #aeb7c0; font-weight: 700; white-space: nowrap; }
.stock-chart-lock-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: #929eaa; font: inherit; white-space: nowrap; cursor: pointer; }
.stock-chart-lock-track { position: relative; width: 36px; height: 20px; border: 1px solid #41444c; border-radius: 999px; background: #171c23; transition: background-color 160ms ease, border-color 160ms ease; }
.stock-chart-lock-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #929eaa; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); transition: transform 160ms ease, background-color 160ms ease; }
.stock-chart-lock-toggle[aria-checked="true"] { color: #f3e65a; font-weight: 700; }
.stock-chart-lock-toggle[aria-checked="true"] .stock-chart-lock-track { border-color: #cfc34b; background: #4b4718; }
.stock-chart-lock-toggle[aria-checked="true"] .stock-chart-lock-thumb { background: #f3e65a; transform: translateX(16px); }
.stock-chart-lock-toggle:disabled { opacity: .45; cursor: not-allowed; }
.stock-chart-lock-toggle:focus-visible { outline: 2px solid #f3e65a; outline-offset: 3px; border-radius: 4px; }
.stock-chart-lock-state { min-width: 1em; text-align: left; }
.stock-chart-wheel-hint { display: block; margin-top: 4px; color: #929eaa; font-size: 11px; }
.stock-chart-wheel-hint[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .stock-chart-lock-track, .stock-chart-lock-thumb { transition: none; }
}
.stock-chart-periods { overflow-x: auto; border: 1px solid rgba(143, 174, 202, 0.16); border-radius: 9px; background: #0d141e; scrollbar-width: none; }
.stock-chart-periods::-webkit-scrollbar { display: none; }
.stock-chart-periods button { min-width: 40px; height: 34px; border: 0; border-left: 1px solid rgba(143, 174, 202, 0.12); padding: 0 9px; color: #7f8b9d; background: transparent; font-size: 12px; cursor: pointer; white-space: nowrap; }
.stock-chart-periods button:first-child { border-left: 0; }
.stock-chart-periods button:hover { color: #d8e1e8; background: rgba(143, 174, 202, 0.05); }
.stock-chart-periods button.active { color: var(--cyan); background: rgba(66, 217, 208, 0.1); box-shadow: inset 0 -2px 0 var(--cyan); }
.stock-chart-range-select-label { display: flex; align-items: center; height: 34px; overflow: hidden; border: 1px solid rgba(143, 174, 202, 0.16); border-radius: 9px; color: #647286; background: #0d141e; font-size: 11px; white-space: nowrap; }
.stock-chart-range-select-label span { padding-left: 9px; }
.stock-chart-range-select-label select { height: 32px; border: 0; outline: 0; padding: 0 23px 0 7px; color: #aab5c3; background: #0d141e; font: inherit; cursor: pointer; }
.stock-chart-close { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid rgba(143, 174, 202, 0.16); border-radius: 10px; color: #8c98a9; background: #111924; cursor: pointer; }
.stock-chart-close:hover { color: #f3f6f9; border-color: rgba(143, 174, 202, 0.34); }
.stock-chart-close svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.stock-chart-loading,
.stock-chart-error { display: flex; align-items: center; justify-content: center; min-height: min(720px, calc(100vh - 126px)); gap: 16px; color: #8290a1; }
.stock-chart-loading strong,
.stock-chart-error strong { color: #eef3f7; font-size: 15px; }
.stock-chart-loading p,
.stock-chart-error p { margin: 6px 0 0; font-size: 13px; }
.stock-chart-error { flex-direction: column; text-align: center; }
.stock-chart-error button { margin-top: 8px; border: 1px solid rgba(66, 217, 208, 0.28); border-radius: 9px; padding: 8px 14px; color: var(--cyan); background: rgba(66, 217, 208, 0.06); cursor: pointer; }

.stock-chart-content { position: relative; flex: 1 1 auto; min-height: 0; overflow-x: auto; overflow-y: hidden; background: #101722; }
.stock-chart-main-pane { position: relative; }
.stock-chart-main-pane > .stock-chart-loading,
.stock-chart-main-pane > .stock-chart-error { position: absolute; inset: 0; z-index: 8; min-height: 0; background: var(--terminal-surface, #101722); }
.stock-chart-workspace { display: grid; grid-template-columns: minmax(760px, 4fr) minmax(220px, 1fr); min-width: 1100px; height: 100%; min-height: 0; align-items: stretch; }
.stock-chart-main-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #3b4555 #101722; scrollbar-gutter: stable; background: #101722; }
.stock-chart-research-disclaimer { display: flex; align-items: flex-end; justify-content: flex-end; min-height: clamp(80px, 12vh, 140px); flex: 1 0 clamp(80px, 12vh, 140px); box-sizing: border-box; padding: 0 17px 14px; border-top: 1px solid rgba(143, 174, 202, 0.08); color: #607084; background: #101722; font-size: 11px; letter-spacing: 0.03em; text-align: right; }
.stock-chart-research-disclaimer strong { color: #75869a; font-weight: 800; letter-spacing: 0.06em; }
.stock-chart-command-row { display: flex; align-items: stretch; min-height: 43px; border-bottom: 1px solid rgba(143, 174, 202, 0.11); background: #1a212d; }
.stock-chart-legend { display: flex; flex: 1 1 auto; align-items: center; flex-wrap: wrap; gap: 7px 14px; min-width: 0; min-height: 42px; padding: 7px 16px; color: #c7cfda; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 13px; font-variant-numeric: tabular-nums; }
.stock-chart-legend[hidden] { display: none; }
.stock-chart-legend .legend-date { color: #f2f5f8; font-weight: 700; }
.stock-chart-legend .legend-ohlc { color: #9eaaba; }
.stock-chart-legend .ma5 { color: #d8dce1; }
.stock-chart-legend .ma10 { color: #fff000; }
.stock-chart-legend .ma20 { color: #f428e8; }
.stock-chart-legend .ma30 { color: #20eb36; }
.stock-chart-legend .ma60 { color: #b8bec8; }
.stock-chart-legend .ma120 { color: #00dcf1; }
.stock-chart-legend .ma250 { color: #fff582; }

.stock-chart-tools { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; margin-left: auto; padding: 5px 8px; border-left: 1px solid rgba(143, 174, 202, 0.11); }
.stock-chart-ma-toolbar { display: flex; align-items: center; gap: 7px; min-height: 38px; box-sizing: border-box; padding: 4px 10px; border-bottom: 1px solid rgba(143, 174, 202, 0.1); color: #738194; background: #0e151f; font-size: 11px; }
.stock-chart-ma-label { color: #a7b2c0; font-weight: 700; }
.stock-chart-ma-presets, .stock-chart-custom-mas, .stock-chart-ma-form { display: flex; align-items: center; gap: 4px; }
.stock-chart-ma-presets button, .stock-chart-custom-mas button, .stock-chart-ma-form button { height: 25px; border: 1px solid rgba(143, 174, 202, 0.14); border-radius: 5px; padding: 0 7px; color: #718094; background: #0a1018; font: 10px/1 "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; cursor: pointer; }
.stock-chart-ma-presets button:hover, .stock-chart-custom-mas button:hover { color: #dfe6ec; border-color: rgba(143, 174, 202, 0.3); }
.stock-chart-ma-presets button.active { color: var(--cyan); border-color: rgba(66, 217, 208, 0.35); background: rgba(66, 217, 208, 0.08); }
.stock-chart-custom-mas button.active { color: var(--ma-color); border-color: color-mix(in srgb, var(--ma-color) 42%, transparent); background: color-mix(in srgb, var(--ma-color) 8%, transparent); }
.stock-chart-ma-form { margin-left: auto; }
.stock-chart-ma-form label { color: #687689; }
.stock-chart-ma-form input { width: 52px; height: 25px; box-sizing: border-box; border: 1px solid rgba(143, 174, 202, 0.16); border-radius: 5px; outline: 0; padding: 0 6px; color: #d8e0e8; background: #080e15; font: 11px/1 "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; }
.stock-chart-ma-form input:focus { border-color: rgba(66, 217, 208, 0.46); }
.stock-chart-ma-form input[aria-invalid="true"] { border-color: rgba(255, 83, 103, 0.62); }
.stock-chart-ma-form button { color: var(--cyan); }
.stock-chart-indicator-toolbar { display: flex; align-items: center; gap: 6px; min-height: 34px; box-sizing: border-box; padding: 4px 10px; border-bottom: 1px solid rgba(143, 174, 202, 0.1); color: #7d8998; background: #0a1017; font-size: 11px; }
.stock-chart-indicator-toolbar > span { color: #a7b2c0; font-weight: 700; }
.stock-chart-indicator-toolbar button { height: 25px; border: 1px solid rgba(143, 174, 202, 0.16); border-radius: 5px; padding: 0 9px; color: #788597; background: #050a10; font: 11px/1 "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; cursor: pointer; }
.stock-chart-indicator-toolbar button:hover { color: #e8edf1; border-color: rgba(143, 174, 202, 0.32); }
.stock-chart-indicator-toolbar button.active { color: #e5d85f; border-color: rgba(229, 216, 95, 0.42); background: rgba(229, 216, 95, 0.08); }
.stock-chart-template-select-label { display: flex; align-items: center; gap: 5px; margin-left: auto; color: #8f8b64; white-space: nowrap; }
.stock-chart-template-select-label select { height: 25px; border: 1px solid rgba(229, 216, 95, 0.24); border-radius: 5px; outline: 0; padding: 0 22px 0 7px; color: #d8cf64; background: #050a10; font: 11px/1 "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; cursor: pointer; }
.stock-chart-template-select-label select:focus { border-color: rgba(229, 216, 95, 0.48); }
.stock-chart-indicator-toolbar small { color: #606b79; font-size: 10px; }
.stock-chart-template-status { display: flex; align-items: center; gap: 9px; min-height: 31px; box-sizing: border-box; padding: 4px 10px; border-bottom: 1px solid rgba(229, 216, 95, 0.18); color: #8c8a7f; background: #070806; font-size: 10px; }
.stock-chart-template-status[hidden] { display: none; }
.stock-chart-template-status strong { flex: 0 0 auto; color: #e5d85f; font-size: 11px; }
.stock-chart-template-status span { min-width: 0; overflow: hidden; color: #a4a299; text-overflow: ellipsis; white-space: nowrap; }
.stock-chart-template-status small { flex: 0 0 auto; margin-left: auto; padding: 3px 6px; border: 1px solid rgba(69, 215, 205, 0.22); border-radius: 4px; color: #45d7cd; white-space: nowrap; }
.stock-chart-template-status small.unavailable { border-color: rgba(232, 182, 101, 0.3); color: #e8b665; }
.stock-chart-template-status button { flex: 0 0 auto; height: 23px; border: 1px solid rgba(229, 216, 95, 0.24); border-radius: 5px; padding: 0 8px; color: #bcb568; background: transparent; font-size: 10px; cursor: pointer; }
.stock-chart-template-status button:hover { color: #fff46a; border-color: rgba(229, 216, 95, 0.46); }
.chart-tool { display: flex; align-items: center; justify-content: center; gap: 5px; height: 31px; border: 1px solid rgba(143, 174, 202, 0.17); border-radius: 7px; padding: 0 9px; color: #8794a6; background: #111924; font-size: 12px; cursor: pointer; white-space: nowrap; }
.chart-tool:hover { color: #edf2f6; border-color: rgba(143, 174, 202, 0.34); }
.chart-tool.active { color: var(--cyan); border-color: rgba(66, 217, 208, 0.44); background: rgba(66, 217, 208, 0.1); box-shadow: inset 0 0 0 1px rgba(66, 217, 208, 0.06); }
.chart-tool-square { width: 31px; padding: 0; color: #c9d2dc; font-size: 21px; line-height: 1; }
.chart-tool svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.chart-tool-delete { color: #dc9c91; }
.chart-tool-clear { color: #e2b664; }
.chart-tool:focus-visible { outline: 2px solid rgba(66, 217, 208, 0.62); outline-offset: 2px; }

.stock-chart-canvas-scroll { flex: 0 0 auto; min-height: 0; overflow: auto; }
.stock-chart-canvas-wrap { position: relative; min-width: 760px; height: clamp(500px, 62vh, 680px); background: #111722; }
.stock-chart-navigator { position: relative; flex: 0 0 52px; min-width: 760px; height: 52px; overflow: hidden; border-top: 1px solid rgba(143, 174, 202, 0.11); border-bottom: 1px solid rgba(143, 174, 202, 0.11); background: #080d13; cursor: crosshair; touch-action: none; user-select: none; }
.stock-chart-navigator canvas { display: block; width: 100%; height: 100%; }
.stock-chart-navigator-selection { position: absolute; top: 0; bottom: 0; display: grid; grid-template-columns: 8px 1fr 8px; min-width: 18px; border: 1px solid rgba(84, 211, 203, 0.78); box-sizing: border-box; background: rgba(84, 211, 203, 0.07); cursor: grab; }
.stock-chart-navigator.dragging .stock-chart-navigator-selection { cursor: grabbing; }
.stock-chart-navigator-selection > span { min-width: 0; }
.stock-chart-navigator-selection button { width: 8px; height: 100%; border: 0; padding: 0; background: rgba(84, 211, 203, 0.8); cursor: ew-resize; }
#stockChartCanvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
#stockChartCanvas.mode-draw { cursor: crosshair; }
#stockChartCanvas.mode-horizontal { cursor: crosshair; }
#stockChartCanvas.mode-delete { cursor: not-allowed; }
#stockChartCanvas.line-hover { cursor: pointer; }
.stock-chart-tooltip { position: absolute; z-index: 2; min-width: 0; width: max-content; padding: 6px 8px; border: 1px solid rgba(143, 174, 202, 0.22); border-radius: 4px; color: #cbd3dc; background: rgba(9, 14, 22, 0.94); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 16px; line-height: 1.5; pointer-events: none; white-space: nowrap; }
.stock-chart-tooltip-row { display: flex; justify-content: space-between; gap: 12px; }
.stock-chart-tooltip .up { color: #ff5367; }
.stock-chart-tooltip .down { color: #24dc78; }

.intraday-session-modal { position: fixed; z-index: 125; inset: 0; display: grid; place-items: center; padding: 28px; }
.intraday-session-modal[hidden] { display: none; }
.intraday-session-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(5px); }
.intraday-session-dialog { position: relative; z-index: 1; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(940px, calc(100vw - 56px)); height: min(620px, calc(100vh - 56px)); overflow: hidden; border: 1px solid rgba(229, 216, 95, 0.3); border-radius: 10px; color: #d9dde3; background: #050607; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.72); }
.intraday-session-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 18px; border-bottom: 1px solid rgba(229, 216, 95, 0.16); background: #0a0b0c; }
.intraday-session-head span { color: #777a7e; font: 11px/1 "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; letter-spacing: 0.12em; }
.intraday-session-head h2 { margin: 5px 0 0; color: #eee9cf; font-size: 20px; }
.intraday-session-head p { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 7px 0 0; color: #8e949d; font-size: 12px; }
.intraday-session-head p strong { color: #e5d85f; }
.intraday-session-head button { width: 35px; height: 35px; border: 1px solid rgba(229, 216, 95, 0.22); border-radius: 6px; color: #999a94; background: #111213; font-size: 24px; cursor: pointer; }
.intraday-session-head button:hover { color: #f5f0d6; border-color: rgba(229, 216, 95, 0.46); }
.intraday-session-body { position: relative; min-height: 0; background: #020303; }
#intradaySessionCanvas { display: block; width: 100%; height: 100%; }
.intraday-session-state { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; color: #9b9d97; background: rgba(2, 3, 3, 0.92); font-size: 14px; }
.intraday-session-state[hidden] { display: none; }
.intraday-session-state.error { color: #e4b469; }
.intraday-session-dialog footer { display: flex; justify-content: space-between; gap: 18px; padding: 9px 16px; border-top: 1px solid rgba(229, 216, 95, 0.14); color: #6e716d; background: #090a0a; font: 11px/1.4 "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; }

.horizontal-line-editor { position: absolute; z-index: 4; width: 230px; padding: 11px; border: 1px solid rgba(255, 191, 105, 0.46); border-radius: 9px; color: #cbd3dc; background: rgba(12, 18, 28, 0.98); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.48); font-size: 12px; }
.horizontal-line-editor strong { display: block; margin-bottom: 8px; color: #ffbf69; font-size: 13px; }
.horizontal-line-editor label { display: block; margin-bottom: 5px; color: #8996a8; }
.horizontal-line-editor-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
.horizontal-line-editor input { min-width: 0; height: 30px; border: 1px solid rgba(143, 174, 202, 0.24); border-radius: 6px; padding: 0 8px; color: #eef3f7; background: #111924; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 13px; outline: none; }
.horizontal-line-editor input:focus { border-color: rgba(255, 191, 105, 0.72); box-shadow: 0 0 0 2px rgba(255, 191, 105, 0.1); }
.horizontal-line-editor input[aria-invalid="true"] { border-color: rgba(255, 83, 103, 0.72); }
.horizontal-line-editor button { height: 30px; border: 1px solid rgba(255, 191, 105, 0.42); border-radius: 6px; padding: 0 8px; color: #151a22; background: #ffbf69; font-size: 12px; cursor: pointer; }
.horizontal-line-editor .horizontal-line-editor-cancel { border-color: rgba(143, 174, 202, 0.2); color: #9ba8b8; background: #17202c; }
.horizontal-line-editor p { margin: 7px 0 0; color: #ff6375; }

.stock-chart-footer { display: flex; justify-content: space-between; gap: 24px; padding: 9px 16px 11px; border-top: 1px solid rgba(143, 174, 202, 0.11); color: #657487; background: #151c27; font-size: 11px; }
.stock-chart-footer p { margin: 0; }

.stock-intelligence-dock { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(340px, 0.94fr); height: 230px; flex: 0 0 230px; border-top: 1px solid rgba(143, 174, 202, 0.17); border-bottom: 1px solid rgba(143, 174, 202, 0.12); background: #121924; }
.ai-chat-card { grid-column: 1; }
.next-day-plan-card { grid-column: 2; border-left: 1px solid rgba(143, 174, 202, 0.17); }
.ai-chat-dock-placeholder { display: flex; grid-column: 1; align-items: center; justify-content: center; min-width: 0; gap: 9px; color: #647487; background: #121924; text-align: left; }
.ai-chat-dock-placeholder[hidden] { display: none; }
.ai-chat-dock-placeholder > span { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid rgba(66, 217, 208, 0.2); border-radius: 8px; color: #64d8d3; background: rgba(66, 217, 208, 0.06); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 11px; font-weight: 800; }
.ai-chat-dock-placeholder strong, .ai-chat-dock-placeholder small { display: block; }
.ai-chat-dock-placeholder strong { color: #8998a9; font-size: 12px; }
.ai-chat-dock-placeholder small { margin-top: 4px; color: #536275; font-size: 10px; }
.intelligence-card { display: grid; grid-template-rows: 42px minmax(0, 1fr) 42px; min-width: 0; min-height: 0; overflow: hidden; background: #151c27; }
.intelligence-card-head { display: flex; align-items: center; justify-content: space-between; min-width: 0; gap: 12px; padding: 7px 11px; border-bottom: 1px solid rgba(143, 174, 202, 0.11); background: #1d2532; }
.intelligence-card-title { display: flex; align-items: center; min-width: 0; gap: 8px; }
.intelligence-card-title > div { min-width: 0; }
.intelligence-card-title h3 { overflow: hidden; margin: 0; color: #e7edf3; font-size: 13px; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis; }
.intelligence-card-title p { overflow: hidden; margin: 3px 0 0; color: #68778a; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 10px; line-height: 1.1; white-space: nowrap; text-overflow: ellipsis; }
.intelligence-card-icon { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 auto; border: 1px solid rgba(66, 217, 208, 0.23); border-radius: 7px; color: var(--cyan); background: rgba(66, 217, 208, 0.06); }
.intelligence-card-icon.plan-icon { border-color: rgba(168, 139, 255, 0.24); color: var(--violet); background: rgba(168, 139, 255, 0.07); }
.intelligence-card-icon svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.model-status, .forecast-horizon { flex: 0 0 auto; padding: 4px 6px; border: 1px solid rgba(255, 191, 105, 0.2); border-radius: 999px; color: #c5a66d; background: rgba(255, 191, 105, 0.05); font-size: 9px; font-weight: 700; letter-spacing: 0.05em; white-space: nowrap; }
.model-status.online { border-color: rgba(66, 217, 208, 0.25); color: #65d8d1; background: rgba(66, 217, 208, 0.06); }
.ai-chat-head-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 5px; }
.ai-chat-expand { display: flex; align-items: center; justify-content: center; height: 23px; gap: 3px; border: 1px solid rgba(66, 217, 208, 0.27); border-radius: 6px; padding: 0 6px; color: #77d8d3; background: rgba(66, 217, 208, 0.07); font-size: 10px; cursor: pointer; white-space: nowrap; }
.ai-chat-expand:hover { border-color: rgba(66, 217, 208, 0.52); background: rgba(66, 217, 208, 0.13); }
.ai-chat-expand svg { width: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 150ms ease; }
.ai-chat-expand[aria-expanded="true"] svg { transform: rotate(180deg); }
.forecast-horizon { border-color: rgba(168, 139, 255, 0.22); color: #aa96de; background: rgba(168, 139, 255, 0.06); }
.forecast-head-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 5px; }
.forecast-generate { height: 23px; border: 1px solid rgba(168, 139, 255, 0.35); border-radius: 6px; padding: 0 7px; color: #d4c8ff; background: rgba(168, 139, 255, 0.1); font-size: 10px; cursor: pointer; }
.forecast-generate:hover:not(:disabled) { border-color: rgba(168, 139, 255, 0.62); background: rgba(168, 139, 255, 0.17); }
.forecast-generate:disabled { color: #657084; cursor: not-allowed; opacity: 0.72; }

.ai-chat-messages { display: flex; flex-direction: column; min-height: 0; gap: 6px; overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #344152 transparent; }
.ai-chat-message { display: flex; flex: 0 0 auto; align-items: flex-start; min-width: 0; gap: 7px; }
.ai-chat-avatar { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 auto; border-radius: 7px; color: #08141e; background: var(--cyan); font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 800; }
.ai-chat-message p { min-width: 0; max-width: calc(100% - 32px); box-sizing: border-box; margin: 1px 0 0; border-radius: 7px; padding: 4px 6px; overflow-wrap: anywhere; word-break: break-word; color: #96a4b5; background: rgba(143, 174, 202, 0.055); font-size: 11px; line-height: 1.5; white-space: pre-wrap; }
.ai-chat-message.user { flex-direction: row-reverse; }
.ai-chat-message.user .ai-chat-avatar { color: #f2edff; background: #745ca8; }
.ai-chat-message.user p { color: #cfc5ea; background: rgba(168, 139, 255, 0.1); }
.ai-chat-message.error p { color: #ff8491; background: rgba(255, 83, 103, 0.08); }
.ai-chat-message.pending p { color: #6dcac6; }
.ai-chat-composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 6px 10px 7px; border-top: 1px solid rgba(143, 174, 202, 0.09); background: #131a25; }
.ai-chat-composer textarea { width: 100%; min-width: 0; height: 100%; min-height: 0; box-sizing: border-box; resize: none; overflow: hidden; border: 1px solid rgba(143, 174, 202, 0.16); border-radius: 7px; padding: 5px 9px; color: #cbd4de; background: #0f1620; font: inherit; font-size: 11px; line-height: 1.5; outline: none; white-space: nowrap; }
.ai-chat-composer textarea::placeholder { color: #5f6d7e; }
.ai-chat-composer button { min-width: 56px; border: 1px solid rgba(66, 217, 208, 0.28); border-radius: 7px; padding: 0 8px; color: #9ae9e4; background: rgba(66, 217, 208, 0.08); font-size: 10px; cursor: pointer; }
.ai-chat-composer textarea:disabled, .ai-chat-composer button:disabled { cursor: not-allowed; opacity: 0.76; }

.ai-research-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; box-sizing: border-box; padding: 16px; background: rgba(0, 0, 0, 0.62); }
.ai-research-modal[hidden] { display: none; }
body.page-dashboard .ai-research-modal .ai-chat-card { width: min(760px, 100%); height: min(640px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); grid-template-rows: auto minmax(0, 1fr) auto 58px; border: 1px solid rgba(229, 216, 95, 0.35); border-radius: 12px; background: #080a0c; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6); }
/* The floating card uses viewport coordinates, independent of its original grid column. */
body.page-dashboard .ai-research-modal .ai-chat-card.is-positioned { position: absolute; grid-area: auto; max-height: none; }
.ai-research-modal .intelligence-card-head { cursor: grab; touch-action: none; user-select: none; }
.ai-research-modal .ai-chat-card.is-moving .intelligence-card-head { cursor: grabbing; }
.ai-research-modal .ai-chat-card.is-adjusting { user-select: none; }
.ai-research-modal .ai-chat-composer { padding-right: 22px; padding-bottom: 12px; padding-left: 22px; }
.ai-window-resize { position: absolute; z-index: 2; width: 20px; height: 20px; margin: 0; padding: 0; border: 0; background: transparent; touch-action: none; }
.ai-window-resize::after { position: absolute; width: 7px; height: 7px; border: solid #8c8756; content: ""; }
.ai-window-resize:hover::after, .ai-window-resize:focus-visible::after { border-color: #f6d94d; }
.ai-window-resize:focus-visible { outline: 2px solid #e5d85f; outline-offset: -4px; border-radius: 5px; }
.ai-window-resize[data-ai-resize="nw"] { top: 0; left: 0; cursor: nwse-resize; }
.ai-window-resize[data-ai-resize="ne"] { top: 0; right: 0; cursor: nesw-resize; }
.ai-window-resize[data-ai-resize="sw"] { bottom: 0; left: 0; cursor: nesw-resize; }
.ai-window-resize[data-ai-resize="se"] { bottom: 0; right: 0; cursor: nwse-resize; }
.ai-window-resize[data-ai-resize="nw"]::after { top: 5px; left: 5px; border-width: 1px 0 0 1px; }
.ai-window-resize[data-ai-resize="ne"]::after { top: 5px; right: 5px; border-width: 1px 1px 0 0; }
.ai-window-resize[data-ai-resize="sw"]::after { bottom: 5px; left: 5px; border-width: 0 0 1px 1px; }
.ai-window-resize[data-ai-resize="se"]::after { bottom: 5px; right: 5px; border-width: 0 1px 1px 0; }
.ai-agent-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid #282d34; color: #a9b3bf; font-size: 12px; }
.ai-agent-controls label { display: flex; align-items: center; gap: 6px; }
.ai-agent-controls select, .ai-agent-controls button, .ai-answer-tools button, .ai-answer-retry { border: 1px solid #414a55; border-radius: 6px; padding: 5px 8px; background: #141a23; color: #dbe4ee; font: inherit; cursor: pointer; }
.ai-agent-controls [role="status"] { flex: 1; min-width: 100px; color: #8ecac5; }
.ai-agent-controls button[hidden] { display: none; }
.ai-answer-model { display: inline-block; margin-right: 8px; color: #9aa9b8; font-size: 11px; }
.ai-research-modal .ai-question-view { flex: 0 0 calc(100% - 32px); margin-right: 32px; color: #8495a6; font-size: 11px; text-align: right; }
.ai-research-modal .ai-chat-message { flex-wrap: wrap; }
.ai-answer-tools { flex: 0 0 calc(100% - 32px); min-width: 0; margin-left: 32px; color: #9daebf; font-size: 12px; }
.ai-answer-tools summary { cursor: pointer; padding: 5px 0; }
.ai-source-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; }
.ai-source-row span { min-width: 0; overflow-wrap: anywhere; }
.ai-source-row button { flex-shrink: 0; }
.ai-answer-incomplete { color: #d1b47f; }
.ai-answer-retry { margin-left: 32px; font-size: 12px; }
body.page-dashboard .ai-research-modal .intelligence-card-head { min-height: 62px; gap: 8px; padding: 10px 22px 10px 14px; }
body.page-dashboard .ai-research-modal .intelligence-card-title h3 { font-size: 18px; }
body.page-dashboard .ai-research-modal .intelligence-card-title p { font-size: 14px; }
body.page-dashboard .ai-research-modal .model-status { font-size: 12px; }
body.page-dashboard .ai-research-modal .ai-chat-message p,
body.page-dashboard .ai-research-modal .ai-chat-composer textarea { font-size: 15px; }
body.page-dashboard .ai-research-modal .ai-chat-composer button { font-size: 14px; }
body.page-dashboard .ai-research-modal .ai-chat-messages { padding: 14px; }
body.page-dashboard .ai-research-modal .ai-chat-close { flex: 0 0 auto; width: 32px; height: 32px; border: 1px solid rgba(229, 216, 95, 0.28); border-radius: 6px; color: #d9dce1; background: #101214; font-size: 22px; cursor: pointer; }
body.page-dashboard .ai-research-modal .ai-chat-close:hover { color: #f6d94d; border-color: #f6d94d; }
.ai-chat-minimized { position: fixed; z-index: 110; right: 20px; bottom: 20px; display: flex; max-width: calc(100vw - 24px); border: 1px solid rgba(229, 216, 95, 0.45); border-radius: 9px; background: #101214; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4); }
.ai-chat-minimized[hidden] { display: none; }
.ai-chat-minimized button { display: flex; align-items: center; gap: 8px; min-height: 42px; border: 0; border-radius: 8px; padding: 8px 12px; color: #e5d85f; background: transparent; font: inherit; font-size: 14px; cursor: pointer; }
.ai-chat-minimized button > span { color: #a9b4c2; font-size: 12px; }
.ai-chat-minimized button:last-child { border-left: 1px solid rgba(229, 216, 95, 0.2); border-radius: 0 8px 8px 0; font-size: 20px; }
.ai-chat-minimized button:hover { background: rgba(229, 216, 95, 0.08); }
.ai-chat-minimized button:focus-visible { outline: 2px solid #e5d85f; outline-offset: 2px; }
@media (max-width: 520px) {
  body.page-dashboard .ai-research-modal .intelligence-card-head { flex-wrap: wrap; }
  body.page-dashboard .ai-research-modal .ai-chat-head-actions { margin-left: auto; }
}

.next-day-plan-card { grid-template-rows: 42px minmax(0, 1fr) 27px; }
.next-day-plan-body { display: grid; grid-template-columns: 104px minmax(0, 1fr); min-height: 0; gap: 8px; padding: 9px 10px 7px; }
.forecast-decision { display: flex; flex-direction: column; justify-content: center; min-width: 0; border: 1px solid rgba(143, 174, 202, 0.12); border-radius: 9px; padding: 8px 9px; background: #111823; }
.forecast-decision span { color: #6f7d8e; font-size: 10px; }
.forecast-decision strong { margin-top: 5px; color: #d9e0e7; font-size: 19px; line-height: 1; }
.forecast-decision small { overflow: hidden; margin-top: 6px; color: #8b98a8; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.forecast-decision.waiting strong { color: #b8c1cb; }
.forecast-decision.bullish strong { color: #ff5367; }
.forecast-decision.bearish strong { color: #24dc78; }
.forecast-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; margin: 0; }
.forecast-metrics > div { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 4px 7px; border-left: 1px solid rgba(143, 174, 202, 0.08); border-bottom: 1px solid rgba(143, 174, 202, 0.08); }
.forecast-metrics > div:nth-child(2n + 1) { border-left: 0; }
.forecast-metrics > div:nth-last-child(-n + 2) { border-bottom: 0; }
.forecast-metrics dt { color: #687689; font-size: 9px; white-space: nowrap; }
.forecast-metrics dd { overflow: hidden; margin: 4px 0 0; color: #cbd4de; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.forecast-rule { overflow: hidden; margin: 0; padding: 7px 10px; border-top: 1px solid rgba(143, 174, 202, 0.09); color: #667587; background: #131a25; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }

.ai-chat-drawer { position: absolute; z-index: 8; top: 0; right: 0; bottom: 0; width: min(360px, calc(100% - 20px)); box-sizing: border-box; padding: 9px; border-left: 1px solid rgba(66, 217, 208, 0.2); background: rgba(8, 14, 22, 0.97); box-shadow: -22px 0 50px rgba(0, 0, 0, 0.46); }
.ai-chat-drawer[hidden] { display: none; }
.ai-chat-drawer .ai-chat-card { grid-column: auto; width: 100%; height: 100%; border: 1px solid rgba(66, 217, 208, 0.2); border-radius: 11px; box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32); }
.ai-chat-drawer .ai-chat-messages { gap: 9px; padding: 12px 10px; }
.ai-chat-drawer .ai-chat-message p { font-size: 12px; line-height: 1.65; }
.ai-chat-drawer .ai-chat-composer { padding: 8px; }

.daily-inspector {
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-left: 1px solid rgba(143, 174, 202, 0.16);
  color: #cbd3dd;
  background: #151b26;
  scrollbar-color: #3b4555 #151b26;
}

.daily-inspector-hero {
  min-height: 72px;
  padding: 9px 10px 10px;
  border-bottom: 1px solid rgba(143, 174, 202, 0.18);
  background: #191f2b;
}

.daily-inspector-status,
.daily-inspector-price-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daily-inspector-status { color: #707d8f; font-size: 11px; letter-spacing: 0.04em; }
.daily-inspector-status span:first-child { color: #aab4c2; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; letter-spacing: 0; }
.daily-inspector-price-row { margin-top: 5px; }
.daily-inspector-price-row strong { color: #edf2f6; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.daily-inspector-price-row span { color: #909cac; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

.daily-inspector-section { border-bottom: 1px solid rgba(143, 174, 202, 0.14); }
.daily-inspector-section h3 { margin: 0; padding: 7px 10px; border-bottom: 1px solid rgba(143, 174, 202, 0.11); color: #aeb8c6; background: #202735; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
.daily-inspector-section h3 > span { float: right; color: #707d8f; font-size: 10px; font-weight: 500; letter-spacing: 0; }
.daily-metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.daily-metric-grid > div { display: flex; align-items: baseline; justify-content: space-between; min-width: 0; gap: 4px; padding: 6px 7px; border-bottom: 1px solid rgba(143, 174, 202, 0.065); }
.daily-metric-grid > div:nth-last-child(-n + 2) { border-bottom: 0; }
.daily-metric-grid dt { flex: 1 1 auto; overflow: hidden; min-width: 0; color: #7f8b9c; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.daily-metric-grid dd { flex: 0 0 auto; overflow: hidden; margin: 0; color: #d7dee7; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.daily-flow-grid dd { font-size: 11px; }
.chip-distribution-date-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(92px, 1.08fr) minmax(0, 1fr); align-items: center; gap: 4px; padding: 6px 7px 1px; }
.chip-distribution-date-controls label { min-width: 0; }
.chip-distribution-date-controls button,
.chip-distribution-date-controls input { width: 100%; min-width: 0; height: 26px; border: 1px solid rgba(143, 174, 202, 0.18); border-radius: 4px; color: #aeb8c6; background: #151c27; font-size: 10px; }
.chip-distribution-date-controls button { padding: 0 4px; cursor: pointer; }
.chip-distribution-date-controls button:hover:not(:disabled) { color: #eef2f5; border-color: rgba(229, 216, 95, 0.38); }
.chip-distribution-date-controls button:disabled { opacity: 0.35; cursor: default; }
.chip-distribution-section h3 { display: flex; align-items: center; gap: 6px; }
.chip-distribution-section h3 > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-distribution-date-controls input { padding: 0 4px; color-scheme: dark; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; text-align: center; }
.chip-distribution-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 7px 6px 5px; }
.chip-distribution-summary > div { min-width: 0; text-align: center; }
.chip-distribution-summary dt { overflow: hidden; color: #7f8b9c; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.chip-distribution-summary dd { overflow: hidden; margin: 3px 0 0; color: #d7dee7; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.chip-distribution-chart { position: relative; min-height: 220px; padding: 0 7px 4px; }
.chip-distribution-chart canvas { display: block; width: 100%; height: 220px; }
.chip-distribution-chart > p { position: absolute; inset: 0 7px 4px; display: grid; place-items: center; margin: 0; padding: 12px; color: #667386; background: rgba(17, 23, 34, 0.78); font-size: 10px; line-height: 1.5; text-align: center; }
.chip-distribution-chart > p[hidden] { display: none; }
.chip-distribution-coverage { margin: 0; padding: 5px 9px 7px; border-top: 1px solid rgba(143, 174, 202, 0.08); color: #667386; font-size: 9px; line-height: 1.45; text-align: center; }
.capital-flow-panel { border-top: 1px solid rgba(143, 174, 202, 0.13); background: #171d28; }
.capital-flow-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; padding: 4px 7px 4px 10px; border-bottom: 1px solid rgba(143, 174, 202, 0.11); background: #202735; }
.capital-flow-head > strong { color: #aeb8c6; font-size: 12px; letter-spacing: 0.06em; }
.capital-flow-ranges { display: flex; align-items: center; gap: 2px; }
.capital-flow-ranges button { height: 22px; border: 0; border-radius: 4px; padding: 0 5px; color: #9ba6b6; background: transparent; font-size: 11px; cursor: pointer; }
.capital-flow-ranges button:hover { color: #eef3f7; background: rgba(143, 174, 202, 0.08); }
.capital-flow-ranges button.active { color: #fff; background: #2e78cf; }
.capital-flow-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 8px 6px 6px; }
.capital-flow-summary > div { min-width: 0; text-align: center; }
.capital-flow-summary span { display: block; color: #8e99a9; font-size: 10px; white-space: nowrap; }
.capital-flow-summary strong { display: block; overflow: hidden; margin-top: 3px; color: #dbe2ea; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
#capitalFlowMainIn { color: #ff4b60; }
#capitalFlowMainOut { color: #24dc78; }
.capital-flow-donuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 2px 7px 7px; }
.capital-flow-donut-card { min-width: 0; margin: 0; text-align: center; }
.capital-flow-donut-card h4 { margin: 0 0 2px; color: #aeb8c6; font-size: 11px; font-weight: 600; }
.capital-flow-donut-card canvas { display: block; width: 100%; height: 116px; }
.capital-flow-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 5px; margin-top: 1px; }
.capital-flow-legend span { display: flex; align-items: center; min-width: 0; gap: 3px; color: #818d9d; font-size: 9px; white-space: nowrap; }
.capital-flow-legend i { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; }
.capital-flow-legend b { overflow: hidden; color: #c7d0da; font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; font-weight: 600; text-overflow: ellipsis; }
.capital-flow-coverage { margin: 0; padding: 5px 9px 7px; border-top: 1px solid rgba(143, 174, 202, 0.08); color: #667386; font-size: 9px; text-align: center; }
.daily-inspector .positive { color: #ff4b60; }
.daily-inspector .negative { color: #24dc78; }
.daily-inspector .neutral { color: #d7dee7; }
.daily-inspector-disclaimer { margin: 0; padding: 9px 11px 11px; color: #647184; background: #111722; font-size: 10px; line-height: 1.55; }

@keyframes chart-dialog-in {
  from { transform: translateY(8px) scale(0.99); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

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

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 38px; padding-top: 60px; }
  .market-card { min-height: auto; }
  .strategy-grid { grid-template-columns: repeat(2, 1fr); }
  .watchlist-history-groups { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 28px, 1400px); }
  .topbar { min-height: 74px; }
  .status-pill { padding: 8px; }
  #headerStatus { display: none; }
  .topbar-actions { gap: 6px; }
  .status-pill { width: 31px; height: 31px; justify-content: center; padding: 0; }
  .hero { padding: 48px 0 58px; }
  .hero h1 { font-size: 41px; }
  .hero-text { font-size: 16px; }
  .strategy-grid { grid-template-columns: 1fr; }
  .section-title-row > p { display: none; }
  .results-head { align-items: stretch; flex-direction: column; padding: 22px 18px; }
  .results-actions { width: 100%; flex-wrap: wrap; }
  .search-box { width: 100%; flex: 1 0 100%; order: 3; }
  .active-strategy p { line-height: 1.6; }
  .app-modal { padding: 0; }
  .watchlist-history-dialog { height: 100vh; }
  .watchlist-date-toolbar { grid-template-columns: 34px minmax(0, 1fr) 34px; padding: 10px; }
  .watchlist-date-strip { grid-template-columns: repeat(6, minmax(132px, 1fr)); }
  .watchlist-history-content { padding: 12px 10px 18px; }
  .watchlist-history-stock { grid-template-columns: 24px minmax(0, 1fr) auto auto; }
  .watchlist-following { display: none; }
  .watchlist-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; }
  .watchlist-quote.price { display: none; }
  .market-stats { gap: 6px; }
  .market-stats strong { font-size: 18px; }
  footer { flex-direction: column; line-height: 1.6; }
  .stock-chart-modal { padding: 0; }
  .stock-chart-dialog { width: 100vw; max-height: 100vh; height: 100vh; border: 0; border-radius: 0; }
  .stock-chart-head { align-items: flex-start; min-height: 118px; padding: 13px; }
  .stock-chart-symbol { min-width: 66px; height: 40px; padding: 0 8px; font-size: 12px; }
  .stock-chart-head-actions { gap: 8px; }
  .stock-chart-quote { display: none; }
  .stock-chart-period-controls { position: absolute; top: 64px; right: 13px; left: 13px; justify-content: flex-end; overflow-x: auto; }
  .stock-chart-title-line h2 { max-width: 125px; font-size: 19px; }
  .stock-chart-content { flex: 1; }
  .stock-chart-command-row { display: block; }
  .stock-chart-ma-toolbar { min-width: 760px; overflow-x: auto; }
  .stock-chart-legend { min-width: 760px; border-bottom: 1px solid rgba(143, 174, 202, 0.11); }
  .stock-chart-tools { position: sticky; left: 0; width: max-content; border-left: 0; }
  .stock-chart-canvas-wrap { height: calc(100vh - 301px); }
  .stock-chart-footer { flex-direction: column; gap: 4px; }
}

@media (max-width: 520px) {
  .brand > span:last-child { display: none; }
  .topbar-actions { gap: 4px; }
  .stock-chart-periods button { min-width: 37px; padding: 0 6px; }
  .stock-chart-range-select-label span { display: none; }
  .stock-chart-range-select-label select { padding-left: 8px; }
}

@media (max-height: 800px) {
  .intelligence-card { grid-template-rows: 38px minmax(0, 1fr) 38px; }
  .next-day-plan-card { grid-template-rows: 38px minmax(0, 1fr) 23px; }
  .intelligence-card-head { padding-top: 5px; padding-bottom: 5px; }
  .ai-chat-messages { padding-top: 6px; padding-bottom: 5px; }
  .next-day-plan-body { padding-top: 6px; padding-bottom: 5px; }
  .forecast-rule { padding-top: 5px; padding-bottom: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Modern financial-terminal redesign. The original application remains in the
   sibling stork_web_v2 project; these overrides only belong to this copy. */
:root {
  --bg: #070a0f;
  --panel: #0d131c;
  --panel-strong: #111a25;
  --line: rgba(159, 177, 197, 0.15);
  --text: #edf2f7;
  --muted: #8997a8;
  --cyan: #4fd1c8;
  --violet: #9b8cff;
  --lime: #9bda72;
  --amber: #e8b665;
  --positive: #ff5f73;
  --negative: #32d17d;
  --radius: 10px;
}

html { scroll-padding-top: 76px; }

body {
  background: #070a0f;
  color: var(--text);
}

.ambient { display: none; }

.terminal-layout {
  display: block;
  width: 100%;
  min-height: 100vh;
}

.terminal-sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #0a0e14;
}

.terminal-sidebar .brand {
  min-height: 72px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.terminal-sidebar .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #0d2425;
}

.terminal-sidebar .brand-mark svg { width: 25px; }
.terminal-sidebar .brand strong { font-size: 14px; letter-spacing: 0.13em; }
.terminal-sidebar .brand small { margin-top: 3px; font-size: 12px; letter-spacing: 0.05em; }

.terminal-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 10px;
}

.terminal-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 10px;
  color: #8592a3;
  background: transparent;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.terminal-nav-item:hover {
  color: #dce4eb;
  background: #111821;
}

.terminal-nav-item.active {
  border-color: rgba(79, 209, 200, 0.18);
  color: #dff8f6;
  background: rgba(79, 209, 200, 0.075);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.terminal-nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.terminal-nav-item > span { min-width: 0; }
.terminal-nav-item strong,
.terminal-nav-item small { display: block; }
.terminal-nav-item strong { color: inherit; font-size: 14px; font-weight: 650; }
.terminal-nav-item small { margin-top: 3px; color: #566273; font-size: 11px; }
.terminal-nav-item.active small { color: #6e9e9b; }

.terminal-nav-item .notification-unread-badge {
  top: 6px;
  right: 8px;
  border-color: #0a0e14;
}

.terminal-sidebar-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: auto 12px 14px;
  border: 1px solid rgba(232, 182, 101, 0.15);
  border-radius: 7px;
  padding: 10px;
  background: rgba(232, 182, 101, 0.04);
}

.sidebar-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(232, 182, 101, 0.08);
}

.terminal-sidebar-note strong,
.terminal-sidebar-note small { display: block; }
.terminal-sidebar-note strong { color: #c7b28d; font-size: 12px; }
.terminal-sidebar-note small { margin-top: 3px; color: #675e50; font-size: 10px; }

.terminal-main { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 64px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 13, 19, 0.96);
  backdrop-filter: blur(14px);
}

.topbar-title span,
.topbar-title strong { display: block; }
.topbar-title span { color: #5e6c7d; font: 700 11px/1.2 "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; letter-spacing: 0.13em; }
.topbar-title strong { margin-top: 4px; color: #dce4eb; font-size: 16px; font-weight: 650; }

.topbar-actions { gap: 8px; }

.status-pill {
  height: 34px;
  border-radius: 6px;
  padding: 0 10px;
  background: #0d141d;
  font-size: 12px;
}

.pulse {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 0 4px rgba(79, 209, 200, 0.08);
}

.auth-button {
  height: 34px;
  border-radius: 6px;
  padding: 0 11px;
  background: #0d181e;
  font-size: 12px;
}

.terminal-content {
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: 16px 22px 28px;
}

.hero {
  grid-template-columns: minmax(320px, 0.72fr) minmax(560px, 1.28fr);
  gap: 20px;
  padding: 10px 0 16px;
}

.overline,
.section-kicker {
  margin-bottom: 8px;
  color: #6d8588;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.overline span { width: 20px; background: var(--cyan); }

.hero h1 {
  max-width: none;
  font-size: calc(clamp(24px, 2.2vw, 32px) + 2px);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.hero-text {
  max-width: 560px;
  margin-top: 12px;
  color: #7e8c9c;
  font-size: 14px;
  line-height: 1.7;
}

.glass {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: none;
  backdrop-filter: none;
}

.market-card {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(340px, 1.28fr);
  min-height: 118px;
  padding: 13px 16px;
  border-radius: 9px;
}

.market-card::after { display: none; }

.market-card-head {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: #738091;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.quality {
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 10px;
}

.market-date-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding-right: 18px;
  border-right: 1px solid var(--line);
}

.date-display {
  margin: 0;
  font: 650 clamp(24px, 2.1vw, 30px)/1.1 "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.market-date-block p {
  margin: 6px 0 0;
  color: #687687;
  font-size: 11px;
}

.market-stats {
  align-self: stretch;
  gap: 0;
  border: 0;
  padding: 0 0 0 10px;
}

.market-stats div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 16px;
  border-left: 1px solid rgba(159, 177, 197, 0.08);
}

.market-stats div:first-child { border-left: 0; }
.market-stats strong { font: 700 19px/1 "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; }
.market-stats span { margin-top: 7px; color: #697687; font-size: 11px; }

.strategy-section { margin-bottom: 12px; }

.section-title-row {
  align-items: center;
  margin-bottom: 9px;
  padding: 0 2px;
}

.section-title-row h2 { font-size: 19px; letter-spacing: -0.01em; }

.section-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #657385;
  font-size: 11px;
}

.section-status span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
}

.strategy-grid {
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 8px;
}

.custom-strategy-card {
  border-color: rgba(229, 216, 95, 0.24);
}

.custom-strategy-card:hover {
  border-color: rgba(229, 216, 95, 0.48);
}

.strategy-card {
  min-height: 90px;
  border-radius: 7px;
  padding: 13px 15px;
  background: #0c121a;
  transition: border-color 120ms ease, background 120ms ease;
}

.strategy-card:hover {
  transform: none;
  border-color: rgba(159, 177, 197, 0.3);
  background: #101720;
}

.strategy-card[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--card-accent) 38%, transparent);
  background: color-mix(in srgb, var(--card-accent) 5%, #0d141d);
}

.strategy-card[aria-selected="true"]::after {
  top: 10px;
  right: auto;
  bottom: 10px;
  left: 0;
  width: 3px;
  height: auto;
  background: var(--card-accent);
  box-shadow: none;
}

.strategy-top { font-size: 11px; letter-spacing: 0.09em; }
.strategy-card h3 { margin: 13px 0 0; font-size: 18px; }
.strategy-card .leader { margin-top: 8px; font-size: 11px; }
.strategy-card-placeholder { display: none; }

.results {
  min-height: 470px;
  margin-bottom: 14px;
  border-radius: 9px;
}

.results-head {
  min-height: 62px;
  gap: 16px;
  padding: 10px 14px;
  background: #0f1620;
}

.active-strategy { gap: 10px; }

.strategy-eyebrow {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  font-size: 9px;
}

.active-strategy h2 { font-size: 18px; }
.active-strategy p { margin-top: 4px; font-size: 12px; }
.results-actions { gap: 7px; }

.refresh-list-button,
.export-txt-button,
.strategy-edit-button {
  height: 34px;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 12px;
}

.refresh-list-button svg,
.export-txt-button svg,
.strategy-edit-button svg { width: 14px; }

.search-box {
  width: min(260px, 100%);
  height: 34px;
  border-radius: 6px;
  padding: 0 10px;
  background: #080d13;
}

.search-box svg { width: 14px; }
.search-box input { font-size: 13px; }

.table-wrap { background: #0b1119; }

table {
  min-width: 960px;
  table-layout: fixed;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  color: #758293;
  background: #111821;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

td {
  height: 43px;
  padding: 0 12px;
  border-top-color: rgba(159, 177, 197, 0.075);
  color: #d3dbe4;
  font-size: 14px;
}

th:first-child,
td:first-child { width: 58px; text-align: center; }
th:nth-child(2),
td:nth-child(2) { width: 118px; }
.strategy-stock-table th:nth-child(2),
.strategy-stock-table td:nth-child(2) { width: 230px; }
th:nth-child(3),
td:nth-child(3) { width: 180px; }
th:nth-child(n + 4),
td:nth-child(n + 4) { text-align: right; }

tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.008); }
tbody tr:hover {
  background: rgba(79, 209, 200, 0.045);
  box-shadow: inset 3px 0 0 rgba(79, 209, 200, 0.72);
}

.rank { width: auto; color: #687586; font-size: 13px; }
.rank.top { color: #d9e0e7; }

.stock-code-cell { font-variant-numeric: tabular-nums; }
.stock-code-cell .stock-code {
  display: inline-block;
  color: #d1d8e1;
  font-size: 13px;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.stock-code-cell .copy-button {
  display: inline-grid;
  width: 20px;
  height: 20px;
  margin-left: 4px;
  vertical-align: middle;
}

.stock-cell { gap: 7px; }
.stock-open-button { gap: 0; }
.stock-initial,
.stock-code-line { display: none; }
.stock-name { color: #eee6bb; font-size: 15px; font-weight: 650; }
.market-table .stock-name { font-size: 18px; line-height: 1.15; }
.stock-open-button:hover .stock-name { color: #fff4ba; }
.watchlist-toggle { width: 22px; height: 22px; }
.score-wrap { justify-content: flex-end; }
.score-track { width: 46px; }
#tableWrap th:nth-child(3),
#tableWrap td:nth-child(3) { text-align: center; }
#tableWrap .score-wrap { justify-content: center; }
#tableWrap .score { min-width: 34px; text-align: right; }
.numeric { font-family: "Stork Chinese Kai", "Stork Chinese Kai Fallback", "SFMono-Regular", Consolas, monospace; }

.loading-state,
.error-state { min-height: 300px; }

  min-height: 285px;
  gap: 18px;
  padding: 36px clamp(24px, 5vw, 70px);
  background: #0b1119;
}

  width: 56px;
  height: 56px;
  border-radius: 9px;
}


footer { padding: 4px 2px 18px; color: #505d6d; font-size: 10px; }

.app-modal-backdrop { background: rgba(2, 5, 9, 0.86); backdrop-filter: blur(6px); }
.app-dialog { border-radius: 10px; background: #0d131c; }
.app-dialog-head { padding: 16px 18px; background: #111821; }
.app-dialog-head h2 { font-size: 20px; }
.app-dialog-close { border-radius: 6px; }

.stock-chart-modal { padding: 10px; }
.stock-chart-backdrop { background: rgba(1, 3, 6, 0.9); backdrop-filter: blur(4px); }
.stock-chart-dialog {
  width: calc(100vw - 20px);
  height: calc(100vh - 20px);
  max-height: calc(100vh - 20px);
  border-radius: 10px;
  border-color: rgba(159, 177, 197, 0.2);
  background: #0a0e14;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

.stock-chart-head {
  min-height: 66px;
  padding: 10px 14px;
  background: #111721;
}

.stock-chart-symbol { height: 38px; border-radius: 6px; }
.stock-chart-title-line h2 { font-size: 19px; }
.stock-chart-identity p { margin-top: 4px; font-size: 11px; }
.stock-chart-quote strong { font-size: 23px; }
.stock-chart-periods,
.stock-chart-range-select-label { border-radius: 6px; }
.stock-chart-close { width: 34px; height: 34px; border-radius: 6px; }

.stock-chart-content,
.stock-chart-main-pane { background: #0a0e14; }
.stock-chart-workspace { grid-template-columns: minmax(760px, 4fr) minmax(220px, 1fr); min-width: 1100px; }
.stock-chart-command-row { background: #121923; }
.stock-chart-canvas-wrap { background: #0b1017; }
.stock-chart-footer { background: #101720; }
.stock-intelligence-dock { background: #0e141d; }
.intelligence-card { background: #111821; }
.intelligence-card-head { background: #151d28; }
.daily-inspector { background: #111721; }
.daily-inspector-hero { background: #151c26; }
.daily-inspector-section h3,
.capital-flow-head { background: #1a222e; }

.intelligence-card-title h3 { font-size: 13px; }
.intelligence-card-title p,
.forecast-decision span,
.forecast-decision small,
.forecast-metrics dt,
.forecast-rule,
.model-status,
.forecast-horizon { font-size: 10px; }
.ai-chat-message p,
.ai-chat-composer textarea,
.forecast-metrics dd { font-size: 11px; }
.daily-inspector-status,
.daily-metric-grid dt,
.capital-flow-ranges button,
.capital-flow-summary span { font-size: 11px; }
.daily-metric-grid dd,
.capital-flow-summary strong { font-size: 12px; }

@media (max-width: 1180px) {
  .terminal-layout { display: block; }
  .terminal-sidebar .brand { justify-content: center; padding: 0; }
  .terminal-sidebar .brand > span:last-child,
  .terminal-nav-item > span,
  .terminal-sidebar-note { display: none; }
  .terminal-nav-item { justify-content: center; min-height: 46px; padding: 8px; }
  .terminal-nav-item .notification-unread-badge { top: 3px; right: 5px; }
  .hero { grid-template-columns: 1fr; }
  .market-card { grid-template-columns: minmax(170px, 0.6fr) minmax(420px, 1.4fr); }
  .strategy-grid { grid-template-columns: repeat(2, minmax(190px, 1fr)); }
}

@media (max-width: 760px) {
  .terminal-layout { display: block; }
  .terminal-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .terminal-sidebar .brand { min-height: 58px; }
  .terminal-nav {
    flex-direction: row;
    gap: 2px;
    overflow-x: auto;
    padding: 6px;
  }
  .terminal-nav-item { width: 42px; min-width: 42px; min-height: 42px; }
  .topbar { min-height: 56px; padding: 0 12px; }
  .topbar-title span { display: none; }
  .topbar-title strong { margin: 0; font-size: 14px; }
  .terminal-content { padding: 12px; }
  .hero { padding-top: 4px; }
  .hero h1 { font-size: 25px; }
  .market-card { grid-template-columns: 1fr; }
  .market-date-block { padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .market-stats { padding: 10px 0 0; }
  .strategy-grid { grid-template-columns: 1fr; }
  .results-head { align-items: stretch; }
  .results-actions { flex-wrap: wrap; }
  .search-box { width: 100%; flex-basis: 100%; }
}
#strategyEditorModal[data-rule-id="rebound_1430"] .strategy-editor-dialog {
  width: min(920px, calc(100vw - 40px));
}
#strategyEditorModal[data-rule-id="rebound_1430"] .strategy-editor-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#strategyEditorModal[data-rule-id="rebound_1430"] .strategy-parameter-field {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-height: 0;
  padding: 8px 12px;
}
#strategyEditorModal[data-rule-id="rebound_1430"] .strategy-parameter-field > span { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
#strategyEditorModal[data-rule-id="rebound_1430"] .strategy-parameter-field > span small { margin-top: 0; white-space: nowrap; }
#strategyEditorModal[data-rule-id="rebound_1430"] .strategy-parameter-stepper {
  grid-template-columns: 34px minmax(60px, 1fr) auto 34px;
}
#strategyEditorModal[data-rule-id="rebound_1430"] input { width: 100%; }
@media (max-width: 620px) {
  #strategyEditorModal[data-rule-id="rebound_1430"] .strategy-editor-fields { grid-template-columns: 1fr; }
}

/* Keep inherited browser heading/small text at exactly the same +2px step. */
#marketRankingTitle { font-size: 24.5px; }
#marketFreshness { font-size: 14.5px; }
#stockChartTemplateAvailability { font-size: 15.3333px; }

/* Classification controls stay inside the existing industry drawer. */
.industry-controls{display:flex;gap:10px;padding:0 0 12px;flex-wrap:wrap}.industry-controls label{display:flex;gap:7px;align-items:center;font-size:16px;color:var(--muted,#91a2b1)}.industry-controls select{background:#0c1117;color:#e4dfa9;border:1px solid #414332;border-radius:5px;padding:5px 7px;font:inherit}
