:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-2: #eaf1fb;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --surface-2: #eef4ff;
  --text: #102033;
  --muted: #617089;
  --border: #d9e5f2;
  --primary: #1e40af;
  --primary-2: #3b82f6;
  --positive: #047857;
  --negative: #b42318;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1220;
  --bg-2: #111a2b;
  --surface: rgba(18, 27, 43, 0.88);
  --surface-solid: #121b2b;
  --surface-2: #1a2740;
  --text: #edf4ff;
  --muted: #9baac2;
  --border: #263854;
  --primary: #82aaff;
  --primary-2: #4f8cff;
  --positive: #4ade80;
  --negative: #fb7185;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 28rem),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
table {
  font: inherit;
}

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

.topbar,
.section-head,
.metric-grid,
.update-grid {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 20px;
}

.top-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 840px;
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.status-card,
.theme-toggle,
.metric,
.update-card,
.panel {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.theme-toggle {
  min-width: 104px;
  min-height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--primary-2);
  outline: none;
}

.theme-toggle span {
  color: var(--primary);
  font-size: 18px;
}

.status-card {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-2);
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.16);
}

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

.metric {
  min-height: 108px;
  padding: 18px;
  border-radius: 8px;
}

.metric strong,
.status-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.1;
}

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

.update-card {
  min-height: 128px;
  padding: 18px;
  border-radius: 8px;
}

.update-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.2;
}

.update-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  margin-top: 16px;
  padding: 22px;
  border-radius: 8px;
}

.section-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 18px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
}

th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

tbody tr:hover {
  background: color-mix(in srgb, var(--primary-2) 7%, transparent);
}

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

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

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

.muted {
  color: var(--muted);
}

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

  .top-actions {
    flex-wrap: wrap;
  }

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

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

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

  .top-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .theme-toggle,
  .status-card {
    width: 100%;
    min-width: 0;
  }

  .panel {
    padding: 16px;
  }
}
