:root {
  color-scheme: dark;
  --ink: #eef5ff;
  --muted: #8fa3ba;
  --surface: #0b1725;
  --surface-2: #0e1d2e;
  --line: rgba(143, 163, 186, 0.18);
  --navy: #07121f;
  --cyan: #3cd6d0;
  --green: #54e39a;
  --red: #ff707d;
  --amber: #ffc662;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--navy); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 1.5; }
button, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1440px, calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 8px 12px; transform: translateY(-150%); background: white; color: black; border-radius: 6px; }
.skip-link:focus { transform: none; }

.hero { position: relative; overflow: hidden; padding: 48px 0 0; background: radial-gradient(circle at 80% 10%, rgba(42, 137, 166, .16), transparent 35%), linear-gradient(180deg, #091827, #07121f); border-bottom: 1px solid var(--line); }
.hero::before { content: ""; position: absolute; inset: 0; opacity: .22; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, black, transparent); }
.hero-glow { position: absolute; top: -170px; right: 8%; width: 420px; height: 420px; background: var(--cyan); filter: blur(150px); opacity: .08; border-radius: 50%; }
.hero-inner { position: relative; }
.eyebrow, .section-kicker { font-family: var(--font-mono); font-size: .78rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--cyan); }
.signal-dot { display: inline-block; width: 7px; height: 7px; margin-right: 10px; background: var(--green); border-radius: 50%; box-shadow: 0 0 12px var(--green); }
.hero-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 48px; margin-top: 20px; }
h1 { margin: 0; font-size: clamp(2.6rem, 6vw, 5.8rem); line-height: .94; letter-spacing: -.065em; font-weight: 760; }
h1 span { color: #9fb6c8; }
.subtitle { max-width: 660px; margin: 24px 0 0; color: var(--muted); font-size: 1.05rem; }
.hero-controls { min-width: 270px; display: grid; gap: 9px; }
.hero-controls label, .table-tools label { color: var(--muted); font-size: .82rem; font-weight: 700; letter-spacing: .05em; }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 15px; top: 50%; transform: translateY(-56%); pointer-events: none; color: var(--muted); }
select, input[type="search"] { width: 100%; color: var(--ink); background: rgba(10, 27, 42, .82); border: 1px solid var(--line); border-radius: 8px; padding: 12px 40px 12px 14px; outline: none; }
select { appearance: none; }
select:focus, input:focus, button:focus-visible, a:focus-visible { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(60, 214, 208, .18); outline: none; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid transparent; border-radius: 8px; font-weight: 750; text-decoration: none; cursor: pointer; transition: transform .15s ease, background .15s ease, opacity .15s ease; }
.primary-button { padding: 11px 16px; color: #031315; background: var(--cyan); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .58; transform: none; }
.button-icon { font-size: 1.25rem; }
.secondary-button { padding: 8px 12px; color: var(--ink); background: #102337; border-color: var(--line); font-size: .86rem; }

.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 50px; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; overflow: hidden; background: rgba(7, 18, 31, .56); backdrop-filter: blur(12px); }
.status-item { min-height: 88px; display: grid; align-content: center; gap: 5px; padding: 18px 22px; border-right: 1px solid var(--line); }
.status-item:last-child { border-right: 0; }
.status-item span { color: var(--muted); font-size: .78rem; letter-spacing: .05em; }
.status-item strong { font-family: var(--font-mono); font-size: 1rem; }
.status-pill { justify-self: start; padding: 4px 9px; border-radius: 99px; font-family: var(--font-sans) !important; font-size: .82rem !important; }
.status-pill.success { color: var(--green); background: rgba(84, 227, 154, .1); }
.status-pill.warning { color: var(--amber); background: rgba(255, 198, 98, .1); }
.status-pill.neutral { color: var(--muted); background: rgba(143, 163, 186, .1); }
.notice { min-height: 44px; display: flex; align-items: center; padding: 10px 18px; color: #b9c8d8; background: #0b1a2b; border-inline: 1px solid var(--line); font-size: .9rem; }

.main-content { padding-block: 34px 80px; }
.empty-state { padding: 80px 20px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.empty-state h2 { margin: 8px 0; font-size: 2rem; }
.empty-state p:last-child { color: var(--muted); }
.scope-note { display: flex; gap: 16px; padding: 14px 18px; margin-bottom: 22px; border-left: 3px solid var(--amber); background: rgba(255, 198, 98, .06); color: var(--muted); }
.scope-note strong { color: var(--amber); white-space: nowrap; }
.top-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { background: linear-gradient(180deg, rgba(16, 35, 55, .88), rgba(10, 24, 39, .94)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 18px 50px rgba(0, 0, 0, .12); }
.panel-heading { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 3px 0 0; font-size: 1.35rem; letter-spacing: -.02em; }
.panel-heading p { margin: 0; }
.section-kicker { margin: 0; }
.section-kicker.positive { color: var(--green); }
.section-kicker.negative { color: var(--red); }
.panel-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; font-size: 1.55rem; font-weight: 300; }
.buy-mark { color: var(--green); background: rgba(84, 227, 154, .08); border: 1px solid rgba(84, 227, 154, .2); }
.sell-mark { color: var(--red); background: rgba(255, 112, 125, .08); border: 1px solid rgba(255, 112, 125, .2); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { color: var(--muted); background: rgba(2, 10, 18, .2); font-size: .71rem; letter-spacing: .05em; text-transform: uppercase; text-align: left; white-space: nowrap; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .018); }
.number { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ticker { color: var(--ink); font-family: var(--font-mono); font-weight: 800; }
.instrument-name { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: .72rem; white-space: nowrap; }
.net-positive { color: var(--green); }
.net-negative { color: var(--red); }
.rank { color: var(--muted); font-family: var(--font-mono); }
.watch-panel, .full-panel { margin-top: 20px; }
.split-heading > p { max-width: 460px; color: var(--muted); font-size: .86rem; text-align: right; }
.status-badge, .mapping-badge { display: inline-block; padding: 3px 8px; border-radius: 99px; font-size: .72rem; font-weight: 750; white-space: nowrap; }
.status-badge.in { color: var(--green); background: rgba(84, 227, 154, .09); }
.status-badge.out { color: var(--muted); background: rgba(143, 163, 186, .09); }
.not-ranked { color: var(--muted); }
.action-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.table-tools { max-width: 420px; display: grid; gap: 7px; padding: 18px 22px; }
.full-table-wrap { max-height: 660px; }
.full-table th { position: sticky; top: 0; z-index: 1; cursor: pointer; }
.full-table td { white-space: nowrap; }
.mapping-badge { color: var(--cyan); background: rgba(60, 214, 208, .08); }
.mapping-badge.warn { color: var(--amber); background: rgba(255, 198, 98, .08); }
.quality-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
.quality-card { padding: 22px; background: #0b1928; border: 1px solid var(--line); border-radius: 12px; }
.quality-card > span { color: var(--muted); font-family: var(--font-mono); font-size: .75rem; letter-spacing: .1em; }
.quality-card strong { display: block; margin-top: 8px; font-size: 1.2rem; }
.quality-card p { margin: 7px 0 0; color: var(--muted); font-size: .82rem; }
.footer { display: flex; justify-content: space-between; gap: 30px; padding-block: 25px 36px; color: var(--muted); border-top: 1px solid var(--line); font-size: .78rem; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(420px, calc(100vw - 44px)); padding: 12px 16px; color: var(--ink); background: #142a40; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 16px 50px rgba(0,0,0,.35); transform: translateY(160%); transition: transform .25s ease; }
.toast.show { transform: none; }

@media (max-width: 1050px) {
  .hero-title-row { align-items: stretch; flex-direction: column; }
  .hero-controls { grid-template-columns: 1fr 1fr; align-items: end; }
  .hero-controls label { grid-column: 1 / -1; margin-bottom: -5px; }
  .status-grid { grid-template-columns: 1fr 1fr; }
  .status-item:nth-child(2) { border-right: 0; }
  .status-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .top-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .shell { width: min(100% - 24px, 1440px); }
  .hero { padding-top: 30px; }
  h1 { font-size: clamp(2.55rem, 14vw, 4rem); }
  .hero-controls { grid-template-columns: 1fr; }
  .hero-controls label { grid-column: auto; }
  .status-grid { grid-template-columns: 1fr; margin-top: 34px; }
  .status-item { min-height: 72px; border-right: 0; border-bottom: 1px solid var(--line); }
  .status-item:last-child { border-bottom: 0; }
  .scope-note, .split-heading, .footer { align-items: flex-start; flex-direction: column; }
  .split-heading > p { text-align: left; }
  .action-row { justify-content: flex-start; }
  .quality-grid { grid-template-columns: 1fr; }
  .panel-heading { padding: 18px 16px; }
  th, td { padding: 10px; }
}

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

