/* Data playground (pages/playground.php). Uses the site colour names, so the dark theme works as is. */
.pg-sources { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 22px 0 0; }
.pg-sources a { display: inline-block; padding: 5px 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 50px;
  color: rgba(255,255,255,.85); font-size: .8rem; text-decoration: none; }
.pg-sources a:hover { color: #fff; border-color: rgba(255,255,255,.5); }

.pg-section { padding-top: 48px; }
.pg { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.pg > * { min-width: 0; }
.pg-panel, .pg-main { background: var(--white); border: 1px solid var(--line); border-radius: 16px; }
.pg-panel { padding: 20px; position: sticky; top: 88px; display: grid; gap: 20px; }
.pg-main { padding: 22px 24px; min-width: 0; }

/* Left panel */
.pg-area { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pg-area legend, .pg-field > label { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.pg-area label { display: grid; gap: 2px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: .88rem; color: var(--text); }
.pg-area label small { color: var(--text-muted); font-size: .72rem; }
.pg-area input { position: absolute; opacity: 0; pointer-events: none; }
.pg-area label:has(input:checked) { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 10%, transparent); }
.pg-area label:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 2px; }
.pg-field { display: grid; gap: 8px; }
.pg-field input[type=search], .pg-field input[type=text], .pg-field select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: 8px; font: inherit; font-size: .88rem;
  background: var(--white); color: var(--text); }
.pg-hint { color: var(--text-muted); font-size: .74rem; line-height: 1.4; }
.pg-field-head { display: flex; justify-content: space-between; align-items: baseline; }
.pg-field-head label { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.pg-search { position: relative; }
.pg-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .8rem; pointer-events: none; }
.pg-field .pg-search input { padding-left: 32px; border-radius: 10px; }
.pg-topics { display: flex; flex-wrap: wrap; gap: 5px; }
.pg-topic { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 50px;
  background: none; color: var(--text-muted); font: inherit; font-size: .74rem; cursor: pointer; transition: background .15s, color .15s; }
.pg-topic i { font-size: .7rem; opacity: .8; }
.pg-topic:hover { color: var(--teal); border-color: var(--teal); }
.pg-topic[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }

/* Measure list: one row per measure, a small source tag on the right */
.pg-mlist { position: relative; max-height: 330px; overflow-y: auto; margin: 2px -6px 0; padding: 0 6px 4px; scrollbar-width: thin;
  mask-image: linear-gradient(180deg, #000 calc(100% - 24px), transparent); -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 24px), transparent); }
.pg-mgroup { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 7px; margin: 0; padding: 10px 4px 6px;
  background: var(--white); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--text-muted); }
.pg-mgroup i { width: 18px; height: 18px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .62rem; color: var(--teal); background: color-mix(in srgb, var(--teal) 14%, transparent); }
.pg-mitem { display: flex; align-items: flex-start; gap: 8px; padding: 7px 9px; margin: 1px 0; border-radius: 9px; cursor: pointer;
  font-size: .85rem; line-height: 1.35; color: var(--text); border: 1px solid transparent; transition: background .12s; }
.pg-mitem:hover { background: var(--gray-100); }
.pg-mitem input { position: absolute; opacity: 0; pointer-events: none; }
.pg-mitem:has(input:checked) { background: color-mix(in srgb, var(--teal) 12%, transparent); border-color: color-mix(in srgb, var(--teal) 45%, transparent); }
.pg-mitem:has(input:checked) .pg-mname { color: var(--teal); font-weight: 600; }
.pg-mitem:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 1px; }
.pg-mname { flex: 1; }
.pg-src { flex-shrink: 0; margin-top: 1px; font-size: .62rem; font-weight: 600; letter-spacing: .02em; padding: 2px 6px; border-radius: 5px; }
.pg-src-wb   { background: #E8F0FB; color: #1A5FA8; }
.pg-src-who  { background: #E6F4F1; color: #0A7A6B; }
.pg-src-owid { background: #FBF3E3; color: #8A5A0F; }
.pg-src-cdc  { background: #FDECEC; color: #A1241A; }
html[data-theme="dark"] .pg-src-wb   { background: #1A2D4A; color: #A3C8F5; }
html[data-theme="dark"] .pg-src-who  { background: #123A36; color: #7EE8D7; }
html[data-theme="dark"] .pg-src-owid { background: #3A2E14; color: #F5C46B; }
html[data-theme="dark"] .pg-src-cdc  { background: #3A1E22; color: #FFB4AB; }
.pg-empty { padding: 14px 6px; color: var(--text-muted); font-size: .82rem; }
.pg-topic:focus-visible, .pg-btn:focus-visible, .pg-x:focus-visible, .pg-tile:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.pg-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pg-chips li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px; border: 1px solid var(--line); border-radius: 50px; font-size: .8rem; color: var(--text); }
.pg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--chip); }
.pg-x { border: 0; background: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 5px; border-radius: 50%; }
.pg-x:hover { color: var(--red, #B42318); background: var(--gray-100); }
.pg-add { display: flex; gap: 6px; }
.pg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--white); color: var(--text); font: inherit; font-size: .82rem; cursor: pointer; white-space: nowrap; }
.pg-btn:hover { border-color: var(--teal); color: var(--teal); }

/* Right side */
.pg-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.pg-head h2 { font-size: 1.35rem; margin: 0 0 6px; color: var(--text); }
.pg-desc { margin: 0; color: var(--text-muted); font-size: .88rem; line-height: 1.55; max-width: 680px; }
.pg-actions { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
.pg-year { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 8px; font-size: .86rem; color: var(--text); }
.pg-year[hidden] { display: none; }
.pg-year input[type=range] { flex: 1; min-width: 180px; accent-color: var(--teal); }
.pg-order { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.pg-order[hidden] { display: none; }
.pg-status { min-height: 1.2em; margin: 0 0 8px; font-size: .8rem; color: var(--text-muted); }
.pg-status.is-err { color: var(--red, #B42318); }
.pg-canvas { position: relative; height: 420px; }
.pg-canvas-tall { height: 560px; }
.pg-canvas-short { height: 220px; }
.pg-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.pg-inline[hidden] { display: none; }
.pg-inline select { padding: 5px 8px; border: 1px solid var(--gray-200); border-radius: 8px; background: var(--white); color: var(--text); font: inherit; font-size: .84rem; max-width: 280px; }
.pg-x-pick { flex-basis: 100%; }
.pg-x-pick select { flex: 1; max-width: 420px; }

/* Snapshot cards */
.pg-cards { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pg-card { position: relative; display: grid; gap: 2px; padding: 12px 14px 10px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--chip) 9%, transparent), transparent 60%); }
.pg-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--chip); }
.pg-card-name { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-card-val { font-size: 1.45rem; font-weight: 600; color: var(--text); line-height: 1.15; letter-spacing: -.01em; }
.pg-card-unit { font-size: .68rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-card-ch { font-size: .72rem; font-weight: 600; margin-top: 2px; }
.pg-card-ch.is-up { color: var(--teal); }
.pg-card-ch.is-down { color: var(--red, #B42318); }
html[data-theme="dark"] .pg-card-ch.is-down { color: #FF8A80; }
.pg-card-ch.is-flat { color: var(--text-muted); }
.pg-card svg { width: 100%; height: 34px; margin-top: 4px; }
.pg-card-none { font-size: .8rem; color: var(--text-muted); padding: 12px 0; }

.pg-sub { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.pg-sub h3 { font-size: .95rem; margin: 0 0 2px; color: var(--text); }
.pg-sub p { margin: 0 0 8px; font-size: .78rem; color: var(--text-muted); }
.pg-fit { margin: 10px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--gray-100); font-size: .84rem; color: var(--text); line-height: 1.5; }
.pg-fit:empty { display: none; }
.pg-tile { display: grid; place-content: center; gap: 1px; }
.pg-tile small { font-size: .58rem; font-weight: 500; }

/* #p-map wins over jsvectormap's own .jvm-container { height: 100% } */
#p-map .pg-map { height: 460px; border-radius: 10px; overflow: hidden; }
#p-map .pg-map[hidden] { display: none; }
.pg-map [data-code].is-on { stroke: var(--text) !important; stroke-width: 1.4 !important; }
.pg-tiles { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 5px; max-width: 640px; margin: 8px auto; }
.pg-tiles[hidden] { display: none; }
.pg-tile { aspect-ratio: 1; border: 2px solid transparent; border-radius: 8px; background: var(--gray-100); color: var(--text-muted);
  font: inherit; font-size: .72rem; font-weight: 600; cursor: pointer; padding: 0; }
.pg-tile.is-on { border-color: var(--text); }
.pg-tile:hover { filter: brightness(1.08); }
/* The map's key: css/map-key.css (.map-key); here only its place in the widgets */
.pg-legend { margin-top: 12px; }

.pg-table-wrap { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.pg-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.pg-table caption { text-align: left; padding: 10px 12px; color: var(--text-muted); font-size: .78rem; }
.pg-table th, .pg-table td { padding: 7px 12px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; color: var(--text); }
.pg-table th:first-child { text-align: left; }
.pg-table thead th { position: sticky; top: 0; background: var(--gray-100); font-weight: 600; }

.pg-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .78rem; }
.pg-source { margin: 0; color: var(--text-muted); }
.pg-source a, .pg-reports { color: var(--teal); font-weight: 600; }
.pg-note { max-width: 820px; margin: 22px auto 0; text-align: center; color: var(--text-muted); font-size: .8rem; line-height: 1.6; }
.pg-note a { color: var(--teal); }

/* jsvectormap tooltip above the sticky nav */
.jvm-tooltip { z-index: 2300; }   /* above the sticky nav AND above an expanded widget (2000) */

@media (max-width: 980px) {
  .pg { grid-template-columns: minmax(0, 1fr); }   /* minmax(0,..): a wide child can no longer stretch the column past the screen */
  .pg-panel { position: static; }
  .pg-mlist { max-height: 260px; }
}
@media (max-width: 600px) {
  .pg-main { padding: 16px; }
  .pg-head { flex-direction: column; }
  .pg-canvas { height: 320px; }
  .pg-canvas-tall { height: 520px; }
  .pg-tile { font-size: .6rem; border-radius: 5px; }
}

/* ═══════════ Dashboard layout ═══════════ */
.container.pg-wide { max-width: 1480px; }
.pg { grid-template-columns: 300px minmax(0, 1fr); }
@media (max-width: 980px) { .pg { grid-template-columns: minmax(0, 1fr); } }   /* phones and tablets: one column (this later rule had undone the one above) */
.pg-main { background: transparent; border: 0; padding: 0; }
.pg-head { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; }
.pg-kicker { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); font-weight: 600; margin-bottom: 4px; }
.pg-status:empty { display: none; }
.pg-status { margin: 10px 0 0; }
.pg-btn-solid { background: var(--btn-teal); border-color: var(--btn-teal); color: #fff; }
.pg-btn-solid:hover { color: #fff; filter: brightness(1.08); }

/* Year bar: stays in view under the nav while scrolling the panels */
.pg-toolbar { position: sticky; top: 76px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 14px 0; padding: 10px 16px; border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--white) 92%, transparent); box-shadow: 0 6px 20px rgba(11,31,58,.06); font-size: .86rem; color: var(--text); }
.pg-toolbar label { font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.pg-toolbar input[type=range] { flex: 1; min-width: 160px; accent-color: var(--teal); }
.pg-toolbar small { flex-basis: 100%; color: var(--text-muted); font-size: .72rem; }
.pg-year-out { min-width: 3.2em; font-size: 1.05rem; color: var(--teal); font-variant-numeric: tabular-nums; }
.pg-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--text-muted); cursor: pointer; font-size: .78rem; }
.pg-icon:hover:not(:disabled) { color: var(--teal); border-color: var(--teal); }
.pg-icon:disabled { opacity: .4; cursor: default; }
.pg-icon:focus-visible, .pg-pick-btn:focus-visible, .pg-details summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Panels */
.pg-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.pg-box { grid-column: span 12; min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px 18px;
  transition: box-shadow .2s; }
.pg-box:hover { box-shadow: 0 10px 28px rgba(11,31,58,.07); }
html[data-theme="dark"] .pg-box:hover { box-shadow: 0 10px 28px rgba(0,0,0,.35); }
.pg-w7 { grid-column: span 7; } .pg-w6 { grid-column: span 6; } .pg-w5 { grid-column: span 5; }
.pg-box.is-wide { grid-column: span 12; }
.pg-ph { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.pg-ph-text { min-width: 0; }
.pg-ph h3, .pg-h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .98rem; font-weight: 600; color: var(--text); }
.pg-ph h3 i, .pg-h3 i { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .75rem; color: var(--teal); background: color-mix(in srgb, var(--teal) 13%, transparent); }
.pg-pnote { margin: 4px 0 0 34px; font-size: .74rem; color: var(--text-muted); line-height: 1.4; }
.pg-ptools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pg-mini { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--text-muted); }
.pg-mini select { padding: 4px 8px; border: 1px solid var(--gray-200); border-radius: 8px; background: var(--white); color: var(--text); font: inherit; font-size: .78rem; }
.pg-mini-wide select { max-width: 260px; }
.pg-switch { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--text-muted); cursor: pointer; }
.pg-switch input { accent-color: var(--teal); }
.pg-canvas-rank { height: 400px; }
.pg-canvas-mid { height: 320px; }
#p-rank.is-wide .pg-canvas-rank { height: 620px; }
#p-movers.is-wide .pg-canvas-mid, #p-hist.is-wide .pg-canvas-mid { height: 420px; }
.pg-legend { margin-top: 10px; }

/* Data table as a fold-out panel */
.pg-details { padding: 0; }
.pg-details summary { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; cursor: pointer; list-style: none; border-radius: 16px; }
.pg-details summary::-webkit-details-marker { display: none; }
.pg-details summary .pg-pnote { display: block; }
.pg-details[open] summary .pg-caret { transform: rotate(180deg); }
.pg-caret { color: var(--text-muted); font-size: .75rem; transition: transform .2s; }
.pg-details .pg-table-wrap { margin: 0 18px 18px; }

/* Places drop-down */
.pg-pick { position: relative; }
.pg-pick-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--gray-200); border-radius: 10px;
  background: var(--white); color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; text-align: left; }
.pg-pick-btn > span { flex: 1; }
.pg-pick-btn > i:first-child { color: var(--teal); }
.pg-pick-btn[aria-expanded="true"] { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.pg-pick-btn[aria-expanded="true"] .pg-caret { transform: rotate(180deg); }
.pg-pick-panel { position: absolute; left: 0; right: -40px; top: calc(100% + 6px); z-index: 30; display: grid; gap: 8px; padding: 10px;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px rgba(11,31,58,.18); }
html[data-theme="dark"] .pg-pick-panel { box-shadow: 0 18px 44px rgba(0,0,0,.55); }
.pg-pick-panel[hidden] { display: none; }
.pg-pick-list { max-height: 320px; overflow-y: auto; scrollbar-width: thin; margin: 0 -4px; padding: 0 4px; }
.pg-pick-group { position: sticky; top: 0; z-index: 1; margin: 0; padding: 8px 4px 4px; background: var(--white);
  font-size: .66rem; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; color: var(--text-muted); }
.pg-pick-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: .84rem; color: var(--text); }
.pg-pick-item:hover { background: var(--gray-100); }
.pg-pick-item input { accent-color: var(--chip, var(--teal)); width: 15px; height: 15px; flex-shrink: 0; }
.pg-pick-item input:disabled + .pg-pick-name { opacity: .5; }
.pg-pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-pick-val { font-size: .72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pg-pick-item.is-empty .pg-pick-val { font-style: italic; opacity: .7; }
.pg-pick-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: .72rem; color: var(--text-muted); }
.pg-link-btn { border: 0; background: none; padding: 4px; color: var(--teal); font: inherit; font-size: .78rem; cursor: pointer; }
.pg-chips { margin-top: 4px; }
/* A long list (counties) folds by state: each state's row opens to list its places */
.pg-pick-hint { margin: 2px 4px 6px; font-size: .78rem; line-height: 1.4; color: var(--text-muted); }
.pg-pick-fold > summary.pg-pick-group { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; list-style: none;
  font-size: .86rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text); }
.pg-pick-fold > summary::-webkit-details-marker { display: none; }
.pg-pick-fold > summary::before { content: '\f054'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: .62rem; color: var(--text-muted); transition: transform .15s; }
.pg-pick-fold[open] > summary::before { transform: rotate(90deg); }
.pg-pick-fold > summary small { margin-left: auto; font-size: .72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pg-pick-fold > summary:hover { background: var(--gray-100); }
.pg-pick-fold > summary:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.pg-pick-fold[open] > summary { color: var(--teal); }
.pg-pick-fold > .pg-pick-item { margin-left: 14px; }
@media (prefers-reduced-motion: reduce) { .pg-pick-fold > summary::before { transition: none; } }

@media (max-width: 1180px) {
  .pg-w7, .pg-w6, .pg-w5 { grid-column: span 12; }
  [data-expand] { display: none; }
}
@media (max-width: 980px) {
  .pg-toolbar { top: 64px; }
  .pg-pick-panel { right: 0; }
}
@media (max-width: 600px) {
  .pg-ph { flex-direction: column; }
  .pg-head { padding: 14px; }
  .pg-box { padding: 14px; }
  .pg-canvas-rank { height: 420px; }
  .pg-toolbar small { display: none; }
}
@media (prefers-reduced-motion: reduce) { .pg-caret, .pg-box { transition: none; } }

/* ═══════════ Widgets (CloudWatch-style): 12 columns × 60px rows; size set inline by playground.js ═══════════ */
.pg-toolbar { justify-content: space-between; }
.pg-tb-year { display: flex; align-items: center; gap: 10px; flex: 1 1 420px; min-width: 0; }
/* Phones: the year slider gets its own full row so Play no longer runs off the screen */
@media (max-width: 600px) {
  .pg-tb-year { flex-wrap: wrap; gap: 8px; }
  .pg-tb-year input[type=range] { order: 5; flex: 1 1 100%; min-width: 0; }
}
.pg-tb-layout { display: flex; align-items: center; gap: 8px; }
.pg-addw { position: relative; }
.pg-grid { grid-auto-rows: 60px; grid-auto-flow: row dense; }
.pg-widget { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 14px; grid-column: span 12; grid-row: span 6;
  transition: box-shadow .2s, border-color .2s; }
.pg-widget[hidden] { display: none; }
.pg-widget:hover { border-color: color-mix(in srgb, var(--teal) 35%, var(--line)); box-shadow: 0 8px 24px rgba(11,31,58,.07); }
html[data-theme="dark"] .pg-widget:hover { box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.pg-widget .pg-ph { margin-bottom: 8px; align-items: center; gap: 8px; flex-shrink: 0; }
.pg-widget .pg-ph-text { flex: 1; }
.pg-widget .pg-ph h3 { font-size: .9rem; }
.pg-widget .pg-ph h3 i { width: 22px; height: 22px; font-size: .68rem; border-radius: 6px; }
.pg-widget .pg-pnote { margin: 2px 0 0 30px; font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-widget .pg-ptools { gap: 6px; }
.pg-widget .pg-icon { width: 26px; height: 26px; border-color: transparent; background: none; }
.pg-widget .pg-icon:hover { border-color: var(--line); background: var(--gray-100); }
.pg-grip { cursor: grab; color: var(--text-muted); opacity: .45; padding: 4px 2px; font-size: .8rem; touch-action: none; }
.pg-widget:hover .pg-grip { opacity: 1; }
.pg-grip:active { cursor: grabbing; }
.pg-wbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pg-widget .pg-canvas { flex: 1; min-height: 0; height: auto; }
.pg-widget .pg-tiles { flex: 1; min-height: 0; overflow: auto; max-width: 720px; width: 100%; align-content: start; }
.pg-widget .pg-legend { flex-shrink: 0; margin-top: 8px; }
.pg-widget .pg-cards { margin: 0; overflow: auto; flex: 1; min-height: 0; align-content: start; grid-auto-rows: min-content; padding: 1px; }   /* more cards than fit: the list scrolls, the cards keep their height */
.pg-widget .pg-table-wrap { flex: 1; min-height: 0; max-height: none; }
.pg-widget .pg-fit { flex-shrink: 0; margin-top: 8px; font-size: .8rem; }

/* Resize corner */
.pg-resize { position: absolute; right: 3px; bottom: 3px; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none; opacity: .35;
  background: linear-gradient(135deg, transparent 50%, var(--text-muted) 50%, var(--text-muted) 58%, transparent 58%, transparent 70%, var(--text-muted) 70%, var(--text-muted) 78%, transparent 78%); }
.pg-widget:hover .pg-resize { opacity: .9; }
.pg-widget.is-resizing { outline: 2px dashed var(--teal); outline-offset: 2px; user-select: none; }
.pg-widget.is-resizing::after { content: attr(data-size); position: absolute; right: 24px; bottom: 6px; padding: 2px 8px; border-radius: 6px;
  background: var(--teal); color: #fff; font-size: .72rem; font-weight: 600; }
.pg-widget.is-dragging { opacity: .45; outline: 2px dashed var(--teal); }

/* Full screen */
.pg-widget.is-max { position: fixed; inset: 24px; z-index: 2000; grid-column: auto !important; grid-row: auto !important; padding: 16px 20px 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.pg-widget.is-max .pg-resize, .pg-widget.is-max .pg-grip { display: none; }
.pg-backdrop { position: fixed; inset: 0; z-index: 1999; background: rgba(6,18,38,.55); }
.pg-backdrop[hidden] { display: none; }
body.pg-noscroll { overflow: hidden; }

/* Menus */
.pg-menu { position: absolute; z-index: 2100; min-width: 210px; padding: 6px; background: var(--white); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 16px 40px rgba(11,31,58,.18); display: grid; gap: 1px; }
html[data-theme="dark"] .pg-menu { box-shadow: 0 16px 40px rgba(0,0,0,.55); }
.pg-menu[hidden] { display: none; }
.pg-addw .pg-menu { right: 0; top: calc(100% + 6px); }
.pg-menu-head { margin: 6px 8px 2px; font-size: .64rem; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; color: var(--text-muted); }
.pg-menu-head:first-child { margin-top: 2px; }
.pg-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 7px; background: none;
  color: var(--text); font: inherit; font-size: .84rem; text-align: left; cursor: pointer; }
.pg-menu button i { width: 14px; color: var(--text-muted); font-size: .75rem; }
.pg-menu button:hover:not(:disabled), .pg-menu button:focus-visible { background: var(--gray-100); outline: none; }
.pg-menu button:disabled { opacity: .4; cursor: default; }
.pg-menu button[role=menuitemradio]::before { content: ''; width: 14px; text-align: center; color: var(--teal); font-weight: 700; }
.pg-menu button[aria-checked="true"]::before { content: '✓'; }

@media (max-width: 900px) {
  .pg-widget { grid-column: span 12 !important; }
  .pg-resize, .pg-grip { display: none; }
  .pg-grid { grid-auto-rows: 56px; }
  .pg-widget.is-max { inset: 8px; }
}
@media (prefers-reduced-motion: reduce) { .pg-widget { transition: none; } }

/* ═══════════ Compact widget view: 40px rows, 10px gaps (ROW/GAP in playground.js) ═══════════ */
.pg-grid { grid-auto-rows: 40px; gap: 10px; }
.pg-widget { padding: 8px 10px 10px; border-radius: 10px; }
.pg-widget .pg-ph { margin-bottom: 4px; gap: 6px; }
.pg-widget .pg-ph h3 { font-size: .82rem; gap: 6px; }
.pg-widget .pg-ph h3 i { width: 20px; height: 20px; font-size: .62rem; }
.pg-widget .pg-pnote { margin: 1px 0 0 26px; font-size: .66rem; }
.pg-widget .pg-icon { width: 24px; height: 24px; font-size: .72rem; }
.pg-widget .pg-mini, .pg-widget .pg-switch { font-size: .7rem; }
.pg-widget .pg-mini select { padding: 2px 6px; font-size: .72rem; }
.pg-widget .pg-legend { gap: 3px 10px; font-size: .66rem; margin-top: 4px; }
.pg-widget .pg-legend i { width: 11px; height: 8px; }
.pg-widget .pg-fit { padding: 6px 10px; font-size: .74rem; margin-top: 4px; }
.pg-widget .pg-table { font-size: .76rem; }
.pg-widget .pg-table th, .pg-widget .pg-table td { padding: 5px 9px; }
.pg-widget .pg-table caption { padding: 6px 9px; font-size: .7rem; }
/* Narrow widgets: hide the note line and extra tools so the chart keeps its room */
.pg-widget[data-w="s"] .pg-pnote { display: none; }
.pg-widget[data-w="s"] .pg-mini { font-size: 0; gap: 0; }
.pg-widget[data-w="s"] .pg-mini select { font-size: .7rem; }

/* Compact snapshot cards */
.pg-widget .pg-cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pg-widget .pg-card { padding: 7px 10px 6px; border-radius: 9px; gap: 0; }
.pg-widget .pg-card-name { font-size: .68rem; }
.pg-widget .pg-card-val { font-size: 1.15rem; }
.pg-widget .pg-card-unit { font-size: .6rem; }
.pg-widget .pg-card-ch { font-size: .64rem; margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-widget .pg-card svg { height: 22px; margin-top: 2px; }

.pg-toolbar { margin: 10px 0; padding: 7px 12px; }
.pg-toolbar small { font-size: .68rem; }

/* Measure category bar (top of the dashboard) */
.pg-cats { margin-top: 10px; display: grid; gap: 8px; }
.pg-cat-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px; margin: -4px;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.pg-cat { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 12px; border: 0; border-radius: 9px;
  background: none; color: var(--text-muted); font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.pg-cat i { font-size: .75rem; }
.pg-cat small { font-size: .64rem; padding: 1px 6px; border-radius: 50px; background: var(--gray-100); color: var(--text-muted); }
.pg-cat:hover { color: var(--teal); background: color-mix(in srgb, var(--teal) 7%, transparent); }
.pg-cat[aria-pressed="true"] { background: var(--teal); color: #fff; }
.pg-cat[aria-pressed="true"] small { background: rgba(255,255,255,.22); color: #fff; }
.pg-cat:focus-visible, .pg-pill:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.pg-cat-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pg-pill { padding: 5px 11px; border: 1px solid var(--line); border-radius: 50px; background: var(--white); color: var(--text);
  font: inherit; font-size: .76rem; cursor: pointer; }
.pg-pill:hover { border-color: var(--teal); color: var(--teal); }
.pg-pill[aria-pressed="true"] { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 12%, var(--white)); color: var(--teal); font-weight: 600; }

/* Medium screens: quarter and third widgets become halves */
@media (max-width: 1180px) {
  .pg-widget[data-w="s"], .pg-widget[data-w="m"] { grid-column: span 6 !important; }
  .pg-widget[data-w="l"] { grid-column: span 12 !important; }
}
@media (max-width: 900px) {
  .pg-widget[data-w] { grid-column: span 12 !important; }
  .pg-cat { flex: 0 0 auto; }
}
/* Card: name + year / big value with % change beside it / trend line */
.pg-card-name small { margin-left: auto; font-size: .6rem; opacity: .8; }
.pg-card-line { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.pg-widget .pg-card { gap: 2px; }
.pg-widget .pg-card-ch { font-size: .66rem; }

/* Category bar with the measure search on its right; measure pills below */
.pg-cats { grid-template-columns: minmax(0, 1fr); }
.pg-cat-bar { display: flex; gap: 8px; align-items: stretch; min-width: 0; }
.pg-cat-bar .pg-cat-row { flex: 1; min-width: 0; margin: 0; flex-wrap: wrap; overflow: visible; }
.pg-cat-bar .pg-cat { flex: 1 1 auto; padding: 7px 10px; }
.pg-cat-find { flex: 0 0 240px; }
.pg-cat-find input { width: 100%; height: 100%; padding: 8px 10px 8px 32px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); color: var(--text); font: inherit; font-size: .82rem; }
.pg-cat-find input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.pg-pill { display: inline-flex; align-items: center; gap: 6px; }
.pg-pill i { font-size: .7rem; color: var(--teal); }
.pg-pill .pg-src { font-size: .58rem; padding: 1px 5px; }
.pg-cat-pills .pg-empty { padding: 4px 2px; margin: 0; }
@media (max-width: 1180px) { .pg-cat-bar { flex-direction: column; } .pg-cat-find { flex-basis: auto; } }

/* Title below the measure bar; links to our reports for the chosen measure (top and bottom) */
.pg-cats + .pg-head { margin-top: 10px; }
.pg-reports-cta { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 7px 14px; border-radius: 50px;
  background: color-mix(in srgb, var(--teal) 12%, transparent); color: var(--teal); font-size: .82rem; font-weight: 500; text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent); transition: background .15s; }
.pg-reports-cta:hover { background: var(--teal); color: #fff; }
.pg-reports-cta[hidden] { display: none; }
.pg-reports-cta strong { text-transform: capitalize; }
.pg-reports-cta .fa-arrow-right { font-size: .72rem; transition: transform .15s; }
.pg-reports-cta:hover .fa-arrow-right { transform: translateX(3px); }
.pg-reports-cta:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.pg-reports-big { display: flex; justify-content: center; margin-top: 14px; padding: 14px 20px; border-radius: 14px; font-size: .92rem; }
@media (prefers-reduced-motion: reduce) { .pg-reports-cta, .pg-reports-cta .fa-arrow-right { transition: none; } }

/* ═══════════ Measure picker: heading, 1. topic tiles, 2. measure options ═══════════ */
.pg-measure { display: block; margin-top: 0; padding: 16px 18px 18px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; }
.pg-measure-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 6px; }
.pg-measure-head h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--text); }
.pg-measure-head h2 i { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; color: #fff; background: var(--teal); }
.pg-measure-head p { margin: 4px 0 0 37px; font-size: .8rem; color: var(--text-muted); }
.pg-measure .pg-cat-find { flex: 0 1 280px; }
.pg-measure .pg-cat-find input { height: 38px; border-radius: 10px; }
.pg-step { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; font-size: .7rem; letter-spacing: .07em; text-transform: uppercase;
  font-weight: 600; color: var(--text-muted); }
.pg-step span { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: .64rem; letter-spacing: 0; background: var(--gray-100); color: var(--text); }
.pg-step b { font-weight: 600; text-transform: none; letter-spacing: 0; font-size: .8rem; color: var(--text); }

/* Topic tiles: same size, in one row on a wide screen */
.pg-topic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.pg-tt { display: grid; justify-items: center; gap: 4px; padding: 12px 8px 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); color: var(--text); font: inherit; cursor: pointer; text-align: center; transition: border-color .15s, background .15s, transform .15s; }
.pg-tt-ic { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .9rem; color: var(--teal); background: color-mix(in srgb, var(--teal) 12%, transparent); }
.pg-tt-name { font-size: .8rem; font-weight: 600; line-height: 1.25; }
.pg-tt-n { font-size: .68rem; color: var(--text-muted); }
.pg-tt:hover { border-color: var(--teal); transform: translateY(-1px); }
.pg-tt[aria-pressed="true"] { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 10%, var(--white)); box-shadow: inset 0 0 0 1px var(--teal); }
.pg-tt[aria-pressed="true"] .pg-tt-ic { background: var(--teal); color: #fff; }
.pg-tt[aria-pressed="true"] .pg-tt-name { color: var(--teal); }
.pg-tt:focus-visible, .pg-mo:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Measure options: cards in columns, a dot that fills when chosen. They sit in a box of fixed height that scrolls, so a
   topic with a hundred measures does not push the dashboard down. A fade at its foot shows while more wait below
   (js/playground.js sets .is-more). The padding leaves room for the focus ring. */
.pg-measure-box { position: relative; }
.pg-measure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px;
  position: relative; max-height: min(348px, 60vh); overflow-y: auto; padding: 4px; margin: -4px; scrollbar-width: thin; }
.pg-measure-box::after { content: ''; position: absolute; left: 0; right: 14px; bottom: -4px; height: 40px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--white)); opacity: 0; transition: opacity .15s; }
.pg-measure-box.is-more::after { opacity: 1; }
.pg-mo { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--white); color: var(--text); font: inherit; cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.pg-mo:hover { border-color: var(--teal); background: var(--gray-100); }
.pg-mo-dot { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--gray-200); background: var(--white); }
.pg-mo-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pg-mo-name { font-size: .82rem; font-weight: 500; line-height: 1.3; }
.pg-mo-name i { margin-right: 5px; font-size: .7rem; color: var(--teal); }
.pg-mo-hint { font-size: .68rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-mo .pg-src { margin-top: 1px; }
.pg-mo[aria-pressed="true"] { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 9%, var(--white)); box-shadow: inset 0 0 0 1px var(--teal); }
.pg-mo[aria-pressed="true"] .pg-mo-dot { border-color: var(--teal); background: radial-gradient(circle, var(--teal) 45%, transparent 50%); }
.pg-mo[aria-pressed="true"] .pg-mo-name { color: var(--teal); font-weight: 600; }
.pg-measure-grid .pg-empty { grid-column: 1 / -1; margin: 0; padding: 6px 2px; }
.pg-measure + .pg-head { margin-top: 12px; }
@media (max-width: 700px) {
  .pg-measure-head { flex-direction: column; }
  .pg-measure .pg-cat-find { flex-basis: auto; width: 100%; }
  .pg-topic-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .pg-tt, .pg-mo, .pg-measure-box::after { transition: none; } .pg-tt:hover { transform: none; } }

/* Flags beside place names (same .flag / .flag-globe as the market pages) */
.pg-chips li .flag, .pg-pick-name .flag, .pg-card-name .flag, .pg-table th .flag { width: 18px; height: 13px; margin-right: 6px; vertical-align: -2px; }
.pg-chips li .flag-globe, .pg-pick-name .flag-globe, .pg-card-name .flag-globe, .pg-table th .flag-globe { width: 18px; margin-right: 6px; font-size: .8rem; }
.pg-card-name .flag { width: 16px; height: 12px; margin-right: 1px; }
.pg-card-name .flag-globe { width: 14px; margin-right: 1px; font-size: .7rem; }
html[data-theme="dark"] .flag { box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.pg-card-name .pg-dot { display: none; }          /* the colour bar on the card's left already shows the place's colour */
.pg-card-name small { flex-shrink: 0; padding-left: 4px; }

/* ═══════════ Next steps band (reports, newsletter, contact) ═══════════ */
.pg-next { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 22px; }
.pg-next-card[hidden] { display: none; }
/* "From our blog" stories for the chosen measure's topic */
.pg-stories { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .86rem; line-height: 1.4; }
.pg-stories a { color: var(--teal); font-weight: 500; }
.pg-next-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--white); color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
a.pg-next-card:hover, a.pg-next-card:focus-visible { border-color: var(--teal); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(11,31,58,.08); color: var(--text); }
.pg-next-card strong { font-size: 1rem; font-weight: 600; }
.pg-next-text { font-size: .84rem; color: var(--text-muted); line-height: 1.5; flex: 1; }
.pg-next-go { margin-top: 4px; font-size: .84rem; font-weight: 600; color: var(--teal); }
.pg-next-go i { font-size: .72rem; margin-left: 3px; }
.pg-next-ic { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--teal); background: color-mix(in srgb, var(--teal) 13%, transparent); font-size: .95rem; margin-bottom: 4px; }
.newsletter-compact .newsletter-row input { padding: 9px 14px; font-size: .86rem; background: var(--off-white); color: var(--text); }
.newsletter-compact .newsletter-row .btn { padding: 9px 16px; font-size: .84rem; }
.newsletter-compact .newsletter-msg { margin-top: 6px !important; font-size: .78rem; min-height: 0; }
.newsletter-compact .newsletter-msg:empty { display: none; }
html[data-theme="dark"] .newsletter-compact .newsletter-row input { background: #0B1424; border-color: var(--line); }

/* ═══════════ Pop-up in the bottom corner ═══════════ */
.pg-nudge { position: fixed; right: 20px; bottom: 20px; z-index: 1500; width: min(380px, calc(100vw - 32px)); padding: 18px 18px 14px;
  background: var(--white); color: var(--text); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px rgba(11,31,58,.25);
  opacity: 0; transform: translateY(16px); transition: opacity .25s ease, transform .25s ease; }
.pg-nudge.is-in { opacity: 1; transform: none; }
.pg-nudge[hidden] { display: none; }
html[data-theme="dark"] .pg-nudge { box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.pg-nudge-x { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none;
  color: var(--text-muted); cursor: pointer; }
.pg-nudge-x:hover { background: var(--gray-100); color: var(--text); }
.pg-nudge-x:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.pg-nudge-head { display: flex; gap: 12px; padding-right: 26px; margin-bottom: 12px; }
.pg-nudge-head h2 { margin: 0 0 3px; font-size: 1rem; font-weight: 600; color: var(--text); }
.pg-nudge-head p { margin: 0; font-size: .82rem; line-height: 1.45; color: var(--text-muted); }
.pg-nudge-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .8rem; }
.pg-nudge-links a { color: var(--teal); font-weight: 500; }
.pg-nudge-links i { margin-right: 4px; font-size: .74rem; }
@media (max-width: 900px) { .pg-next { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .pg-nudge { right: 8px; bottom: 8px; } }
@media (prefers-reduced-motion: reduce) { .pg-nudge, .pg-next-card { transition: none; transform: none !important; } }

/* Source tags for UNICEF and ClinicalTrials.gov */
.pg-src-unicef { background: #E6F2FB; color: #1C6CB0; }
.pg-src-ctg    { background: #F1ECFB; color: #5B3FA8; }
.pg-src-oecd   { background: #FDF0E6; color: #9A4A12; }
html[data-theme="dark"] .pg-src-unicef { background: #13304A; color: #8CC4F2; }
html[data-theme="dark"] .pg-src-ctg    { background: #2A2146; color: #C7B6F5; }
html[data-theme="dark"] .pg-src-oecd   { background: #3A2614; color: #F6C49A; }

/* ═══════════ Key facts, all measures, questions (below the dashboard) ═══════════ */
.pg-facts, .pg-index, .pg-faq { margin: 28px 0 0; padding: 22px 24px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; color: var(--text); }
.pg-facts h2, .pg-index h2, .pg-faq h2 { font-size: 1.15rem; margin: 0 0 10px; }
.pg-facts > p { margin: 0 0 14px; line-height: 1.7; color: var(--text-muted); max-width: 980px; font-size: .92rem; }
/* Data lists: the same size as the "All measures" list (.88rem), numbers lined up */
.pg-facts ol li { font-size: .86rem; }
.pg-facts ol li b { font-weight: 600; }
.pg-facts > p strong { color: var(--text); }
.pg-facts a, .pg-faq a { color: var(--teal); font-weight: 600; }
.pg-facts-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.pg-facts h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 0 0 8px; }
.pg-facts ol { margin: 0; padding-left: 20px; }
.pg-facts li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.pg-facts li span { display: inline-block; min-width: 55%; }
.pg-facts li b { font-variant-numeric: tabular-nums; }
.pg-facts-unit { margin: 12px 0 0; font-size: .82rem; color: var(--text-muted); }
/* All measures (pages/playground.php pg_index): a fold per topic, the names in columns. On the dashboard home a fold
   per place holds its topic folds. */
.pg-index-area, .pg-index-topic { border-top: 1px solid var(--line); }
.pg-index-area > summary, .pg-index-topic > summary { display: flex; align-items: center; gap: 8px; padding: 10px 2px; cursor: pointer;
  list-style: none; font-size: .92rem; font-weight: 600; }
.pg-index-area > summary { padding: 12px 2px; font-size: 1rem; }
.pg-index-area > .pg-index-topic { margin-left: 18px; }
.pg-index-area > summary::-webkit-details-marker, .pg-index-topic > summary::-webkit-details-marker { display: none; }
.pg-index-area > summary::before, .pg-index-topic > summary::before { content: '\f054'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
  font-size: .62rem; color: var(--text-muted); transition: transform .15s; }
.pg-index-area[open] > summary::before, .pg-index-topic[open] > summary::before { transform: rotate(90deg); }
.pg-index-area > summary small, .pg-index-topic > summary small { font-size: .74rem; font-weight: 400; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pg-index-area > summary:hover, .pg-index-topic > summary:hover { color: var(--teal); }
.pg-index-area > summary:focus-visible, .pg-index-topic > summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
.pg-index ul { list-style: none; margin: 0; padding: 0 0 12px 18px; columns: 230px; column-gap: 24px; }
.pg-index li { padding: 3px 0; font-size: .88rem; break-inside: avoid; }
.pg-index li a { color: var(--text); text-decoration: none; }
.pg-index li a:hover, .pg-index li a[aria-current] { color: var(--teal); text-decoration: underline; }
.pg-index-other { margin: 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: .85rem; line-height: 1.8; color: var(--text-muted); }
.pg-index-other a { color: var(--teal); }
@media (prefers-reduced-motion: reduce) { .pg-index-area > summary::before, .pg-index-topic > summary::before { transition: none; } }
.pg-faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.pg-faq details:first-of-type { border-top: 0; }
.pg-faq summary { cursor: pointer; font-weight: 600; }
.pg-faq details p { margin: 8px 0 0; color: var(--text-muted); line-height: 1.6; }
@media (max-width: 700px) {
  .pg-facts, .pg-index, .pg-faq { padding: 18px 16px; }
  .pg-facts-cols { grid-template-columns: 1fr; }
}

/* Sources table (licence + last fetched), in the questions section */
.pg-faq { scroll-margin-top: 90px; }
.pg-src-table-wrap { overflow-x: auto; margin: 10px 0 0; }
.pg-src-table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 620px; }
.pg-src-table th, .pg-src-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pg-src-table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; }
.pg-src-table tbody th { font-weight: 600; }
.pg-src-table a { color: var(--teal); }
.pg-src-table td:nth-child(3) { font-variant-numeric: tabular-nums; }

/* Folded sections (key facts, all measures): closed until clicked */
.pg-fold > summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.pg-fold > summary::-webkit-details-marker { display: none; }
.pg-fold > summary h2 { margin: 0; }
.pg-fold > summary::after { content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900; margin-left: auto; font-size: .8rem;
  color: var(--teal); transition: transform .2s ease; }
.pg-fold[open] > summary::after { transform: rotate(180deg); }
.pg-fold-hint { font-size: .82rem; color: var(--text-muted); }
.pg-fold[open] > summary { margin-bottom: 14px; }
.pg-fold[open] .pg-fold-hint { display: none; }
.pg-fold > summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; border-radius: 6px; }
.pg-facts.pg-fold { margin-top: 18px; }
.pg-fold { scroll-margin-top: 90px; }
@media (prefers-reduced-motion: reduce) { .pg-fold > summary::after { transition: none; } }
@media (max-width: 600px) { .pg-fold-hint { display: none; } }

/* Jump links under the page title */
.pg-jump { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; padding: 0; list-style: none; font-size: .86rem; }
.pg-jump a { color: rgba(255,255,255,.78); text-decoration: none; border-bottom: 1px dashed rgba(255,255,255,.3); }
.pg-jump a:hover { color: #fff; border-bottom-color: #3FD3BF; }
.pg-jump i { color: #3FD3BF; margin-right: 5px; font-size: .78rem; }

/* ═══════════ One measure, four views (tabs), embed, sources, county map ═══════════ */
/* A link inside a sentence shows by more than its colour (WCAG) */
.pg-note a, .pg-fit a { text-decoration: underline; }
/* Anything the dashboard hides stays hidden, whatever its own display */
.pg [hidden] { display: none !important; }

.pg-src-eurostat { background: #EEF0FB; color: #3949AB; }
.pg-src-cckp     { background: #E8F0FB; color: #1A5FA8; }
html[data-theme="dark"] .pg-src-eurostat { background: #1E2448; color: #B4BDF5; }
html[data-theme="dark"] .pg-src-cckp     { background: #1A2D4A; color: #A3C8F5; }

/* Embed: the code to paste, and a preview of the picture it shows */
.pg-embed { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 400px); gap: 18px; align-items: start; margin: 14px 0 0;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--teal) 4%, var(--white)); }
.pg-embed h3 { margin: 0 0 10px; font-size: 1rem; color: var(--text); }
.pg-embed-kind { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; color: var(--text); }
.pg-embed-kind legend { float: left; width: 100%; margin-bottom: 4px; font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.pg-embed-kind input { accent-color: var(--teal); }
.pg-embed-label { display: block; margin-bottom: 4px; font-size: .88rem; font-weight: 600; color: var(--text); }
.pg-embed textarea, .pg-srcuse textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 10px; resize: vertical;
  background: var(--white); color: var(--text); font: .84rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.pg-embed-do { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 8px 0 0; font-size: .86rem; color: var(--text-muted); }
.pg-embed .pg-hint, .pg-srcuse .pg-hint { margin: 10px 0 0; font-size: .86rem; line-height: 1.5; }
.pg-embed-img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; background: #FFFFFF; }
@media (max-width: 760px) { .pg-embed { grid-template-columns: 1fr; } }

/* The dashboard (pages/playground.php): the year bar, the chart over time and the widget grid, 10px apart, then the
   data table and about the data, each a column under its heading. */
.pg-board { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.pg-board > .pg-toolbar { margin: 0; }
.pg-sec { display: flex; flex-direction: column; gap: 10px; min-width: 0; margin-top: 22px; }
.pg-sec-head { display: grid; gap: 4px; padding: 2px 2px 10px; border-bottom: 1px solid var(--line); }
.pg-sec-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.2rem; font-weight: 600; color: var(--text); }
.pg-sec-head h2 i { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .85rem; color: #fff; background: var(--teal); }
.pg-sec-head p { margin: 0 0 0 40px; font-size: .92rem; line-height: 1.5; color: var(--text-muted); }
/* Full-width widgets, as tall as their content (no grid size): the chart, the map, the table, the sources */
.pg-widget:not([data-w]) { padding: 12px 14px 14px; border-radius: 12px; }
.pg-widget:not([data-w]) .pg-ph h3 { font-size: .95rem; }
.pg-widget:not([data-w]) .pg-pnote { font-size: .8rem; white-space: normal; }
.pg-widget:not([data-w]) .pg-mini, .pg-widget:not([data-w]) .pg-switch { font-size: .84rem; }
.pg-widget:not([data-w]) .pg-legend { font-size: .8rem; gap: 4px 14px; }
.pg-widget:not([data-w]) .pg-canvas { flex: none; height: 320px; }
#p-map .pg-map, #p-map .pg-counties { flex: none; height: 460px; }
#p-all .pg-all-wrap { max-height: 560px; }
#p-all .pg-find { width: 240px; }
#p-all .pg-find input { padding-top: 6px; padding-bottom: 6px; font-size: .86rem; }
/* Full screen: the widget's chart, map or table fills it */
.pg-widget:not([data-w]).is-max .pg-canvas, #p-map.is-max .pg-map, #p-map.is-max .pg-counties { flex: 1; height: auto; min-height: 0; }
#p-all.is-max .pg-all-wrap { flex: 1; max-height: none; }
/* A widget's controls go under its title when there is no room beside it (the "Only my places" switches) */
.pg-widget .pg-ph { flex-wrap: wrap; }
.pg-widget .pg-ph-text { flex: 1 1 140px; }
.pg-widget .pg-ptools { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
/* An older link to one of the views scrolls to its widget, clear of the nav and the year bar */
.pg-widget { scroll-margin-top: 150px; }
@media (max-width: 600px) {
  .pg-sec-head p { margin-left: 0; }
  .pg-widget:not([data-w]) { padding: 10px 10px 12px; }
  .pg-widget:not([data-w]) .pg-canvas { height: 280px; }
  #p-map .pg-map, #p-map .pg-counties { height: 300px; }
  #p-all .pg-find { width: 100%; }
}

/* Events on the chart over time, written out under it with their sources */
.pg-events { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 10px 0 0; font-size: .84rem; line-height: 1.5; color: var(--text-muted); }
.pg-event b { margin-right: 4px; color: var(--text); font-variant-numeric: tabular-nums; }
.pg-event a { color: var(--teal); font-weight: 500; }

/* Table view: every place (its headings sort: css/main.css, table[data-sortable]), and its find box */
.pg-find { position: relative; display: block; }
.pg-find i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .82rem; pointer-events: none; }
.pg-find input { width: 100%; padding: 8px 12px 8px 32px; border: 1px solid var(--gray-200); border-radius: 10px; background: var(--white);
  color: var(--text); font: inherit; font-size: .9rem; }
.pg-find input:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.pg-all-wrap { max-height: 560px; }
.pg-table-all td:first-child { text-align: left; width: 5em; }
.pg-table-all { font-size: .9rem; }
.pg-table-all caption { font-size: .84rem; }
.pg-table-all thead th:nth-child(2), .pg-table-all tbody th { text-align: left; }
.pg-table-all tbody th { font-weight: 500; }
.pg-table-all tbody th a { color: var(--teal); text-decoration: none; }
.pg-table-all tbody th a:hover { text-decoration: underline; }
.pg-table-all tbody tr:hover { background: color-mix(in srgb, var(--teal) 5%, transparent); }

/* Sources view: the facts on the left, what it measures and a citation on the right */
.pg-srcview { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 18px 28px; padding: 4px 2px 8px; }
.pg-srcfacts { margin: 0; display: grid; gap: 10px; align-content: start; }
.pg-srcfacts > div { display: grid; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pg-srcfacts dt { font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.pg-srcfacts dd { margin: 0; font-size: .94rem; color: var(--text); }
.pg-srcfacts a, .pg-srcuse a { color: var(--teal); font-weight: 500; }
.pg-srcuse h4 { margin: 0 0 6px; font-size: .98rem; font-weight: 600; color: var(--text); }
.pg-srcuse h4 + p { margin: 0 0 16px; color: var(--text-muted); font-size: .92rem; line-height: 1.6; }
@media (max-width: 760px) { .pg-srcview { grid-template-columns: 1fr; } }

/* County map: its box here; the outlines and the tooltip in css/map-key.css */
.pg-counties { position: relative; height: 460px; }

/* Keyboard focus on the new controls */
.pg-embed textarea:focus-visible, .pg-srcuse textarea:focus-visible,
.pg-table-wrap:focus-visible, .pg-embed-kind input:focus-visible, .pg-switch input:focus-visible, .pg-mini select:focus-visible,
.pg-tb-year input[type=range]:focus-visible, .pg-event a:focus-visible, .pg-table-all a:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Phones (last, over the fixed rows above): the widgets stack in one column, each as tall as it needs, a chart 320px,
   so a header or note that wraps never squeezes its chart; a header wider than the screen wraps instead of running
   off both sides. The full-width widgets keep their own sizes (above). */
@media (max-width: 600px) {
  .pg-grid { grid-auto-rows: auto; }
  .pg-widget { grid-row: auto !important; }
  .pg-grid .pg-widget .pg-canvas { flex: none; height: 320px; }
  .pg-grid #p-regions .pg-canvas { height: 440px; }   /* seven regions with two-line names and a long key */
  .pg-widget .pg-cards, .pg-grid .pg-widget .pg-table-wrap { flex: none; max-height: 420px; }
  .pg-widget .pg-ph { align-items: stretch; }   /* the header is a column here: the title starts at the left */
  .pg-widget .pg-ph-text { flex: none; }         /* its 140px width above would be a 140px height in a column */
  .pg-widget .pg-ph-text, .pg-widget .pg-ptools { max-width: 100%; }
  .pg-widget .pg-ptools { flex-wrap: wrap; justify-content: center; }
  .pg-widget .pg-mini-wide select { max-width: 190px; }
}

/* A country's figure beside the world's, under the measure's description */
.pg-worldcmp { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--gray-100); color: var(--text); font-size: .86rem; line-height: 1.5; max-width: 680px; }
.pg-worldcmp[hidden], .pg-cmp-open[hidden] { display: none; }
.pg-worldcmp small { color: var(--text-muted); }
.pg-cmp-open { margin-top: 10px; }

/* Compare two countries' regions */
.pg-compare { margin: 14px 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); display: grid; gap: 12px; }
.pg-compare[hidden] { display: none; }
.pg-compare h3 { margin: 0; font-size: 1.05rem; color: var(--text); }
.pg-compare-help { margin: 0; color: var(--text-muted); font-size: .86rem; }
.pg-compare-pick { display: flex; flex-wrap: wrap; gap: 12px; }
.pg-compare-pick label { display: grid; gap: 4px; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.pg-compare-pick select { min-width: 190px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--text); font: inherit; font-size: .88rem;
  text-transform: none; letter-spacing: 0; font-weight: 400; }
.pg-cmp-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pg-cmp-col h4 { margin: 0; font-size: 1rem; color: var(--text); }
.pg-cmp-col h4 span { font-weight: 400; color: var(--text-muted); font-size: .86rem; }
.pg-cmp-src { margin: 2px 0 8px; font-size: .78rem; color: var(--text-muted); }
.pg-cmp-list { list-style: none; margin: 0; padding: 0 4px 0 0; max-height: 520px; overflow-y: auto; display: grid; gap: 3px; }
.pg-cmp-list li { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) 48px; gap: 8px; align-items: center; font-size: .8rem; }
.pg-cmp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.pg-cmp-bar { height: 10px; border-radius: 5px; background: var(--gray-100); overflow: hidden; }
.pg-cmp-bar i { display: block; height: 100%; border-radius: 5px; background: var(--teal); }
.pg-cmp-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.pg-cmp-note { margin: 0; font-size: .78rem; color: var(--text-muted); }
@media (max-width: 720px) {
  .pg-cmp-cols { grid-template-columns: 1fr; }
  .pg-compare-pick select { min-width: 0; width: 100%; }
  .pg-compare-pick label { flex: 1 1 100%; }
}

/* The banner inside a country (js/playground-areas.js): flag, name, headline numbers, the way back to the world */
.pg-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin: 0 0 16px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--teal) 14%, var(--white)), var(--white) 60%); }
.pg-strip[hidden] { display: none; }
.pg-strip-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pg-strip-id img { width: 48px; height: 36px; object-fit: cover; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); flex: none; }
.pg-strip-id > i { font-size: 2rem; color: var(--teal); }
.pg-strip-kicker { margin: 0; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.pg-strip h2 { margin: 0; font-size: 1.5rem; line-height: 1.15; color: var(--text); }
.pg-strip-sub { margin: 2px 0 0; font-size: .84rem; color: var(--text-muted); }
.pg-strip-nums { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 320px; align-items: stretch; }
.pg-strip-num { display: grid; gap: 1px; text-align: left; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); color: var(--text); font: inherit; cursor: pointer; min-width: 150px; height: 100%; }
.pg-strip-num:hover { border-color: var(--teal); }
.pg-strip-num:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.pg-strip-label { font-size: .74rem; color: var(--text-muted); }
.pg-strip-num strong { font-size: 1.4rem; line-height: 1.15; }
.pg-strip-unit { font-size: .72rem; color: var(--text-muted); }
.pg-strip-num small { font-size: .7rem; color: var(--text-muted); }
.pg-strip-links { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.pg-strip-links .pg-btn { text-decoration: none; }
@media (max-width: 720px) {
  .pg-strip { padding: 14px; }
  .pg-strip-nums li { flex: 1 1 100%; }
  .pg-strip-num { width: 100%; }
  .pg-strip-links { margin-left: 0; width: 100%; }
}

/* ── Where you are: the trail "World › Canada", the countries to go inside, and the Regions link in the world table (js/playground-areas.js).
   The radio buttons stay in the page, out of sight: js/playground.js reads them. */
.pg-area-radios { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pg-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 0 0 12px; font-size: .9rem; }
.pg-crumb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.pg-crumb-list li + li::before { content: "›"; margin-right: 8px; color: var(--text-muted); }
.pg-crumb-list a { color: var(--teal); font-weight: 600; text-decoration: none; }
.pg-crumb-list a:hover { text-decoration: underline; }
.pg-crumb-here { color: var(--text); font-weight: 700; }
.pg-crumb-here:focus-visible, .pg-crumb-list a:focus-visible, .pg-go a:focus-visible, .pg-drill:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.pg-go { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--text-muted); font-size: .84rem; }
.pg-go ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pg-go a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--text); text-decoration: none; font-size: .82rem; }
.pg-go a:hover { border-color: var(--teal); color: var(--teal); }
.pg-go img { width: 20px; height: 15px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }
.pg-drill { margin-left: 8px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: .72rem; font-weight: 600; color: var(--teal); text-decoration: none; white-space: nowrap; }
.pg-drill:hover { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 10%, transparent); }

/* On phones the Regions link sits under the country's name, so the table keeps its width (Value and Year stay in view) */
@media (max-width: 720px) {
  .pg-drill { display: block; width: max-content; margin: 3px 0 0; }
}
