/* ========== Design System (Replicate-inspired) ========== */
:root {
  --canvas: #f9f7f3;
  --surface-bone: #f3f0e8;
  --surface-card: #ffffff;
  --surface-dark: #202020;
  --surface-deep: #000000;
  --primary: #ea2804;
  --primary-deep: #c01f00;
  --on-primary: #ffffff;
  --ink: #202020;
  --body: #3a3a3a;
  --charcoal: #575757;
  --mute: #646464;
  --ash: #8d8d8d;
  --stone: #bbbbbb;
  --on-dark: #fcfcfc;
  --on-dark-mute: rgba(252,252,252,0.72);
  --hairline: rgba(32,32,32,0.12);
  --hairline-strong: #202020;
  --badge-success: #2b9a66;
  --badge-danger: #d0312d;
  --ring-focus: rgba(59,130,246,0.5);
  --green: #cb3729;
  --red: #cb3729;

  --font-display: 'Bricolage Grotesque', -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Geist', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --rounded-full: 9999px;
  --rounded-md: 10px;
  --rounded-lg: 16px;

  --shadow-card: 0 1px 2px rgba(32,32,32,0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

/* ========== Navigation ========== */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--canvas);
  height: 60px;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 4px;
}
.nav-brand {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700;
  letter-spacing: -0.3px;
  margin-right: 16px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.nav-brand span { color: var(--primary); }
.nav-tab {
  padding: 8px 20px;
  border-radius: var(--rounded-full);
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  border: none; cursor: pointer;
  background: transparent;
  color: var(--charcoal);
  transition: all 0.15s;
  text-decoration: none;
}
.nav-tab:hover { background: var(--surface-bone); color: var(--ink); }
.nav-tab.active { background: var(--ink); color: var(--on-dark); }
.nav-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 12px;
}
.nav-level {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--rounded-full);
  background: var(--surface-bone);
  color: var(--charcoal);
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
.nav-bell {
  font-size: 18px;
  line-height: 1;
}
.bell-badge {
  font-family: -apple-system, 'Segoe UI', system-ui, sans-serif;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.trading { background: var(--badge-success); }
.status-dot.lunch { background: #e8a317; }
.status-dot.pre { background: var(--stone); }
.status-dot.post { background: var(--ash); }
.status-dot.closed { background: var(--stone); }
.status-label {
  font-size: 13px; color: var(--charcoal);
  font-weight: 500;
  cursor: default;
  user-select: none;
}

/* ========== Main Layout ========== */
.main { max-width: 1440px; margin: 0 auto; padding: 24px; }
.page { display: none; }
.page.active { display: block; }

/* ========== Summary Bar ========== */
.summary-bar {
  display: flex; gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.summary-item {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  padding: 12px 20px;
  flex: 1; min-width: 100px;
  box-shadow: var(--shadow-card);
}
.summary-item .label { font-size: 12px; color: var(--charcoal); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px; }
.summary-item .value { font-size: 28px; font-weight: 700; font-family: var(--font-display); letter-spacing: -0.5px; }
.summary-item .value.up { color: var(--badge-danger); }
.summary-item .value.down { color: var(--badge-success); }
.summary-item .value.neutral { color: var(--ash); }

/* ========== Sector Grid ========== */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}
.sector-card {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.sector-card:hover { box-shadow: 0 4px 12px rgba(32,32,32,0.08); }
.sector-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  user-select: none;
}
.sector-header:hover { background: var(--surface-bone); }
.sector-name { font-weight: 600; font-size: 15px; }
.sector-stats { display: flex; align-items: center; gap: 8px; }
.sector-up-pct {
  font-weight: 700; font-size: 18px;
  font-family: var(--font-display);
  letter-spacing: -0.3px;
}
.sector-up-pct.up { color: var(--badge-danger); }
.sector-up-pct.down { color: var(--badge-success); }
.sector-direction {
  font-size: 14px;
  padding: 2px 8px;
  border-radius: var(--rounded-full);
  background: var(--surface-bone);
  font-weight: 600;
}
.sector-counts { font-size: 12px; color: var(--charcoal); }

/* ========== Sector Stock Table ========== */
.sector-body { padding: 0; }
.sector-body.collapsed { display: none; }
.stock-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stock-table th {
  padding: 6px 16px;
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ash);
  border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0;
  background: var(--surface-card);
}
.stock-table td { padding: 5px 16px; border-bottom: 1px solid var(--hairline); }
.stock-table tr:last-child td { border-bottom: none; }
.stock-table tr:hover td { background: var(--surface-bone); }
.stock-code { font-family: var(--font-mono); font-size: 12px; color: var(--charcoal); }
.stock-name { font-weight: 500; }
.stock-change { font-weight: 600; text-align: right; font-family: var(--font-mono); font-size: 12px; }
.stock-change.up { color: var(--badge-danger); }
.stock-change.down { color: var(--badge-success); }
.stock-price { text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--charcoal); }

/* ========== Reports Page ========== */
.report-date-group { margin-bottom: 32px; }
.report-date-title {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 12px;
  color: var(--ink);
}
.report-cards { display: flex; flex-direction: column; gap: 8px; }
.report-card {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: pointer;
}
.report-card-header {
  display: flex; align-items: center;
  padding: 14px 20px;
  gap: 16px;
}
.report-card-header:hover { background: var(--surface-bone); }
.report-time {
  font-family: var(--font-mono);
  font-size: 14px; font-weight: 600;
  color: var(--primary);
  min-width: 60px;
}
.report-label {
  font-weight: 600;
  font-size: 15px;
  flex: 1;
}
.report-ratings { display: flex; gap: 6px; }
.rating-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--rounded-full);
  background: var(--surface-bone);
  font-weight: 600;
}
.report-body {
  padding: 0 20px 16px;
  display: none;
}
.report-body.open { display: block; }

/* 报告渲染（marked / DOMPurify 输出） */
/* 作用域：report-body（报告页）、rs-view-content（投研弹窗） */

.report-body, .rs-view-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}

.report-body h1, .rs-view-content h1 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin: 20px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
  letter-spacing: -0.3px;
}

.report-body h2, .rs-view-content h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin: 18px 0 10px;
  letter-spacing: -0.3px;
}

.report-body h3, .rs-view-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 14px 0 8px;
}

.report-body p, .rs-view-content p {
  margin: 6px 0;
  color: var(--charcoal);
}

.report-body ul, .rs-view-content ul,
.report-body ol, .rs-view-content ol {
  margin: 6px 0;
  padding-left: 20px;
}

.report-body li, .rs-view-content li {
  margin: 3px 0;
  color: var(--charcoal);
}

.report-body strong, .rs-view-content strong {
  color: var(--ink);
  font-weight: 600;
}

.report-body table, .rs-view-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.report-body th, .rs-view-content th,
.report-body td, .rs-view-content td {
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  text-align: left;
}

