:root {
  color-scheme: light;
  --ink: #15191f;
  --muted: #68707c;
  --soft: #f4f6f8;
  --panel: #ffffff;
  --line: #d9dee5;
  --line-strong: #b9c1cb;
  --green: #087f5b;
  --green-soft: #e7f5ef;
  --blue: #2463a7;
  --blue-soft: #eaf2fb;
  --amber: #9a6700;
  --amber-soft: #fff4d6;
  --red: #b42318;
  --red-soft: #fcebea;
  --charcoal: #252b33;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: #f7f8fa;
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.shell {
  width: min(1440px, calc(100vw - 40px));
  margin: 0 auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
}

.header-row {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(300px, 1fr);
  align-items: center;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--charcoal);
  color: #fff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}
.brand h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.product-nav {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px;
  background: var(--soft);
}
.product-nav a {
  padding: 7px 13px;
  border-radius: 5px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}
.product-nav a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08); }

.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.run-picker {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}
.run-picker select { max-width: 170px; border: 0; outline: 0; background: transparent; color: var(--ink); font-weight: 700; }
.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.icon-button:hover { border-color: var(--line-strong); background: var(--soft); }
.icon-button.loading span { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-band { background: #fff; border-bottom: 1px solid var(--line); }
.status-grid { min-height: 62px; display: grid; grid-template-columns: repeat(4, 1fr); }
.status-item { padding: 11px 18px; border-left: 1px solid var(--line); }
.status-item:last-child { border-right: 1px solid var(--line); }
.status-item span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.status-item strong { display: block; font-size: 14px; }

.main-shell { padding: 22px 0 38px; }
.notice { margin-bottom: 14px; padding: 11px 14px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #604100; }
.hidden { display: none !important; }

.daily-brief {
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 8px 2px 20px;
  border-bottom: 1px solid var(--line);
}
.brief-copy { max-width: 980px; }
.eyebrow, .section-kicker { color: var(--green); font-size: 11px; font-weight: 800; }
.daily-brief h2 { margin: 8px 0 7px; font-size: 26px; line-height: 1.35; }
.daily-brief p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.brief-count { min-width: 130px; padding-left: 28px; border-left: 1px solid var(--line); text-align: center; }
.brief-count strong { display: block; font-size: 34px; line-height: 1; }
.brief-count span { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }

.monitor-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 610px;
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.watchlist { min-width: 0; border-right: 1px solid var(--line); background: #fbfcfd; }
.section-head { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.section-head h3 { margin: 4px 0 0; font-size: 16px; }
.count-badge { min-width: 28px; height: 24px; display: grid; place-items: center; padding: 0 8px; border-radius: 12px; background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 800; }
.watchlist-items { max-height: 720px; overflow: auto; }
.watch-row {
  width: 100%;
  min-height: 92px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 14px 15px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.watch-row:hover { background: #f2f5f7; }
.watch-row.active { background: var(--green-soft); box-shadow: inset 3px 0 var(--green); }
.watch-row > span:nth-child(2) { min-width: 0; overflow: hidden; }
.watch-rank { color: var(--muted); font-size: 12px; font-weight: 800; text-align: center; }
.watch-symbol { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.watch-symbol strong { font-size: 17px; }
.watch-symbol span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.watch-side { margin-top: 6px; overflow: hidden; color: #3e4650; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.watch-score { text-align: right; }
.watch-score strong { display: block; font-size: 16px; }
.watch-score span { display: block; margin-top: 5px; font-size: 11px; }

.state-label { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; }
.state-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.state-action { color: var(--green); }
.state-action::before { background: var(--green); }
.state-watch { color: var(--amber); }
.state-watch::before { background: var(--amber); }
.state-pass { color: var(--red); }
.state-pass::before { background: var(--red); }
.state-pending { color: var(--muted); }

.opportunity-detail { min-width: 0; padding: 0 26px 28px; }
.detail-head { min-height: 96px; display: flex; justify-content: space-between; align-items: center; gap: 22px; border-bottom: 1px solid var(--line); }
.detail-title { min-width: 0; }
.detail-symbol-row { display: flex; align-items: center; gap: 10px; }
.detail-symbol-row h3 { margin: 0; font-size: 23px; }
.sector-label { padding: 3px 7px; border-radius: 4px; background: var(--soft); color: var(--muted); font-size: 11px; }
.detail-title p { margin: 7px 0 0; color: var(--muted); }
.score-block { text-align: right; }
.score-block strong { display: block; font-size: 25px; }
.score-block span { color: var(--muted); font-size: 11px; }

.agent-verdict { margin: 22px 0 0; padding: 16px 18px; border-left: 4px solid var(--green); background: var(--green-soft); }
.agent-verdict.pending { border-left-color: var(--blue); background: var(--blue-soft); }
.verdict-top { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 9px; }
.verdict-top strong { font-size: 15px; }
.agent-verdict p { margin: 0; line-height: 1.75; }

.evidence-grid { display: grid; grid-template-columns: 1fr 1fr 1.15fr; margin-top: 22px; border: 1px solid var(--line); }
.evidence-cell { min-width: 0; min-height: 142px; padding: 16px; border-right: 1px solid var(--line); }
.evidence-cell:last-child { border-right: 0; }
.evidence-cell h4, .analysis-section h4 { margin: 0 0 14px; color: var(--muted); font-size: 11px; font-weight: 800; }
.metric-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.metric-row strong { font-size: 21px; }
.metric-row span { color: var(--muted); font-size: 11px; }
.percent-track { position: relative; height: 8px; margin: 17px 0 9px; background: #e5e9ee; border-radius: 4px; overflow: hidden; }
.percent-fill { height: 100%; background: var(--green); border-radius: 4px; }
.percent-fill.blue { background: var(--blue); }
.percent-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.backtest-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.backtest-item span { display: block; color: var(--muted); font-size: 10px; }
.backtest-item strong { display: block; margin-top: 6px; font-size: 16px; }
.backtest-period { margin-top: 15px; color: var(--muted); font-size: 11px; }

.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin-top: 24px; }
.analysis-section { min-width: 0; padding: 18px 0; border-top: 1px solid var(--line); }
.analysis-section.full { grid-column: 1 / -1; }
.evidence-list { margin: 0; padding: 0; list-style: none; }
.evidence-list li { position: relative; margin: 0 0 9px; padding-left: 14px; line-height: 1.65; }
.evidence-list li::before { content: ""; position: absolute; left: 0; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.evidence-list.risk li::before { background: var(--red); }
.muted-copy { margin: 0; color: var(--muted); line-height: 1.7; }
.source-link { color: var(--blue); text-decoration: none; }
.source-link:hover { text-decoration: underline; }

.data-date-strip { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.date-item { padding: 12px 10px; border-right: 1px solid var(--line); }
.date-item:last-child { border-right: 0; }
.date-item span { display: block; color: var(--muted); font-size: 10px; }
.date-item strong { display: block; margin-top: 5px; font-size: 12px; }

.decision-bar { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.decision-row { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; align-items: center; gap: 14px; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); }
.segmented button { border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; }
.segmented:not(.compact) button { min-width: 72px; padding: 8px 12px; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1); }
.decision-note { width: 100%; height: 38px; padding: 8px 10px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; outline: 0; }
.decision-note:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(8, 127, 91, 0.1); }
.save-button { height: 38px; padding: 0 16px; border: 1px solid var(--green); border-radius: 6px; background: var(--green); color: #fff; cursor: pointer; font-weight: 800; }
.save-button:hover { background: #066b4d; }

.empty-state { min-height: 500px; display: grid; place-content: center; gap: 8px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); font-size: 17px; }

.operations { margin-top: 20px; border-top: 1px solid var(--line); }
.operations-tabs { display: flex; gap: 22px; min-height: 54px; align-items: flex-end; border-bottom: 1px solid var(--line); }
.ops-tab { height: 54px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-weight: 800; }
.ops-tab.active { border-bottom-color: var(--ink); color: var(--ink); }
.operations-panel { padding-top: 18px; }
.ops-summary { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 14px; }
.summary-chip span { color: var(--muted); font-size: 11px; }
.summary-chip strong { margin-left: 7px; font-size: 13px; }
.health-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.segmented.compact button { padding: 6px 10px; font-size: 11px; }

.table-scroll { overflow: auto; border: 1px solid var(--line); background: #fff; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.data-table th { position: sticky; top: 0; z-index: 1; background: #f1f3f5; color: #4c5561; font-size: 11px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f8fafb; }
.health-state { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
.health-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.health-state.warning::before { background: var(--amber); }
.health-state.stale::before { background: var(--red); }
.health-state.unknown::before { background: var(--muted); }
.warning-copy { max-width: 390px; overflow: hidden; text-overflow: ellipsis; }
.history-table tbody tr { cursor: pointer; }
.history-table tbody tr.current { background: var(--green-soft); }

.report-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.report-head span { font-weight: 800; }
.report-head a { color: var(--blue); font-size: 12px; text-decoration: none; }
.report-text { max-height: 620px; margin: 0; padding: 18px; overflow: auto; border: 1px solid var(--line); background: #fff; color: #303743; font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif; font-size: 12px; line-height: 1.75; white-space: pre-wrap; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 40; max-width: 320px; padding: 11px 14px; border-radius: 6px; background: var(--charcoal); color: #fff; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2); }

@media (max-width: 1050px) {
  .header-row { grid-template-columns: 1fr auto; }
  .product-nav { display: none; }
  .monitor-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .evidence-grid { grid-template-columns: 1fr 1fr; }
  .evidence-cell:nth-child(2) { border-right: 0; }
  .evidence-cell:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .decision-row { grid-template-columns: 1fr auto; }
  .decision-note { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 1440px); }
  .header-row { min-height: 62px; grid-template-columns: 1fr auto; gap: 8px; }
  .brand p, .run-picker span { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .brand h1 { font-size: 17px; }
  .run-picker { max-width: 150px; padding: 0 6px; }
  .run-picker select { max-width: 128px; }
  .status-grid { grid-template-columns: 1fr 1fr; }
  .status-item:nth-child(2) { border-right: 1px solid var(--line); }
  .status-item:nth-child(n+3) { border-top: 1px solid var(--line); }
  .main-shell { padding-top: 14px; }
  .daily-brief { min-height: 104px; gap: 12px; }
  .daily-brief h2 { font-size: 20px; }
  .brief-count { min-width: 82px; padding-left: 14px; }
  .brief-count strong { font-size: 28px; }
  .monitor-layout { display: block; min-height: 0; }
  .watchlist { border-right: 0; border-bottom: 1px solid var(--line); }
  .watchlist-items { display: flex; max-height: none; overflow-x: auto; }
  .watch-row { min-width: 265px; border-right: 1px solid var(--line); }
  .opportunity-detail { padding: 0 16px 22px; }
  .detail-head { min-height: 86px; }
  .detail-symbol-row h3 { font-size: 20px; }
  .evidence-grid { grid-template-columns: 1fr; }
  .evidence-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .evidence-cell:last-child { grid-column: auto; border-top: 0; border-bottom: 0; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-section.full { grid-column: auto; }
  .data-date-strip { grid-template-columns: repeat(2, 1fr); }
  .date-item { border-bottom: 1px solid var(--line); }
  .decision-row { grid-template-columns: 1fr; }
  .decision-note { grid-column: auto; grid-row: auto; }
  .save-button { width: 100%; }
  .operations-tabs { gap: 16px; overflow-x: auto; }
  .toast { right: 12px; bottom: 12px; left: 12px; max-width: none; }
}
