/* AIStockAssist · 抄 Mock v4 视觉 · 红涨绿跌 + 蓝 banner + tabs + 表格 */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f8f9fb;
  color: #222;
  line-height: 1.5;
  font-size: 14px;
}
.container { max-width: 1400px; margin: 0 auto; padding: 16px 24px 40px; }

/* topbar · 紧凑系统功能条 · 合并原 banner + scan-status + toolbar-right
   两栏 grid：左栏弹性可缩（内容长时自己换行），右栏固定贴右（永远不下移）
*/
.topbar {
  background: linear-gradient(135deg, #1e3a8a 0%, #312e81 100%);
  color: white;
  padding: 10px 18px;
  border-radius: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.topbar .tb-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}
.topbar .tb-brand { font-weight: 700; font-size: 14px; white-space: nowrap; }
.topbar .tb-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.25);
}
.topbar .tb-clock { display: flex; align-items: baseline; gap: 8px; }
.topbar .tb-time {
  font-family: "SF Mono", "Menlo", "Monaco", monospace;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fbbf24;
}
.topbar .tb-date { font-size: 12px; opacity: 0.85; }
.topbar .tb-status { font-size: 12px; opacity: 0.92; }
.topbar .tb-status .ss-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
  vertical-align: 1px;
}
.topbar .ss-tag-wait { background: #fef3c7; color: #b45309; }
.topbar .ss-tag-running { background: #dbeafe; color: #1e40af; }
.topbar .ss-tag-done { background: #d1fae5; color: #065f46; }
.topbar .ss-tag-failed { background: #fee2e2; color: #991b1b; }
.topbar .ss-tag-idle { background: rgba(255,255,255,0.18); color: #fff; }
.topbar .ss-tag-stale { background: #fed7aa; color: #9a3412; }

.topbar .tb-right { display: flex; align-items: center; gap: 8px; }
.topbar .tb-btn {
  padding: 5px 12px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.12s;
}
.topbar .tb-btn:hover { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.5); }
.topbar .tb-btn-primary {
  background: #fbbf24;
  color: #1e3a8a;
  border-color: #fbbf24;
  font-weight: 600;
}
.topbar .tb-btn-primary:hover { background: #f59e0b; border-color: #f59e0b; }
.topbar .tb-user {
  font-size: 12px;
  opacity: 0.92;
  margin: 0 4px;
  padding-left: 8px;
  border-left: 1px solid rgba(255,255,255,0.25);
}

/* 触发日 / run 元信息 · 替代旧 banner.sub */
.report-meta {
  font-size: 12px;
  color: #6b7280;
  padding: 0 4px;
  margin-bottom: 10px;
}

/* 扫描进度条 · 独立 · 仅扫描进行中显示 */
.ss-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 14px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-left: 3px solid #6366f1;
}
.ss-progress-bar {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}
.ss-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #1e3a8a 100%);
  width: 0;
  transition: width 0.4s ease;
}
.ss-progress-fill.over {
  background: linear-gradient(90deg, #f59e0b 0%, #b45309 100%);
}
.ss-progress-label {
  font-size: 12px;
  color: #4b5563;
  font-family: "SF Mono", monospace;
  white-space: nowrap;
}

/* market alert */
.market-alert {
  padding: 14px 22px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  font-weight: 500;
}
.market-alert.danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-left: 5px solid #dc2626;
  color: #991b1b;
}
.market-alert.normal {
  background: #f0fdf4;
  border-left: 5px solid #10b981;
  color: #166534;
}
.market-alert.warn_down {
  background: #f0f9ff;
  border-left: 5px solid #6366f1;
  color: #1e40af;
}
.market-alert.unavailable {
  background: #f9fafb;
  border-left: 5px solid #9ca3af;
  color: #4b5563;
}
.market-alert .ma-icon { font-size: 24px; }
.market-alert .ma-content { flex: 1; }
.market-alert .ma-title { font-weight: 700; margin-bottom: 2px; font-size: 15px; }
.market-alert .ma-detail { font-size: 12px; opacity: 0.85; }
.market-alert .ma-pct {
  background: rgba(255,255,255,0.6);
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-family: "SF Mono", monospace;
}
.market-alert.danger .ma-pct { color: #dc2626; background: white; }
.market-alert.warn_down .ma-pct { color: #10b981; background: white; }
/* A 股惯例 · ma-pct 内涨跌数字本身永远按数值定色（盖卡片继承色）*/
.market-alert .ma-pct.pct-up { color: #dc2626 !important; background: white; }
.market-alert .ma-pct.pct-down { color: #10b981 !important; background: white; }
.market-alert .ma-pct.pct-flat { color: #6b7280 !important; background: rgba(255,255,255,0.6); }

/* 综合评分横幅 · 单条 · 替代原 stats-bar（方案 A）*/
.summary-banner {
  background: white;
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  border-left: 4px solid #1e3a8a;
  font-size: 14px;
}
.summary-banner .sb-label { font-weight: 600; color: #1e3a8a; }
.summary-banner .sb-item { color: #4b5563; font-size: 13px; }
.summary-banner .sb-item strong { font-size: 18px; margin: 0 4px; font-weight: 700; }
.summary-banner .sb-r3 strong { color: #dc2626; }
.summary-banner .sb-r2 strong { color: #ea580c; }
.summary-banner .sb-r1 strong { color: #ca8a04; }
.summary-banner .sb-r0 strong { color: #6b7280; }

/* toolbar · 已删除右侧系统功能（搬到 topbar）· 仅留日期 chips + 推荐日记 */
.toolbar {
  display: flex;
  align-items: center;
  background: white;
  padding: 10px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  flex-wrap: wrap;
  gap: 12px;
}
.toolbar-left { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tool-btn {
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  font-family: inherit;
  transition: all 0.15s;
}
.tool-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.tool-btn.primary {
  background: #1e3a8a;
  color: white;
  border-color: #1e3a8a;
  font-weight: 600;
}
.tool-btn.primary:hover { background: #1e40af; }

/* 日期 chips · 近交易日快速选 · 老日期回退原生日历 */
.date-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}
.date-chips-label { color: #6b7280; font-size: 12px; font-weight: 500; }
.date-chips-list { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.date-chip {
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: white;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  color: #4b5563;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.12s;
}
.date-chip:hover { border-color: #1e3a8a; color: #1e3a8a; }
.date-chip.active {
  background: #1e3a8a;
  color: white;
  border-color: #1e3a8a;
  font-weight: 600;
}
.date-chip .chip-badge {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  border-radius: 8px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
}
.date-chip.active .chip-badge { background: rgba(255,255,255,0.25); color: white; }
.date-chip.today { border-color: #6366f1; }
.date-chips-more { font-size: 12px; padding: 5px 10px; }
.date-picker-hidden { display: none; }
.date-picker-hidden.show {
  display: inline-block;
  border: 1px solid #1e3a8a;
  border-radius: 4px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12px;
  background: white;
  color: #1e3a8a;
  font-weight: 600;
}
.chip-loading { font-size: 12px; color: #9ca3af; }

/* tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 0; border-bottom: 2px solid #e5e7eb; }
.tab {
  padding: 10px 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
}
.tab:hover { color: #1e3a8a; }
.tab.active {
  color: #1e3a8a;
  border-bottom-color: #1e3a8a;
  background: rgba(30, 58, 138, 0.04);
}
.tab .count {
  display: inline-block;
  background: #6366f1;
  color: white;
  border-radius: 10px;
  padding: 1px 9px;
  margin-left: 6px;
  font-size: 11px;
}
.tab.active .count { background: #1e3a8a; }
.tab-summary {
  background: #f3f4f6;
  padding: 12px 18px;
  font-size: 13px;
  color: #374151;
  border-left: 3px solid #6366f1;
}

/* panel + table */
.panel {
  background: white;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  margin-bottom: 26px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: none;
}
.panel.active { display: block; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: #f9fafb; }
th {
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  color: #4b5563;
  font-size: 12px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}
th.num, td.num { text-align: right; }
th.center, td.center { text-align: center; }
td {
  padding: 11px 8px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
tr:hover { background: #fafbfd; }
tr.cand-row { cursor: pointer; }
tr.cand-row.expanded { background: #f0f9ff; }
tr.cand-row .expand-hint {
  color: #9ca3af;
  font-size: 10px;
  margin-left: 4px;
  transition: transform 0.15s;
  display: inline-block;
}
tr.cand-row.expanded .expand-hint {
  transform: rotate(180deg);
  color: #1e3a8a;
}
tr.cand-detail { background: #f0f9ff; }
tr.cand-detail td { padding: 14px 18px; border-top: 1px solid #dbeafe; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.detail-block {
  background: white;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.7;
  color: #374151;
}
.detail-block .detail-label {
  color: #6b7280;
  font-weight: 600;
  font-size: 11px;
  margin-bottom: 5px;
}
.detail-block strong { color: #1e3a8a; }
.detail-note {
  margin-top: 4px;
  font-size: 11px;
  color: #9ca3af;
  font-style: italic;
}

/* 涨跌颜色 · A 股惯例 红涨绿跌 */
.pct-up { color: #dc2626; font-weight: 600; }
.pct-down { color: #10b981; font-weight: 600; }
.pct-flat { color: #888; }

.code-cell { font-family: "SF Mono", "Monaco", monospace; color: #4b5563; }
.name-cell { font-weight: 500; }
.xg-badge {
  display: inline-block;
  background: #fef3c7;
  color: #b45309;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  margin-left: 4px;
}

/* 推荐等级 */
.rec {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.rec.r3 { background: #fef2f2; color: #dc2626; }
.rec.r2 { background: #fff7ed; color: #ea580c; }
.rec.r1 { background: #fefce8; color: #ca8a04; }
.rec.r0 { background: #f3f4f6; color: #6b7280; }

/* 综合分 bar */
.score-bar {
  display: inline-block;
  width: 70px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
  position: relative;
  overflow: hidden;
}
.score-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #1e3a8a 100%);
}
.score-val { font-weight: 600; color: #1e3a8a; }

/* 触发指标 badge */
.trig-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.trig-badge.t-x { background: #ecfeff; color: #0891b2; }
.trig-badge.t-ggg { background: #fef3c7; color: #b45309; }
.trig-badge.t-xuangu { background: #f0fdf4; color: #15803d; }

/* 推荐日记面板 */
.diary-panel {
  display: none;
  background: white;
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-left: 4px solid #6366f1;
}
.diary-panel.show { display: block; }
.diary-header h3 { margin: 0 0 10px 0; font-size: 15px; color: #374151; }
.diary-hint {
  background: #f0f9ff;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: #1e40af;
  margin: 10px 0 14px;
}
.diary-table { font-size: 12px; }
.diary-table th { padding: 7px 8px; font-size: 11px; }
.diary-table td { padding: 8px; }
.diary-pending { color: #9ca3af; font-style: italic; font-size: 11px; }
.btn-mini {
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid #d1d5db;
  background: white;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  color: #6b7280;
}
.btn-mini:hover { background: #1e3a8a; color: white; border-color: #1e3a8a; }
.btn-mini.marked { background: #1e3a8a; color: white; border-color: #1e3a8a; }

/* modal · 用户改密等通用 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: white;
  border-radius: 8px;
  padding: 24px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.modal h3 { margin: 0 0 12px 0; font-size: 16px; color: #1e3a8a; }
.modal label {
  display: block;
  font-size: 12px;
  color: #4b5563;
  margin: 10px 0 4px;
}
.modal input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
}
.modal input:focus { outline: none; border-color: #1e3a8a; }
.modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.modal .err {
  margin-top: 8px;
  padding: 6px 10px;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 4px;
  font-size: 12px;
  display: none;
}
.modal .err.show { display: block; }
.modal .btn {
  padding: 7px 14px;
  border-radius: 5px;
  border: 1px solid #d1d5db;
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: #4b5563;
}
.modal .btn:hover { background: #f9fafb; border-color: #9ca3af; }
.modal .btn.btn-primary {
  background: #1e3a8a;
  color: white;
  border-color: #1e3a8a;
  font-weight: 600;
}
.modal .btn.btn-primary:hover { background: #1e40af; }

/* toast 通用 */
.toast {
  position: fixed;
  top: 70px;
  right: 24px;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  z-index: 200;
  display: none;
}
.toast.show { display: block; }
.toast.success { background: #065f46; color: white; }
.toast.error { background: #991b1b; color: white; }

/* footer */
.footer-note {
  margin-top: 30px;
  padding: 16px 20px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 12px;
  color: #7c2d12;
}

.footer-disclaimer {
  margin-top: 40px;
  padding: 20px 24px;
  background: #f9fafb;
  border-top: 3px solid #e5e7eb;
  border-radius: 0;
  font-size: 12px;
  color: #4b5563;
  line-height: 1.7;
}
.footer-disclaimer p { margin: 0 0 10px 0; }
.footer-disclaimer p:last-child { margin-bottom: 0; }
.footer-disclaimer strong { color: #1f2937; }
.footer-disclaimer .footer-meta {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #d1d5db;
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
}

/* ============ login.html ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #312e81 100%);
}
.login-card {
  background: white;
  padding: 36px 40px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 360px;
}
.login-card h1 {
  margin: 0 0 6px 0;
  font-size: 18px;
  color: #1e3a8a;
}
.login-card .sub { font-size: 12px; color: #6b7280; margin-bottom: 24px; }
.login-card label { display: block; font-size: 12px; color: #4b5563; margin: 12px 0 4px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.login-card input:focus { outline: none; border-color: #1e3a8a; }
.login-card button {
  width: 100%;
  margin-top: 20px;
  padding: 11px;
  background: #1e3a8a;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.login-card button:hover { background: #1e40af; }
.login-err {
  margin-top: 12px;
  padding: 8px 12px;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 4px;
  font-size: 12px;
  display: none;
}
.login-err.show { display: block; }
