:root,
[data-theme="dark"] {
  --bg: #0f141a;
  --surface: #1a212b;
  --surface-2: #222b37;
  --text: #e6e9ee;
  --text-muted: #9aa5b1;
  --border: #2a333f;
  --divider: #232c38;
  --header-bg: #0a0e13;
  --link: #5aa2ff;
  --active-bg: #2b6cb0;
  --active-text: #ffffff;
  --badge-pos-bg: #14331e; --badge-pos-fg: #69e0a0;
  --badge-neg-bg: #3a1b1b; --badge-neg-fg: #ff8f87;
  --badge-neu-bg: #2a313c; --badge-neu-fg: #aeb6c2;
}
[data-theme="light"] {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #1f2933;
  --text-muted: #7b8794;
  --border: #e4e7eb;
  --divider: #edf0f3;
  --header-bg: #1f2933;
  --link: #2b6cb0;
  --active-bg: #2b6cb0;
  --active-text: #ffffff;
  --badge-pos-bg: #e3f3e8; --badge-pos-fg: #1f7a44;
  --badge-neg-bg: #fbe4e4; --badge-neg-fg: #b42318;
  --badge-neu-bg: #eceef1; --badge-neu-fg: #52606d;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }

.container { width: 100%; max-width: 1140px; margin-inline: auto; padding-inline: 1.5rem; }
.site-header { background: var(--header-bg); color: #fff; }
.header-inner { display: flex; align-items: center; gap: 1rem 1.25rem; flex-wrap: wrap; padding-block: 1rem; }
.site-title { color: #fff; text-decoration: none; font-size: 1.2rem; font-weight: 700; }
.tagline { color: #aeb6c2; font-size: .85rem; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.site-nav a { color: #cbd2d9; text-decoration: none; font-size: .95rem; }
.site-nav a:hover { color: #fff; }
.site-nav a.active { color: #fff; font-weight: 600; }
.theme-toggle { border: 1px solid #3a4654; background: transparent; color: #cbd2d9; font-size: 1rem; line-height: 1; padding: .3rem .5rem; border-radius: 6px; cursor: pointer; }
.theme-toggle:hover { color: #fff; border-color: #6b7785; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 120px); }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem; }
.sidebar h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 0 0 .5rem; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: .4rem .6rem; border-radius: 6px; color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; }
.sidebar a:hover { background: var(--surface-2); }
.sidebar a.active { background: var(--active-bg); color: var(--active-text); font-weight: 600; }
.date-jump { margin-top: .75rem; }
.date-jump label { display: block; font-size: .78rem; color: var(--text-muted); margin-bottom: .25rem; }
.date-jump input { width: 100%; max-width: 220px; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: var(--surface); color: var(--text); }

.content { padding: 1.5rem 2rem; min-width: 0; }
.content h1 { font-size: 1.5rem; margin: 0 0 1.25rem; }
.content a { color: var(--link); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.panel > h2 { margin-top: 0; font-size: 1.1rem; border-bottom: 2px solid var(--divider); padding-bottom: .5rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem; border-bottom: 2px solid var(--divider); padding-bottom: .5rem; margin-bottom: .75rem; }
.panel-head h2 { margin: 0; font-size: 1.1rem; }
.toggle-all { border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .82rem; padding: .25rem .7rem; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.toggle-all:hover { background: var(--surface-2); }

.news-item { border-bottom: 1px solid var(--divider); }
.news-item:last-child { border-bottom: none; }
.news-item > summary { display: flex; align-items: center; gap: .5rem; cursor: pointer; padding: .6rem 0; list-style: none; }
.news-item > summary::-webkit-details-marker { display: none; }
.news-item > summary::before { content: "\203A"; color: var(--text-muted); font-size: 1.1rem; line-height: 1; transition: transform .15s; }
.news-item[open] > summary::before { transform: rotate(90deg); }
.news-item .rank { color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 1.4em; text-align: right; }
.news-item .news-title { flex: 1; font-weight: 600; }
.news-body { padding: 0 0 .85rem 2rem; }
.news-body p { margin: 0 0 .4rem; color: var(--text-muted); }
.news-body .impact { color: var(--text); }
.news-body .sources { font-size: .82rem; color: var(--text-muted); }
.news-body .sources a { color: var(--link); margin: 0 .15rem; }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.pos { background: var(--badge-pos-bg); color: var(--badge-pos-fg); }
.badge.neg { background: var(--badge-neg-bg); color: var(--badge-neg-fg); }
.badge.neu { background: var(--badge-neu-bg); color: var(--badge-neu-fg); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stock-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 600px; }
.stock-table th, .stock-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--divider); vertical-align: top; }
.stock-table th { color: var(--text-muted); font-weight: 600; }
.stock-table .nowrap { white-space: nowrap; }
.stock-table td:first-child { font-variant-numeric: tabular-nums; }
.stock-table .reason { min-width: 16rem; color: var(--text-muted); }

.disclaimer-note { font-size: .78rem; font-weight: 400; color: var(--text-muted); }
.empty { color: var(--text-muted); }

.about-head { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.about-head img { width: 128px; height: 128px; border-radius: 50%; border: 3px solid var(--border); }
.about-head .role { color: var(--text-muted); margin: .25rem 0 0; }
.about-links { list-style: none; padding: 0; margin: 0; }
.about-links li { margin-bottom: .4rem; }

.disclaimer { padding-block: 1rem; font-size: .8rem; color: var(--text-muted); background: var(--surface-2); border-top: 1px solid var(--border); text-align: center; }

@media (max-width: 768px) {
  .container { padding-inline: 1rem; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); padding: .75rem 1rem; }
  .sidebar h2 { margin-bottom: .4rem; }
  .sidebar ul { display: flex; gap: .4rem; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: .2rem; }
  .sidebar li { flex: 0 0 auto; }
  .sidebar a { white-space: nowrap; }
  .content { padding: 1.25rem 1rem; }
}
@media (max-width: 560px) {
  .tagline { display: none; }
  .header-inner { gap: .75rem; padding-block: .85rem; }
  .content h1 { font-size: 1.3rem; }
  .panel { padding: 1rem; }
  .news-body { padding-left: 1.5rem; }
}
