:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  color: #172033;
  background: #f1f4f8;
  --panel: #ffffff;
  --line: #d7dfe9;
  --muted: #667085;
  --ink: #172033;
  --accent: #176b5b;
  --accent-soft: #e8f3f0;
  --amber: #b66711;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    linear-gradient(#e9eef4 0, #f1f4f8 220px, #f1f4f8 100%);
}
.topbar, main { width: min(1280px, calc(100% - 32px)); margin: 0 auto; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 30px 0 22px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 32px; line-height: 1.15; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
.eyebrow { color: var(--amber); font-size: 12px; font-weight: 800; margin-bottom: 5px; }
.live-line {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 7px;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #20a77b;
  box-shadow: 0 0 0 4px rgba(32, 167, 123, 0.12);
}
#status, .muted { color: var(--muted); font-size: 13px; margin-top: 7px; }
button, select {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
  padding: 9px 12px;
  font: inherit;
}
button { cursor: pointer; }
.history-controls {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 5px 16px rgba(23, 32, 51, 0.06);
}
.history-controls label { display: grid; gap: 5px; }
.history-controls label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.history-controls select {
  min-width: 150px;
  padding: 8px 10px;
  font-weight: 650;
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
  margin-bottom: 22px;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #dfe5ec;
  box-shadow: 0 8px 24px rgba(33, 47, 70, 0.08);
}
.tab {
  border: 0;
  background: transparent;
  color: #647084;
  font-weight: 700;
  padding: 13px 18px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 9px;
}
.tab.active {
  background: var(--panel);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(24, 32, 51, 0.14);
}
.tab small {
  color: #8a94a5;
  font-size: 11px;
  font-weight: 600;
}
.tab.active small {
  color: #4f7f75;
}
.tab-view { display: none; }
.tab-view.active { display: block; }
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.card, .analysis-summary, .analysis-block, .recommendation {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.card {
  padding: 16px;
  box-shadow: 0 8px 22px rgba(35, 49, 74, 0.055);
  border-top: 3px solid #8fa4bb;
}
.card-head { display: flex; justify-content: space-between; gap: 10px; }
.symbol { font-size: 20px; }
.signal { color: #168a5a; font-size: 12px; font-weight: 700; }
.signal.hot { color: #cf3030; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.metric { background: #f3f6f9; padding: 10px; border-radius: 6px; }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 4px; }
.positive { color: #d63636; }
.negative { color: #168a5a; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 26px 0 12px;
}
.analysis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.analysis-summary {
  grid-column: 1 / -1;
  border-left: 5px solid var(--amber);
  padding: 17px;
  box-shadow: 0 6px 18px rgba(35, 49, 74, 0.045);
}
.analysis-summary p:last-child { color: var(--muted); margin-top: 8px; line-height: 1.55; }
.analysis-block { padding: 14px; min-height: 115px; }
.analysis-block p { color: var(--muted); font-size: 13px; line-height: 1.55; margin-top: 7px; }
.recommendation-intro {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: end;
  margin: 24px 0 16px;
  padding: 19px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
}
.recommendation-intro > p { max-width: 620px; color: var(--muted); line-height: 1.55; }
.recommendations { display: grid; gap: 12px; }
.recommendation {
  padding: 19px;
  box-shadow: 0 9px 25px rgba(35, 49, 74, 0.06);
  border-left: 4px solid #779a91;
}
.recommendation-head { display: flex; justify-content: space-between; gap: 20px; }
.recommendation h3 { font-size: 20px; }
.recommendation p { line-height: 1.5; }
.recommendation-price { font-weight: 700; }
.recommendation-time { color: var(--muted); font-size: 12px; margin-top: 8px; }
.recommendation-summary { font-size: 15px; font-weight: 600; margin-top: 10px; }
.recommendation-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.recommendation-detail { padding: 12px; background: #f3f6f8; border-radius: 6px; }
.recommendation-detail strong { font-size: 12px; }
.recommendation-detail p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.recommendation-agent {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #c7d7c9;
  border-radius: 8px;
  background: #f3f8f1;
}
.recommendation-agent p { margin: 6px 0 0; white-space: pre-wrap; }
.empty { background: var(--panel); border: 1px dashed #bfc9d7; padding: 20px; color: var(--muted); }
@media (max-width: 900px) {
  .cards, .analysis { grid-template-columns: 1fr 1fr; }
  .recommendation-details { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .cards, .analysis, .recommendation-details { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .history-controls { width: 100%; }
  .history-controls label { flex: 1; }
  .history-controls select { width: 100%; min-width: 0; }
  .tab { padding: 12px 8px; flex-direction: column; gap: 2px; }
  .recommendation-intro, .recommendation-head { align-items: flex-start; flex-direction: column; }
}

/* --- Market Overview --- */
.market-overview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: 0 8px 30px rgba(35, 49, 74, 0.07);
}
.mo-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}
.mo-header .eyebrow { margin-bottom: 0; }
.mo-bias {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}
.bias-bull { background: #fef2f2; color: #d63636; }
.bias-bear { background: #edf7f3; color: #168a5a; }
.bias-neutral { background: #eef1f6; color: #667085; }
.mo-summary {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.55;
  margin-bottom: 18px;
  color: var(--ink);
}
.mo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.mo-card {
  background: #f6f8fb;
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  padding: 16px;
}
.mo-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}
.mo-level-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 8px;
}
.risk-high { background: #fef0f0; color: #cf3030; }
.risk-mid  { background: #fff7ed; color: #b66711; }
.risk-low  { background: #edf7f3; color: #168a5a; }
.mo-direction {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.mo-detail { color: var(--muted); font-size: 13px; line-height: 1.55; margin-top: 6px; }
.mo-card-summary {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
.mo-card-detail {
  display: block;
  white-space: pre-line;
}
.mo-correlated { margin-top: 6px; }
.mo-correlated h3 { font-size: 14px; margin-bottom: 10px; }
.mo-correlated-grid { display: grid; gap: 8px; }
.mo-correlated-item {
  background: #f6f8fb;
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.mo-correlated-item strong { font-size: 14px; white-space: nowrap; }
.mo-correlated-item p { color: var(--muted); font-size: 13px; flex: 1; min-width: 200px; }
.mo-meta { margin-top: 14px; }
.hidden { display: none !important; }
@media (max-width: 900px) {
  .mo-grid { grid-template-columns: 1fr; }
  .mo-correlated-item { flex-direction: column; gap: 6px; }
}

.mo-reason { color: #9ca3af; font-size: 12px; margin-top: 4px; font-style: italic; }


/* ── News Tab ── */
.news-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 5px 16px rgba(23, 32, 51, 0.05);
}
.news-controls label { display: grid; gap: 5px; }
.news-controls label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.news-controls select {
  min-width: 150px;
  padding: 8px 10px;
  font-weight: 650;
}
.news-list { display: grid; gap: 10px; }
.news-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 5px 18px rgba(35, 49, 74, 0.05);
  transition: box-shadow 0.2s;
}
.news-card:hover { box-shadow: 0 8px 25px rgba(35, 49, 74, 0.09); }
.news-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.news-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.news-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.news-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 6px;
}
.news-title:hover { color: var(--accent); text-decoration: underline; }
.news-body {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}
.news-relevance {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-left: 3px solid var(--amber);
  background: #fff8ea;
  color: #725018;
  font-size: 12px;
  line-height: 1.55;
}
@media (max-width: 620px) {
  .news-controls { flex-direction: column; }
  .news-controls label { flex: 1; }
  .news-controls select { width: 100%; min-width: 0; }
}
