:root {
  --bg: #f3f6fa;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --surface-raised: #f7f9fc;
  --border: rgba(43, 58, 79, 0.13);
  --border-strong: rgba(43, 58, 79, 0.24);
  --text: #162337;
  --muted: #68788e;
  --muted-strong: #45566d;
  --accent: #087f6d;
  --accent-strong: #056b5c;
  --accent-soft: rgba(8, 127, 109, 0.1);
  --blue: #3268c8;
  --blue-soft: rgba(50, 104, 200, 0.1);
  --amber: #a76008;
  --amber-soft: rgba(167, 96, 8, 0.1);
  --red: #c13f50;
  --red-soft: rgba(193, 63, 80, 0.1);
  --shadow: 0 22px 65px rgba(26, 43, 68, 0.1);
  --radius: 20px;
  --radius-small: 12px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background:
    radial-gradient(circle at 10% -10%, rgba(94, 137, 205, 0.17), transparent 35%),
    radial-gradient(circle at 95% 0%, rgba(8, 127, 109, 0.12), transparent 32%),
    var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(35, 53, 78, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 53, 78, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 30px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 10px;
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
  letter-spacing: -0.025em;
}

h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.hero-copy {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted-strong);
  font-size: 1.02rem;
  line-height: 1.6;
}

.hero-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  min-width: 190px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(14px);
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.status-label,
.summary-label,
.summary-note,
.muted {
  color: var(--muted);
}

.status-label {
  display: block;
  margin-bottom: 3px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-status strong {
  font-size: 0.88rem;
  font-weight: 650;
}

.warning-panel {
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(167, 96, 8, 0.28);
  border-radius: var(--radius-small);
  background: var(--amber-soft);
  color: #774707;
}

.warning-panel strong {
  display: block;
  margin-bottom: 6px;
}

.warning-panel div {
  color: var(--muted-strong);
  font-size: 0.88rem;
  line-height: 1.5;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.summary-card {
  position: relative;
  min-height: 148px;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(50, 104, 200, 0.035), transparent 60%),
    var(--surface);
  box-shadow: 0 16px 48px rgba(26, 43, 68, 0.07);
}

.summary-card::after {
  position: absolute;
  right: -38px;
  bottom: -52px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--accent-soft);
  content: "";
  filter: blur(4px);
}