.report-body th, .rs-view-content th {
  background: var(--surface-bone);
  font-weight: 600;
  font-size: 12px;
  color: var(--ash);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.report-body td, .rs-view-content td {
  color: var(--charcoal);
}

.report-body img, .rs-view-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--rounded-md);
  margin: 12px 0;
  box-shadow: var(--shadow-card);
}

.report-body code, .rs-view-content code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-bone);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--charcoal);
}

.report-body pre, .rs-view-content pre {
  background: var(--surface-bone);
  padding: 12px 16px;
  border-radius: var(--rounded-md);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0;
}

.report-body pre code, .rs-view-content pre code {
  background: none;
  padding: 0;
}

.report-body blockquote, .rs-view-content blockquote {
  margin: 10px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--primary);
  background: var(--surface-bone);
  color: var(--charcoal);
  font-style: italic;
}

.report-body hr, .rs-view-content hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 16px 0;
}

/* ========== Notification ========== */
.report-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface-dark);
  color: var(--on-dark);
  padding: 12px 20px;
  border-radius: var(--rounded-full);
  font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(32,32,32,0.2);
  display: none;
  z-index: 200;
  cursor: pointer;
  animation: slideUp 0.3s ease;
}
.report-toast.show { display: flex; align-items: center; gap: 8px; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast-close {
  background: none; border: none; color: var(--on-dark-mute);
  cursor: pointer; font-size: 16px; padding: 0 4px;
}

/* ========== Loading ========== */
.loading {
  text-align: center; padding: 48px;
  color: var(--charcoal);
  font-size: 15px;
}
.loading .spinner {
  display: inline-block;
  width: 24px; height: 24px;
  border: 2px solid var(--hairline);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 盘前参考 ========== */
.ml-section {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 12px;
}
.ml-section h3 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 12px;
}
.ml-detail { font-size: 13px; line-height: 1.6; color: var(--body); margin-bottom: 8px; }
.ml-detail strong { color: var(--ink); }
.ml-stock-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.ml-stock-table th { padding: 6px 10px; text-align: left; font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--ash); border-bottom: 1px solid var(--hairline); background: var(--surface-bone); white-space: nowrap; }
.ml-stock-table td { padding: 5px 10px; border-bottom: 1px solid var(--hairline); }
.ml-stock-table tr:last-child td { border-bottom: none; }
.ml-stock-type { font-size: 11px; color: var(--primary); font-weight: 600; }
.ml-stock-name { font-weight: 600; }
.ml-stock-reason { color: var(--charcoal); font-size: 12px; }
.ml-rating-badge { display: inline-block; padding: 1px 8px; border-radius: var(--rounded-full); font-size: 11px; font-weight: 700; margin-left: 6px; vertical-align: middle; }
.ml-rating-S { background: #ff4d4f; color: #fff; }
.ml-rating-A { background: var(--primary); color: var(--on-primary); }
.ml-rating-B { background: var(--charcoal); color: var(--on-dark); }
.wechat-date-btn {
  padding: 6px 14px; border-radius: var(--rounded-full);
  border: 1px solid var(--hairline); background: var(--surface-card);
  font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--charcoal); transition: all 0.15s;
}
.wechat-date-btn:hover { border-color: var(--primary); color: var(--primary); }
.wechat-date-btn.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

/* ========== Empty State ========== */
.empty-state {
  text-align: center; padding: 64px 24px;
  color: var(--charcoal);
}
.empty-state h3 { font-family: var(--font-display); font-size: 20px; margin-bottom: 8px; color: var(--ink); }
.empty-state p { font-size: 14px; }

