:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #101722;
  --panel-strong: #151f2d;
  --text: #edf2f7;
  --muted: #9aa8ba;
  --border: #273347;
  --accent: #6ee7b7;
  --accent-strong: #38c798;
  --accent-contrast: #06251c;
  --warning: #f6b44b;
  --danger: #fb7185;
  --table-stripe: #0d131d;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

body.light {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-strong: #eef3f8;
  --text: #182131;
  --muted: #5d6978;
  --border: #d7e0ea;
  --accent: #0f9f78;
  --accent-strong: #087f60;
  --accent-contrast: #ffffff;
  --warning: #9a640c;
  --danger: #b4233c;
  --table-stripe: #f7fafc;
  --shadow: 0 18px 45px rgba(23, 34, 53, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.site-header,
.section-heading,
.pagination,
.toolbar,
.lineup-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header {
  margin-bottom: 20px;
}

.header-actions,
.pagination-actions,
.filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-stack {
  display: grid;
  gap: 2px;
  text-align: right;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 3vw, 2.65rem);
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  line-height: 1.2;
}

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

.muted,
.section-note,
.section-subtitle,
.data-status {
  color: var(--muted);
}

.data-status {
  font-size: 0.9rem;
}

.section-subtitle {
  margin: 6px 0 0;
  font-size: 0.95rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px 10px;
  font-weight: 700;
}

.tab.is-active {
  color: var(--text);
  border-color: var(--accent);
}

.page {
  display: none;
}

.page.is-active {
  display: block;
}

.section-heading {
  margin: 18px 0;
}

.toolbar,
.filter-panel,
.lineup-panel,
.about-panel,
.empty-state {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toolbar {
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 14px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

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

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 8px 10px;
}

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

.table-shell,
.lineup-table-shell {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
  line-height: 1.25;
  min-width: 108px;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  vertical-align: bottom;
  white-space: normal;
  z-index: 1;
}

tbody tr:nth-child(even) {
  background: var(--table-stripe);
}

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

th.sortable {
  cursor: pointer;
  user-select: none;
}

.numeric {
  text-align: right;
}

.pagination {
  margin-top: 14px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--accent-strong);
  background: var(--accent);
  color: var(--accent-contrast);
}

.primary-button.is-loading {
  border-color: var(--warning);
  background: var(--warning);
  color: #101722;
}

.secondary-button,
.icon-button {
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
}

.ghost-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.lineup-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
}

.filter-panel,
.lineup-panel {
  padding: 16px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 6px 9px;
}

.chip button {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 900;
  padding: 0;
}

.filter-divider {
  height: 1px;
  margin: 20px 0;
  background: var(--border);
}

.empty-state {
  display: none;
  padding: 32px;
  text-align: center;
}

.empty-state.is-visible {
  display: block;
}

.lineup-content.is-hidden {
  display: none;
}

.lineup-summary {
  align-items: stretch;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.metric {
  min-width: 150px;
  flex: 1 1 150px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 12px;
}

.metric-stack {
  flex: 0 1 420px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  margin-top: 3px;
  font-size: 1.08rem;
  font-weight: 900;
}

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

.about-panel {
  padding: 20px;
}

.about-panel-wide {
  grid-column: 1 / -1;
}

.about-panel p:last-child {
  margin-bottom: 0;
}

.contact-link {
  color: var(--accent);
  font-weight: 800;
  overflow-wrap: anywhere;
  text-underline-offset: 3px;
}

.contact-link:hover {
  text-decoration-thickness: 2px;
}

@media (max-width: 900px) {
  .site-header,
  .section-heading,
  .pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .lineup-layout,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .header-actions,
  .pagination-actions {
    width: 100%;
    justify-content: space-between;
  }

  .status-stack {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 18px;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    flex: 0 0 auto;
  }

  .toolbar,
  .field {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .icon-button {
    width: 100%;
    justify-content: center;
  }

  .filter-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
