:root {
  --ink: #17202b;
  --muted: #677487;
  --panel: rgba(250, 247, 241, 0.92);
  --line: rgba(28, 39, 54, 0.10);
  --navy: #12324a;
  --teal: #137b72;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: #f5f7f8;
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
}

.dataset-shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

.dataset-header,
.dataset-summary,
.dataset-note,
.methodology-warning,
.dataset-sources,
.controls-panel,
.table-panel,
.download-panel,
.visuals-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(17, 30, 43, 0.08);
}

.dataset-header {
  padding: 22px 200px 22px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow,
.summary-label,
.control-field span {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  color: var(--muted);
}

.dataset-header h1 {
  margin: 8px 0 8px;
  font-size: clamp(1.8rem, 2.8vw, 2.8rem);
  line-height: 1.05;
}

.header-copy {
  margin: 0;
  color: #304050;
}

.back-link {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(19, 123, 114, 0.34);
  background: linear-gradient(135deg, rgba(18, 50, 74, 0.98), rgba(19, 123, 114, 0.98));
  box-shadow: 0 18px 34px rgba(19, 123, 114, 0.28);
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.back-link:hover,
.back-link:focus {
  border-color: rgba(255, 255, 255, 0.42);
  background: linear-gradient(135deg, rgba(16, 60, 88, 0.99), rgba(21, 141, 129, 0.99));
  box-shadow: 0 22px 36px rgba(19, 123, 114, 0.34);
  transform: translateY(-2px);
  outline: none;
}

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

.dataset-note {
  margin-top: 16px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(220, 244, 240, 0.96), rgba(240, 249, 247, 0.92));
}

.dataset-note p {
  margin: 8px 0 0;
  color: #304050;
  line-height: 1.5;
}

.methodology-warning {
  position: relative;
  margin-top: 16px;
  padding: 20px;
  overflow: hidden;
  border-color: rgba(176, 45, 45, 0.32);
  background:
    linear-gradient(135deg, rgba(255, 245, 221, 0.98), rgba(255, 231, 231, 0.96)),
    var(--panel);
  box-shadow: 0 20px 44px rgba(176, 45, 45, 0.16);
}

.methodology-warning::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: linear-gradient(180deg, #b02d2d, #d68622);
}

.methodology-warning .eyebrow {
  color: #8c2c20;
  font-weight: 800;
}

.methodology-warning h2 {
  margin: 8px 0 10px;
  font-size: clamp(1.45rem, 2.2vw, 2.3rem);
  line-height: 1.08;
  color: #4f201c;
}

.methodology-lede,
.methodology-impact {
  max-width: 980px;
  margin: 0;
  color: #3b2f2a;
  font-size: 1.02rem;
  line-height: 1.55;
}

.methodology-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.methodology-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: flex-start;
  min-height: 100%;
  padding: 14px;
  border: 1px solid rgba(176, 45, 45, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.methodology-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #8c2c20;
  color: #ffffff;
  font-weight: 800;
}

.methodology-step p {
  margin: 0;
  color: #3b2f2a;
  line-height: 1.5;
}

.methodology-impact {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(176, 45, 45, 0.16);
  font-weight: 800;
}

.dataset-sources {
  margin-top: 16px;
  padding: 18px;
}

.sources-copy {
  margin: 8px 0 0;
  color: #304050;
  line-height: 1.5;
}

.source-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.source-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.60);
  border: 1px solid rgba(18, 50, 74, 0.06);
}

.source-card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.2;
}

.source-card p {
  margin: 0;
  color: #304050;
  line-height: 1.5;
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 12px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(19, 123, 114, 0.16);
  background: linear-gradient(180deg, rgba(220, 244, 240, 0.96), rgba(240, 249, 247, 0.92));
  color: #0f5f58;
  text-decoration: none;
  font-weight: 700;
}

.summary-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.60);
  border: 1px solid rgba(18, 50, 74, 0.06);
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
}

.controls-panel {
  margin-top: 16px;
  padding: 18px;
  display: grid;
  grid-template-columns: 2fr 1fr 180px;
  gap: 12px;
}

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

.control-field input,
.control-field select,
.pagination button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(18, 50, 74, 0.10);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  font: inherit;
}

.table-panel {
  margin-top: 16px;
  padding: 18px;
}

.download-panel {
  margin-top: 16px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(220, 244, 240, 0.96), rgba(240, 249, 247, 0.92));
}

.download-panel h2 {
  margin: 6px 0 10px;
  line-height: 1.08;
}

.download-copy {
  margin: 0;
  color: #304050;
  line-height: 1.5;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 14px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(19, 123, 114, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 250, 249, 0.94));
  color: #0f5f58;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(19, 123, 114, 0.10);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.download-link:hover,
.download-link:focus {
  border-color: rgba(19, 123, 114, 0.30);
  background: linear-gradient(180deg, rgba(247, 253, 251, 0.98), rgba(238, 248, 246, 0.94));
  box-shadow: 0 16px 28px rgba(19, 123, 114, 0.14);
  transform: translateY(-1px);
  outline: none;
}

.visuals-panel {
  margin-top: 16px;
  padding: 18px;
}

.visuals-panel h2 {
  margin: 6px 0 10px;
  line-height: 1.08;
}

.visuals-copy {
  margin: 0;
  color: #304050;
  line-height: 1.5;
}

.visuals-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.visual-card {
  margin: 0;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(18, 50, 74, 0.06);
}

.visual-card img {
  display: block;
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(18, 50, 74, 0.08);
  background: white;
}

.visual-card figcaption {
  margin-top: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #304050;
}

.visual-card-wide {
  grid-column: 1 / -1;
}

.table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 300px);
  border-radius: 14px;
  border: 1px solid rgba(18, 50, 74, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

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

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef5f4;
  color: #0f5f58;
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(18, 50, 74, 0.07);
  white-space: nowrap;
  font-size: 0.9rem;
}

tbody tr:nth-child(even) {
  background: rgba(245, 249, 248, 0.76);
}

tbody tr:hover {
  background: rgba(220, 244, 240, 0.68);
}

@media (max-width: 1100px) {
  .dataset-summary,
  .controls-panel {
    grid-template-columns: 1fr 1fr;
  }

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

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

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

@media (max-width: 760px) {
  .dataset-shell {
    padding: 16px;
  }

  .dataset-header {
    padding: 84px 16px 18px;
  }

  .dataset-header,
  .table-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .dataset-summary,
  .controls-panel {
    grid-template-columns: 1fr;
  }

  .back-link {
    top: 14px;
    right: 16px;
    min-height: 44px;
    padding: 0 15px;
  }
}