/* ========== Responsive ========== */
/* ========== Research Page ========== */
.research-subnav {
  display: flex; gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 8px;
}
.research-subnav-btn {
  padding: 8px 20px;
  border-radius: var(--rounded-full);
  border: none; cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  background: transparent;
  color: var(--charcoal);
  transition: all 0.15s;
}
.research-subnav-btn:hover { background: var(--surface-bone); color: var(--ink); }
.research-subnav-btn.active { background: var(--ink); color: var(--on-dark); }
.research-subpage { display: none; }
.research-subpage.active { display: block; }
.research-card {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
  padding: 24px;
  max-width: 640px;
}
.research-label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--body);
  margin-bottom: 6px;
}
.research-input {
  width: 100%; height: 44px;
  padding: 0 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-full);
  font-size: 14px;
  font-family: var(--font-mono);
  outline: none;
  background: var(--surface-card);
  color: var(--ink);
}
.research-input:focus { border-color: var(--ink); }
.research-search-wrap { position: relative; }
.research-suggest {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  box-shadow: 0 8px 24px rgba(32,32,32,0.1);
  z-index: 50;
  max-height: 300px; overflow-y: auto;
}
.rs-suggest-item {
  padding: 10px 16px; cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--hairline);
}
.rs-suggest-item:last-child { border-bottom: none; }
.rs-suggest-item:hover { background: var(--surface-bone); }
.rs-sug-code { font-family: var(--font-mono); color: var(--primary); font-weight: 600; }
.rs-sug-name { color: var(--charcoal); }
.rs-stock-info { margin: 8px 0; }
.rs-stock-tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--surface-bone);
  border-radius: var(--rounded-full);
  font-size: 13px; font-weight: 600;
}
.research-types { display: flex; gap: 8px; flex-wrap: wrap; }
.rs-type-btn {
  padding: 8px 16px;
  border-radius: var(--rounded-full);
  border: 1px solid var(--hairline);
  background: var(--surface-card);
  font-family: var(--font-body);
  font-size: 13px; cursor: pointer;
  color: var(--charcoal);
  transition: all 0.15s;
  display: flex; align-items: center; gap: 4px;
}
.rs-type-btn:hover { border-color: var(--primary); color: var(--primary); }
.rs-type-btn.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.rs-type-time { font-size: 11px; opacity: 0.7; }
.rs-ai-badge {
  font-size: 10px; padding: 1px 5px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  font-weight: 700;
}
.rs-data-info { margin: 8px 0 0; }
.rs-ready-hint {
  font-size: 12px; color: var(--ash);
  padding: 6px 12px;
  background: var(--surface-bone);
  border-radius: var(--rounded-md);
  display: inline-block;
}
.rs-quota { margin: 16px 0; }
.rs-quota-text { font-size: 13px; color: var(--charcoal); margin-bottom: 4px; }
.rs-quota-num { font-weight: 700; color: var(--ink); }
.rs-quota-num.rs-quota-warn { color: #e8a317; }
.rs-quota-bar {
  height: 4px; border-radius: 4px;
  background: var(--surface-bone);
  overflow: hidden;
}
.rs-quota-fill {
  height: 100%; border-radius: 4px;
  background: var(--badge-success);
  transition: width 0.3s;
}
.rs-quota-fill.rs-quota-warn { background: #e8a317; }
.rs-submit-btn {
  width: 100%; height: 44px;
  border: none; border-radius: var(--rounded-full);
  background: var(--primary); color: var(--on-primary);
  font-size: 16px; font-weight: 600; cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.15s;
}
.rs-submit-btn:hover { background: var(--primary-deep); }
.rs-submit-btn:disabled { background: var(--stone); cursor: not-allowed; }
.rs-submit-msg { margin-top: 12px; font-size: 13px; padding: 8px 12px; border-radius: var(--rounded-md); }
.rs-submit-success { background: #eef9f2; color: var(--badge-success); }
.rs-submit-error { background: #fef0ef; color: var(--badge-danger); }

/* 分析记录 */
.research-month-group { margin-bottom: 24px; }
.research-month-title {
  font-size: 18px; font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.3px;
  margin-bottom: 10px;
}
.research-record {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  margin-bottom: 8px;
}
.rr-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rr-stock { font-weight: 600; font-size: 14px; }
.rr-type { font-size: 12px; color: var(--charcoal); background: var(--surface-bone); padding: 2px 8px; border-radius: var(--rounded-full); }
.rr-bottom { display: flex; align-items: center; gap: 8px; }
.rr-time { font-size: 12px; color: var(--ash); flex: 1; }
.rr-status { font-size: 11px; padding: 2px 8px; border-radius: var(--rounded-full); font-weight: 600; }
.rs-status-pending { background: var(--surface-bone); color: var(--charcoal); }
.rs-status-processing { background: #e8f4fd; color: #1a73e8; }
.rs-status-completed { background: #eef9f2; color: var(--badge-success); }
.rs-status-failed { background: #fef0ef; color: var(--badge-danger); }
.rs-status-cancelled { background: var(--surface-bone); color: var(--ash); text-decoration: line-through; }
.rs-cancel-btn {
  padding: 2px 10px; border-radius: var(--rounded-full);
  border: 1px solid var(--hairline); background: var(--surface-card);
  font-size: 11px; cursor: pointer; color: var(--badge-danger);
  font-family: var(--font-body);
}
.rs-cancel-btn:hover { background: #fef0ef; }
.rs-cancel-btn:disabled { color: var(--stone); cursor: not-allowed; }
.rs-view-btn {
  padding: 2px 10px; border-radius: var(--rounded-full);
  border: none; background: var(--badge-success);
  font-size: 11px; cursor: pointer; color: #fff;
  font-family: var(--font-body);
}
.rs-view-btn:hover { opacity: 0.85; }

/* 报告查看弹窗（全屏大弹窗） */
.rs-view-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(32,32,32,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.rs-view-loader {
  text-align: center; color: var(--on-dark);
  font-size: 14px;
}
.rs-view-modal {
  background: var(--surface-card);
  border-radius: var(--rounded-lg);
  box-shadow: 0 8px 40px rgba(32,32,32,0.25);
  width: 100%;
  max-width: 1200px;
  height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.rs-view-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.rs-view-title {
  font-size: 16px; font-weight: 700;
}
.rs-view-close {
  background: none; border: none;
  font-size: 20px; cursor: pointer;
  color: var(--charcoal); padding: 4px 8px;
  border-radius: var(--rounded-full);
  font-family: inherit;
}
.rs-view-close:hover { background: var(--surface-bone); }
.rs-view-body {
  flex: 1; overflow-y: auto;
  padding: 24px;
}
.rs-view-header {
  padding: 16px 20px;
  font-size: 16px; font-weight: 700;
  border-bottom: 1px solid var(--hairline);
}
.rs-view-body { padding: 16px 20px; }
.rs-view-row { font-size: 13px; margin-bottom: 8px; color: var(--body); }
.rs-view-row strong { color: var(--ink); }
.rs-view-path {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface-bone); padding: 4px 8px;
  border-radius: 4px; word-break: break-all; display: inline-block;
}
.rs-view-footer { padding: 12px 20px; border-top: 1px solid var(--hairline); }

@media (max-width: 768px) {
  .nav { padding: 0 12px; }
  .nav-brand { font-size: 17px; margin-right: 8px; }
  .nav-tab { padding: 6px 10px; font-size: 12px; }
  .main { padding: 12px; }
  .sector-grid { grid-template-columns: 1fr; }
  .summary-item .value { font-size: 22px; }
  .status-label { display: none; }
  .research-card { max-width: 100%; padding: 16px; }
  .research-subnav, .research-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; flex-wrap: nowrap; }
  .research-subnav-btn, .research-tab { flex-shrink: 0; font-size: 13px; padding: 6px 14px; }
  .research-types { gap: 6px; }
  .rs-type-btn { font-size: 12px; padding: 6px 12px; }
  .research-input { font-size: 13px; }

  /* 看板：整体布局改为纵向堆叠，sidebar 全宽，避免 main 被压成窄列 */
  .board-layout {
    flex-direction: column;
  }
  .board-sidebar {
    width: 100%;
    flex-shrink: 1;
    padding-right: 0;
    position: static;
    max-height: none;
    overflow-y: visible;
  }
  .board-main {
    width: 100%;
    min-width: 0;
  }
  /* 长文本块允许正常换行，避免被压成单字一列 */
  .board-climate-toggle,
  .board-climate-basis,
  .board-legend-hint,
  .board-alert-item {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .board-alert-item {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .board-alert-msg {
    min-width: 0;
    flex-basis: 100%;
  }

  /* 看板：表格横向滚动 + 列紧凑化，避免中文单字折行 */
  .board-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .board-table-scroll .board-table {
    min-width: 640px;
    font-size: 12px;
  }
  .board-table th, .board-table td {
    padding: 8px 8px;
  }
  .board-table th {
    font-size: 10px;
    letter-spacing: 0;
  }
  /* 判定透视表也允许横向滚动 */
  .board-climate-detail {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .board-climate-table {
    min-width: 560px;
  }
  /* 指标说明文字过长时正常换行，避免单词级别折断 */
  .board-legend-hint {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .board-legend {
    flex-direction: column;
    gap: 6px;
  }
  .board-search-rel { min-width: 0; }
  .board-add-row { flex-wrap: wrap; }
}

/* ========== Notification Panel ========== */
.notif-panel {
  display: none;
  position: fixed;
  top: 60px; right: 16px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 480px;
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: 0 8px 32px rgba(32,32,32,0.15);
  z-index: 200;
  overflow: hidden;
  flex-direction: column;
}
.notif-panel.show { display: flex; }
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px; font-weight: 600;
}
.notif-read-all {
  background: none; border: none;
  font-size: 12px; color: var(--primary); cursor: pointer;
  font-family: inherit;
}
.notif-list {
  overflow-y: auto;
  flex: 1;
}
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: background 0.1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-bone); }
.notif-item .notif-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notif-item .notif-msg { font-size: 12px; color: var(--charcoal); margin-bottom: 2px; }
.notif-item .notif-time { font-size: 11px; color: var(--ash); }
.notif-empty {
  text-align: center; padding: 32px 16px;
  color: var(--charcoal); font-size: 13px;
}
/* 通知类型颜色 */
.notif-report_ready .notif-title { color: var(--badge-success); }
.notif-report_failed .notif-title { color: var(--badge-danger); }
.notif-quota_warning .notif-title { color: #e8a317; }
.notif-subscription_expiring .notif-title { color: #e8a317; }

/* ========== Board Page ========== */
.board-climate-card {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 16px;
}
.board-climate-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
/* 指数行 — 内嵌在气候卡片底部 */
/* 看板页面布局 */
.board-layout {
  display: flex; gap: 0;
  min-height: calc(100vh - 120px);
}
.board-sidebar {
  width: 320px; flex-shrink: 0;
  padding-right: 20px;
  position: sticky; top: 80px;
  align-self: flex-start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.board-main {
  flex: 1; min-width: 0;
}
/* 子标签 */
.board-subtabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--hairline);
  margin-bottom: 16px;
}
.board-subtab {
  padding: 8px 18px;
  font-size: 13px; font-weight: 600;
  color: var(--ash);
  background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font-display);
}
.board-subtab:hover { color: var(--text-primary); }
.board-subtab.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}
.board-subpage { display: none; }
.board-subpage.active { display: block; }

.board-indices-row {
  display: flex; flex-wrap: wrap; gap: 6px 20px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--hairline);
}
.board-index-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; white-space: nowrap;
  padding: 4px 8px;
  border-radius: var(--rounded-sm);
  background: var(--surface-card);
  border: 1px solid var(--hairline);
}
/* 判定透视 — 主区域顶部全宽卡片 */
.board-index-detail-card {
  margin-bottom: 12px;
  padding: 12px 16px;
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
}
.board-index-name {
  color: var(--ash); min-width: 44px;
}
.board-index-price {
  font-family: var(--font-mono); color: var(--ink);
  min-width: 44px;
}
.board-index-change {
  font-family: var(--font-mono); font-weight: 600;
}
.board-index-change.up { color: var(--badge-danger); }
.board-index-change.down { color: var(--badge-success); }
.board-indices-time {
  font-size: 11px; color: var(--ash);
  font-family: var(--font-mono); margin-left: auto;
}
#boardIndicesRow {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--surface-bone);
  border-radius: var(--rounded-md);
  flex-wrap: wrap;
}
.board-grade {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.board-grade.grade-a { background: var(--badge-success); }
.board-grade.grade-b { background: #e8a317; }
.board-grade.grade-c { background: var(--badge-danger); }
.board-grade-desc {
  font-size: 18px; font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.3px;
}
.board-date {
  margin-left: auto;
  font-size: 13px; color: var(--ash);
  font-family: var(--font-mono);
}
.board-climate-risks {
  display: flex; gap: 24px;
}
.board-risk-item {
  display: flex; flex-direction: column;
}
.board-risk-label {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ash);
}
.board-risk-value {
  font-size: 24px; font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.3px;
}
.board-c-banner {
  margin-top: 12px;
  padding: 8px 16px;
  background: #fef0ef;
  border-radius: var(--rounded-md);
  color: var(--badge-danger);
  font-size: 13px; font-weight: 600;
}
.board-risk-map {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--surface-bone);
  border-radius: var(--rounded-md);
  font-size: 12px;
  line-height: 1.8;
}
.board-risk-map-row {
  display: flex; align-items: center; gap: 8px;
}
.board-grade-sm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.board-grade-sm.grade-a { background: var(--badge-success); }
.board-grade-sm.grade-b { background: #e8a317; }
.board-grade-sm.grade-c { background: var(--badge-danger); }
.board-emergency-card {
  margin-top: 12px; padding: 12px;
  background: #fef0ef;
  border: 1px solid var(--badge-danger);
  border-radius: var(--rounded-md);
}
.board-emergency-title {
  font-size: 13px; font-weight: 700;
  color: var(--badge-danger);
  margin-bottom: 4px;
}
.board-emergency-msg {
  font-size: 12px; color: var(--ink);
  line-height: 1.4;
}
.board-emergency-time {
  margin-top: 4px; font-size: 10px;
  color: var(--ash);
  font-family: var(--font-mono);
}
.board-emergency-risks {
  margin-top: 6px; font-size: 12px;
  color: var(--badge-danger);
  font-weight: 600;
}
.board-emergency-risks b {
  color: var(--badge-danger);
}
/* 判定透视面板 */
.board-climate-toggle {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px; padding: 8px 0;
  font-size: 13px; font-weight: 600;
  color: var(--ash);
  cursor: pointer; user-select: none;
  border-top: 1px solid var(--hairline);
  transition: color 0.15s;
}
.board-climate-toggle:hover { color: var(--text-primary); }
.board-climate-toggle-arrow {
  font-size: 10px; transition: transform 0.15s;
}
.board-climate-detail {
  margin-top: 4px;
}
.board-climate-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px; font-family: var(--font-mono);
}
.board-climate-table th {
  padding: 6px 8px; text-align: left;
  font-weight: 600; color: var(--ash);
  border-bottom: 1px solid var(--hairline);
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.2px;
}
.board-climate-table th.th-num { text-align: right; }
.board-climate-table td {
  padding: 6px 8px; border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.board-climate-table .td-name { font-weight: 600; font-family: var(--font-display); }
.board-climate-table .td-dir { font-weight: 600; }
.board-climate-table .td-dir.dir-up { color: var(--badge-success); }
.board-climate-table .td-dir.dir-down { color: var(--badge-danger); }
.board-climate-table .td-dir.dir-flat { color: var(--ash); }
.board-climate-table .td-str.str-strong { font-weight: 700; }
.board-climate-table .td-str.str-weak { color: var(--ash); }
.board-climate-table .td-str.str-chaos { color: #e6a817; }
.board-climate-table .td-method { color: var(--ash); font-size: 11px; }
.board-climate-table .td-method::after {
  content: "?";
  display: inline-block;
  margin-left: 2px;
  width: 12px; height: 12px;
  line-height: 12px; text-align: center;
  font-size: 9px; font-weight: 700;
  color: #fff; background: var(--ash);
  border-radius: 50%;
  vertical-align: top;
  cursor: help;
}
.board-climate-table .td-num { text-align: right; }
.board-climate-table .td-num.up { color: var(--badge-danger); }
.board-climate-table .td-num.down { color: var(--badge-success); }
.board-climate-basis {
  margin-top: 8px; padding: 6px 10px;
  font-size: 12px; color: var(--ash);
  background: var(--surface-bone);
  border-radius: var(--rounded-sm);
  display: flex; flex-wrap: wrap; gap: 4px;
}
.board-climate-basis .basis-main {
  color: var(--charcoal);
  font-weight: 500;
}
.board-climate-basis .basis-meta {
  color: var(--ash);
  font-weight: 400;
}
/* 策略状态区域 */
.board-strategy-section {
  margin-top: 14px;
}
.board-section-title {
  font-size: 13px; font-weight: 700;
  margin-bottom: 8px;
  font-family: var(--font-display);
  letter-spacing: -0.2px;
}
.board-section-sub { margin-top: 12px; }
.board-text-muted { font-size: 12px; color: var(--ash); }
.board-strategy-list {
  display: flex; flex-direction: column; gap: 4px;
}
.board-strategy-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border-radius: var(--rounded-sm);
  font-size: 12px;
  flex-wrap: wrap;
}
.board-strategy-item.strategy-available { background: #e8f5e9; }
.board-strategy-item.strategy-placeholder { background: var(--surface-bone); }
.board-strategy-icon { font-size: 13px; flex-shrink: 0; }
.board-strategy-name { font-weight: 600; flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; }
.board-strategy-desc { color: var(--ash); font-size: 11px; margin-left: auto; flex-shrink: 0; }
.board-strategy-active {
  font-size: 10px; font-weight: 700;
  color: #fff; background: var(--badge-success);
  padding: 1px 4px; border-radius: 3px;
  vertical-align: middle;
  flex-shrink: 0;
}
.board-target-list {
  display: flex; flex-direction: column; gap: 4px;
}
.board-target-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  background: var(--surface-bone);
  border-radius: var(--rounded-sm);
  font-size: 12px;
  flex-wrap: wrap;
}
.board-target-name { font-weight: 600; flex-shrink: 0; max-width: 100%; }
.board-target-struct { color: var(--ash); font-size: 11px; flex-shrink: 0; }
.board-resonance-tag {
  font-size: 10px; font-weight: 700;
  color: var(--badge-success);
  background: #e8f5e9;
  padding: 1px 4px; border-radius: 3px;
  margin-left: auto;
  flex-shrink: 0;
}
.board-sector-counts {
  display: flex; gap: 10px; align-items: center;
  font-size: 13px; padding: 4px 0;
}
.board-count-item b { font-weight: 700; }
.board-count-item.count-trend { color: var(--badge-success); }
.board-count-item.count-range { color: #e8a317; }
.board-count-item.count-reverse { color: var(--badge-danger); }
.board-count-sep { color: var(--hairline); }
.board-sector-toggle {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 6px 0;
  font-size: 12px; font-weight: 600;
  color: var(--ash);
  cursor: pointer; user-select: none;
}
.board-sector-toggle:hover { color: var(--text-primary); }
.board-sector-list { margin-top: 4px; }
.board-sector-table {
  width: 100%; border-collapse: collapse;
  font-size: 10.5px; font-family: var(--font-mono);
  table-layout: fixed;
}
.board-sector-table th {
  padding: 4px 4px; text-align: left;
  font-weight: 600; color: var(--ash);
  border-bottom: 1px solid var(--hairline);
  font-size: 10px; text-transform: uppercase;
  overflow: hidden;
}
.board-sector-table td {
  padding: 4px 4px; border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-sector-table th:nth-child(1), .board-sector-table td:nth-child(1) { padding-left: 2px; }
.board-sector-table th:nth-child(2) { text-align: left; }
.board-sector-table td:nth-child(2) { text-align: left; }
.board-sector-table th:nth-child(3), .board-sector-table td:nth-child(3),
.board-sector-table th:nth-child(4), .board-sector-table td:nth-child(4) { text-align: center; width: 44px; }
.board-sector-table .struct-trend { color: var(--badge-success); font-weight: 600; }
.board-sector-table .struct-range { color: #e8a317; }
.board-sector-table .struct-reverse { color: var(--badge-danger); }
.board-sector-table .resonance-yes { color: var(--badge-success); font-weight: 600; text-align: center; }
.board-sector-table .td-num { text-align: right; color: var(--ash); }
.board-add-wrap {
  display: flex; gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.board-add-input {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-full);
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
  background: var(--surface-card);
  color: var(--ink);
  width: 140px;
}
.board-add-input:focus { border-color: var(--ink); }
.board-add-btn {
  height: 36px; padding: 0 16px;
  border: none; border-radius: var(--rounded-full);
  background: var(--primary); color: var(--on-primary);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-body);
}
.board-add-btn:hover { background: var(--primary-deep); }
.board-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
/* 看板表格横向滚动容器（窄屏启用） */
.board-table-scroll {
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
  background: var(--surface-card);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.board-table-scroll .board-table {
  border-radius: 0;
  box-shadow: none;
}
.board-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ash);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-bone);
  white-space: nowrap;
}
.board-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.board-table tr:last-child td { border-bottom: none; }
.board-table tr:hover td { background: var(--surface-bone); }
.board-table .up { color: var(--badge-danger); font-weight: 600; }
.board-table .down { color: var(--badge-success); font-weight: 600; }
.board-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--rounded-full);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.board-del-btn {
  background: none; border: 1px solid var(--hairline);
  border-radius: var(--rounded-full);
  width: 26px; height: 26px;
  font-size: 12px; cursor: pointer;
  color: var(--ash);
  display: flex; align-items: center; justify-content: center;
}
.board-del-btn:hover { background: #fef0ef; color: var(--badge-danger); border-color: var(--badge-danger); }
/* 列表风险行底色 — 轻量区分 */
.board-table tbody tr.row-triggered { background: #fef5f5; }
.board-table tbody tr.row-danger    { background: #fefaf0; }
.board-table tbody tr.row-warning   { background: #fffdf5; }

/* 旧版兼容（保留 .board-risk-item / .risk-stat 防止其它地方误用） */
.board-risk-stats {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 6px; font-size: 11px;
  color: var(--ash);
}
.risk-stat { font-weight: 600; }
.risk-stat.danger { color: var(--badge-danger); }
.risk-stat.warn { color: #e6a817; }
.board-risk-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-mono);
}
.board-risk-item:last-child { border-bottom: none; }
.board-risk-item.risk-danger { color: var(--badge-danger); font-weight: 600; }
.board-risk-item.risk-warn { color: #e6a817; }
.risk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 8px; }
.risk-pct { font-weight: 600; flex-shrink: 0; }
.board-empty {
  text-align: center; padding: 32px;
  color: var(--charcoal); font-size: 14px;
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
}

/* Board Legend */
.board-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--ash);
}
.board-legend-item {
  display: flex; align-items: center; gap: 6px;
}
.board-legend-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.board-legend-hint {
  font-size: 12px; color: var(--ash);
  margin-bottom: 8px;
  line-height: 1.6;
  padding: 8px 12px;
  background: var(--surface-bone);
  border-radius: var(--rounded-md);
}

/* Board Search with Suggestions */
.board-search-rel {
  position: relative;
  flex: 1;
  min-width: 280px;
}
.board-search-input {
  width: 100%; height: 36px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-full);
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  background: var(--surface-card);
  color: var(--ink);
}
.board-search-input:focus { border-color: var(--ink); }
.board-suggest {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  margin-top: 4px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  box-shadow: 0 8px 24px rgba(32,32,32,0.1);
  z-index: 50;
  max-height: 300px; overflow-y: auto;
}
.board-suggest-item {
  padding: 10px 14px; cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--hairline);
}
.board-suggest-item:last-child { border-bottom: none; }
.board-suggest-item:hover { background: var(--surface-bone); }
.board-sug-code { font-family: var(--font-mono); color: var(--primary); font-weight: 600; margin-right: 8px; }
.board-sug-name { color: var(--ink); font-weight: 500; }
.board-sug-market { font-size: 11px; color: var(--ash); }
.board-pending { font-style: italic; color: var(--ash); font-weight: 400; }
.board-quote-time {
  font-size: 12px; color: var(--ash);
  margin-bottom: 6px;
}

/* ========== Watch Pool（观察池，设计文档 §6） ========== */
.wp-overview {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  align-items: center;
  font-size: 13px; font-weight: 600;
  padding: 10px 14px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  margin-bottom: 6px;
}
.wp-meta {
  font-size: 12px; color: var(--ash);
  padding: 0 2px 10px;
}
.wp-sep { color: var(--hairline); }

.wp-tier-title {
  font-size: 13px; font-weight: 700;
  margin: 14px 0 8px;
  padding-left: 8px;
  border-left: 3px solid var(--primary);
}

.wp-table td { cursor: pointer; }

/* 技术状态着色 */
.wp-status-r { color: var(--green); font-weight: 600; }
.wp-status-t { color: #d4a017; font-weight: 600; }
.wp-status-l { color: var(--ash); }

/* 实时价参考（盘中副文本） */
.wp-rt { font-size: 11px; color: var(--ash); margin-left: 2px; }
.wp-rt.up { color: var(--badge-danger); }
.wp-rt.down { color: var(--badge-success); }

/* 确认位：实心=未收复，空心=已收复（价位达标≠判据满足，5.2） */
.wp-confirm-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: transparent;
  margin-right: 4px;
  vertical-align: middle;
}
.wp-confirm-dot.wp-confirm-reclaimed {
  background: var(--ink);
}

/* 标记徽章 */
.wp-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--rounded-full);
  font-size: 11px; font-weight: 700;
  color: #fff;
  margin-right: 4px;
}
.wp-badge-exit { background: #e60012; }
.wp-badge-waiver { background: #7b5cd6; }
.wp-note { color: var(--charcoal); font-size: 12px; margin-left: 2px; }

/* 行展开详情 */
.wp-detail td {
  background: var(--surface-bone);
  padding: 6px 14px;
}
.wp-detail-box { font-size: 12px; color: var(--charcoal); line-height: 1.7; }
.wp-detail-line { margin: 2px 0; }
.wp-detail-sub {
  font-size: 11px;
  color: var(--ash);
  margin: 1px 0 3px 72px;
}
.wp-detail-label {
  display: inline-block;
  min-width: 64px;
  font-weight: 600;
  color: var(--ash);
  margin-right: 8px;
}
.wp-rank { font-weight: 700; color: var(--primary); }

/* Board Alerts */
/* 告警面板 - 筛选按钮 */
.board-alert-filter {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.board-filter-btn {
  padding: 4px 12px;
  font-size: 12px; font-weight: 600;
  color: var(--ash);
  background: var(--surface-bone);
  border: 1px solid var(--hairline); border-radius: var(--rounded-sm);
  cursor: pointer; transition: all 0.15s;
}
.board-filter-btn:hover { color: var(--text-primary); border-color: var(--ash); }
.board-filter-btn.active {
  color: #fff; background: var(--text-primary); border-color: var(--text-primary);
}
/* 告警项 - 分级 */
.board-alert-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; margin-bottom: 2px;
  border-left: 3px solid var(--hairline);
  border-radius: 2px;
  font-size: 12px; background: #fff;
}
.board-alert-item.sev-critical { border-left-color: var(--badge-danger); background: #fef0ef; }
.board-alert-item.sev-warning  { border-left-color: #e6a817; background: #fff9ee; }
.board-alert-item.sev-info     { border-left-color: var(--ash); }
.board-alert-item.alert-flash  { animation: alertPulse 1.5s ease-in-out 3; }
@keyframes alertPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.board-alert-icon { flex-shrink: 0; }
.board-alert-msg { flex: 1; font-size: 12px; color: var(--ink); }
.board-alert-time { font-size: 10px; color: var(--ash); white-space: nowrap; }

/* ========== Research Page ========== */
.research-tabs {
  display: flex; gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 8px;
}
.research-tab {
  padding: 8px 20px;
  border-radius: var(--rounded-full);
  border: none; cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  background: transparent;
  color: var(--charcoal);
  transition: all 0.15s;
}
.research-tab:hover { background: var(--surface-bone); color: var(--ink); }
.research-tab.active { background: var(--ink); color: var(--on-dark); }
.research-card {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 12px;
}
#page-research .research-card { max-width: none; }
.research-card-title {
  font-size: 13px; font-weight: 600;
  margin-bottom: 12px;
  color: var(--ink);
}
.research-type-btns {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.research-type-btn {
  padding: 8px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-full);
  font-size: 13px; cursor: pointer;
  background: var(--surface-card);
  color: var(--ink);
  font-family: var(--font-body);
  transition: all 0.15s;
}
.research-type-btn:hover { border-color: var(--ink); }
.research-type-btn.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.research-strategy-options {
  display: flex; flex-direction: column; gap: 10px;
}
.research-radio {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer;
  color: var(--ink);
}
.research-radio input[type="radio"] { margin: 0; }
.research-submit-wrap {
  text-align: left;
  margin-top: 16px;
}
.research-submit-btn {
  padding: 10px 32px;
  border: none; border-radius: var(--rounded-full);
  background: var(--primary); color: var(--on-primary);
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: var(--font-body);
}
.research-submit-btn:hover { background: var(--primary-deep); }
.research-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.research-hint {
  margin-top: 8px;
  font-size: 12px; color: var(--ash);
}
.research-task-item {
  padding: 12px 16px;
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 6px;
}
.research-task-item:hover { background: var(--surface-bone); }
.research-task-row {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
}
.research-task-type {
  font-weight: 600; color: var(--ink);
  min-width: 100px;
}
.research-task-stock { color: var(--charcoal); min-width: 120px; }
.research-task-strategy { font-size: 11px; color: var(--ash); min-width: 80px; }
.research-task-date { font-size: 11px; color: var(--ash); font-family: var(--font-mono); margin-left: auto; }
.research-status { font-size: 12px; font-weight: 600; min-width: 80px; text-align: right; }
.research-status.pending { color: var(--charcoal); }
.research-status.completed { color: var(--green); }
.research-status.failed { color: var(--badge-danger); }

/* Report Overlay — Markdown 渲染内容样式 */
.research-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(32,32,32,0.6);
  z-index: 100;
  align-items: center; justify-content: center;
}
.research-overlay-content {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  width: 90%; max-width: 900px; max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(32,32,32,0.2);
}
.research-overlay-header {
  display: flex; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline);
}
.research-overlay-title {
  font-size: 15px; font-weight: 600;
  color: var(--ink);
}
.research-overlay-close {
  margin-left: auto;
  background: none; border: 1px solid var(--hairline);
  border-radius: 50%; width: 28px; height: 28px;
  cursor: pointer; font-size: 14px;
  color: var(--ash);
  display: flex; align-items: center; justify-content: center;
}
.research-overlay-close:hover { background: var(--surface-bone); }
.research-overlay-body {
  flex: 1; overflow-y: auto;
  padding: 20px;
}
.research-overlay-markdown {
  font-size: 14px; line-height: 1.7;
  color: var(--ink);
  word-break: break-word;
}
/* Markdown 内容样式 */
.research-overlay-markdown h1 { font-size: 20px; margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--hairline); }
.research-overlay-markdown h2 { font-size: 17px; margin: 18px 0 10px; }
.research-overlay-markdown h3 { font-size: 15px; margin: 16px 0 8px; }
.research-overlay-markdown p { margin: 8px 0; }
.research-overlay-markdown ul, .research-overlay-markdown ol { padding-left: 20px; margin: 8px 0; }
.research-overlay-markdown li { margin: 4px 0; }
.research-overlay-markdown table {
  width: 100%; border-collapse: collapse; margin: 12px 0;
  font-size: 13px;
}
.research-overlay-markdown th, .research-overlay-markdown td {
  padding: 8px 12px; border: 1px solid var(--hairline);
  text-align: left;
}
.research-overlay-markdown th { background: var(--surface-bone); font-weight: 600; }
.research-overlay-markdown tr:nth-child(even) td { background: var(--surface-bone); }
.research-overlay-markdown code {
  font-family: var(--font-mono); font-size: 13px;
  background: var(--surface-bone); padding: 2px 6px;
  border-radius: 3px;
}
.research-overlay-markdown pre {
  background: #1e1e1e; color: #d4d4d4;
  padding: 16px; border-radius: var(--rounded-md);
  overflow-x: auto; font-size: 13px; line-height: 1.5;
  margin: 12px 0;
}
.research-overlay-markdown pre code {
  background: none; padding: 0; font-size: 13px; color: inherit;
}
.research-overlay-markdown blockquote {
  border-left: 4px solid var(--primary);
  padding: 8px 16px; margin: 12px 0;
  background: var(--surface-bone);
  color: var(--charcoal); font-style: italic;
}
.research-overlay-markdown hr { border: none; border-top: 1px solid var(--hairline); margin: 20px 0; }
.research-overlay-markdown img { max-width: 100%; border-radius: var(--rounded-md); margin: 12px 0; }
.research-overlay-markdown strong { font-weight: 600; }
.research-overlay-share {
  margin-left: 12px;
  background: var(--primary);
  border: none;
  border-radius: var(--rounded-sm);
  padding: 5px 12px;
  font-size: 12px; font-weight: 600;
  color: #fff;
  cursor: pointer;
  font-family: var(--font-display);
}
.research-overlay-share:hover { background: var(--primary-deep); }
.research-task-summary {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ash);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ========== Research Library (研究报告库) ========== */
.library-cats {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 16px;
}
.library-cat-btn {
  padding: 6px 14px;
  font-size: 12px; font-weight: 600;
  border-radius: var(--rounded-sm);
  border: 1px solid var(--hairline);
  background: var(--surface-card);
  color: var(--charcoal);
  cursor: pointer;
  font-family: var(--font-display);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.library-cat-btn:hover { border-color: var(--primary); color: var(--primary); }
.library-cat-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.library-cat-btn.empty { display: none; }

/* ========== Notify (Toast + Modal) ========== */
.notify-stack {
  position: fixed;
  top: 56px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.notify-toast {
  position: relative;
  min-width: 220px;
  max-width: 360px;
  padding: 14px 18px 14px 42px;
  border-radius: 10px;
  background: var(--surface-card);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.1px;
  box-shadow: 0 4px 18px rgba(32,32,32,0.12), 0 0 0 1px rgba(32,32,32,0.04);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  pointer-events: auto;
}
.notify-toast-show { opacity: 1; transform: translateX(0); }
.notify-toast-hide { opacity: 0; transform: translateX(24px); }
.notify-toast::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 16px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}
.notify-toast-success::before {
  content: '✓';
  position: absolute;
  left: 14px;
  top: 13px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #16a34a11;
  color: #16a34a;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 18px;
  text-align: center;
}
.notify-toast-error::before {
  content: '×';
  position: absolute;
  left: 14px;
  top: 13px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(234,40,4,0.08);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.notify-toast-info::before {
  content: 'i';
  position: absolute;
  left: 14px;
  top: 13px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(32,32,32,0.06);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 18px;
  text-align: center;
}

.notify-modal-open { overflow: hidden; }
.notify-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(32,32,32,0.4);
  z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  animation: notifyFadeIn 0.15s ease;
}
@keyframes notifyFadeIn { from { opacity: 0; } to { opacity: 1; } }
.notify-modal {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: 0 16px 48px rgba(32,32,32,0.18);
  width: 320px;
  max-width: calc(100vw - 32px);
  padding: 24px 24px 20px;
  animation: notifySlideUp 0.18s ease;
}
@keyframes notifySlideUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.notify-modal-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
}
.notify-modal-msg {
  font-size: 13px;
  line-height: 1.6;
  color: var(--body);
  margin-bottom: 20px;
  word-break: break-word;
}
.notify-modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}
.notify-btn {
  padding: 8px 20px;
  border-radius: var(--rounded-full);
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.notify-btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(234,40,4,0.2); }
.notify-btn-ghost {
  background: transparent;
  color: var(--charcoal);
}
.notify-btn-ghost:hover { background: var(--surface-bone); color: var(--ink); }
.notify-btn-primary {
  background: var(--ink);
  color: var(--on-dark);
}
.notify-btn-primary:hover { background: #000; }
.notify-btn-danger { background: var(--primary); }
.notify-btn-danger:hover { background: var(--primary-deep); }

/* ========== 通用页面子标签 ========== */
.page-subtabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--hairline);
  margin-bottom: 16px;
}
.page-subtab {
  padding: 8px 18px;
  font-size: 13px; font-weight: 600;
  color: var(--ash);
  background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font-display);
}
.page-subtab:hover { color: var(--text-primary); }
.page-subtab.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}
.page-subpage { display: none; }
.page-subpage.active { display: block; }

