:root {
  --bg: #081018;
  --bg-soft: #0c1723;
  --surface: rgba(12, 22, 34, 0.92);
  --surface-strong: #122132;
  --surface-soft: #192a3b;
  --border: rgba(143, 164, 188, 0.16);
  --border-strong: rgba(143, 164, 188, 0.3);
  --text: #ebf2fb;
  --muted: #90a5c1;
  --accent: #55d1a5;
  --accent-soft: rgba(85, 209, 165, 0.15);
  --success: #72d48f;
  --warning: #f3bc63;
  --danger: #ff7474;
  --info: #71bfff;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  --radius: 18px;
  --radius-sm: 12px;
  --font-ui: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(113, 191, 255, 0.14), transparent 24%),
    radial-gradient(circle at 85% 0, rgba(85, 209, 165, 0.12), transparent 20%),
    linear-gradient(180deg, #09121b 0%, #071018 100%);
  color: var(--text);
  font-family: var(--font-ui);
}

button,
input,
table {
  font: inherit;
}

.page-shell {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.hero,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.8fr);
  gap: 18px;
  padding: 24px;
}

.hero__eyebrow,
.section-head__eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1,
.section-head h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

.hero h1 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
}

.hero__subtitle {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.meta-chip {
  min-width: 150px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.meta-chip__label,
.section-head__hint {
  color: var(--muted);
  font-size: 12px;
}

.meta-chip strong {
  display: block;
  margin-top: 6px;
  font-size: 14px;
}

.meta-chip__link {
  color: inherit;
  text-decoration: none;
}

.meta-chip__link:hover {
  text-decoration: underline;
}

.status-badge-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(77, 212, 172, 0.08), rgba(101, 184, 255, 0.03)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
}

.status-badge-card__label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-badge-card__text {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}

.status-badge--ok {
  color: #032716;
  background: var(--success);
}

.status-badge--warning {
  color: #392300;
  background: var(--warning);
}

.status-badge--danger {
  color: #3a0909;
  background: var(--danger);
}

.status-badge--neutral {
  color: var(--text);
  background: var(--surface-soft);
}

.banner {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1.5;
}

.banner--warning {
  background: rgba(255, 191, 102, 0.12);
  border-color: rgba(255, 191, 102, 0.28);
  color: #ffdca9;
}

.banner--danger {
  background: rgba(255, 109, 109, 0.12);
  border-color: rgba(255, 109, 109, 0.24);
  color: #ffc9c9;
}

.hidden {
  display: none !important;
}

.panel {
  padding: 18px;
}

.panel--toolbar {
  margin-top: 14px;
  padding: 12px 16px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.toolbar__group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar__group--right {
  justify-content: flex-end;
}

.button {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 12px;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button:hover,
.interval-button:hover {
  transform: translateY(-1px);
  border-color: rgba(146, 166, 191, 0.46);
}

.button--primary {
  border-color: transparent;
  background: linear-gradient(135deg, #4dd4ac, #65b8ff);
  color: #061320;
  font-weight: 700;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.02);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.interval-picker {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.interval-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.interval-button.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.layout {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.layout__split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.side-stack {
  display: grid;
  gap: 14px;
}

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

.section-head__hint {
  margin: 0;
}

.section-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.segmented-control__button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.segmented-control__button.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.health-cards,
.summary-grid,
.details-grid {
  display: grid;
  gap: 12px;
}

.health-cards {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.details-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.health-card,
.summary-card,
.detail-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.health-card::after,
.summary-card::after,
.detail-card::after {
  content: "";
  position: absolute;
  inset: auto -20px -35px auto;
  width: 90px;
  height: 90px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.health-card__label,
.summary-card__label,
.detail-card__label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.health-card__value,
.summary-card__value,
.detail-card__value {
  margin-top: 8px;
  font-size: 23px;
  font-weight: 700;
}

.health-card__hint,
.summary-card__hint,
.detail-card__hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.card-tone--ok {
  border-color: rgba(98, 211, 132, 0.28);
}

.card-tone--warning {
  border-color: rgba(255, 191, 102, 0.28);
}

.card-tone--danger {
  border-color: rgba(255, 109, 109, 0.26);
}

.card-tone--neutral {
  border-color: var(--border);
}

.alert-stack {
  display: grid;
  gap: 10px;
}

.alert-box {
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.alert-box--warning {
  border-left: 4px solid var(--warning);
}

.alert-box--danger {
  border-left: 4px solid var(--danger);
}

.alert-box--ok {
  border-left: 4px solid var(--success);
}

.alert-box__title {
  margin: 0 0 6px;
  font-weight: 700;
}

.alert-box__text {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
}

.results-table {
  width: 100%;
  min-width: 1680px;
  border-collapse: collapse;
}

.results-table th,
.results-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(146, 166, 191, 0.1);
  vertical-align: top;
  text-align: left;
}

.results-table thead th {
  position: sticky;
  top: 0;
  background: #102030;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.results-table thead th.is-sorted {
  color: var(--text);
}

.results-table tbody tr {
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
}

.results-table tbody tr:hover,
.results-table tbody tr.is-active {
  background: rgba(101, 184, 255, 0.08);
}

.results-table tbody tr.is-active {
  outline: 1px solid rgba(101, 184, 255, 0.45);
  box-shadow: inset 3px 0 0 rgba(101, 184, 255, 0.85);
}

.results-table tbody tr.row--high-potential {
  background: linear-gradient(90deg, rgba(98, 211, 132, 0.12), rgba(255, 255, 255, 0.015));
}

.results-table tbody tr.row--watchlist {
  background: linear-gradient(90deg, rgba(255, 191, 102, 0.1), rgba(255, 255, 255, 0.015));
}

.symbol-stack {
  display: grid;
  gap: 4px;
}

.symbol-stack strong {
  font-size: 15px;
}

.symbol-stack small {
  color: var(--muted);
}

.score-pill,
.potential-pill,
.reason-pill,
.risk-pill,
.flag-pill,
.diff-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  margin: 0 6px 6px 0;
  border: 1px solid rgba(146, 166, 191, 0.2);
}

.score-pill {
  font-weight: 700;
}

.potential-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
}

.score-pill[data-label="high"] {
  background: rgba(98, 211, 132, 0.16);
  color: #c0ffcf;
}

.score-pill[data-label="strong"] {
  background: rgba(101, 184, 255, 0.15);
  color: #b3ddff;
}

.score-pill[data-label="watch"] {
  background: rgba(255, 191, 102, 0.16);
  color: #ffd8a4;
}

.score-pill[data-label="weak"] {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.potential-pill {
  font-weight: 700;
}

.potential-pill[data-label="high_potential"] {
  background: rgba(98, 211, 132, 0.16);
  color: #c0ffcf;
}

.potential-pill[data-label="watchlist"] {
  background: rgba(101, 184, 255, 0.15);
  color: #b3ddff;
}

.potential-pill[data-label="low_conviction"] {
  background: rgba(255, 191, 102, 0.16);
  color: #ffd8a4;
}

.potential-pill[data-label="weak"] {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.reason-pill {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.risk-pill--low {
  background: rgba(98, 211, 132, 0.12);
  color: #d2ffd9;
}

.risk-pill--medium {
  background: rgba(255, 191, 102, 0.14);
  color: #ffd8a4;
}

.risk-pill--high {
  background: rgba(255, 109, 109, 0.14);
  color: #ffc8c8;
}

.risk-pill--neutral {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.flag-pill {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.diff-pill--entered {
  background: rgba(98, 211, 132, 0.12);
  color: #d2ffd9;
}

.diff-pill--exited {
  background: rgba(255, 109, 109, 0.12);
  color: #ffc8c8;
}

.number-positive {
  color: var(--success);
}

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

.direction {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.direction::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--muted);
}

.direction-up::before {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(98, 211, 132, 0.12);
}

.direction-down::before {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(255, 109, 109, 0.12);
}

.direction-flat::before {
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(255, 191, 102, 0.12);
}

.timestamp,
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.notes {
  max-width: 300px;
  color: var(--muted);
}

.reasons-cell {
  min-width: 240px;
}

.notes__line {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state,
.detail-panel__empty {
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px dashed var(--border-strong);
}

.empty-state h3,
.detail-panel__empty h3 {
  margin: 0 0 8px;
}

.empty-state p,
.detail-panel__empty p {
  margin: 0;
  color: var(--muted);
}

.detail-panel {
  display: grid;
  gap: 14px;
}

.detail-panel__hero {
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(77, 212, 172, 0.08), rgba(101, 184, 255, 0.05));
  border: 1px solid var(--border);
}

.detail-panel__title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.detail-panel__title h3 {
  margin: 0;
  font-size: 22px;
}

.detail-panel__sub {
  color: var(--muted);
  margin: 0;
}

.detail-panel__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-stat {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
}

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

.detail-stat__value {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.details-block {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-strong);
  overflow: hidden;
}

.details-block summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 700;
}

.details-block[open] summary {
  border-bottom: 1px solid var(--border);
}

.details-grid {
  padding: 16px;
}

@media (max-width: 1100px) {
  .hero,
  .layout__split {
    grid-template-columns: 1fr;
  }

  .side-stack {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100%, calc(100% - 18px));
    padding-top: 16px;
  }

  .hero,
  .panel {
    border-radius: 16px;
  }

  .hero,
  .panel,
  .panel--toolbar {
    padding: 16px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head,
  .section-head__actions {
    align-items: stretch;
  }

  .toolbar__group--right {
    justify-content: flex-start;
  }

  .health-cards,
  .summary-grid,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel__grid {
    grid-template-columns: 1fr;
  }
}
