:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #d9e1ec;
  --text: #0f172a;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --green-dark: #15803d;
  --red: #dc2626;
  --red-dark: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--bg);
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--blue);
  text-decoration: none;
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.logo {
  width: 72px;
  height: auto;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.45rem);
  font-weight: 800;
}

.title-block p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

.filters-grid,
.selectors-grid {
  display: grid;
  gap: 14px;
}

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

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

.field {
  display: grid;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field-year {
  grid-column: 1 / -1;
}

.field span {
  font-size: 0.95rem;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.results-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status-message {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fafc;
}

.status-error {
  color: var(--red-dark);
  background: #fef2f2;
  border-color: #fecaca;
}

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

.compare-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.compare-table th,
.compare-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.compare-table thead th {
  background: #f8fafc;
  font-size: 0.95rem;
}

.empty-table,
.na-cell {
  color: var(--muted);
}

.actions-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0 10px;
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button-secondary {
  background: #475569;
  color: #ffffff;
}

.button-secondary:hover {
  background: #334155;
}

.button-success {
  background: var(--green);
  color: #ffffff;
}

.button-success:hover {
  background: var(--green-dark);
}

.button-danger {
  background: var(--red);
  color: #ffffff;
}

.button-danger:hover {
  background: var(--red-dark);
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.noscript-banner {
  text-align: center;
  padding: 0 20px 20px;
  color: var(--red-dark);
  font-weight: 600;
}

@media (max-width: 980px) {
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .topbar,
  .toolbar,
  .actions-row {
    flex-direction: column;
    align-items: stretch;
  }

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