/* Components for the pages built on top of the base layout (layout.css, map-explorer.css).
 *
 * Contents
 *   1. Shell: banner, sidebar title, language toggle
 *   2. Map Explorer additions: source switch, filters, legend key, side panel, guided tour
 *   3. Pages in navigation order: at a glance, over time, areas in motion, charity lifespans, income concentration,
 *      company sectors, registrations, funding, causes, two registers, small areas, need and place
 */

.prototype-banner {
  background: #fff6e6;
  border-bottom: 1px solid #f0c96b;
  color: #7a5b06;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  padding: 0.5rem 1rem;
}

.sb-head--text-only .sb-title {
  margin-top: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand-d);
}

.page-body {
  padding: 1.4rem 1.6rem 2.4rem;
}

.hub-map__stat-card[disabled] {
  cursor: default;
  opacity: 0.75;
}

.hub-map__stat-card[disabled]:hover {
  transform: none;
  box-shadow: var(--shadow, 0 5px 18px rgba(42, 89, 166, 0.07));
  border-color: var(--hub-map-line);
}

.page-footer {
  text-align: center;
  color: var(--muted, #7a7570);
  font-size: 0.8rem;
  padding: 1.4rem 1rem 2rem;
}


/* ── Map data-source switch (Indicators / charities / companies / mutuals) ── */
.wm-source {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem;
  border: 1px solid var(--hub-map-line);
  border-radius: 12px;
  background: #f7f8f6;
}

.hub-map .wm-source__btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 48px;
  padding: 0.4rem 0.8rem 0.4rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--hub-map-muted);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.wm-source__btn .ic-slot { display: inline-flex; width: 18px; height: 18px; flex: 0 0 auto; }
.wm-source__btn .ic { width: 100%; height: 100%; fill: currentColor; }
.wm-source__btn strong { display: block; color: var(--hub-map-ink); font-size: 0.8rem; line-height: 1.2; }
.wm-source__btn small { display: block; font-size: 0.66rem; line-height: 1.25; }
.wm-source__btn:hover { background: #fff; }

.wm-source__btn[aria-pressed="true"] {
  border-color: #c9d6ee;
  background: #fff;
  color: var(--hub-map-green);
  box-shadow: 0 2px 8px rgba(42, 89, 166, 0.1);
}

.wm-source__btn[aria-pressed="true"] strong { color: var(--hub-map-green-dark); }
.wm-source__btn.is-loading { opacity: 0.6; cursor: progress; }

.wm-source__btn:focus-visible,
.wm-chip:focus-visible,
.wm-toggle button:focus-visible,
.wm-org-link:focus-visible,
.wm-row-btn:focus-visible {
  outline: 2px solid var(--hub-map-green);
  outline-offset: 2px;
}

/* ── Filter row above the map (org modes only) ── */
.wm-filters {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.wm-filters__row--controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}

.wm-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.hub-map .wm-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--hub-map-line);
  border-radius: 999px;
  background: #fff;
  color: var(--hub-map-muted);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.wm-chip span { color: #8b938f; font-weight: 600; font-variant-numeric: tabular-nums; }
.wm-chip:hover { border-color: #c9d6ee; }

.wm-chip[aria-pressed="true"] {
  border-color: var(--hub-map-green);
  background: var(--hub-map-green-soft);
  color: var(--hub-map-green-dark);
}

.wm-chip[aria-pressed="true"] span { color: var(--hub-map-green); }

.wm-search {
  display: flex;
  flex: 1 1 240px;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0 0.7rem;
  border: 1px solid var(--hub-map-line);
  border-radius: 9px;
  background: #fff;
  color: var(--hub-map-muted);
}

.wm-search .ic-slot { display: inline-flex; width: 13px; height: 13px; }
.wm-search .ic { width: 100%; height: 100%; fill: currentColor; }
.hub-map .wm-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--hub-map-ink); font-size: 0.8rem; }
.wm-search:focus-within { border-color: var(--hub-map-green); }

.wm-toggle { display: inline-flex; align-items: center; gap: 0.25rem; }
.wm-toggle__label { margin-right: 0.3rem; color: var(--hub-map-muted); font-size: 0.72rem; font-weight: 700; }

.hub-map .wm-toggle button {
  min-height: 30px;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--hub-map-line);
  border-radius: 7px;
  background: #fff;
  color: var(--hub-map-muted);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.wm-toggle button[aria-pressed="true"] {
  border-color: var(--hub-map-green);
  background: var(--hub-map-green);
  color: #fff;
}

.wm-check { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--hub-map-ink); font-size: 0.75rem; font-weight: 700; cursor: pointer; }
.wm-check input { accent-color: var(--hub-map-green); }

/* ── Legend: point key ── */
.wm-legend-points {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.45rem 0 0;
  padding-top: 0.45rem;
  border-top: 1px solid #edf0ee;
  color: #27332f;
  font-size: 0.7rem;
  font-weight: 700;
}

.wm-legend-points__dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 1.5px solid #fff;
  border-radius: 50%;
  background: #eb6834;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

