  :root {
    --surface-1:      #fcfcfb;
    --page:           #f9f9f7;
    --text-primary:   #0b0b0b;
    --text-secondary: #52514e;
    --text-muted:     #898781;
    --gridline:       #e1e0d9;
    --baseline:       #c3c2b7;
    --border:         rgba(11,11,11,0.10);
    --line-ink:       #0b0b0b;
    --row-alt:        #f3f2ee;
    --chip-bg:        #f0efec;
    --narrative-bg:   #f4f4f4;
    --sidebar-bg:     #eef0f1;

    --masthead-blue: #274375;
    --who-blue: #007eb4;

    --ord3-1: #86b6ef;
    --ord3-2: #4874ab;
    --ord3-3: #0d366b;

    --ord5-1: #86b6ef;
    --ord5-2: #6694cd;
    --ord5-3: #4874ab;
    --ord5-4: #2b548b;
    --ord5-5: #0d366b;

    --no-data: #c3c2b7;

    --trend-widen:  #c23b32;
    --trend-narrow: #2f8f5b;
    --trend-flat:   #c98a1a;

    --ord-single: #2b548b;

    --bar-range: #86b6ef;

    --accent-1: #9c4a30;
    --accent-1-soft: #f0ded7;
    --accent-2: #2f7d6b;
    --accent-2-soft: #dcece7;
    --accent-3: #3b6fa0;
    --accent-3-soft: #dbe6f0;
    --accent-4: #7c4fa3;
    --accent-4-soft: #e9def0;
    --accent-5: #3f8f97;
    --accent-5-soft: #dbecee;
    --accent-6: #4c5fd9;

    --cat-health-services: #c1443a;
    --cat-health-services-soft: #f7e8e6;
    --cat-living-conditions: #2f8f5b;
    --cat-living-conditions-soft: #e3f0e8;
    --cat-social-human-capital: #7c4fa3;
    --cat-social-human-capital-soft: #ede4f2;
    --cat-employment: #3d94c9;
    --cat-employment-soft: #e2eef5;
    --cat-income-security: #d9a13f;
    --cat-income-security-soft: #f6ecda;
    --cat-neutral: #b08968;
    --cat-neutral-soft: #f1e6da;
    --cat-stripe: linear-gradient(90deg,
      var(--cat-health-services) 0%,
      var(--cat-living-conditions) 25%,
      var(--cat-social-human-capital) 50%,
      var(--cat-employment) 75%,
      var(--cat-income-security) 100%);
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --surface-1:      #1a1a19;
      --page:           #0d0d0d;
      --text-primary:   #ffffff;
      --text-secondary: #c3c2b7;
      --text-muted:     #898781;
      --gridline:       #2c2c2a;
      --baseline:       #383835;
      --border:         rgba(255,255,255,0.10);
      --line-ink:       #ffffff;
      --row-alt:        #212120;
      --who-blue:       #4cc2ea;
      --chip-bg:        #242423;
      --narrative-bg:   #333331;
      --sidebar-bg:     #232426;

      --ord3-1: #86b6ef;
      --ord3-2: #4f82c2;
      --ord3-3: #184f95;

      --ord5-1: #86b6ef;
      --ord5-2: #6a9cd8;
      --ord5-3: #4f82c2;
      --ord5-4: #3468ab;
      --ord5-5: #184f95;

      --no-data: #454542;

      --trend-widen:  #e2564b;
      --trend-narrow: #3fb478;
      --trend-flat:   #d9a13f;

      --ord-single: #6a9cd8;

      --accent-1: #dd8563;
      --accent-1-soft: #3a271f;
      --accent-2: #5cbfa8;
      --accent-2-soft: #1a2f2a;
      --accent-3: #7aa9d9;
      --accent-3-soft: #24344a;
      --accent-4: #b98fe0;
      --accent-4-soft: #362a44;
      --accent-5: #5fb8c0;
      --accent-5-soft: #1c3436;
      --accent-6: #8b98ea;

      --cat-health-services: #e2564b;
      --cat-health-services-soft: #34211f;
      --cat-living-conditions: #3fb478;
      --cat-living-conditions-soft: #1c2f24;
      --cat-social-human-capital: #b98fe0;
      --cat-social-human-capital-soft: #2c2436;
      --cat-employment: #6ab6e8;
      --cat-employment-soft: #1e2c37;
      --cat-income-security: #d9a13f;
      --cat-income-security-soft: #332c1c;
      --cat-neutral: #d3a97a;
      --cat-neutral-soft: #332a1e;
    }
  }

  * { box-sizing: border-box; }
  html, body {
    margin: 0; padding: 0;
    background: var(--page);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  }
  body { padding: 24px; min-height: 100vh; display: flex; flex-direction: column; }
  .wrap { max-width: 1920px; margin: 0 auto; flex: 1 0 auto; width: 100%; }

  .topbar {
    background: var(--masthead-blue);
    padding: 10px 32px;
    margin: -24px -24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
  }
  .topbar-brand { display: flex; align-items: center; gap: 12px; }
  .topbar-logo { display: flex; align-items: center; line-height: 0; }
  .topbar-logo img { height: 28px; width: auto; display: block; }
  .topbar-title {
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    opacity: 0.92;
  }
  .topbar-title:hover,
  .topbar-title:focus-visible {
    opacity: 1;
    text-decoration: underline;
  }
  .topbar-links {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .topbar-links a {
    color: #ffffff;
    text-decoration: none;
    opacity: 0.85;
  }
  .topbar-links a:hover,
  .topbar-links a:focus-visible {
    opacity: 1;
    text-decoration: underline;
  }
  .topbar-links .sep { color: #ffffff; opacity: 0.4; }
  .accent-bar {
    height: 4px;
    margin: 0 -24px 24px;
    background: var(--cat-stripe);
  }

  header { margin-bottom: 20px; }
  .home-link {
    display: inline-block; font-size: 12px; font-weight: 600; color: var(--text-muted);
    text-decoration: none; margin-bottom: 10px;
  }
  .home-link:hover { color: var(--text-primary); text-decoration: underline; }
  h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; }
  .subtitle { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 0 0 4px; }
  .category-badge {
    display: flex; align-items: center; gap: 7px;
    font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
    margin: 0 0 6px;
  }
  .category-badge-dot {
    width: 9px; height: 9px; border-radius: 50%; flex: none;
    background: var(--badge-color, var(--cat-neutral));
  }
  .meta-line { font-size: 12px; color: var(--text-muted); margin: 0; }
  .meta-line-link { color: var(--accent-3); text-decoration: none; }
  .meta-line-link:hover, .meta-line-link:focus-visible { text-decoration: underline; }
  .meta-line-link[data-tip] { position: relative; }
  .meta-line-link[data-tip]::after {
    content: attr(data-tip);
    position: absolute; left: 0; top: calc(100% + 6px); z-index: 20;
    white-space: nowrap; pointer-events: none;
    background: var(--text-primary); color: var(--surface-1);
    font-size: 12px; font-weight: 500; padding: 4px 8px; border-radius: 6px;
    opacity: 0; transition: opacity .08s;
  }
  .meta-line-link[data-tip]:hover::after,
  .meta-line-link[data-tip]:focus-visible::after { opacity: 1; }

  .atlas-pill-row { display: flex; justify-content: flex-end; margin-bottom: -8px; }
  .atlas-pill {
    display: inline-block; padding: 6px 14px; border-radius: 999px;
    background: var(--accent-3); color: #fff; border: 1px solid var(--accent-3);
    font-size: 12.5px; font-weight: 600; text-decoration: none;
  }
  .atlas-pill:hover { filter: brightness(1.1); }
  .atlas-pill:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }

  .layout { display: flex; align-items: flex-start; gap: 20px; }
  .sidebar {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
  }
  .main-content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

  .indicator-header { display: flex; align-items: center; gap: 14px; }
  .indicator-icon {
    width: 52px; height: 52px; flex: none;
    border-radius: 10px; border: 1px solid var(--border);
    object-fit: cover; background: var(--surface-1);
  }
  .indicator-header-text { flex: 1 1 auto; min-width: 0; }
  .indicator-header .chart-toolbar-btn,
  .indicator-header .chart-export,
  .indicator-header .table-export-btn { flex: none; }
  .indicator-header-text .subtitle,
  .indicator-header-text .category-badge,
  .indicator-header-text .meta-line { margin: 0 0 4px; }
  .indicator-header-text .meta-line { margin-bottom: 0; }

  #country-header .subtitle { font-size: 30px; }
  .stage-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; border-bottom: 2px solid var(--accent-5); }
  .stage-tab {
    appearance: none; border: 1px solid var(--border); border-bottom: none;
    background: var(--surface-1); color: var(--text-secondary);
    font: inherit; font-size: 14px; font-weight: 600;
    padding: 9px 18px; border-radius: 8px 8px 0 0; cursor: pointer;
    margin-bottom: -2px;
  }
  .stage-tab:hover { background: var(--accent-5-soft); }
  .stage-tab.active { background: var(--accent-5); border-color: var(--accent-5); color: #fff; }
  .stage-tab:focus-visible { outline: 2px solid var(--accent-5); outline-offset: 2px; }
  #country-header .meta-line { font-size: 14.5px; }
  .sidebar .card,
  .main-content .card { margin-bottom: 0; }

  @media (max-width: 600px) {
    .wrap, .layout, .main-content, .main-content > * { min-width: 0; max-width: 100%; }
    .indicator-header { flex-wrap: wrap; }
    .indicator-header-text { flex: 1 1 180px; }
    #country-header .subtitle { font-size: 24px; }
    .stage-tabs { max-width: 100%; }
    svg.chart { min-width: 560px; }
    .profile-indicator-chart-scroll { overflow-x: auto; max-width: 100%; }
    .profile-trend-narrative-row { flex-direction: column; }
    .profile-trend-narrative-row > .chart-scroll { flex: 1 1 auto; width: 100%; }
  }
  @media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { position: static; max-height: none; width: 100%; flex: 1 1 auto; }
  }

  .atlas-wrap,
  .country-profile-wrap { width: 90%; }
  @media (min-width: 901px) {
    .atlas-wrap .sidebar,
    .country-profile-wrap .sidebar { flex-basis: 20%; }
  }

  .card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 16px;
  }
  .sidebar .card { background: var(--sidebar-bg); }

  .filter-card {
    padding-top: 14px;
    border-top: 3px solid transparent;
  }
  .filter-card-indicator { border-top-color: var(--accent-1); }
  .filter-card-slice { border-top-color: var(--accent-2); }
  .filter-card-view { border-top-color: var(--accent-6); }
  .filter-card-region { border-top-color: var(--accent-5); }
  .filter-card-country { border-top-color: var(--accent-5); }

  .chart-card-main,
  .chart-card-trend {
    border-top: 3px solid transparent;
  }
  .chart-card-main { border-top-color: var(--accent-3); }
  .chart-card-trend { border-top-color: var(--accent-4); }
  .filter-card-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; margin: 0 0 12px;
  }
  .filter-card-indicator .filter-card-title { color: var(--accent-1); }
  .filter-card-slice .filter-card-title { color: var(--accent-2); }
  .filter-card-view .filter-card-title { color: var(--accent-6); }
  .filter-card-region .filter-card-title { color: var(--accent-5); }
  .filter-card-country .filter-card-title { color: var(--accent-5); }

  summary.filter-card-title {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; list-style: none;
  }
  summary.filter-card-title::-webkit-details-marker { display: none; }
  summary.filter-card-title::after {
    content: "▾"; font-size: 9px; margin-left: 8px; flex: none;
    color: inherit; opacity: 0.7; transition: transform 0.15s ease;
  }
  details.filter-card[open] > summary.filter-card-title::after { transform: rotate(180deg); }
  summary.filter-card-title:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
  details.filter-card:not([open]) > .filterbar { display: none; }

  .filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 20px;
  }
  .sidebar .filterbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .sidebar .filterbar .spacer { display: none; }
  .sidebar .filterbar select,
  .sidebar .filterbar .view-toggle { width: 100%; }
  .sidebar .filterbar .seg button { flex: 1 1 0; }
  .load-status {
    font-size: 12.5px; color: var(--text-secondary); font-style: italic;
    margin: 0;
  }
  .filter-group { display: flex; flex-direction: column; gap: 6px; }
  .filter-group label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted);
  }
  .symbol-toggle-row { display: flex; flex-wrap: wrap; gap: 12px; }
  .year-slider-value { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
  .year-slider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 6px; margin: 8px 0 6px; padding: 0; border-radius: 3px; cursor: pointer;
    background: linear-gradient(to right, var(--border) var(--pct, 0%), var(--slider-color, var(--accent-6)) var(--pct, 0%));
  }
  .year-slider::-webkit-slider-runnable-track { background: transparent; height: 6px; }
  .year-slider::-moz-range-track { background: transparent; height: 6px; }
  .year-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -5px;
    border-radius: 50%; background: var(--slider-color, var(--accent-6)); border: 2px solid var(--surface-1);
    box-shadow: 0 0 0 1px var(--slider-color, var(--accent-6));
  }
  .year-slider::-moz-range-thumb {
    width: 12px; height: 12px; border-radius: 50%; background: var(--slider-color, var(--accent-6));
    border: 2px solid var(--surface-1); box-shadow: 0 0 0 1px var(--slider-color, var(--accent-6));
  }
  .year-slider:focus-visible { outline: 2px solid var(--slider-color, var(--accent-6)); outline-offset: 4px; }
  .filter-card-slice { --slider-color: var(--accent-2); }
  .seg {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
  }
  .seg button {
    appearance: none; border: none; background: transparent;
    color: var(--text-secondary);
    font: inherit; font-size: 13px; font-weight: 500;
    padding: 7px 14px; cursor: pointer;
    border-right: 1px solid var(--border);
  }
  .seg button:last-child { border-right: none; }
  .seg button:hover { background: var(--chip-bg); }
  .seg button.active {
    background: var(--text-primary);
    color: var(--surface-1);
  }
  .filter-card-slice .seg button.active { background: var(--accent-2); color: #fff; }
  .filter-card-view .seg button.active { background: var(--accent-6); color: #fff; }
  select {
    appearance: none;
    font: inherit; font-size: 13px;
    color: var(--text-primary);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 32px 7px 12px;
    cursor: pointer;
    max-width: 320px;
    text-overflow: ellipsis;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23898781'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
  }
  .filter-card-indicator select:focus-visible { outline: 2px solid var(--accent-1); outline-offset: 1px; }
  .filter-card-slice select:focus-visible,
  .filter-card-slice .seg button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
  .filter-card-view select:focus-visible,
  .filter-card-view .seg button:focus-visible { outline: 2px solid var(--accent-6); outline-offset: 1px; }
  .filter-card-region select:focus-visible { outline: 2px solid var(--accent-5); outline-offset: 1px; }
  .filter-card-country select:focus-visible,
  .filter-card-country .seg button:focus-visible { outline: 2px solid var(--accent-5); outline-offset: 1px; }
  .filter-card-country .seg button.active { background: var(--accent-5); color: #fff; }
  .spacer { flex: 1 1 auto; }
  .view-toggle {
    appearance: none; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-1); color: var(--text-secondary);
    font: inherit; font-size: 13px; padding: 7px 14px; cursor: pointer;
  }
  .view-toggle:hover { background: var(--chip-bg); }

  .legend {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 8px; margin-bottom: 14px; font-size: 12px; color: var(--text-secondary);
  }
  .legend-row { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; }
  .legend-group { display: flex; align-items: center; gap: 8px; }
  .legend-ramp { display: flex; align-items: center; gap: 4px; }
  .legend-swatch {
    width: 11px; height: 11px; border-radius: 50%;
    box-shadow: 0 0 0 2px var(--surface-1);
    flex: none;
  }
  .legend-line { width: 22px; height: 0; border-top: 2px solid var(--line-ink); flex: none; }
  .legend-bar { width: 22px; height: 8px; border-radius: 4px; background: var(--bar-range); flex: none; }
  .legend-nodata { width: 11px; height: 11px; border-radius: 50%; background: var(--no-data); flex: none; }
  .legend-gaptrend-icon { font-size: 13px; line-height: 1; flex: none; }
  .legend-gaptrend-icon.widening { color: var(--trend-widen); }
  .legend-gaptrend-icon.narrowing { color: var(--trend-narrow); }
  .legend-gaptrend-icon.flat { color: var(--trend-flat); }

  .chart-toolbar {
    display: flex; justify-content: flex-end; align-items: center;
    gap: 8px; margin-bottom: 10px;
  }
  .chart-toolbar-btn {
    appearance: none; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-1); color: var(--text-secondary);
    font: inherit; font-size: 12.5px; padding: 6px 12px; cursor: pointer;
  }
  .chart-toolbar-btn:hover { background: var(--chip-bg); }
  .chart-toolbar-btn:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
  .chart-toolbar-btn.active { background: var(--accent-3); color: #fff; border-color: var(--accent-3); }

  .chart-export { position: relative; }
  .chart-export-btn {
    list-style: none; cursor: pointer; appearance: none;
    display: inline-flex; align-items: center; justify-content: center;
    font: inherit; font-size: 14px; color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 5px 7px; background: var(--surface-1);
    line-height: 1;
  }
  .chart-export-btn::-webkit-details-marker { display: none; }
  .chart-export-btn:hover { background: var(--chip-bg); }
  .chart-export-btn:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
  .chart-export-btn[hidden] { display: none; }
  .chart-export-menu {
    position: absolute; top: calc(100% + 4px); right: 0; z-index: 5;
    display: flex; flex-direction: column; min-width: 130px;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18); overflow: hidden;
  }
  .chart-export-menu button {
    appearance: none; border: none; background: transparent; text-align: left;
    font: inherit; font-size: 12.5px; color: var(--text-primary);
    padding: 8px 12px; cursor: pointer;
  }
  .chart-export-menu button:hover,
  .chart-export-menu button:focus-visible { background: var(--chip-bg); outline: none; }
  .chart-export-row { display: flex; justify-content: flex-end; margin-bottom: 6px; }

  #hesr-chart-print-overlay { display: none; }
  @media print {
    body.printing-chart > *:not(#hesr-chart-print-overlay) { display: none !important; }
    body.printing-chart #hesr-chart-print-overlay { display: block !important; padding: 24px; }
  }

  .print-profile-btn[hidden] { display: none; }
  @media print {
    @page { margin: 12mm; }
    body.printing-profile { padding: 0; background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body.printing-profile .topbar,
    body.printing-profile .accent-bar,
    body.printing-profile header,
    body.printing-profile .sidebar,
    body.printing-profile .chart-toolbar-btn,
    body.printing-profile .chart-export,
    body.printing-profile .table-export-btn,
    body.printing-profile .trend-hint,
    body.printing-profile .row-trend-icon,
    body.printing-profile .load-status,
    body.printing-profile #tooltip { display: none !important; }
    body.printing-profile .wrap { width: 100%; max-width: none; margin: 0; padding: 0; }
    body.printing-profile .layout { display: block; }
    body.printing-profile .main-content { width: 100%; }
    body.printing-profile footer { margin: 12px 0 0; }
    body.printing-profile .profile-indicator-row { break-inside: avoid; }
    body.printing-profile .profile-indicator-narrative,
    body.printing-profile .profile-trend-narrative-text { font-size: 10.5px; line-height: 1.35; padding: 4px 8px; margin-top: 4px; }
    body.printing-profile .profile-trend-narrative-card { padding: 6px 8px; }
    body.printing-profile .profile-category-heading,
    body.printing-profile .profile-indicator-title,
    body.printing-profile .profile-group-head { break-after: avoid; }
    body.printing-profile .profile-indicator-chart-scroll,
    body.printing-profile .chart-scroll { overflow: visible; }
  }

  .chart-scroll { overflow-x: auto; }
  svg.chart { display: block; width: 100%; height: auto; }

  .chart-split { display: flex; flex-direction: row; align-items: flex-start; gap: 24px; }
  .chart-split[hidden] { display: none; }
  .chart-split-panel { flex: 1 1 0; min-width: 0; }
  .chart-split-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted); margin: 0 0 8px;
  }
  @media (max-width: 900px) {
    .chart-split { flex-direction: column; }
  }
  .row-label {
    font-size: 14px; fill: var(--text-primary);
  }
  .country-profile-wrap .row-label { font-size: 12px; }
  .group-header-label {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; fill: var(--accent-6);
  }
  .row-year {
    font-size: 10px; fill: var(--text-muted);
  }
  .row-flag {
    font-size: 10px; fill: var(--text-muted); font-style: italic;
  }
  .gap-trend-icon { font-size: 13px; }
  .gap-trend-icon.widening { fill: var(--trend-widen); }
  .gap-trend-icon.narrowing { fill: var(--trend-narrow); }
  .gap-trend-icon.flat { fill: var(--trend-flat); }
  .gap-trend-box { fill: #e4e7eb; stroke: none; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .gap-trend-box { fill: #4a505b; }
  }
  :root[data-theme="dark"] .gap-trend-box { fill: #4a505b; }
  .gap-trend-col-title { font-size: 9px; font-weight: 700; fill: var(--text-primary); }
  .axis-label { font-size: 11px; fill: var(--text-muted); }
  .gridline { stroke: var(--gridline); stroke-width: 1; shape-rendering: crispEdges; }
  .baseline { stroke: var(--baseline); stroke-width: 1; shape-rendering: crispEdges; }
  .range-line { stroke: var(--line-ink); stroke-width: 2; stroke-linecap: round; }
  .range-bar { fill: var(--bar-range); }
  .range-bar.hover { fill: var(--line-ink); }
  .dot {
    stroke: var(--surface-1); stroke-width: 2; pointer-events: none;
  }
  .hit {
    fill: transparent; cursor: pointer;
  }
  .hit:focus { outline: none; }
  .hit:focus + .dot, .dot.hover {
    stroke: var(--text-primary);
  }
  .row-band { fill: var(--row-alt); }
  .no-data-text { font-size: 11px; fill: var(--text-muted); font-style: italic; }

  .row-hit { fill: transparent; cursor: pointer; }
  .row-hit:hover { fill: var(--chip-bg); }
  .row-hit:focus { outline: none; }
  .row-hit:focus-visible { outline: 2px solid var(--text-primary); outline-offset: -2px; }
  .row-label { pointer-events: none; }
  .row-label.row-hover,
  .row-label.selected { fill: var(--text-primary); font-weight: 600; }
  .row-selected-marker { fill: var(--line-ink); }

  .row-trend-icon { font-size: 11px; pointer-events: none; }
  .row-trend-icon-hit:hover ~ .row-trend-icon { opacity: 0.7; }

  .trend-hint { font-size: 11.5px; color: var(--text-muted); margin: 0 0 14px; }
  .trend-card { display: none; }
  .card.trend-card {
    background: color-mix(in srgb, var(--cat-section-bg, #cfd3d6) 40%, var(--surface-1));
  }
  .trend-card.visible { display: block; }
  @keyframes trend-fade-in { from { opacity: 0; transform: translateY(-16px) scale(0.98); } to { opacity: 1; transform: none; } }
  .trend-card.visible, .profile-trend-card.fade-in { animation: trend-fade-in 0.6s ease-out; }
  .trend-card.fading-out, .profile-trend-card.fading-out {
    opacity: 0; transform: translateY(-16px) scale(0.98);
    transition: opacity 0.4s ease-in, transform 0.4s ease-in;
  }
  @media (prefers-reduced-motion: reduce) {
    .trend-card.visible, .profile-trend-card.fade-in { animation: none; }
    .trend-card.fading-out, .profile-trend-card.fading-out { transition: none; }
  }
  .trend-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 14px; gap: 12px;
  }
  .trend-title { font-size: 22px; font-weight: 600; margin: 0 0 3px; color: var(--text-primary); }
  .trend-subtitle { font-size: 15px; color: var(--text-secondary); margin: 0; }
  .trend-close {
    appearance: none; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-1); color: var(--text-secondary);
    font: inherit; font-size: 13px; padding: 6px 12px; cursor: pointer; flex: none;
  }
  .trend-close:hover { background: var(--chip-bg); }
  .trend-close:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
  .trend-actions { display: flex; gap: 8px; flex: none; }
  .trend-line { fill: none; stroke-width: 2; }
  .trend-dot { stroke: var(--surface-1); stroke-width: 2; pointer-events: none; }
  .hit:focus + .trend-dot, .trend-dot.hover { stroke: var(--text-primary); }
  .trend-axis-label { font-size: 10.5px; fill: var(--text-muted); }
  .trend-zoom-hint { font-size: 11.5px; color: var(--text-muted); margin: 0 0 12px; }
  .trend-drag-overlay { fill: transparent; cursor: crosshair; }
  .trend-brush { fill: var(--text-primary); opacity: 0.08; pointer-events: none; }

  #tooltip {
    position: fixed;
    pointer-events: none;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 190px;
    max-width: 260px;
    z-index: 50;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.08s ease, transform 0.08s ease;
  }
  #tooltip.visible { opacity: 1; transform: translateY(0); }
  #tooltip .tt-title {
    font-size: 12.5px; font-weight: 600; color: var(--text-primary);
    margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
  }
  #tooltip .tt-key {
    display: inline-block; width: 14px; height: 2px; border-radius: 1px;
  }
  #tooltip .tt-value {
    font-size: 18px; font-weight: 600; color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    margin-bottom: 4px;
  }
  #tooltip .tt-row {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 2px 0; font-variant-numeric: tabular-nums;
  }
  #tooltip .tt-row span:first-child { color: var(--text-muted); }
  #tooltip .tt-note { margin-top: 6px; color: var(--text-muted); font-style: italic; }

  .table-wrap { display: none; overflow-x: auto; }
  .table-wrap.visible { display: block; }
  .chart-wrap.hidden { display: none; }
  table.data-table {
    width: 100%; border-collapse: collapse; font-size: 12.5px;
    font-variant-numeric: tabular-nums;
  }
  table.data-table th, table.data-table td {
    text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--gridline);
  }
  table.data-table th {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
    color: var(--text-muted); font-weight: 600;
  }
  table.data-table td { color: var(--text-secondary); }
  table.data-table td.strong { color: var(--text-primary); font-weight: 500; }
  table.data-table tr:nth-child(even) { background: var(--row-alt); }

  .stats-row { display: flex; gap: 24px; margin-bottom: 4px; flex-wrap: wrap; }
  .stat { min-width: 120px; }
  .stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
  .stat-value { font-size: 20px; font-weight: 600; color: var(--text-primary); }
  .stat-value-sources { font-size: 20px; font-weight: 600; max-width: 260px; line-height: 1.3; }
  .stat-value-gaptrend { display: flex; align-items: center; gap: 6px; font-size: 15px; }
  .stat-value-gaptrend .legend-gaptrend-icon { font-size: 16px; }
  #stats-row .stat-value,
  #stats-row .stat-value-sources { font-size: 18px; }

  .accent-bar-bottom {
    height: 4px;
    margin: 18px -24px 0;
    background: var(--cat-stripe);
  }
  footer {
    background: var(--masthead-blue);
    margin: 0 -24px -24px;
    padding: 16px 32px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
  }
  footer a { color: #ffffff; }

  .visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }

  .profile-category-section {
    background: var(--cat-section-bg, var(--cat-neutral-soft));
    border-radius: 10px;
    padding: 16px 20px 20px;
    margin-bottom: 16px;
  }
  .profile-category-heading {
    display: flex; align-items: center; gap: 14px;
    font-size: 22px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--cat-color, var(--text-primary));
    margin: 0 0 18px;
  }
  .profile-category-dot {
    width: 10px; height: 10px; border-radius: 50%; flex: none;
    background: var(--cat-color, var(--cat-neutral));
  }
  .profile-category-icon {
    width: 80px; height: 80px; flex: none;
    border-radius: 14px; object-fit: cover;
  }
  .profile-indicator-row {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px 18px;
  }
  .profile-indicator-row + .profile-indicator-row { margin-top: 28px; }
  .profile-indicator-title {
    font-size: 18px; font-weight: 700; color: var(--text-primary);
    margin: 0 0 12px; padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }
  .profile-group-head { justify-content: space-between; align-items: center; margin: 14px 0 6px; }
  .profile-group-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--accent-3);
  }
  .profile-indicator-row .profile-indicator-narrative + .profile-group-head { margin-top: 22px; }
  .profile-indicator-row > .profile-trend-card { margin: 0 0 18px; }
  .profile-indicator-chart-scroll { overflow-x: auto; }

  .profile-indicator-title-row { display: flex; align-items: center; gap: 14px; }
  .profile-indicator-title-row .profile-indicator-title { margin: 0; font-size: 22px; flex: 1 1 auto; }
  .profile-indicator-icon { width: 80px; height: 80px; flex: none; border-radius: 14px; object-fit: cover; }
  .profile-indicator-title-row .chart-export,
  .profile-indicator-title-row .table-export-btn { flex: none; }

  .profile-trend-card {
    margin: 0 -20px 18px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--cat-section-bg, var(--surface-1)) 40%, var(--surface-1));
  }
  #custom-trend-host .profile-trend-card { margin: 18px 0; }
  .chart-card-trend .trend-subtitle { font-size: 18px; font-weight: 700; }
  .chart-card-trend .stat-value,
  .chart-card-trend .stat-value-sources { font-size: 15px; }

  .profile-indicator-narrative {
    font-size: 14.5px; font-style: italic; color: var(--text-muted);
    margin: 8px 0 0;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--narrative-bg);
    padding: 8px 12px;
  }
  .profile-indicator-narrative:empty { display: none; }
  .profile-narrative-line { margin-top: 2px; }
  .profile-narrative-line:first-child { margin-top: 0; }
  .profile-narrative-heading { margin-top: 8px; font-style: normal; font-weight: 700; }
  .profile-indicator-narrative-label {
    font-style: normal; font-weight: 700; color: var(--accent-3); margin-right: 4px;
  }

  .profile-trend-narrative-row { display: flex; gap: 18px; align-items: flex-start; }
  .profile-trend-narrative-row > .chart-scroll { flex: 0 0 70%; min-width: 0; }
  .profile-trend-narrative-card {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--chip-bg); border: 1px solid var(--border); border-radius: 8px;
    padding: 10px 12px; margin-top: 2px;
    text-align: left;
  }
  .profile-trend-narrative-label {
    font-weight: 700; color: var(--accent-3); margin-right: 4px;
  }
  .profile-trend-narrative-text { font-size: 14.5px; color: var(--text-secondary); margin: 0; line-height: 1.45; }

  .manual-layout {
    display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start;
    margin-top: 4px;
  }
  .manual-toc {
    position: sticky; top: 24px;
    max-height: calc(100vh - 48px); overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
    border-left: 2px solid var(--border);
    padding-left: 16px;
  }
  @media (max-width: 900px) {
    .manual-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .manual-toc { position: static; max-height: none; overflow: visible; }
  }
  .manual-toc .toc-label {
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-muted); margin: 0 0 10px;
  }
  .manual-toc a { font-size: 13.5px; color: var(--text-secondary); text-decoration: none; padding: 5px 0; line-height: 1.4; display: block; }
  .manual-toc a:hover, .manual-toc a:focus-visible { color: var(--accent-3); }
  .manual-toc a.sub { padding-left: 14px; font-size: 12.5px; color: var(--text-muted); }

  .manual-section { margin-bottom: 52px; scroll-margin-top: 24px; }
  .manual-section:last-of-type { margin-bottom: 0; }
  .manual-section h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); margin: 0 0 14px; scroll-margin-top: 24px; }
  .manual-section h3 { font-size: 15.5px; font-weight: 700; color: var(--text-primary); margin: 26px 0 8px; scroll-margin-top: 24px; }
  .manual-section h3:first-child { margin-top: 0; }
  .manual-step-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; }
  .manual-step-num {
    font-size: 13px; font-weight: 700; color: var(--accent-3);
    border: 1.5px solid var(--accent-3); border-radius: 50%;
    width: 22px; height: 22px; flex: none;
    display: flex; align-items: center; justify-content: center;
  }

  .manual-body p { font-size: 14px; line-height: 1.65; color: var(--text-secondary); max-width: 66ch; margin: 0 0 12px; }
  .manual-body p:last-child { margin-bottom: 0; }
  .manual-body strong { color: var(--text-primary); font-weight: 600; }
  .manual-body code {
    font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.92em;
    background: var(--chip-bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
    color: var(--text-primary);
  }
  .manual-body a { color: var(--accent-3); }

  .manual-panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin: 14px 0 18px; }
  .manual-field-list { display: flex; flex-direction: column; gap: 11px; }
  .manual-field { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 12px; align-items: start; }
  @media (max-width: 560px) { .manual-field { grid-template-columns: 1fr; gap: 3px; } }
  .manual-field dt {
    font-size: 12.5px; font-weight: 700; color: var(--text-primary);
    background: var(--chip-bg); border: 1px solid var(--border); border-radius: 6px;
    padding: 2px 8px; width: fit-content; max-width: 100%; white-space: normal; overflow-wrap: anywhere;
  }
  .manual-field dd { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-secondary); }

  .manual-callout {
    display: flex; gap: 10px;
    background: var(--chip-bg); border-left: 3px solid var(--accent-3);
    border-radius: 0 8px 8px 0; padding: 12px 16px; margin: 14px 0;
    font-size: 13.5px; line-height: 1.6; color: var(--text-secondary);
  }
  .manual-callout strong { color: var(--text-primary); }

  .manual-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
  .manual-list li { font-size: 13.5px; line-height: 1.55; color: var(--text-secondary); padding-left: 16px; position: relative; }
  .manual-list li::before { content: ""; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-3); }
  .manual-list li strong { color: var(--text-primary); font-weight: 600; }

  .manual-glyph-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 13.5px; color: var(--text-secondary); }
  .manual-glyph-row .glyph { font-size: 16px; line-height: 1; width: 18px; text-align: center; }
  .manual-glyph-row .widening  { color: var(--trend-widen); }
  .manual-glyph-row .narrowing { color: var(--trend-narrow); }
  .manual-glyph-row .flat      { color: var(--trend-flat); }
  .manual-glyph-row strong { color: var(--text-primary); }

  .manual-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
  .manual-chip {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
    color: var(--text-primary); background: var(--chip-bg); border: 1px solid var(--border);
    border-radius: 100px; padding: 5px 11px 5px 8px;
  }
  .manual-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

  .manual-swatch-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
  .manual-swatch { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px var(--surface-1); }
  .manual-swatch-label { font-size: 12px; color: var(--text-muted); margin-right: 12px; }

  .manual-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 4px; }
  .manual-table th, .manual-table td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--gridline); vertical-align: top; }
  .manual-table th { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 700; }
  .manual-table td.term { font-weight: 700; color: var(--text-primary); white-space: nowrap; }
  .manual-table td.def { color: var(--text-secondary); line-height: 1.5; }

  .manual-kbd {
    font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 11.5px;
    background: var(--chip-bg); border: 1px solid var(--border); border-radius: 4px;
    padding: 1.5px 6px; color: var(--text-primary);
  }

  .hub-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
    max-width: 880px; margin-top: 8px;
  }
  @media (max-width: 640px) { .hub-grid { grid-template-columns: 1fr; } }
  .hub-tile {
    display: block; background: var(--surface-1); border: 1px solid var(--border);
    border-radius: 10px; padding: 20px 22px; border-top: 3px solid var(--accent-1);
    text-decoration: none; transition: border-color .15s ease, background .15s ease;
  }
  a.hub-tile:hover, a.hub-tile:focus-visible { background: var(--chip-bg); }
  a.hub-tile:focus-visible { outline: 2px solid var(--accent-1); outline-offset: 2px; }
  .hub-tile-title { font-size: 15.5px; font-weight: 700; color: var(--text-primary); margin: 0 0 6px; }
  .hub-tile-desc { font-size: 13px; color: var(--text-secondary); margin: 0; line-height: 1.5; }
  .hub-tile-disabled { border-top-color: var(--border); opacity: 0.6; cursor: not-allowed; }
  .hub-tile-disabled .hub-tile-title { color: var(--text-muted); }

  .metadata-notes { font-size: 13.5px; line-height: 1.65; color: var(--text-secondary); }
  .metadata-notes p { margin: 0 0 12px; }
  .metadata-notes p:last-child { margin-bottom: 0; }
  .metadata-notes h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); margin: 0 0 10px; }
  .metadata-notes b { color: var(--text-primary); font-weight: 600; }
  .metadata-notes a { color: var(--accent-3); }
  .strat-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
  .strat-pill {
    font-size: 12px; font-weight: 600; line-height: 1; padding: 5px 10px; border-radius: 999px;
    background: var(--chip-bg); border: 1px solid var(--border); color: var(--text-primary);
  }
  .strat-pill-strat { border-color: var(--accent-3); color: var(--accent-3); }
  .strat-pill-age { border-color: var(--accent-6); color: var(--accent-6); }
  .strat-pill-sex { border-color: var(--accent-5); color: var(--accent-5); }
  .metadata-notes img { max-width: 100%; border-radius: 6px; }
  .metadata-box-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    margin: 0 0 12px;
  }
  .metadata-card { background: var(--cat-section-bg, var(--surface-1)); }

  .reference-toolbar-card { padding-bottom: 14px; }
  .reference-search-input {
    appearance: none;
    font: inherit; font-size: 13px;
    color: var(--text-primary);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    min-width: 220px;
  }
  .reference-search-input:focus-visible { outline: 2px solid var(--accent-1); outline-offset: 1px; }
  .indicators-category-cell { display: flex; align-items: center; gap: 7px; }
  .indicators-category-dot {
    width: 9px; height: 9px; border-radius: 50%; flex: none;
    background: var(--badge-color, var(--cat-neutral));
  }
  .indicators-subcategory { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
  #indicators-table td a,
  #stratifiers-table td a { color: var(--text-primary); font-weight: 500; text-decoration: none; }
  #indicators-table td a:hover,
  #indicators-table td a:focus-visible,
  #stratifiers-table td a:hover,
  #stratifiers-table td a:focus-visible { color: var(--accent-3); text-decoration: underline; }

  #stratifiers-table tbody tr.strat-band-a { background: transparent; }
  #stratifiers-table tbody tr.strat-band-b { background: var(--row-alt); }

  .analysis-wrap { max-width: 980px; }
  .analysis-card { margin-bottom: 18px; }
  .analysis-prose { font-size: 13.5px; line-height: 1.65; color: var(--text-secondary); }
  .analysis-prose p { margin: 0 0 10px; }
  .analysis-prose p:last-child { margin-bottom: 0; }
  .analysis-chart-toolbar { display: flex; align-items: center; justify-content: space-between; }
  #table-card .profile-indicator-title-row .metadata-box-title { flex: 1 1 auto; }

  .coef-bar-pos { fill: var(--trend-widen); }
  .coef-bar-neg { fill: var(--trend-narrow); }
  .coef-bar-pos.hover, .coef-bar-neg.hover { opacity: 0.75; }
  .coef-zero-line { stroke: var(--baseline); stroke-width: 1.5; shape-rendering: crispEdges; }

  .cat-bar.hover { opacity: 0.8; }

  .scatter-diagonal { stroke: var(--baseline); stroke-width: 1.5; stroke-dasharray: 4 4; shape-rendering: crispEdges; }
