:root {
  --brand: #014b96;
  --brand-soft: #eef7f9;
  --ink: #1d2733;
  --muted: #6b7785;
  --line: #e3e7ec;
  --bs-primary: var(--brand);
  --bs-primary-rgb: 1, 75, 150;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 1, 75, 150;
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f7f9fb;
}

[x-cloak] { display: none !important; }

/* Header / nav */
.site-header {
  background: #fff;
  border-bottom: 3px solid var(--brand);
}
.site-nav .nav-link {
  color: var(--brand);
  font-weight: 600;
  border-radius: 0;
  padding: 0.55rem 1.5rem;
  background: var(--brand-soft);
  margin-right: 1px;
}
.site-nav .nav-link:hover { background: #dcedf2; }
.site-nav .nav-link.active { background: var(--brand); color: #fff; }

.site-footer {
  color: var(--brand);
  font-weight: 700;
  font-size: 0.875rem;
}

/* Bootstrap primary buttons in brand colour */
.btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand);
  --bs-btn-active-border-color: var(--brand);
  --bs-btn-disabled-color: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
}

/* Filters sidebar */
.filters {
  background: var(--brand-soft);
  padding: 1rem 1.1rem;
  border-radius: 0.5rem;
  position: sticky;
  top: 1rem;
}
.filter-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
  margin-bottom: 0.35rem;
}
.filter-list {
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.875rem;
}
.filter-list .form-check { margin-bottom: 0.1rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* Stat tiles */
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
}
.stat-label { font-size: 0.8rem; color: var(--muted); }
.stat-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Table */
.data-table {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  transition: opacity 0.15s;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}
.data-table tfoot th { background: var(--brand-soft); border-top: 2px solid var(--brand); }
.data-table td, .data-table th { padding: 0.45rem 0.75rem; }
.num { font-variant-numeric: tabular-nums; }
.is-loading { opacity: 0.5; pointer-events: none; }

/* Map */
.map {
  height: 72vh;
  min-height: 420px;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: #dfe9ef;
}
.map-legend {
  background: #fff;
  padding: 0.5rem 0.7rem;
  border-radius: 0.375rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  font-size: 0.78rem;
  line-height: 1.5;
}
.map-legend-title { font-weight: 700; margin-bottom: 0.2rem; }
.map-legend i {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.popup-table th { font-weight: 500; color: var(--muted); padding-right: 0.8rem; }
.popup-table td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* IPC phase badge (colours set inline from IPC_PHASES) */
.phase-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.stat-value .phase-badge { font-size: 0.8rem; }