/* ========== 账户页 ========== */
.account-subtabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--hairline);
  margin-bottom: 20px;
}
.account-subtab {
  padding: 8px 18px;
  font-size: 13px; font-weight: 600;
  color: var(--ash);
  background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: var(--font-display);
}
.account-subtab:hover { color: var(--text-primary); }
.account-subtab.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}
.account-subpage { display: none; }
.account-subpage.active { display: block; }

/* 账户卡片 */
.account-card {
  display: flex; align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.account-card:hover { border-color: var(--charcoal); }
.account-card.selected { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(32,32,32,0.08); }
.account-card-main { flex: 1; min-width: 0; }
.account-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.account-card-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.account-card-mid { font-size: 13px; color: var(--body); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.account-card-dot { color: var(--hairline); }
.account-card-bot { font-size: 12px; color: var(--ash); margin-top: 2px; }
.account-card-ops { display: flex; gap: 4px; flex-shrink: 0; margin-left: 12px; }

.account-type-tag {
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: var(--rounded-full);
  text-transform: uppercase;
}
.type-real { background: rgba(230,0,18,0.1); color: var(--primary); }
.type-sim { background: rgba(0,122,255,0.1); color: #007aff; }

.acct-icon-btn {
  background: none; border: 1px solid var(--hairline);
  border-radius: var(--rounded-full);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px; color: var(--ash);
  transition: all 0.15s;
}
.acct-icon-btn:hover { border-color: var(--charcoal); color: var(--ink); }
.acct-icon-del:hover { border-color: var(--primary); color: var(--primary); }

.acct-btn {
  padding: 8px 18px;
  border-radius: var(--rounded-full);
  border: none;
  font-family: var(--font-body);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.acct-btn-sm { padding: 5px 12px; font-size: 12px; }
.acct-btn-primary { background: var(--ink); color: var(--on-dark); }
.acct-btn-primary:hover { background: #000; }
.acct-btn-outline { background: transparent; border: 1px solid var(--hairline); color: var(--ink); }
.acct-btn-outline:hover { background: var(--surface-bone); }
.acct-btn-ghost { background: transparent; color: var(--charcoal); }
.acct-btn-ghost:hover { background: var(--surface-bone); color: var(--ink); }

.account-empty {
  text-align: center; padding: 32px 16px;
  font-size: 14px; color: var(--ash);
}

/* 持仓操作栏 */
.account-pos-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.account-pos-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.account-pos-actions { display: flex; gap: 6px; }

.source-tag {
  font-size: 10px; font-weight: 600;
  padding: 1px 5px; border-radius: var(--rounded-full);
}
.src-plan { background: rgba(0,122,255,0.1); color: #007aff; }
.src-manual { background: rgba(230,0,18,0.08); color: var(--primary); }
.src-unplanned { background: rgba(212,160,23,0.15); color: #d4a017; }

/* 推荐标的卡片 */
.rec-list {
  display: flex; flex-direction: column; gap: 8px;
}
.rec-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  padding: 12px 14px;
}
.rec-card-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.rec-card-sector {
  font-size: 13px; font-weight: 700; color: var(--ink);
}
.rec-card-strategy {
  font-size: 11px; font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--rounded-full);
  background: var(--surface-bone);
  color: var(--charcoal);
}
.rec-card-stock {
  font-size: 15px; font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 6px;
}
.rec-card-row {
  font-size: 12px; color: var(--charcoal);
  margin-bottom: 3px;
}
.rec-card-row .up { color: var(--badge-danger); font-weight: 600; }
.rec-card-actions {
  display: flex; gap: 6px; margin-top: 8px;
}
.rec-btn {
  padding: 5px 14px;
  border-radius: var(--rounded-full);
  border: 1px solid var(--hairline);
  background: var(--surface-card);
  font-family: var(--font-body);
  font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--charcoal);
  transition: all 0.15s;
}
.rec-btn:hover { border-color: var(--charcoal); }
.rec-btn-primary {
  background: var(--ink); color: var(--on-dark); border-color: var(--ink);
}
.rec-btn-primary:hover { background: #000; }

/* 计划书 */
.plan-group-title {
  font-size: 13px; font-weight: 700; color: var(--ink);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--hairline);
}
.plan-count { color: var(--ash); font-weight: 400; }
.plan-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-md);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.plan-card-top {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.plan-card-code { font-weight: 700; font-size: 14px; color: var(--ink); }
.plan-card-name { font-size: 13px; color: var(--body); }
.plan-card-date { font-size: 11px; color: var(--ash); margin-left: auto; }
.plan-card-detail {
  font-size: 12px; color: var(--charcoal);
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.plan-card-dot { color: var(--hairline); }
.plan-card-actions {
  display: flex; gap: 6px; margin-top: 8px;
}
.plan-grade {
  font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: var(--rounded-full);
}
.plan-grade.a { background: rgba(0,168,92,0.1); color: #00a85c; }
.plan-grade.b { background: rgba(212,160,23,0.1); color: #d4a017; }
.plan-grade.c { background: rgba(230,0,18,0.1); color: var(--primary); }
.plan-tag {
  font-size: 10px; font-weight: 600;
  padding: 1px 5px; border-radius: var(--rounded-full);
  background: var(--surface-bone); color: var(--charcoal);
}
.plan-tag-res { background: rgba(0,122,255,0.1); color: #007aff; }

/* 账户弹窗 */
.account-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(32,32,32,0.4);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  animation: notifyFadeIn 0.15s ease;
}
.account-modal {
  background: var(--surface-card);
  border-radius: var(--rounded-md);
  box-shadow: 0 16px 48px rgba(32,32,32,0.18);
  width: 400px;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 24px 20px;
  animation: notifySlideUp 0.18s ease;
}
.account-modal-title {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
}
.account-modal-body { margin-bottom: 20px; }
.account-modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}

/* 表单 */
.acct-form-group { margin-bottom: 14px; }
.acct-form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--ash); margin-bottom: 4px;
}
.acct-form-input {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--rounded-sm);
  font-family: var(--font-body); font-size: 14px;
  color: var(--ink); background: var(--canvas);
  outline: none; transition: border-color 0.15s;
  box-sizing: border-box;
}
.acct-form-input:focus { border-color: var(--ink); }
.acct-form-input::placeholder { color: var(--hairline); }
.acct-form-row { display: flex; gap: 12px; }
.acct-form-half { flex: 1; }
.acct-form-radios { display: flex; gap: 16px; }
.acct-radio {
  font-size: 13px; color: var(--body); cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}

/* 响应式 */
@media (max-width: 768px) {
  .account-card { flex-direction: column; align-items: flex-start; gap: 8px; }
  .account-card-ops { margin-left: 0; }
  .account-modal { width: calc(100vw - 24px); padding: 20px 16px; }
  .acct-form-row { flex-direction: column; gap: 0; }
}
