:root {
  --color-red-dark: #780000;
  --color-red-bright: #c1121f;
  --color-beige: #fdf0d5;
  --color-blue-deep: #003049;
  --color-blue-gray: #669bbc;
  --color-white: #ffffff;
  --color-text: #1f2933;
  --border: rgba(0, 48, 73, 0.12);
  --shadow: 0 8px 24px rgba(0, 48, 73, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--color-text);
  background: linear-gradient(180deg, var(--color-beige) 0%, #ffffff 72%);
  line-height: 1.6;
}

.app-shell {
  width: min(94%, 1120px);
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.app-header {
  padding: 2rem 0 1rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--color-blue-deep);
  text-decoration-thickness: 2px;
  font-weight: 600;
}

.kicker {
  margin: 0 0 0.25rem;
  color: var(--color-red-bright);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  font-size: 0.82rem;
}

h1,
h2,
h3 {
  color: var(--color-blue-deep);
  line-height: 1.2;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.35rem);
}

h2 {
  margin: 0 0 0.8rem;
}

h3 {
  margin: 0.2rem 0 0.55rem;
}

.subtitle {
  max-width: 820px;
  margin-top: 0.75rem;
  color: var(--color-red-dark);
  font-weight: 600;
  font-size: 1.05rem;
}

.panel {
  background: var(--color-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow);
  margin-top: 1rem;
}

.intro-panel p,
.note,
.section-heading p,
.next-card p {
  color: #52616f;
}

.info-grid,
.filters-grid,
.summary-grid,
.next-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.info-grid {
  margin-top: 1rem;
}

.mini-card {
  grid-column: span 4;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(253, 240, 213, 0.34);
}

.metric-label {
  display: block;
  color: #52616f;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.mini-card strong {
  display: block;
  color: var(--color-blue-deep);
  font-size: 1.45rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.filters-grid {
  margin-top: 1rem;
}

.filters-grid label {
  grid-column: span 3;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 700;
  color: var(--color-blue-deep);
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.72rem 0.8rem;
  font: inherit;
  background: #fff;
  color: var(--color-text);
}

input:focus,
select:focus {
  outline: 3px solid rgba(102, 155, 188, 0.28);
  border-color: var(--color-blue-gray);
}

.table-toolbar {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.status-text {
  margin: 0;
  color: #52616f;
  font-weight: 700;
}

.table-wrap {
  margin-top: 0.85rem;
  overflow-x: auto;
}

.table-wrap.compact {
  max-height: 420px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.summary-card table {
  min-width: 420px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.7rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--color-blue-deep);
  background: rgba(102, 155, 188, 0.12);
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  color: var(--color-text);
}

td small {
  color: #52616f;
}

.topic-cell,
.document-cell {
  min-width: 220px;
}

.btn {
  border: 0;
  cursor: pointer;
  text-decoration: none;
  padding: 0.72rem 1.05rem;
  border-radius: 10px;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.btn-outline {
  background: transparent;
  color: var(--color-blue-deep);
  border: 1px solid var(--color-blue-deep);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn:not(:disabled):hover,
.btn:not(:disabled):focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.pagination {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

#pageIndicator {
  font-weight: 700;
  color: var(--color-blue-deep);
}

.plot {
  width: 100%;
  height: 560px;
  margin-top: 1rem;
}

.map-plot {
  height: 600px;
}

.summary-card,
.next-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
}

.country-summary-card,
.right-summary-stack,
.next-card {
  grid-column: span 6;
}

.right-summary-stack {
  display: grid;
  gap: 1rem;
}

.right-summary-stack .summary-card {
  width: 100%;
}

.small-summary-table {
  max-height: none;
}

.next-card {
  background: rgba(253, 240, 213, 0.28);
}

.inline-link {
  color: var(--color-red-bright);
  text-decoration-thickness: 2px;
  font-weight: 700;
}

.inline-link:hover {
  color: var(--color-red-dark);
}

.app-message {
  margin-top: 1rem;
  color: var(--color-red-bright);
  font-weight: 700;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(102, 155, 188, 0.16);
  color: var(--color-blue-deep);
  font-size: 0.82rem;
  font-weight: 700;
}

@media (max-width: 860px) {
  .mini-card,
  .filters-grid label,
  .country-summary-card,
  .right-summary-stack,
  .next-card {
    grid-column: span 12;
  }
  
  .panel {
    padding: 1rem;
  }

  .plot,
  .map-plot {
    height: 460px;
  }

  table {
    min-width: 760px;
  }
}