:root {
  --bg: #09111f;
  --panel: rgba(14, 23, 40, 0.92);
  --panel-soft: rgba(22, 34, 57, 0.8);
  --border: rgba(158, 194, 255, 0.12);
  --text: #eff6ff;
  --muted: #9ab0cc;
  --accent: #68a3ff;
  --accent-2: #7ef0c8;
  --danger: #ff7a90;
  --warning: #ffd166;
  --selected: #7ef0c8;
  --winner: #68a3ff;
  --rejected: #ff7a90;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top, #11203d 0%, #09111f 45%, #050914 100%);
  color: var(--text);
}

a { color: #b7d0ff; text-decoration: none; }
a:hover { color: #ffffff; }

.shell {
  max-width: 1680px;
  margin: 0 auto;
  padding: 32px;
}

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

.page-header h1 {
  margin: 6px 0 10px;
  font-size: clamp(2rem, 2.7vw, 3rem);
  line-height: 1.05;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--accent-2);
}

.lede {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  line-height: 1.55;
}

.header-actions,
.detail-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button,
button,
select,
input {
  font: inherit;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(104, 163, 255, 0.18), rgba(104, 163, 255, 0.08));
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.button:hover,
button:hover { filter: brightness(1.08); }
.button-secondary { background: rgba(255, 255, 255, 0.06); }
.button-danger { background: linear-gradient(180deg, rgba(255, 122, 144, 0.22), rgba(255, 122, 144, 0.12)); }

.stats-grid,
.detail-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.detail-grid { grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr) minmax(320px, 1fr); }
.bottom-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.stat-card,
.panel,
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.stat-label,
.metric-label,
.subtle {
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
  line-height: 1;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.panel-heading p,
.empty-copy { margin: 0; color: var(--muted); }

.filters-grid {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(6, minmax(140px, 1fr));
  gap: 14px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 0.88rem;
  color: var(--muted);
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.field-actions {
  display: flex;
  gap: 12px;
}

.table-wrap { overflow: auto; }
.table-panel { padding-bottom: 8px; }
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1480px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: rgba(9, 17, 31, 0.96);
  z-index: 1;
  text-align: left;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
}

.data-table tbody td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}

.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.event-link { font-weight: 700; }
.title-cell { font-weight: 600; margin-bottom: 8px; }
.summary-line {
  max-width: 520px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}
.file-cell {
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty-state,
.empty-panel-state {
  padding: 24px !important;
  color: var(--muted);
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(104, 163, 255, 0.16);
  border: 1px solid rgba(104, 163, 255, 0.18);
  font-size: 0.82rem;
}
.pill-secondary { background: rgba(255,255,255,0.06); }
.pill-selected { background: rgba(126, 240, 200, 0.16); border-color: rgba(126, 240, 200, 0.2); }
.pill-winner { background: rgba(104, 163, 255, 0.16); border-color: rgba(104, 163, 255, 0.2); }
.pill-rejected { background: rgba(255, 122, 144, 0.14); border-color: rgba(255, 122, 144, 0.18); }

.hero-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.hero-summary-grid div {
  padding: 14px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid rgba(255,255,255,0.04);
}
.hero-summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
}
.file-banner {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-list {
  display: grid;
  gap: 12px;
  margin: 0;
}
.info-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; text-align: right; }

.bar-chart { display: grid; gap: 14px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(220px, 3fr) minmax(110px, auto);
  gap: 14px;
  align-items: center;
}
.bar-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.bar-copy strong,
.bar-copy span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  height: 16px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--winner), #a5c8ff);
}
.bar-fill-selected { background: linear-gradient(90deg, var(--selected), #baffeb); }
.bar-fill-rejected { background: linear-gradient(90deg, var(--rejected), #ffc6d2); }
.bar-value { text-align: right; }

.list-reset { list-style: none; padding: 0; margin: 0; }
.stack-list { display: grid; gap: 10px; }
.raw-json-details summary { cursor: pointer; color: var(--accent-2); }
pre {
  white-space: pre-wrap;
  margin-top: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 16px;
  color: #d7e7ff;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-shell {
  width: min(100%, 460px);
  padding: 24px;
}
.login-card h1 { margin: 6px 0 10px; }
.error-banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 122, 144, 0.14);
  border: 1px solid rgba(255, 122, 144, 0.2);
  color: #ffd9df;
}
.back-link {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent-2);
}

@media (max-width: 1280px) {
  .stats-grid,
  .detail-grid,
  .bottom-grid,
  .hero-summary-grid,
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .shell { padding: 20px; }
  .page-header,
  .field-actions,
  .bar-row,
  .info-list div {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .stats-grid,
  .detail-grid,
  .bottom-grid,
  .hero-summary-grid,
  .filters-grid {
    grid-template-columns: 1fr;
  }
  .data-table { min-width: 1120px; }
}
