:root {
  color-scheme: light;
  --bg: #eef0ec;
  --surface: #fbfaf6;
  --surface-strong: #ffffff;
  --ink: #161a1d;
  --muted: #687076;
  --line: #d8ddd5;
  --green: #176b4d;
  --cyan: #1f6f8b;
  --amber: #a86c10;
  --red: #b23b3b;
  --blue: #305d7c;
  --shadow: 0 18px 45px rgba(30, 40, 33, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(23, 107, 77, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(168, 108, 16, 0.08), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: rgba(251, 250, 246, 0.88);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--green), var(--cyan) 54%, var(--amber));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.52);
}

.brand h1,
.brand p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
  letter-spacing: 0;
}

.brand p {
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 36px;
}

.nav-list a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

.nav-list a.active,
.nav-list a:hover {
  color: var(--ink);
  background: #e7ece5;
}

.method-box {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.method-box span,
.method-box p {
  color: var(--muted);
}

.method-box strong {
  display: block;
  margin-top: 4px;
  font-size: 28px;
}

.method-box p {
  margin: 8px 0 0;
  font-size: 12px;
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 8px 0 2px;
}

.eyebrow {
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.topbar h2 {
  margin-top: 6px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.14;
  letter-spacing: 0;
}

.topbar-actions,
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.text-button,
select {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  border-radius: 8px;
  min-height: 38px;
}

.icon-button {
  width: 38px;
  font-size: 18px;
  cursor: pointer;
}

.text-button {
  padding: 0 14px;
  cursor: pointer;
}

select {
  padding: 0 28px 0 10px;
  max-width: 160px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-card,
.panel,
.opportunity-item,
.evidence-card,
.chain-stage {
  background: rgba(251, 250, 246, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 16px;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 30px;
}

.metric-card.warning strong {
  color: var(--red);
}

.panel {
  padding: 18px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-title.compact {
  align-items: center;
}

.section-title p {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.opportunity-list,
.heatmap,
.evidence-grid,
.weekly-grid,
.selection-grid {
  display: grid;
  gap: 10px;
}

.opportunity-item {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  box-shadow: none;
}

.opportunity-item h3,
.opportunity-item p {
  margin: 0;
}

.opportunity-item h3 {
  font-size: 15px;
}

.opportunity-item p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.rank-pill,
.rating-pill,
.source-pill,
.risk-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.rank-pill {
  background: #e3eee7;
  color: var(--green);
}

.rating-strong {
  background: #dff0e8;
  color: var(--green);
}

.rating-buy {
  background: #e7f0f5;
  color: var(--cyan);
}

.rating-watch {
  background: #f6ecd6;
  color: var(--amber);
}

.rating-avoid,
.rating-sell {
  background: #f5e3df;
  color: var(--red);
}

.heat-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 10px;
}

.heat-label {
  font-weight: 700;
}

.heat-bar {
  height: 12px;
  border-radius: 999px;
  background: #dde4dc;
  overflow: hidden;
}

.heat-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--amber));
}

.heat-score {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chain-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.chain-stage {
  min-height: 132px;
  padding: 14px;
  box-shadow: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease;
}

.chain-stage:hover {
  transform: translateY(-2px);
  border-color: rgba(23, 107, 77, 0.45);
}

.chain-stage h3,
.chain-stage p {
  margin: 0;
}

.chain-stage h3 {
  font-size: 15px;
}

.chain-stage p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.chain-stage .stage-meta {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.selection-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.selection-card {
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.selection-card h3,
.selection-card p {
  margin: 0;
}

.selection-card h3 {
  font-size: 15px;
}

.selection-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.style-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef3ea;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  background: #f3f4ef;
}

td {
  font-size: 13px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.company-name {
  font-weight: 800;
}

.ticker {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.score {
  font-weight: 900;
  color: var(--green);
}

.evidence-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.evidence-card {
  padding: 14px;
  box-shadow: none;
}

.evidence-card h3 {
  margin: 10px 0 8px;
  font-size: 15px;
}

.evidence-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.source-pill.s {
  background: #e0eee7;
  color: var(--green);
}

.source-pill.a {
  background: #e6eef4;
  color: var(--cyan);
}

.source-pill.b,
.source-pill.c {
  background: #f5ead5;
  color: var(--amber);
}

.weekly-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.weekly-grid article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.weekly-grid h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.weekly-grid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.weekly-grid li + li {
  margin-top: 8px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px;
  }

  .nav-list {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
  }

  .method-box {
    position: static;
    margin-left: auto;
    max-width: 230px;
  }

  .two-column,
  .weekly-grid,
  .evidence-grid,
  .selection-grid {
    grid-template-columns: 1fr;
  }

  .chain-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 16px;
  }

  .topbar,
  .section-title.compact,
  .sidebar {
    align-items: stretch;
    flex-direction: column;
  }

  .method-box {
    max-width: none;
    margin-left: 0;
  }

  .metric-grid,
  .chain-map {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-wrap: wrap;
  }

  select {
    max-width: none;
    flex: 1 1 140px;
  }
}
