:root {
  color-scheme: light;
  --background: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #eef3f8;
  --text: #182230;
  --text-muted: #526273;
  --border: #cbd6e2;
  --accent: #075985;
  --accent-strong: #064466;
  --accent-soft: #dff3ff;
  --focus: #c2410c;
  --danger: #a21caf;
  --shadow: 0 14px 35px rgb(35 55 80 / 9%);
  --radius: 1rem;
  --content-width: 82rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  background: var(--background);
  color: var(--text);
}

body {
  min-width: 20rem;
  margin: 0;
  background:
    radial-gradient(circle at 12% -10%, rgb(14 165 233 / 12%), transparent 28rem),
    var(--background);
}

button,
table {
  font: inherit;
}

button {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 0.5rem;
  background: var(--text);
  color: #fff;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.site-header {
  border-bottom: 1px solid rgb(203 214 226 / 75%);
  background: rgb(255 255 255 / 78%);
}

.header-inner,
.dashboard,
.site-footer {
  width: min(calc(100% - 2rem), var(--content-width));
  margin-inline: auto;
}

.header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 2.5rem 2rem;
}

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

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

h1 {
  margin-bottom: 0.4rem;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  letter-spacing: -0.015em;
}

.intro,
.export-time,
.site-footer {
  color: var(--text-muted);
}

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

.export-time {
  flex: 0 0 auto;
  margin-bottom: 0.25rem;
  text-align: right;
  font-size: 0.9rem;
}

.export-time time {
  display: block;
  color: var(--text);
  font-weight: 700;
}

.dashboard {
  padding-block: 1.5rem 4rem;
}

.tabs-shell {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  scrollbar-width: thin;
}

.tab-list {
  display: flex;
  min-width: max-content;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--surface);
  box-shadow: 0 6px 20px rgb(35 55 80 / 6%);
}

.tab-button {
  min-height: 2.9rem;
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
}

.tab-button:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.tab-button[aria-selected="true"] {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 5px 14px rgb(7 89 133 / 22%);
}

.tab-panel:focus {
  outline: none;
}

.panel-status {
  min-height: 3.3rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--text-muted);
}

.panel-status:empty {
  display: none;
}

.panel-status[data-state="loading"]::before {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.65rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -0.1rem;
  content: "";
  animation: spin 0.8s linear infinite;
}

.panel-status[data-state="error"] {
  border-color: #efb4e9;
  background: #fff1fc;
  color: #701a75;
}

.panel-status[data-state="empty"] {
  border-style: dashed;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.summary-card,
.data-card {
  border: 1px solid rgb(203 214 226 / 88%);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-card {
  min-height: 8rem;
  padding: 1.1rem;
  border-radius: 0.85rem;
}

.summary-label {
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.summary-value {
  margin-bottom: 0.3rem;
  color: var(--accent-strong);
  font-size: clamp(1.5rem, 4vw, 2.05rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.summary-detail {
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.data-card {
  margin-top: 1rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: var(--radius);
}

.chart {
  width: 100%;
  min-height: 25rem;
}

.chart-fallback {
  display: grid;
  min-height: 16rem;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.chart-description {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.table-card {
  padding-inline: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.table-card h2 {
  padding-inline: clamp(1rem, 3vw, 1.5rem);
}

.table-scroll {
  max-height: 38rem;
  overflow: auto;
  border-top: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

th,
td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #e9f1f7;
  color: #253649;
  font-size: 0.8rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

tbody tr:nth-child(even) {
  background: #f8fafc;
}

tbody tr:hover {
  background: var(--accent-soft);
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 800;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.sort-indicator {
  width: 0.8rem;
  color: var(--accent);
  text-align: center;
}

.numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.invalid-value {
  color: var(--danger);
  font-style: italic;
}

.site-footer {
  padding-block: 1.5rem 2.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
}

.site-footer p {
  margin-bottom: 0.35rem;
}

code {
  padding: 0.08rem 0.25rem;
  border-radius: 0.25rem;
  background: #e6edf5;
  color: #253649;
}

.noscript {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 1rem auto;
  padding: 1rem;
  border: 1px solid #efb4e9;
  background: #fff1fc;
}

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

@media (max-width: 43rem) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 1.2rem;
    padding-block: 2rem 1.5rem;
  }

  .export-time {
    text-align: left;
  }

  .export-time time {
    display: inline;
  }

  .dashboard {
    padding-top: 1rem;
  }

  .chart {
    min-height: 20rem;
  }

  th,
  td {
    padding: 0.7rem 0.8rem;
  }
}

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

@media print {
  body {
    background: #fff;
  }

  .tab-list {
    display: none;
  }

  .tab-panel[hidden] {
    display: none;
  }

  .data-card,
  .summary-card {
    box-shadow: none;
  }
}
