:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #fffdf8;
  --ink: #171717;
  --muted: #67645e;
  --line: #dfd8ca;
  --accent: #157a6e;
  --accent-soft: #d9eee9;
  --danger: #b64235;
  --good: #116c3f;
  --flat: #a36a00;
  --flat-soft: #fff1bf;
  --shadow: 0 18px 60px rgba(30, 27, 21, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 22px clamp(18px, 4vw, 56px);
  background: rgba(247, 244, 238, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 0.98;
  font-weight: 760;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status {
  min-width: 220px;
  text-align: right;
}

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

.status span {
  color: var(--muted);
  font-size: 12px;
}

.status strong {
  margin-top: 4px;
  font-size: 14px;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 56px) 56px;
}

.summary {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(160px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
  animation: rise 420ms ease both;
}

.metric {
  min-height: 132px;
  padding: 22px;
  background: var(--surface);
}

.metric.primary {
  background: #112521;
  color: #fffdf8;
}

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

.metric.primary span,
.metric.primary small {
  color: rgba(255, 253, 248, 0.72);
}

.metric strong {
  display: block;
  margin: 10px 0 6px;
  font-size: clamp(26px, 3vw, 44px);
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 28px;
  margin-top: 28px;
  align-items: start;
}

.allocation,
.positions,
.thesis-grid,
.watchlist,
.cockpit {
  animation: rise 520ms ease both;
}

.allocation {
  position: sticky;
  top: 122px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

button {
  border: 1px solid #173f38;
  border-radius: 8px;
  background: #173f38;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  padding: 10px 14px;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover {
  background: #20584f;
  transform: translateY(-1px);
}

button:disabled {
  cursor: progress;
  opacity: 0.68;
}

button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

button.secondary:hover {
  background: #f4efe4;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.bars {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee8dc;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 520ms ease;
}

.note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.positions {
  min-width: 0;
}

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

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

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 14px;
  white-space: nowrap;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr {
  transition: background 160ms ease;
}

tbody td {
  vertical-align: middle;
}

tbody td:nth-child(2) {
  max-width: 220px;
  color: #2b2925;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  white-space: normal;
}

tbody td:nth-child(3),
tbody td:nth-child(4),
tbody td:nth-child(9),
tbody td:nth-child(11) {
  color: #2f2d29;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

tbody tr:hover {
  background: #f4efe4;
}

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

.ticker,
.ticker-lockup {
  display: grid;
  gap: 2px;
}

.ticker strong,
.ticker-lockup strong {
  font-size: 15px;
}

.ticker span,
.ticker-lockup span {
  color: var(--muted);
  font-size: 12px;
}

.ticker-cell {
  min-width: 220px;
}

.ticker-cell .stock-links {
  margin-top: 8px;
}

.ticker-lockup strong {
  color: var(--ink);
  font-size: 28px;
  font-weight: 860;
  line-height: 0.95;
}

.ticker-lockup span {
  color: #4e4a43;
  font-size: 14px;
  font-weight: 650;
}

.stock-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.stock-links a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbf8f1;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.stock-links a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.positive {
  color: var(--good);
  font-weight: 760;
}

.negative {
  color: var(--danger);
  font-weight: 760;
}

.flat {
  color: var(--flat);
  font-weight: 760;
}

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

.price-cell {
  display: inline-grid;
  justify-items: end;
  gap: 7px;
}

.price-cell strong {
  font-size: 18px;
  font-weight: 820;
}

.trend {
  display: inline-flex;
  justify-content: center;
  min-width: 76px;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
}

.trend.positive {
  background: #dff2e7;
  color: var(--good);
}

.trend.negative {
  background: #f7ded9;
  color: var(--danger);
}

.trend.flat {
  background: var(--flat-soft);
  color: var(--flat);
}

.thesis-grid,
.watchlist,
.cockpit {
  margin-top: 34px;
}

.cockpit {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 28px;
}

.cockpit.two-col {
  grid-template-columns: 1fr 1fr;
}

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.alerts-list,
.stack-rows {
  display: grid;
  gap: 10px;
}

.alert,
.stack-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f1;
}

.alert {
  align-items: flex-start;
  border-left-width: 5px;
}

.alert strong,
.alert span,
.stack-row strong,
.stack-row span {
  display: block;
}

.alert span,
.stack-row span,
.note-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.alert.positive {
  border-left-color: var(--good);
}

.alert.negative {
  border-left-color: var(--danger);
}

.alert.flat {
  border-left-color: var(--flat);
}

.equity-chart {
  min-height: 164px;
}

.sparkline {
  width: 100%;
  height: 100%;
  min-height: 38px;
}

.sparkline path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
}

.sparkline.down path {
  stroke: var(--danger);
}

.equity-chart .sparkline {
  height: 120px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8f1;
}

.chart-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.chart-caption strong {
  color: var(--ink);
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.thesis-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.thesis-card {
  min-height: 190px;
  padding: 20px;
  background: var(--surface);
  transition: transform 160ms ease, background 160ms ease;
}

.thesis-card:hover {
  background: #fbf7ef;
}

.thesis-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.thesis-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.thesis-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 14px;
  align-items: start;
}

.score-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-transform: capitalize;
}

.dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #e4ddcf;
}

.dots span.on {
  background: var(--accent);
}

.note-text {
  margin-top: 14px;
}

.pill {
  display: inline-flex;
  max-width: 100%;
  margin-bottom: 14px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #0f554c;
  font-size: 12px;
  font-weight: 780;
}

.watchlist-rows {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.watch-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, auto));
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.watch-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(130px, 1fr) repeat(5, minmax(72px, auto));
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  background: var(--surface);
}

.watch-row span {
  color: var(--muted);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .summary,
  .workspace,
  .thesis-cards,
  .cockpit,
  .cockpit.two-col {
    grid-template-columns: 1fr;
  }

  .allocation {
    position: static;
  }
}

@media (max-width: 680px) {
  .topbar {
    position: static;
    display: grid;
  }

  .status {
    min-width: 0;
    text-align: left;
  }

  .metric {
    min-height: 112px;
  }

  .watch-row {
    grid-template-columns: 1fr 1fr;
  }

  .watch-head {
    display: none;
  }
}
