:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #172026;
  --muted: #65717c;
  --line: #dfe5ea;
  --line-strong: #c9d2d9;
  --red: #b4101d;
  --red-soft: #fff0f1;
  --teal: #008f8a;
  --teal-soft: #e8f7f5;
  --amber: #a15c00;
  --amber-soft: #fff4df;
  --shadow: 0 18px 50px rgba(23, 32, 38, 0.09);
  --radius: 8px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  background: #151b20;
  color: #f8fafc;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 17px;
  line-height: 1.35;
}

.brand span:not(.brand-mark) {
  margin-top: 2px;
  color: #aab5bd;
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #b9c4cc;
  text-align: left;
  font-size: 14px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.source-block {
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.source-block h2 {
  margin: 0 0 12px;
  color: #eef2f5;
  font-size: 13px;
  font-weight: 700;
}

.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-list span {
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #d6dee4;
  font-size: 12px;
}

.source-block p {
  margin: 0;
  color: #aab5bd;
  font-size: 13px;
  line-height: 1.65;
}

.playbook-list {
  display: grid;
  gap: 8px;
}

.playbook-list span {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: #d6dee4;
  font-size: 12px;
}

.playbook-list small {
  color: #93a0aa;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.12;
  font-weight: 820;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.data-pill {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.data-pill.warning {
  border-color: rgba(180, 16, 29, 0.2);
  background: var(--red-soft);
  color: var(--red);
  font-weight: 800;
}

.data-pill.verified {
  border-color: rgba(0, 143, 138, 0.24);
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
}

.data-disclaimer {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 143, 138, 0.22);
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: #075956;
  font-size: 13px;
  line-height: 1.6;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.icon-button svg,
.search-field svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 176px 176px 160px;
  gap: 12px;
  margin-bottom: 12px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.search-field input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 14px;
}

select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.segmented-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.segmented button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.segmented button.active {
  background: #1d252c;
  color: #fff;
}

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

.metric {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.metric p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.daily-log {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(0, 143, 138, 0.24);
  border-radius: var(--radius);
  background: var(--teal-soft);
}

.daily-log strong {
  font-size: 14px;
}

.daily-log p {
  margin: 4px 0 0;
  color: #366762;
  font-size: 13px;
  line-height: 1.6;
}

.daily-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 50%;
}

.daily-chips span {
  padding: 6px 8px;
  border-radius: 999px;
  background: #fff;
  color: #075956;
  font-size: 12px;
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.freshness {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.deal-table {
  display: grid;
}

.deal-row {
  width: 100%;
  display: grid;
  grid-template-columns: 54px minmax(180px, 1.3fr) 92px 88px minmax(140px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.deal-row:last-child {
  border-bottom: 0;
}

.deal-row:hover,
.deal-row.selected {
  background: #fbfcfd;
}

.deal-row.selected {
  box-shadow: inset 3px 0 0 var(--red);
}

.rank {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--red-soft);
  color: var(--red);
  font-size: 14px;
  font-weight: 800;
}

.deal-main strong,
.deal-main small {
  display: block;
}

.deal-main strong {
  font-size: 15px;
}

.deal-main small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.tag,
.fit,
.investors {
  font-size: 12px;
}

.tag {
  justify-self: start;
  padding: 6px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.tag.high {
  background: var(--red-soft);
  color: var(--red);
}

.tag.medium {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.low {
  background: var(--teal-soft);
  color: var(--teal);
}

.fit,
.investors {
  color: var(--muted);
}

.detail-panel {
  position: sticky;
  top: 18px;
  padding: 18px;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.detail-label {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.detail-top h2 {
  margin-top: 6px;
  font-size: 26px;
}

.detail-top p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.source-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.source-link:hover {
  text-decoration: underline;
}

.score-ring {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 6px solid var(--red-soft);
  border-radius: 50%;
  color: var(--red);
  font-size: 18px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.detail-tags span {
  padding: 7px 9px;
  border-radius: 999px;
  background: #eef3f6;
  color: #36434d;
  font-size: 12px;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.detail-list div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
}

.detail-list dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.judgment {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.judgment + .judgment {
  margin-top: 10px;
}

.judgment h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.judgment p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.judgment .stacked-text {
  margin-top: 8px;
}

.judgment.accent {
  border-color: rgba(0, 143, 138, 0.28);
  background: var(--teal-soft);
}

.judgment.subtle {
  background: #fff;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

@media (max-width: 1080px) {
  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 18px;
  }

  .side-nav,
  .source-block.compact {
    display: none;
  }

  .source-list {
    max-height: 76px;
    overflow: hidden;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .filters,
  .daily-log {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .daily-log {
    display: grid;
  }

  .daily-chips {
    justify-content: flex-start;
    max-width: none;
  }

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

  .deal-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
  }

  .deal-row .tag,
  .deal-row .fit,
  .deal-row .investors {
    grid-column: 2;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .segmented button {
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .detail-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