.summary-label {
  display: block;
  margin-bottom: 17px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.summary-value {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 7px;
  font-size: 2.35rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.summary-note {
  position: relative;
  z-index: 1;
  font-size: 0.82rem;
}

.workspace {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.workspace-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 24px 18px;
}

.result-count {
  color: var(--muted);
  font-size: 0.87rem;
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(150px, 0.55fr));
  gap: 12px;
  padding: 0 24px 22px;
  border-bottom: 1px solid var(--border);
}

.filters label:not(.search-field) {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filters label > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.search-field {
  position: relative;
  align-self: end;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: #ffffff;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

input:hover,
select:hover {
  border-color: var(--border-strong);
}

input {
  padding: 0 14px 0 42px;
}

select {
  padding: 0 34px 0 12px;
}

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

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

thead {
  background: #f5f7fa;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th:first-child,
td:first-child {
  padding-left: 24px;
}

th:last-child,
td:last-child {
  padding-right: 24px;
}

th {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  white-space: nowrap;
}

.sort-button::after {
  width: 0.8em;
  color: #9aa7b7;
  content: "↕";
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
}

th[aria-sort="ascending"] .sort-button,
th[aria-sort="descending"] .sort-button {
  color: var(--accent-strong);
}

th[aria-sort="ascending"] .sort-button::after {
  color: var(--accent);
  content: "↑";
}

th[aria-sort="descending"] .sort-button::after {
  color: var(--accent);
  content: "↓";
}

.sort-button:hover {
  color: var(--text);
}

tbody tr {
  transition: background 150ms ease;
}

tbody tr:hover {
  background: rgba(8, 127, 109, 0.045);
}

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

.model-button {
  display: inline-flex;
  max-width: 280px;
  padding: 0;
  border: 0;
  color: var(--text);
  background: none;
  font-weight: 720;
  line-height: 1.25;
  text-align: left;
}

.model-button:hover {
  color: var(--accent);
}

.model-meta {
  display: block;
  max-width: 290px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.value {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

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

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

.value.missing {
  color: var(--muted);
  font-weight: 500;
}

.metric-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.metric-stack span:last-child {
  color: var(--muted);
  font-size: 0.72rem;
}

.badges,
.dialog-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.68rem;
  font-weight: 720;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge.staked,
.badge.completed,
.badge.submitted {
  border-color: rgba(8, 127, 109, 0.24);
  color: var(--accent);
  background: var(--accent-soft);
}

.badge.unstaked,
.badge.running,
.badge.no-scores {
  border-color: rgba(167, 96, 8, 0.24);
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.failed {
  border-color: rgba(193, 63, 80, 0.25);
  color: var(--red);
  background: var(--red-soft);
}

.badge.offline_only,
.badge.live-slot {
  border-color: rgba(50, 104, 200, 0.24);
  color: var(--blue);
  background: var(--blue-soft);
}

.evidence-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.evidence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(104, 120, 142, 0.3);
}

.evidence-dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.empty-state {
  padding: 50px 24px;
  color: var(--muted);
  text-align: center;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 4px 0;
  color: var(--muted);
  font-size: 0.74rem;
}

dialog {
  width: min(1120px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: 0 30px 100px rgba(26, 43, 68, 0.24);
}

dialog::backdrop {
  background: rgba(22, 35, 55, 0.42);
  backdrop-filter: blur(6px);
}

.dialog-shell {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 25px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-subtitle {
  margin: 7px 0 0;
  color: var(--muted);
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted-strong);
  background: #f6f8fb;
}

.icon-button:hover {
  color: var(--text);
  background: #edf2f7;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.dialog-badges {
  margin: 18px 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

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

.detail-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-raised);
}

.detail-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-card-head .muted {
  font-size: 0.72rem;
  text-align: right;
}

.live-card-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
}

.profile-link {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 680;
  text-decoration: none;
}

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

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

.metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
}

.metric-label,
.metric-note {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

.metric-label {
  margin-bottom: 8px;
  font-weight: 690;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  min-height: 25px;
  overflow: hidden;
  font-size: 1.12rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-note {
  min-height: 15px;
  margin-top: 3px;
}

.metadata-list {
  display: grid;
  grid-template-columns: minmax(110px, 0.45fr) 1fr;
  gap: 8px 14px;
  margin: 16px 0 0;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
}

.metadata-list dt {
  color: var(--muted);
}

.metadata-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.sparkline-block {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.sparkline-block > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sparkline-block .muted {
  font-size: 0.7rem;
}

#corrSparkline {
  display: block;
  width: 100%;
  height: 130px;
  margin-top: 10px;
  overflow: visible;
}

.evidence-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.rounds-card {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-raised);
}

.round-summary-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 16px;
}

.round-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.round-table {
  min-width: 960px;
}

.round-table th,
.round-table td {
  padding: 11px 12px;
}

.round-table th:first-child,
.round-table td:first-child {
  padding-left: 14px;
}

.round-table th:last-child,
.round-table td:last-child {
  padding-right: 14px;
}

.round-date {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
}

.badge.round-resolved {
  border-color: rgba(8, 127, 109, 0.24);
  color: var(--accent);
  background: var(--accent-soft);
}

.badge.round-provisional,
.badge.round-submitted_pending {
  border-color: rgba(167, 96, 8, 0.24);
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.round-no_public_evidence {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

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

  .search-field {
    grid-column: 1 / -1;
  }

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

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

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 22px, 1480px);
    padding-top: 24px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-status {
    width: 100%;
  }

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

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

  .summary-card {
    min-height: 132px;
    padding: 16px;
  }

  .summary-value {
    font-size: 2rem;
  }

  .workspace-head,
  .filters {
    padding-right: 16px;
    padding-left: 16px;
  }

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

  .search-field {
    grid-column: auto;
  }

  footer {
    flex-direction: column;
    gap: 6px;
  }

  .dialog-shell {
    padding: 18px;
  }

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

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

  .summary-card {
    min-height: 118px;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
