:root {
  --bg: #101418;
  --bg-side: #161c22;
  --bg-main: #1a2128;
  --bg-card: #222a33;
  --line: #2c3640;
  --text: #e8eef4;
  --muted: #8b98a5;
  --accent: #4aa3e8;
  --accent-2: #e8b84a;
  --up: #e06b73;
  --down: #3ecf8e;
  --warn: #d4a017;
  --ok: #3ecf8e;
  --signal: #e8b84a;
  --radius: 8px;
  --side-w: 268px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: Consolas, "Sarasa Mono SC", "Cascadia Code", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

#app {
  display: flex;
  min-height: 100%;
}

aside {
  width: var(--side-w);
  flex-shrink: 0;
  background: var(--bg-side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 20;
}

.side-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  z-index: 30;
}
.side-resizer:hover,
body.side-resizing .side-resizer {
  background: var(--accent);
}
body.side-resizing {
  cursor: col-resize;
  user-select: none;
}

.brand { padding: 22px 18px 12px; }
.brand-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}
.brand h1 {
  margin: 6px 0 8px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.brand-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.brand-sub code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

.btn-latest {
  margin: 4px 16px 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.btn-latest:hover { border-color: var(--accent); color: var(--accent); }

.date-nav {
  overflow-y: auto;
  padding: 0 10px 24px;
  flex: 1;
}

.month-label {
  position: sticky;
  top: 0;
  background: var(--bg-side);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 10px 8px 6px;
}

.date-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  margin-bottom: 4px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font: inherit;
}
.date-item:hover { background: var(--bg-card); }
.date-item.active {
  background: var(--bg-card);
  border-left-color: var(--accent);
}
.date-item .d-date { font-variant-numeric: tabular-nums; font-size: 13px; }
.date-item .d-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}
.date-item .d-latest {
  font-size: 10px;
  color: var(--accent-2);
  letter-spacing: 0.06em;
}

.main-wrap {
  flex: 1;
  min-width: 0;
  background: var(--bg-main);
}

.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px 28px 10px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg-main);
  z-index: 10;
}
.btn-menu {
  display: none;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 10px;
  font: inherit;
  cursor: pointer;
}
.top-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}
.top-date {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
}
.ret-box {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ret-box label {
  font-size: 12px;
  color: var(--muted);
}
.ret-box input[type="date"] {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  font: inherit;
  font-size: 12px;
  color-scheme: dark;
}
.ret-pct {
  min-width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 18px;
  color: var(--muted);
}
.ret-pct.up { color: var(--up); }
.ret-pct.down { color: var(--down); }
.ret-n {
  min-width: 28px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.meta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 14px 28px 0;
}
.meta-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.meta-card .k {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.meta-card .v {
  font-size: 13px;
  word-break: break-all;
}

.content {
  padding: 8px 28px 64px;
  max-width: min(1280px, 100%);
  min-width: 0;
}

.content h1 {
  font-size: 22px;
  margin: 18px 0 12px;
  font-weight: 650;
}
.content h2 {
  font-size: 16px;
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: #d5dee6;
}
.content h3 { font-size: 14px; margin: 18px 0 8px; }

.content p, .content li { font-size: 14px; color: #d0d8e0; }
.content ul, .content ol { padding-left: 1.3em; }
.content li { margin: 4px 0; }

.content code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: #12171c;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  color: #c9e1f5;
}
.content strong { color: #fff; font-weight: 650; }
.content strong.flow-up { color: var(--up); font-weight: 700; }
.content strong.flow-down { color: var(--down); font-weight: 700; }
.content p.sig-line { margin: 2px 0 8px; }

.content blockquote {
  margin: 12px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: #151b21;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
  margin: 12px 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #141a20;
}

.content table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.content thead th {
  position: sticky;
  top: 0;
  background: #1e2730;
  text-align: left;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.content td {
  padding: 6px 10px;
  border-bottom: 1px solid #24303a;
  white-space: nowrap;
}
.content tbody tr.row-omit td {
  white-space: normal;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  text-align: left;
}
.content tbody tr:hover { background: #1d262e; }
.content tbody tr.row-signal {
  background: #2a2416;
  outline: 1px solid rgba(232, 184, 74, 0.35);
}
.content tbody tr.row-leader { background: #1a2834; }

/* 次日打板：候选降序表 */
.rank-panel {
  padding: 8px 28px 4px;
}
.rank-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 8px;
}
.rank-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--text, #e8eef4);
}
.rank-hint {
  font-size: 12px;
  color: var(--muted);
}
.rank-table-wrap {
  margin-top: 0;
}
.rank-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.rank-table thead th {
  position: sticky;
  top: 0;
  background: #1e2730;
  text-align: left;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.rank-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #24303a;
  white-space: nowrap;
}
.rank-table tbody tr:hover { background: #1d262e; }
.rank-table tbody tr.row-top1 {
  background: #2a2416;
  outline: 1px solid rgba(232, 184, 74, 0.4);
}
.rank-table tbody tr.row-top1 .col-name,
.rank-table tbody tr.row-top1 .col-score {
  color: #f0d78c;
  font-weight: 700;
}
.rank-table .col-rank {
  color: var(--muted);
  width: 3em;
}
@media (max-width: 860px) {
  .rank-panel { padding: 8px 14px 4px; }
  .rank-head { flex-direction: column; gap: 4px; }
}
.num-up { color: var(--up); }
.num-down { color: var(--down); }
.content td.score-max,
.content td.score-max strong {
  background: #ffff00;
  color: #111;
  font-weight: 700;
}

/* 量比 / 涨跌 关键词着色（仅站点渲染时上色，报告 .md 源码不含任何标签）
   要求：放量、上涨 → 红；缩量、下跌 → 绿 */
.kw-surge { color: var(--up); }    /* 放量 */
.kw-shrink { color: var(--down); } /* 缩量 */
.kw-rise { color: var(--up); }     /* 上涨 */
.kw-fall { color: var(--down); }   /* 下跌 */

.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }

.empty, .error {
  padding: 48px 28px;
  color: var(--muted);
  max-width: 560px;
}
.empty code, .error code { color: var(--accent); }

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 15;
}

@media (max-width: 860px) {
  aside {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
  }
  aside.open { transform: none; }
  .btn-menu { display: inline-block; }
  .backdrop.show { display: block; }
  .content, .topbar, .meta-strip { padding-left: 16px; padding-right: 16px; }
  .meta-strip { grid-template-columns: 1fr 1fr; }
  .main-wrap { max-width: 100%; }
  .content thead th { position: static; }
}

@media print {
  aside, .btn-menu, .btn-latest { display: none !important; }
  .main-wrap { background: #fff; color: #111; }
  .content { max-width: none; }
}

/* ---- 页面切换（开盘日报 / 收盘总结） ---- */
.brand-links {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.navlink {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.navlink:hover { border-color: var(--accent); color: var(--accent); }
.navlink-on {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74, 163, 232, 0.1);
}

/* ---- 收盘总结：涨跌板块 chips ---- */
.sector-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-side);
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.chip-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
  margin-right: 4px;
}
.chip {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  font-variant-numeric: tabular-nums;
}
.chip-up { color: var(--up); border-color: rgba(224, 107, 115, 0.4); }
.chip-down { color: var(--down); border-color: rgba(62, 207, 142, 0.4); }

.meta-card .v.v-up { color: var(--up); }
.meta-card .v.v-down { color: var(--down); }

@media (max-width: 860px) {
  .sector-strip { padding-left: 16px; padding-right: 16px; }
}
