:root {
  --background: #0b0d10;
  --surface: #111419;
  --surface-raised: #161a20;
  --line: #242a32;
  --line-soft: #1c2128;
  --text: #f4f6f8;
  --muted: #8e98a5;
  --accent: #b7f66d;
  --accent-soft: rgba(183, 246, 109, 0.1);
  --danger: #ff6b73;
  --warning: #f3c969;
  --blue: #74a7ff;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--background);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--background);
  color: var(--text);
}

button {
  font: inherit;
}

.shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 32px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 5px;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

h2 {
  margin-top: 5px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.eyebrow,
.section-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.topbar-actions,
.panel-head,
.hero,
.system-strip {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status-dot,
.service-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.status-healthy .status-dot,
.service-dot.online {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.status-degraded .status-dot,
.service-dot.degraded {
  background: var(--warning);
}

.status-unhealthy .status-dot,
.service-dot.offline {
  background: var(--danger);
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
  transition: border-color 160ms ease, transform 160ms ease;
}

.icon-button:hover {
  border-color: #3a424e;
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button.loading {
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hero {
  justify-content: space-between;
  padding: 38px 2px 20px;
}

.hero-copy {
  margin-top: 7px;
  color: #cbd1d8;
  font-size: 15px;
}

.muted,
.metric-note,
.empty-state {
  color: var(--muted);
}

#last-updated {
  font-size: 12px;
}

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

.metric-card,
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
}

.metric-card {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border-radius: var(--radius);
}

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

.metric-value {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 650;
  letter-spacing: -0.05em;
}

.metric-value.positive {
  color: var(--accent);
}

.metric-value.negative {
  color: var(--danger);
}

.metric-note {
  font-size: 11px;
}

.panel {
  margin-top: 12px;
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  justify-content: space-between;
  min-height: 76px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head.compact {
  min-height: 70px;
}

.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0d1014;
}

.filter-button {
  padding: 7px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.filter-button.active {
  background: var(--surface-raised);
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: #66717e;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

td {
  color: #cbd1d8;
  font-size: 12px;
}

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

tbody tr:hover {
  background: rgba(255, 255, 255, 0.018);
}

.symbol-cell strong,
.price-stack strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.symbol-cell span,
.price-stack span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.score-badge,
.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 750;
}

.score-badge {
  min-width: 34px;
  height: 28px;
  color: var(--text);
  background: #20252c;
}

.score-badge.high {
  color: #0b0d10;
  background: var(--accent);
}

.result-badge {
  min-height: 25px;
  padding: 0 9px;
  background: #20252c;
  color: #bec6cf;
}

.result-badge.win {
  background: var(--accent-soft);
  color: var(--accent);
}

.result-badge.loss {
  background: rgba(255, 107, 115, 0.1);
  color: var(--danger);
}

.result-badge.wait {
  background: rgba(116, 167, 255, 0.1);
  color: var(--blue);
}

.return-positive {
  color: var(--accent);
}

.return-negative {
  color: var(--danger);
}

.return-waiting {
  color: #59636f;
}

.empty-cell,
.empty-state {
  padding: 34px 18px;
  text-align: center;
  font-size: 12px;
}

.lower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.score-list,
.insight-list {
  min-height: 180px;
  padding: 18px 20px 20px;
}

.score-row {
  display: grid;
  grid-template-columns: 62px 1fr 120px;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.score-name {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.score-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #252b33;
}

.score-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.score-detail {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.insight {
  position: relative;
  padding: 0 0 16px 18px;
  color: #bdc5ce;
  font-size: 12px;
  line-height: 1.55;
}

.insight:last-child {
  padding-bottom: 0;
}

.insight::before {
  position: absolute;
  top: 6px;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.insight.warning::before {
  background: var(--warning);
}

.system-strip {
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 12px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.system-strip div {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.system-strip strong {
  color: #d7dce2;
  font-weight: 650;
}

footer {
  padding: 22px 4px 0;
  color: #545e69;
  font-size: 10px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 340px;
  padding: 12px 15px;
  border: 1px solid rgba(255, 107, 115, 0.35);
  border-radius: 10px;
  background: #241316;
  color: #ffb2b7;
  font-size: 12px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.4);
}

@media (max-width: 900px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 620px) {
  .shell {
    padding: 0 14px 20px;
  }

  .topbar {
    min-height: 78px;
  }

  .status-pill {
    padding: 0 10px;
  }

  .status-pill span:last-child {
    display: none;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding-top: 28px;
  }

  .metric-grid {
    gap: 8px;
  }

  .metric-card {
    min-height: 114px;
    padding: 15px;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
  }

  .segmented {
    width: 100%;
  }

  .filter-button {
    flex: 1;
  }

  .score-row {
    grid-template-columns: 50px 1fr;
  }

  .score-detail {
    grid-column: 2;
    text-align: left;
  }
}
