:root {
  color-scheme: light;
  --bg: #f2f5f9;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --ink: #121923;
  --muted: #667085;
  --line: #d7dee8;
  --line-strong: #b9c5d4;
  --blue: #2457d6;
  --blue-soft: #e9efff;
  --teal: #0f766e;
  --teal-soft: #e6f5f3;
  --violet: #7c3aed;
  --violet-soft: #f1eafe;
  --slate: #465568;
  --slate-soft: #edf1f6;
  --success: #14743a;
  --success-bg: #eaf8ef;
  --warning: #9a4d10;
  --warning-bg: #fff3e6;
  --error: #bb3518;
  --error-bg: #fff0eb;
  --unknown: #475569;
  --unknown-bg: #edf1f6;
  --shadow: 0 18px 54px rgba(18, 25, 35, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0, rgba(255, 255, 255, 0.72) 150px, rgba(255, 255, 255, 0) 380px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(22px, 3vw, 32px);
  background:
    linear-gradient(135deg, rgba(36, 87, 214, 0.08), rgba(15, 118, 110, 0.04) 45%, rgba(255, 255, 255, 0) 70%),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--teal), var(--blue), var(--violet));
  content: "";
}

.hero-copy {
  position: relative;
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 0 14px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  padding: 0 11px;
  color: var(--teal);
  background: rgba(230, 245, 243, 0.72);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: none;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: clamp(2.35rem, 4.55vw, 3.95rem);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

h2 {
  margin-bottom: 6px;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.2;
  letter-spacing: 0;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.35vw, 1.12rem);
  font-weight: 500;
}

.import-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 154px;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(18, 25, 35, 0.08);
  font-size: 0.92rem;
  font-weight: 850;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.import-control:hover {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 16px 42px rgba(36, 87, 214, 0.14);
  transform: translateY(-1px);
}

.import-control:focus-within {
  outline: 3px solid rgba(36, 87, 214, 0.18);
  outline-offset: 3px;
}

.import-control svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.import-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

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

.metric {
  position: relative;
  display: grid;
  align-content: space-between;
  min-height: 102px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 250, 252, 0.88)),
    var(--surface);
  box-shadow: 0 12px 34px rgba(18, 25, 35, 0.055);
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.metric:hover {
  border-color: var(--line-strong);
  box-shadow: 0 16px 44px rgba(18, 25, 35, 0.08);
  transform: translateY(-1px);
}

.metric-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  color: var(--ink);
  font-size: clamp(1.85rem, 3vw, 2.5rem);
  line-height: 1;
}

.metric::before {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 5px;
  border-radius: 999px;
  content: "";
}

.accent-blue::before {
  background: var(--blue);
}

.accent-teal::before {
  background: var(--teal);
}

.accent-violet::before {
  background: var(--violet);
}

.accent-slate::before {
  background: var(--slate);
}

.results-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 20px 64px rgba(18, 25, 35, 0.08);
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(20px, 3vw, 30px);
  border-bottom: 1px solid var(--line);
}

#results-caption {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.data-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--slate);
  background: var(--surface-soft);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.state-banner {
  display: flex;
  align-items: center;
  min-height: 54px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 15px clamp(20px, 3vw, 30px);
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 750;
}

.state-banner::before {
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 999px;
  background: var(--unknown);
  content: "";
  flex: 0 0 auto;
}

.state-banner.ok {
  border-color: #bfebcc;
  color: var(--success);
  background: var(--success-bg);
}

.state-banner.ok::before {
  background: var(--success);
}

.state-banner.warn {
  border-color: #fed7aa;
  color: var(--warning);
  background: var(--warning-bg);
}

.state-banner.warn::before {
  background: var(--warning);
}

.state-banner.error {
  border-color: #fec7b8;
  color: var(--error);
  background: var(--error-bg);
}

.state-banner.error::before {
  background: var(--error);
}

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  padding: 16px clamp(20px, 3vw, 30px);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.search-field {
  position: relative;
  display: block;
  min-width: 0;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input,
.select-group select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-soft);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
}

.search-field input {
  padding: 0 14px 0 42px;
}

.search-field input::placeholder {
  color: #8993a4;
}

.search-field input:focus,
.select-group select:focus {
  border-color: var(--blue);
  background: #ffffff;
  outline: 3px solid rgba(36, 87, 214, 0.16);
}

.select-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(132px, 1fr));
  gap: 10px;
}

.select-group label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.select-group span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.select-group select {
  appearance: none;
  padding: 0 34px 0 12px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 13px) 18px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--slate);
  background: var(--slate-soft);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

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

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

thead {
  background: #1c2733;
  color: #ffffff;
}

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

th {
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  color: #2d3745;
  font-size: 0.94rem;
}

tbody tr:nth-child(odd) {
  background: #fbfcfe;
}

tbody tr:hover {
  background: #eef5ff;
}

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

.dataset {
  color: var(--ink);
  font-weight: 850;
}

.mode {
  color: var(--muted);
  font-weight: 800;
}

.number {
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 0.74rem;
  font-weight: 900;
}

.status.ok {
  color: var(--success);
  background: var(--success-bg);
}

.status.warn {
  color: var(--warning);
  background: var(--warning-bg);
}

.status.error {
  color: var(--error);
  background: var(--error-bg);
}

.status.unknown {
  color: var(--unknown);
  background: var(--unknown-bg);
}

.empty-row td {
  padding: 44px 18px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
    padding: 28px 0 36px;
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .import-control {
    width: 100%;
  }

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

  .section-header {
    display: grid;
  }

  .data-pill {
    justify-self: start;
  }

  .table-toolbar {
    grid-template-columns: 1fr;
  }

  .filter-count {
    justify-self: start;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 20px;
  }

  h1 {
    font-size: clamp(2rem, 14vw, 3.05rem);
    white-space: normal;
  }

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

  .metric {
    min-height: 96px;
  }

  .select-group {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 14px;
  }
}