/* ── Side panel additions ── */
.hub-map .wm-row-btn {
  font-size: 0.75rem;
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.wm-row-btn:hover { background: #f3f6fc; }

.wm-org-list { margin: 0; padding: 0; list-style: none; }
.wm-org-list li + li { border-top: 1px solid #f0eeeb; }

.hub-map .wm-org-link {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.3rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--hub-map-ink);
  text-align: left;
  cursor: pointer;
}

.wm-org-link strong { font-size: 0.76rem; line-height: 1.3; }
.wm-org-link span { color: var(--hub-map-muted); font-size: 0.7rem; }
.wm-org-link:hover { background: #f3f6fc; }
.wm-org-link:hover strong { color: var(--hub-map-green-dark); text-decoration: underline; }

.wm-source-note {
  margin: 0 1.15rem;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid #f0c96b;
  border-radius: 6px;
  background: #fff6e6;
  color: #7a5b06;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
}

.wm-panel-actions { margin: 0.9rem 1.15rem 1.15rem; }
.hub-map .wm-panel-actions .btn { font-size: 0.78rem; }

.hub-map__side-panel .hub-map__breakdowns { padding-bottom: 0.4rem; }

@media (max-width: 900px) {
  .hub-map__stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  .hub-map__layout {
    grid-template-columns: 1fr;
  }
  .page-body {
    padding: 1rem 1rem 1.8rem;
  }
}

@media (max-width: 1100px) {
  .hub-map__toolbar { flex-wrap: wrap; }
  .wm-source { width: 100%; overflow-x: auto; }
  .wm-source__btn { flex: 1 0 auto; }
}

@media (max-width: 600px) {
  .wm-source__btn small { display: none; }
  .wm-toggle__label { display: none; }
}

/* ── Branding: Welsh Data Hub / Darlun y Sector ── */
.sb-head--text-only .sb-title-cy {
  margin-top: 0.15rem;
  color: var(--brand-mid, #2a59a6);
  font-size: 0.82rem;
  font-weight: 600;
  font-style: italic;
}

.tb-title-sep { margin: 0 0.25rem; color: var(--muted); font-weight: 400; }
.tb-title-en { color: var(--muted); font-weight: 600; }

/* ── Language toggle (shows a notice only; translations are outside this prototype) ── */
.wm-lang {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.wm-lang button {
  min-height: 30px;
  padding: 0.25rem 0.8rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.wm-lang button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.wm-lang button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ── Guided tour (auto-playing demo) ── */
.wm-tour-cursor {
  position: fixed;
  z-index: 10000;
  top: 0;
  left: 0;
  width: 26px;
  height: 26px;
  pointer-events: none;
  transition: transform 0.7s cubic-bezier(0.45, 0, 0.2, 1), opacity 0.3s;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.wm-tour-cursor svg { width: 100%; height: 100%; }

.wm-tour-ripple {
  position: fixed;
  z-index: 9999;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 3px solid #eb6834;
  border-radius: 50%;
  pointer-events: none;
  animation: wm-ripple 0.6s ease-out forwards;
}

@keyframes wm-ripple {
  from { opacity: 0.9; transform: scale(0.3); }
  to { opacity: 0; transform: scale(1.4); }
}


/* Caption lives inside the sticky top bar, between title and controls, so it
   is always on screen and never covers the map. */
.wm-tour-caption {
  position: relative;
  display: flex;
  flex: 0 1 540px;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
  margin: 0 auto;
  padding: 0.5rem 0.9rem 0.6rem 0.55rem;
  border-radius: 12px;
  background: rgba(20, 74, 58, 0.97);
  box-shadow: 0 6px 18px rgba(10, 40, 30, 0.25);
  color: #fff;
  transition: opacity 0.25s, transform 0.25s;
}

.wm-tour-caption.is-changing { opacity: 0; transform: translateY(-4px); }

.wm-tour-caption__step {

  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #eb6834;
  font-size: 0.8rem;
  font-weight: 800;
}

.wm-tour-caption__text { min-width: 0; }
.wm-tour-caption__text strong { display: block; overflow: hidden; font-size: 0.86rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.wm-tour-caption__text span { display: block; overflow: hidden; margin-top: 0.05rem; color: #cfe7dd; font-size: 0.72rem; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }

.wm-tour-caption__bar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

.wm-tour-caption__bar span {
  display: block;
  width: 0;
  height: 100%;
  background: #eb6834;
  transition: width 0.5s ease;
}

.wm-tour-card {
  position: fixed;
  z-index: 10002;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 74, 58, 0.94);
  color: #fff;
  text-align: center;
  opacity: 0;
  transition: opacity 0.6s;
}

.wm-tour-card.is-visible { opacity: 1; }
.wm-tour-card p { margin: 0; }
.wm-tour-card__cy { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 800; letter-spacing: -0.03em; }
.wm-tour-card__en { margin-top: 0.4rem !important; color: #cfe7dd; font-size: clamp(1.1rem, 2.4vw, 1.6rem); font-weight: 600; }
.wm-tour-card__tag { margin-top: 1.4rem !important; color: #f6b596; font-size: 0.95rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

/* Hide the real pointer so only the tour cursor shows, except over the button that stops the tour. */
body.is-touring, body.is-touring * { cursor: none !important; }
body.is-touring [data-tour-toggle], body.is-touring [data-tour-toggle] * { cursor: pointer !important; }
body.is-touring [data-tour-toggle] { background: #eb6834; border-color: #eb6834; color: #fff; }

/* ── First-visit notice ── */
.btn-solid { background: var(--brand-d); color: #fff; }
.btn-solid:hover { background: var(--brand-mid); }

.wh-intro {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto; /* the page reset zeroes margins, which would pin the dialog to the top-left corner */
  overflow: auto;
  padding: 1.7rem 1.8rem 1.5rem;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 25, 50, 0.35);
  color: var(--ink);
}

.wh-intro::backdrop { background: rgba(15, 25, 50, 0.55); }
.wh-intro__tag { margin: 0 0 0.5rem; color: var(--brand); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.wh-intro h2 { margin: 0 0 0.8rem; color: var(--brand-d); font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }
.wh-intro p { margin: 0 0 0.8rem; font-size: 0.95rem; line-height: 1.55; }
.wh-intro__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.2rem; }
.wh-intro__actions .btn { padding: 0.65rem 1.1rem; font-size: 0.9rem; }

/* ── "About this page": a modal that shrinks to a tab on the right edge, which opens the same text as a side panel ── */
.wh-guide {
  width: min(38rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  overflow: auto;
  padding: 1.7rem 1.8rem 1.4rem;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 25, 50, 0.35);
  color: var(--ink);
}

.wh-guide::backdrop { background: rgba(15, 25, 50, 0.55); }

/* The copy that flies to the tab: the same card, placed by script over the dialog's position. */
.wh-guide--ghost { position: fixed; z-index: 10050; margin: 0; overflow: hidden; pointer-events: none; }

.wh-guide__tag { margin: 0 0 0.45rem; color: var(--brand); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.wh-guide h2 { margin: 0 0 0.35rem; color: var(--brand-d); font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }
.wh-guide h3 { margin: 1.1rem 0 0.4rem; color: var(--brand-mid); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; }
.wh-guide p { margin: 0 0 0.7rem; font-size: 0.93rem; line-height: 1.55; }
.wh-guide__question { color: var(--brand-mid); font-size: 1rem !important; font-style: italic; font-weight: 600; }
.wh-guide ul { margin: 0; padding-left: 1.15rem; }
.wh-guide li { margin-bottom: 0.4rem; font-size: 0.92rem; line-height: 1.5; }
.wh-guide__note { margin: 1rem 0 0 !important; padding: 0.7rem 0.9rem; border-radius: 10px; background: #f4f6fb; font-size: 0.86rem !important; }
.wh-guide__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin-top: 1.2rem; }
.wh-guide__actions .btn { padding: 0.65rem 1.3rem; font-size: 0.9rem; }
.wh-guide__hint { color: #5c6577; font-size: 0.8rem; }

.wh-dock { position: fixed; z-index: 2000; top: 34vh; right: 0; }
.wh-dock[hidden], .wh-dock__panel[hidden] { display: none; }
.wh-dock.is-arriving .wh-dock__tab { opacity: 0; }
body.is-touring .wh-dock { display: none; }

.wh-dock__tab {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.95rem 0.6rem;
  border: 0;
  border-radius: 12px 0 0 12px;
  background: var(--brand-d);
  box-shadow: -4px 4px 14px rgba(15, 25, 50, 0.25);
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  writing-mode: vertical-rl;
}

.wh-dock__tab:hover, .wh-dock__tab[aria-expanded="true"] { background: var(--brand-mid); }
.wh-dock__tab:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.wh-dock__tab .ic-slot { display: inline-flex; width: 1.05rem; height: 1.05rem; writing-mode: horizontal-tb; }
.wh-dock__tab .ic-slot svg { width: 100%; height: 100%; fill: currentColor; }
.wh-dock__tab.is-pulsing { animation: wh-dock-pulse 1.8s ease-out; }

@keyframes wh-dock-pulse {
  0% { box-shadow: -4px 4px 14px rgba(15, 25, 50, 0.25), 0 0 0 0 rgba(220, 91, 93, 0.75); }
  70% { box-shadow: -4px 4px 14px rgba(15, 25, 50, 0.25), 0 0 0 16px rgba(220, 91, 93, 0); }
  100% { box-shadow: -4px 4px 14px rgba(15, 25, 50, 0.25), 0 0 0 0 rgba(220, 91, 93, 0); }
}

.wh-dock__panel {
  position: fixed;
  top: 5.5rem;
  right: 3rem;
  width: min(24rem, calc(100vw - 4.5rem));
  max-height: calc(100vh - 7.5rem);
  overflow: auto;
  padding: 1.25rem 1.35rem 1.2rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 25, 50, 0.3);
  color: var(--ink);
}

.wh-dock__panel h2 { margin: 0 1.6rem 0.35rem 0; color: var(--brand-d); font-size: 1.25rem; line-height: 1.2; }
.wh-dock__panel h3 { margin: 1rem 0 0.4rem; color: var(--brand-mid); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.wh-dock__panel p { margin: 0 0 0.65rem; font-size: 0.88rem; line-height: 1.5; }
.wh-dock__panel .wh-guide__tag { margin: 0 0 0.35rem; color: var(--brand); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.wh-dock__panel .wh-guide__question { color: var(--brand-mid); font-size: 0.92rem; font-style: italic; font-weight: 600; }
.wh-dock__panel ul { margin: 0; padding-left: 1.1rem; }
.wh-dock__panel li { margin-bottom: 0.35rem; font-size: 0.86rem; line-height: 1.45; }
.wh-dock__panel .wh-guide__note { margin: 0.9rem 0 0; padding: 0.65rem 0.8rem; border-radius: 10px; background: #f4f6fb; font-size: 0.82rem; }

.wh-dock__close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0.45rem;
  border: 0;
  border-radius: 50%;
  background: #eef1f7;
  color: var(--brand-d);
  cursor: pointer;
}

.wh-dock__close:hover { background: #dfe5f1; }
.wh-dock__close .ic-slot { display: block; width: 100%; height: 100%; }
.wh-dock__close .ic-slot svg { width: 100%; height: 100%; fill: currentColor; }

@media (prefers-reduced-motion: reduce) {
  .wm-tour-cursor { transition: none; }
  .wm-tour-ripple { animation: none; opacity: 0; }
}

.hub-map__intro { margin-bottom: 1.4rem; }
.hub-map__intro p:last-child { max-width: 60rem; margin: 0.35rem 0 0; color: var(--hub-map-muted); font-size: 1.02rem; line-height: 1.5; }

.wm-tour-caption .wm-tour-caption__step { width: 28px; height: 28px; }
.wm-tour-caption__bar { left: 10px; right: 10px; height: 2px; }

/* ── Language toggle explainer ── */
.wm-lang-wrap { position: relative; }

.wm-lang-note {
  position: absolute;
  z-index: 60;
  top: calc(100% + 12px);
  right: 0;
  width: 300px;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #c9d6ee;
  box-shadow: 0 12px 30px rgba(10, 40, 30, 0.18);
  animation: wm-note-in 0.25s ease-out;
}

.wm-lang-note::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 40px;
  width: 12px;
  height: 12px;
  border-top: 1px solid #c9d6ee;
  border-left: 1px solid #c9d6ee;
  background: #fff;
  transform: rotate(45deg);
}

.wm-lang-note strong { display: block; color: var(--brand-d); font-size: 0.86rem; line-height: 1.3; }
.wm-lang-note span { display: block; margin-top: 0.2rem; color: var(--brand-mid, #2a59a6); font-size: 0.8rem; font-style: italic; font-weight: 600; }
.wm-lang-note small { display: block; margin-top: 0.45rem; color: var(--muted); font-size: 0.72rem; line-height: 1.4; }

@keyframes wm-note-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* Keep the title on one line while the tour caption shares the top bar. */
.topbar .tb-left { flex: 0 0 auto; }
.topbar .tb-title { white-space: nowrap; }
.topbar .tb-right { flex: 0 0 auto; flex-wrap: nowrap; }

/* ── At a glance: trend cards ── */
.gl {
  --gl-good: #0e8f86;
  --gl-good-bg: #dff3f1;
  --gl-bad: #a8284e;
  --gl-bad-bg: #f9e6ec;
  --gl-flat: #6b7280;
  --gl-flat-bg: #eef0f2;
  max-width: 1180px;
}

.gl-head {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-end;
  padding: 1.3rem 1.5rem; margin-bottom: 1.1rem; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-tint), var(--accent-l)); border: 1px solid #d5dff2;
}
.gl-title { margin: 0.1rem 0 0; font-size: 1.9rem; font-weight: 800; color: var(--brand-d); letter-spacing: -0.01em; }
.gl-sub { margin: 0.25rem 0 0; color: var(--body); }

.gl-controls { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.gl-area { display: grid; gap: 0.2rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--brand-mid); }
.gl-area select {
  min-height: 40px; padding: 0 0.7rem; border: 1px solid #c9d6ee; border-radius: 10px;
  background: #fff; font: inherit; font-size: 0.95rem; color: var(--ink);
}
.gl-range { display: flex; padding: 3px; gap: 2px; border-radius: 12px; background: rgba(42, 89, 166, 0.1); }
.gl-range button {
  min-height: 34px; padding: 0 0.95rem; border: 0; border-radius: 9px; background: transparent;
  color: var(--brand-d); font: inherit; font-weight: 600; cursor: pointer;
}
.gl-range button[aria-pressed="true"] { background: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(42, 89, 166, 0.3); }

.gl-chips { display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.gl-tab {
  position: relative; padding: 0.55rem 0.1rem; border: 0; background: none; font: inherit;
  font-weight: 600; color: var(--muted); cursor: pointer;
}
.gl-tab:hover { color: var(--brand-d); }
.gl-tab[aria-pressed="true"] { color: var(--brand-d); }
.gl-tab[aria-pressed="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand);
}

.gl-searchrow { margin-bottom: 1rem; }
.gl-search input {
  width: 100%; max-width: 420px; min-height: 42px; padding: 0 0.9rem; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; font: inherit;
}

.gl-summary { margin-bottom: 1.4rem; padding: 0.9rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.gl-summary:empty { display: none; }
.gl-summary__bar { display: flex; gap: 3px; height: 12px; }
.gl-seg { min-width: 0; border-radius: 6px; }
.gl-seg[style*="flex:0"] { display: none; }
.gl-seg--good { background: var(--gl-good); }
.gl-seg--flat { background: #c5cad0; }
.gl-seg--bad { background: var(--gl-bad); }
.gl-summary__key { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin: 0.6rem 0 0; font-size: 0.92rem; color: var(--body); }
.gl-key::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 0.4rem; border-radius: 3px; background: currentColor; }
.gl-key b { font-size: 1.05rem; color: var(--ink); }
.gl-key--good { color: var(--gl-good); }
.gl-key--flat { color: #9aa1a8; }
.gl-key--bad { color: var(--gl-bad); }
.gl-key span, .gl-key { color: inherit; }

.gl-section + .gl-section { margin-top: 1.8rem; }
.gl-section__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.9rem; margin-bottom: 0.7rem; }
.gl-section__head h2 { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--brand-d); }
.gl-section__head p { margin: 0; font-size: 0.88rem; color: var(--muted); }

.gl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }

.gl-card {
  position: relative; display: flex; flex-direction: column; padding: 1rem 1.05rem 0.7rem; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px; background: #fff; text-align: left;
  font: inherit; color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.gl-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gl-flat-bg); }
.gl-card--good::before { background: var(--gl-good); }
.gl-card--bad::before { background: var(--gl-bad); }
.gl-card:hover, .gl-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: #c9d6ee; }

.gl-card__top { display: flex; align-items: center; gap: 0.55rem; }
.gl-card__icon {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent-l); color: var(--brand);
}
.gl-card__icon .ic { width: 15px; height: 15px; fill: currentColor; }
.gl-card__src { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.gl-card__label { margin-top: 0.7rem; font-weight: 700; line-height: 1.25; min-height: 2.5em; }
.gl-card__value { margin-top: 0.15rem; font-size: 1.75rem; font-weight: 800; letter-spacing: -0.01em; }
.gl-card__delta { display: flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; color: var(--muted); }
.gl-card__delta b { padding: 0.12rem 0.5rem; border-radius: 999px; background: var(--gl-flat-bg); color: var(--gl-flat); white-space: nowrap; }
.gl-card__delta i { font-style: normal; }
.gl-card--good .gl-card__delta b { background: var(--gl-good-bg); color: var(--gl-good); }
.gl-card--bad .gl-card__delta b { background: var(--gl-bad-bg); color: var(--gl-bad); }

.gl-spark { position: relative; display: block; margin: 0.6rem 0 0; height: 64px; }
.gl-spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gl-spark path { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.gl-spark__past { stroke: #cfd6dc; stroke-width: 2; }
.gl-spark__now { stroke: var(--gl-flat); stroke-width: 2.5; }
.gl-spark__area { fill: var(--gl-flat-bg) !important; stroke: none; opacity: 0.8; }
.gl-card--good .gl-spark__now { stroke: var(--gl-good); }
.gl-card--good .gl-spark__area { fill: var(--gl-good-bg) !important; }
.gl-card--bad .gl-spark__now { stroke: var(--gl-bad); }
.gl-card--bad .gl-spark__area { fill: var(--gl-bad-bg) !important; }
.gl-spark__end {
  position: absolute; right: -4px; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%;
  background: var(--gl-flat); box-shadow: 0 0 0 3px #fff;
}
.gl-card--good .gl-spark__end { background: var(--gl-good); }
.gl-card--bad .gl-spark__end { background: var(--gl-bad); }

.gl-card__axis { display: flex; justify-content: space-between; margin-top: 0.3rem; font-size: 0.68rem; color: var(--faint); }
.gl-empty { color: var(--muted); }
.gl-foot { margin-top: 1.8rem; max-width: 72ch; color: var(--muted); font-size: 0.82rem; }

.gl-dialog {
  width: min(720px, calc(100vw - 2rem)); padding: 1.4rem 1.6rem 1.5rem; border: 0; border-radius: 18px;
  box-shadow: 0 24px 70px rgba(10, 40, 30, 0.3); color: var(--ink);
}
.gl-dialog::backdrop { background: rgba(14, 40, 31, 0.5); }
.gl-dialog h2 { margin: 0.1rem 0 0; font-size: 1.45rem; color: var(--brand-d); }
.gl-dialog h3 { margin: 1.1rem 0 0.2rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand-mid); }
.gl-dialog p { margin: 0.2rem 0; }
.gl-dialog__source { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.gl-dialog__area { color: var(--muted); }
.gl-dialog__close { position: absolute; top: 0.9rem; right: 0.9rem; }
.gl-dialog__close button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--accent-l); color: var(--brand-d); cursor: pointer; }
.gl-dialog__close .ic { width: 14px; height: 14px; fill: currentColor; }
.gl-dialog__readout { display: flex; gap: 0.7rem; align-items: baseline; margin-top: 0.6rem; }
.gl-dialog__readout strong { font-size: 1.8rem; }
.gl-dialog__readout span { color: var(--muted); }
.gl-dialog__note { margin-top: 1rem; font-size: 0.8rem; color: #7a5b06; }

.gl-c { width: 100%; height: auto; display: block; }
.gl-c__grid { stroke: var(--line); stroke-width: 1; }
.gl-c__tick { font-size: 11px; fill: var(--muted); }
.gl-c__base { fill: none; stroke: #cfd6dc; stroke-width: 2; }
.gl-c__hl { fill: none; stroke: var(--gl-flat); stroke-width: 3; stroke-linecap: round; }
.gl-c__hl--good { stroke: var(--gl-good); }
.gl-c__hl--bad { stroke: var(--gl-bad); }
.gl-c__cursor { stroke: var(--brand-d); stroke-width: 1; stroke-dasharray: 3 3; }
.gl-c__dot { fill: var(--brand-d); }

@media (max-width: 640px) {
  .page-body { padding: 1rem 16px 2rem; }
  .gl-head { padding: 1rem; }
  .gl-title { font-size: 1.5rem; }
}

/* ── dialog centring (the global reset zeroes the browser's auto margins) ── */
.gl-dialog { margin: auto; max-height: calc(100vh - 2rem); overflow-y: auto; }

/* ── Over time: animated map ── */
.tl-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 960px) { .tl-layout { grid-template-columns: 1fr; } }

.tl-map { height: 540px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #eef1f5; }
.tl-legend { display: flex; align-items: center; gap: 0.7rem; margin: 0.7rem 0; font-size: 0.82rem; color: var(--muted); }
.tl-legend__bar { flex: 1; max-width: 260px; height: 10px; border-radius: 5px; }

.tl-player { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.tl-play {
  display: grid; place-items: center; width: 52px; height: 52px; flex: none; border: 0; border-radius: 50%;
  background: var(--brand); color: #fff; cursor: pointer; box-shadow: 0 4px 12px rgba(220, 91, 93, 0.35);
}
.tl-play:hover { filter: brightness(1.06); }
.tl-play svg { width: 24px; height: 24px; fill: currentColor; }
.tl-scrub { flex: 1; min-width: 200px; }
.tl-scrub input { width: 100%; accent-color: var(--brand); }
.tl-scrub__ends { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--faint); }

.tl-side { padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.tl-when { margin: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--brand-mid); }
.tl-total { margin: 0.1rem 0 0; font-size: 2.4rem; font-weight: 800; letter-spacing: -0.02em; color: var(--brand-d); font-variant-numeric: tabular-nums; }
.tl-total__label { margin: 0; color: var(--muted); font-size: 0.88rem; }
.tl-change { margin: 0.4rem 0 0.6rem; font-size: 0.88rem; color: var(--body); }
.tl-change b { padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--gl-flat-bg); }
.tl-trend svg { width: 100%; height: 70px; display: block; overflow: visible; }
.tl-trend__line { fill: none; stroke: #c3cde0; stroke-width: 2; vector-effect: non-scaling-stroke; }
.tl-trend__done { fill: none; stroke: var(--brand-mid); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.tl-trend__dot { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--brand-mid); box-shadow: 0 0 0 3px #fff; pointer-events: none; }

.tl-rank__title { margin: 1rem 0 0.5rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand-mid); }
.tl-rank { position: relative; }
.tl-row {
  position: absolute; left: 0; right: 0; height: 22px; display: grid; grid-template-columns: 118px 1fr 58px; align-items: center; gap: 0.5rem;
  font-size: 0.78rem; transition: transform 0.35s ease;
}
.tl-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-row__track { height: 9px; border-radius: 5px; background: #eef1f5; overflow: hidden; }
.tl-row__bar { height: 100%; border-radius: 5px; transition: width 0.35s ease; }
.tl-row__val { text-align: right; font-variant-numeric: tabular-nums; color: var(--body); }

/* ── Areas in motion: bubble chart ── */
.bm { --r-north: #2a78d6; --r-mid_west: #eb6834; --r-swansea_bay: #1baf7a; --r-cardiff_capital: #6250d6; max-width: 1180px; }
.bm-legend { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.9rem; }
.bm-key {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 36px; padding: 0 0.9rem; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; font: inherit; color: var(--ink); cursor: pointer;
}
.bm-key::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.bm-key[aria-pressed="true"] { border-color: var(--c); box-shadow: 0 0 0 2px var(--c) inset; font-weight: 700; }

.bm-chartwrap { position: relative; margin-bottom: 1rem; padding: 0.5rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.bm-svg { display: block; width: 100%; height: auto; touch-action: manipulation; }
.bm-year {
  position: absolute; right: 2.2rem; bottom: 4.2rem; margin: 0; font-size: clamp(2.4rem, 6vw, 4.6rem); font-weight: 800;
  line-height: 1; letter-spacing: -0.03em; color: rgba(35, 74, 148, 0.09); pointer-events: none; font-variant-numeric: tabular-nums;
}
.bm-grid { stroke: var(--line); stroke-width: 1; }
.bm-axis { stroke: #b8c0cc; stroke-width: 1; }
.bm-tick { font-size: 11px; fill: var(--muted); }
.bm-title { font-size: 12px; font-weight: 700; fill: var(--body); }
.bm-avg { stroke: var(--brand-d); stroke-width: 1.2; stroke-dasharray: 2 4; opacity: 0.55; }
.bm-avgtext { font-size: 10.5px; fill: var(--brand-d); }
.bm-node { cursor: pointer; transition: opacity 0.2s; }
.bm-node:focus { outline: none; }
.bm-node:focus-visible .bm-dot { stroke: var(--ink); stroke-width: 3; }
.bm-dot { stroke: #fff; stroke-width: 2; fill-opacity: 0.82; }
.bm-node.is-dim { opacity: 0.1; pointer-events: none; }
.bm-node.is-on .bm-dot { stroke: var(--ink); stroke-width: 2.5; fill-opacity: 0.95; }
.bm-label { font-size: 11.5px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3.5px; pointer-events: none; }
.bm-trail { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.55; pointer-events: none; }

.bm-tip {
  position: absolute; z-index: 5; min-width: 190px; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; box-shadow: 0 8px 24px rgba(20, 40, 80, 0.18); font-size: 0.82rem; pointer-events: none;
}
.bm-tip strong { display: block; font-size: 0.95rem; }
.bm-tip span { display: block; color: var(--muted); }
.bm-tip b { font-size: 1.05rem; color: var(--ink); }
.bm-tip i { font-style: normal; color: var(--muted); }

.bm-hint { margin: 0.8rem 0 0; color: var(--muted); font-size: 0.85rem; }
.bm-table { margin-top: 1rem; }
.bm-table summary { cursor: pointer; font-weight: 700; color: var(--brand-d); }
.bm-table table { width: 100%; margin-top: 0.6rem; border-collapse: collapse; font-size: 0.85rem; }
.bm-table th, .bm-table td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
.bm-table td:nth-child(n+3), .bm-table th:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Shared chart cards (lifespans, income concentration) ── */
.ls, .mn { max-width: 1180px; }
.ls-card { position: relative; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.ls-svg { display: block; width: 100%; height: auto; }
.ls-note { margin: 0 0 0.8rem; padding: 0.5rem 0.8rem; border-radius: 10px; background: #fff6e6; color: #7a5b06; font-size: 0.85rem; }

/* ── Charity lifespans ── */
.ls-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.ls-stat { padding: 0.9rem 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.ls-stat__v { margin: 0; font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; color: var(--brand-d); }
.ls-stat__l { margin: 0; color: var(--body); font-weight: 600; }
.ls-stat__s { margin: 0.15rem 0 0; font-size: 0.78rem; color: var(--muted); }

.ls-heat { display: grid; grid-template-columns: 112px repeat(15, minmax(34px, 1fr)); gap: 2px; font-size: 0.78rem; }
.ls-heat__corner { align-self: end; padding-bottom: 0.3rem; color: var(--muted); font-size: 0.72rem; }
.ls-heat__col { text-align: center; padding-bottom: 0.3rem; color: var(--muted); font-weight: 700; }
.ls-heat__axis { grid-column: 2 / -1; text-align: center; margin-bottom: 0.2rem; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.ls-heat__row { display: flex; align-items: center; justify-content: space-between; padding-right: 0.5rem; font-weight: 700; color: var(--ink); }
.ls-heat__row small { font-weight: 400; color: var(--muted); }
.ls-cell { display: grid; place-items: center; min-height: 32px; border-radius: 4px; font-variant-numeric: tabular-nums; font-weight: 600; cursor: default; }
.ls-cell:focus-visible, .ls-cell:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.ls-cell--empty { background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 4px, #eceef1 4px, #eceef1 8px); }
.ls-curves__wrap { padding: 0.2rem; }
.ls-curves__key { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; margin-top: 0.4rem; font-size: 0.8rem; color: var(--muted); }
.ls-curves__ramp { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #1c3a70, #a9bde4); }
.ls-curves__all { margin-left: auto; color: var(--brand); font-weight: 700; }
.ls-curves__all::before { content: ""; display: inline-block; width: 22px; border-top: 3px solid var(--brand); margin-right: 0.4rem; vertical-align: middle; }
.ls-line { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: opacity 0.15s; }
.ls-line.is-dim { opacity: 0.18; }
.ls-line.is-on { stroke-width: 3.2; }
.ls-all { fill: none; stroke: var(--brand); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.ls-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }

/* ── Income concentration ── */
.mn-player { margin-bottom: 1rem; }
.mn-sub { margin: 0; color: var(--muted); font-size: 0.82rem; }
.mn-headline { margin: 0 0 1.1rem; max-width: 78ch; font-size: 1.25rem; line-height: 1.4; color: var(--ink); }
.mn-headline b { color: var(--brand-d); }
.mn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; position: relative; }
.mn-wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .mn-grid { grid-template-columns: 1fr; } }
.mn-h { margin: 0 0 0.4rem; font-size: 1rem; color: var(--brand-d); }
.mn-key { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin-bottom: 0.4rem; font-size: 0.8rem; color: var(--muted); }
.mn-k::before, .mn-bk::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 0.4rem; border-radius: 3px; vertical-align: -1px; background: var(--c); }
.mn-k--c { --c: #2a78d6; } .mn-k--i { --c: #eb6834; }
.mn-gini { margin: 0 0 0.3rem; font-size: 0.85rem; color: var(--muted); }
.mn-gini b { color: var(--ink); font-size: 1.1rem; }
.mn-lbl { font-size: 12px; font-weight: 700; fill: var(--ink); }
.mn-sublbl { font-size: 10.5px; fill: var(--muted); }
.mn-val { font-size: 11px; font-weight: 700; fill: var(--ink); }
.mn-bar { cursor: pointer; }
.mn-bar:hover { filter: brightness(1.08); }
.mn-col { cursor: pointer; transition: opacity 0.2s; }

/* ── Company sectors ── */
.sc { position: relative; max-width: 1180px; }
.sc-card { margin-bottom: 1rem; }
.sc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.4rem; }
.sc-sub { margin: 0; max-width: 80ch; font-size: 0.85rem; color: var(--muted); }
.sc-svg { outline: none; }
.sc-svg:focus-visible { outline: 2px solid var(--brand-mid); outline-offset: 2px; border-radius: 6px; }
.sc-tip { min-width: 230px; }
.sc-tip .sc-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.15rem; }
.sc-tip .sc-row::before { content: ""; width: 14px; border-top: 3px solid var(--c); }
.sc-tip .sc-row b { margin-left: auto; padding-left: 0.6rem; }
.sc-area { stroke: #fff; stroke-width: 1.5; }
.sc-band { transition: opacity 0.15s; }
.sc-lbl { font-size: 12px; font-weight: 600; fill: var(--ink); }
.sc-pos { fill: #2a78d6; }
.sc-neg { fill: #eb6834; }
.sc-heat { display: grid; grid-template-columns: 190px repeat(22, minmax(30px, 1fr)); gap: 2px; font-size: 0.72rem; }
.sc-heat__col { height: 118px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; }
.sc-heat__col span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; color: var(--body); font-size: 0.74rem; }
.sc-heat__row { display: flex; align-items: center; font-weight: 600; color: var(--ink); font-size: 0.8rem; padding-right: 0.4rem; }
.sc-cell { display: grid; place-items: center; min-height: 30px; border-radius: 4px; font-variant-numeric: tabular-nums; font-weight: 600; }
.sc-cell:hover, .sc-cell:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.sc-heatkey { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.7rem; font-size: 0.78rem; color: var(--muted); }
.sc-heatkey__bar { width: 200px; height: 9px; border-radius: 5px; background: linear-gradient(90deg, #eb6834, #eef0f3 50%, #2a78d6); }
.sc-card .bm-tip { z-index: 5; }

/* ── Company sectors: fingerprint chart ── */
.sc-when { margin: 0; font-size: 1.5rem; font-weight: 800; color: var(--brand-d); font-variant-numeric: tabular-nums; }
.fp { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(240px, 1fr); gap: 1.2rem; align-items: center; margin: 0.4rem 0 0.8rem; }
@media (max-width: 960px) { .fp { grid-template-columns: 1fr; } }
.fp-key { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; margin-bottom: 0.2rem; font-size: 0.8rem; color: var(--muted); }
.fp-k::before { content: ""; display: inline-block; width: 18px; margin-right: 0.4rem; vertical-align: middle; border-top: 3px solid var(--c); }
.fp-k--c { --c: #2a78d6; } .fp-k--g { --c: #eb6834; }
.fp-k--s::before { border-top: 2px dotted #6b7280; }
.fp-k--m::before { border-top: 3px solid #6b7280; width: 10px; }
.fp-side { padding: 1rem 1.1rem; border-radius: 14px; background: var(--accent-tint); border: 1px solid #dbe4f5; }
.fp-side h3 { margin: 0 0 0.5rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--brand-mid); }
.fp-line { margin: 0 0 0.8rem; padding-left: 0.7rem; border-left: 4px solid var(--c); }
.fp-line strong { display: block; margin-bottom: 0.15rem; color: var(--ink); }
.fp-line span { display: block; font-size: 0.84rem; color: var(--body); line-height: 1.35; margin-bottom: 0.15rem; }
.fp-note { margin: 0; font-size: 0.84rem; color: var(--muted); }
.sc-caption { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--muted); }

/* ── Registrations (Wales fills in) ── */
.pw { max-width: 1180px; }
.pw-check { display: flex; align-items: center; gap: 0.45rem; min-height: 40px; font-weight: 600; color: var(--brand-d); cursor: pointer; }
.pw-check input { accent-color: var(--brand); width: 17px; height: 17px; }
.pw-map { height: 580px; }
.pw-legend { flex-wrap: wrap; }
.pw-spacer { flex: 1; }
.pw-dot::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 0.4rem; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #c5ccd8; vertical-align: -1px; }
.pw-dot--c::before { background: #2a78d6; }
.pw-dot--o::before { background: #eb6834; }
.pw-ramp { width: 140px; height: 9px; border-radius: 5px; background: linear-gradient(90deg, #f1f2f6, #c8cddd, #7f89ad); }
.pw-year { font-size: 3rem; }
.pw-sub { margin: 0 0 0.6rem; font-size: 0.8rem; color: var(--muted); }
.pw-groups { display: grid; gap: 0.55rem; }
.pw-g__top { display: flex; justify-content: space-between; font-size: 0.82rem; }
.pw-g__top b { font-variant-numeric: tabular-nums; }
.pw-g__track { position: relative; height: 12px; border-radius: 6px; background: #eef1f5; }
.pw-g__bar { height: 100%; border-radius: 6px; transition: width 0.25s ease; }
.pw-g__avg { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: 0.55; }
.pw-recent { list-style: none; margin: 0; padding: 0; font-size: 0.82rem; min-height: 9.5em; }
.pw-recent li { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.22rem 0; border-bottom: 1px solid var(--line); animation: pw-in 0.4s ease; }
.pw-recent li::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.pw-recent small { margin-left: auto; color: var(--muted); }
@keyframes pw-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pw-ind select { max-width: 330px; }
.pw-legend [data-range] { color: var(--ink); font-weight: 600; }
.gl-note { margin: 1rem 0 0; max-width: 78ch; padding: 0.6rem 0.9rem; border-radius: 10px; background: var(--accent-tint); border: 1px solid #dbe4f5; color: var(--body); font-size: 0.85rem; }
.gl-note:empty { display: none; }

/* ── Charity lifespans: removal reasons ── */
.rm { margin-top: 1rem; }
.rm-key { display: flex; gap: 1.2rem; margin: 0.3rem 0 0.6rem; font-size: 0.8rem; color: var(--muted); }
.rm-k::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 0.4rem; border-radius: 3px; vertical-align: -1px; }
.rm-k--w::before { background: #2a78d6; } .rm-k--e::before { background: #9aa3ad; }
.rm-row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 1fr; gap: 0.7rem; align-items: center; padding: 0.3rem 0; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.rm-bar { position: relative; display: flex; align-items: center; gap: 0.5rem; height: 16px; }
.rm-bar span { display: block; height: 100%; border-radius: 4px; min-width: 2px; }
.rm-bar--w span { background: #2a78d6; } .rm-bar--e span { background: #9aa3ad; }
.rm-bar b { font-variant-numeric: tabular-nums; }

/* ── Need and place ── */
.np { position: relative; max-width: 1180px; }
.np-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 900px) { .np-grid { grid-template-columns: 1fr; } }
.np-key { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin-top: 0.3rem; font-size: 0.78rem; color: var(--muted); }
.np-k::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 0.4rem; border-radius: 3px; vertical-align: -1px; background: var(--c); }

/* ── Two registers ── */
.ov { position: relative; max-width: 1180px; }
.ov-top { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 900px) { .ov-top { grid-template-columns: 1fr; } }
.ov .sc-card { margin-bottom: 0; }
.ov .np-grid, .ov .ls-card + .ls-card { margin-top: 1rem; }
.ov-big { font-size: 24px; font-weight: 800; fill: var(--ink); }
.ov-small { font-size: 12px; fill: var(--body); }
.ov-facts { display: grid; align-content: center; gap: 1rem; }
.ov-fact b { display: block; font-size: 1.8rem; line-height: 1.1; color: var(--brand-d); }
.ov-fact span { font-size: 0.88rem; color: var(--body); }
.ov-h2 { margin-top: 1rem; }
.ov-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ov-table th, .ov-table td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
.ov-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Funding ── */
.fd { position: relative; max-width: 1180px; }
.fd .sc-card, .fd .np-grid { margin-bottom: 1rem; }
.fd-ribbon { transition: fill-opacity 0.15s; }

/* ── Causes ── */
.cs { position: relative; max-width: 1180px; }
.cs .sc-card { margin-bottom: 1rem; }
.cs-multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.8rem; margin-top: 0.6rem; }
.cs-cell { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.cs-cell:hover, .cs-cell:focus-visible { border-color: #c9d6ee; box-shadow: var(--shadow); outline: none; }
.cs-cell strong { font-size: 0.88rem; line-height: 1.2; min-height: 2.4em; }
.cs-mom { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.cs-mom.up { color: #1a7f5a; } .cs-mom.down { color: #b4521f; }
.cs-spark { width: 100%; height: 54px; margin: 0.2rem 0; overflow: visible; }
.cs-cell small { color: var(--muted); font-size: 0.74rem; }
.sc-h3 { margin: 1.2rem 0 0.2rem; font-size: 0.95rem; color: var(--brand-d); }
.pw-dot--m::before { background: #1baf7a; }
.np-grid--tight { gap: 1.2rem; }

/* ── Small areas ── */
.sa { max-width: 1180px; }
.sa-map { height: 620px; }
.sa-shade select { min-width: 300px; }
.sa-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 0.7rem; margin: 0.7rem 0 0.3rem; font-size: 0.82rem; color: var(--muted); }
.sa-ramp { width: 220px; height: 10px; border-radius: 5px; }
.sa-dots { margin-top: 0.3rem; }
.sa-h { font-size: 1.7rem; line-height: 1.15; }
.sa-note { margin: 0.5rem 0; font-size: 0.8rem; color: var(--muted); }
.sa-row { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 0.5rem; margin: 0.28rem 0; font-size: 0.82rem; }
.sa-track { height: 9px; border-radius: 5px; background: #eef1f5; overflow: hidden; } .sa-track span { display: block; height: 100%; border-radius: 5px; }
.sa-row b { text-align: right; font-variant-numeric: tabular-nums; }
.sa-org { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.sa-org span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 0.45rem; border-radius: 50%; background: var(--c); }
.sa-panel { max-height: 700px; overflow-y: auto; }

/* ── Registrations: organisation-type toggles ── */
.pw-types { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pw-type {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 40px; padding: 0 0.95rem; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
}
.pw-type::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--c); opacity: 0.35; }
.pw-type--charity { --c: #2a78d6; } .pw-type--company { --c: #eb6834; } .pw-type--mutual { --c: #1baf7a; }
.pw-type[aria-pressed="true"] { color: var(--ink); border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.pw-type[aria-pressed="true"]::before { opacity: 1; }

/* ── Sidebar section headings ── */
.sb-section {
  margin: 1.1rem 0.8rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.sb-section:first-child { margin-top: 0.4rem; }
