/* ============================================================
   LRSD Literacy Interventions - Modern Minimalist Stylesheet
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS RESET & CUSTOM PROPERTIES
   ------------------------------------------------------------ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Brand – colours sampled from the Literacy Interventions logo */
  --primary: #0c315a;
  --primary-text: var(--primary);
  --primary-light-text: var(--primary-light);
  --primary-light: #0a7f8a;
  --primary-lighter: #0ea7b4;
  --primary-faint: rgba(12, 49, 90, 0.07);
  --secondary: #0ea7b4;
  --secondary-light: #65cbd3;
  --accent: #f6ae08;
  --accent-dark: #c47c00;
  --accent-light: #fff3c7;

  /* Fun pastel card palette – aligned with the logo's teal / yellow / red-orange */
  --card-yellow-bg: #fef2da;
  --card-yellow-border: #faad0a;
  --card-pink-bg: #fce7e3;
  --card-pink-border: #ee5f48;
  --card-blue-bg: #daf1f3;
  --card-blue-border: #0ea8b1;
  --card-mint-bg: #e8f5e9;
  --card-mint-border: #66bb6a;

  /* Functional – slightly richer for better contrast */
  --success: #5eb892;
  --success-light: #ecf8f2;
  --success-text: #1e7a52;
  --warning: #d1a44e;
  --warning-light: #fdf6e8;
  --warning-text: #8a6d2b;
  --danger: #c27070;
  --danger-light: #fdf0f0;
  --info: #5a9ec9;
  --info-light: #edf5fc;
  --info-text: #2f6a92;

  /* ── Unified flowchart colour code ──
     Only THREE colours are used across the flowchart:
       1. STEP        – every step (checklist, selection, decision, info)
       2. EFFECTIVE   – effective / positive routes & outcomes
       3. INEFFECTIVE – ineffective / needs-improvement routes & outcomes */
  --step: #0c315a;
  --step-bg: #edf5f8;
  --step-header: #d6edf1;
  --step-text: #0c315a;
  --step-soft: rgba(12, 49, 90, 0.18);

  --effective: #2fa56f;
  --effective-bg: #e7f6ee;
  --effective-text: #156844;
  --effective-soft: rgba(47, 165, 111, 0.18);

  --ineffective: #d06464;
  --ineffective-bg: #fbeced;
  --ineffective-text: #97333b;
  --ineffective-soft: rgba(208, 100, 100, 0.18);

  /* Legacy step-type variables now all map to the single STEP colour so the
     whole flowchart shares one colour for steps. Endpoint maps to EFFECTIVE. */
  --step-checklist: var(--step);
  --step-selection: var(--step);
  --step-decision: var(--step);
  --step-info: var(--step);
  --step-endpoint: var(--effective);

  --step-checklist-bg: var(--step-bg);
  --step-checklist-header: var(--step-header);
  --step-checklist-text: var(--step-text);
  --step-selection-bg: var(--step-bg);
  --step-selection-header: var(--step-header);
  --step-selection-text: var(--step-text);
  --step-decision-bg: var(--step-bg);
  --step-decision-header: var(--step-header);
  --step-decision-text: var(--step-text);
  --step-info-bg: var(--step-bg);
  --step-info-header: var(--step-header);
  --step-info-text: var(--step-text);
  --step-endpoint-bg: var(--effective-bg);
  --step-endpoint-header: var(--effective-bg);
  --step-endpoint-text: var(--effective-text);

  /* Tier colours – gentle pastels */
  --tier-1: #5eb892;
  --tier-1-bg: #ecf8f2;
  --tier-2: #d1a44e;
  --tier-2-bg: #fdf6e8;
  --tier-3: #c27070;
  --tier-3-bg: #fdf0f0;

  /* Text – higher contrast for accessibility */
  --text: #1e2530;
  --text-secondary: #4a5568;
  --text-light: #7a8699;
  --text-on-primary: #ffffff;
  --text-muted: #a0a9b6;

  /* Backgrounds */
  --bg: #ffffff;
  --bg-alt: #f8f9fb;
  --bg-muted: #f0f2f5;
  --recommended-bg: #fff1bf;
  --recommended-hover-bg: #ffe89a;
  --recommended-text: #a66b00;
  --resource-tag-bg: rgba(255, 255, 255, 0.72);
  --resource-tag-text: var(--text-secondary);

  /* Borders & Shadows – slightly more visible */
  --border: #e2e5ea;
  --border-focus: var(--primary-light);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 3px 10px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.08);

  /* Radii – rounder and more playful */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 100px;

  /* Spacing – more generous for readability */
  --space-xs: 0.3rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.75rem;
  --space-3xl: 3.5rem;

  /* Nav */
  --nav-height: 64px;
  --side-nav-width: 240px;
  --side-nav-collapsed-width: 72px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 0.12s;
  --duration: 0.18s;
  --duration-slow: 0.3s;
}

/* Keep brand button fills stable; only their foreground counterparts change. */
@media screen {
  :root { color-scheme: light; }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --primary-text: #b9dcff;
    --primary-light-text: #83dce3;
    --primary-faint: rgba(185, 220, 255, 0.12);
    --border-focus: #83dce3;
    --accent-dark: #f6c65b;
    --accent-light: #45371c;
    --text: #eef2f7;
    --text-secondary: #c3cfdd;
    --text-light: #adbbcd;
    --text-muted: #a0b0c4;
    --bg: #172231;
    --bg-alt: #111b28;
    --bg-muted: #243244;
    --border: #46576c;
    --card-yellow-bg: #3b321f;
    --card-pink-bg: #3b252a;
    --card-blue-bg: #1c3540;
    --card-mint-bg: #20382e;
    --success-light: #20382e;
    --success-text: #97e1b9;
    --warning-light: #3b321f;
    --warning-text: #f0cf89;
    --danger-light: #3b252a;
    --info-light: #1c3540;
    --info-text: #a5d4f4;
    --step: #3c7195;
    --step-bg: #1d3041;
    --step-header: #263e50;
    --step-text: #c4e3ff;
    --step-soft: rgba(142, 191, 224, 0.18);
    --effective-bg: #20382e;
    --effective-text: #97e1b9;
    --ineffective-bg: #3b252a;
    --ineffective-text: #ffb8be;
    --tier-1-bg: #20382e;
    --tier-2-bg: #3b321f;
    --tier-3-bg: #3b252a;
    --recommended-bg: #45371c;
    --recommended-hover-bg: #574522;
    --recommended-text: #ffd773;
    --resource-tag-bg: #344354;
    --resource-tag-text: #e2e8f0;
  }

  [data-theme="dark"] .cta-icon,
  [data-theme="dark"] .cta-card.cta-card-featured .cta-icon,
  [data-theme="dark"] .visual-flowchart-card-icon,
  [data-theme="dark"] .flowchart-step-checklist .checklist-item,
  [data-theme="dark"] .flowchart-step-selection .selection-option,
  [data-theme="dark"] .vf-node-checklist .vf-checklist-item,
  [data-theme="dark"] .vf-node-selection .vf-selection-option {
    background: var(--bg);
  }
  [data-theme="dark"] .flowchart-step-checklist .checklist-item:hover,
  [data-theme="dark"] .flowchart-step-selection .selection-option:hover,
  [data-theme="dark"] .vf-node-checklist .vf-checklist-item:hover,
  [data-theme="dark"] .vf-node-selection .vf-selection-option:hover {
    background: var(--bg-muted);
  }
  [data-theme="dark"] .flowchart-step-checklist .checklist-item.checked,
  [data-theme="dark"] .flowchart-step-checklist .checklist-item.item-checked,
  [data-theme="dark"] .flowchart-step-selection .selection-option.selected,
  [data-theme="dark"] .flowchart-step-selection .selection-option.option-selected,
  [data-theme="dark"] .vf-node-checklist .vf-checklist-item.checked,
  [data-theme="dark"] .vf-node-selection .vf-selection-option.vf-option-selected {
    background: var(--step-soft);
  }
  :root[data-theme="dark"] .visual-flowchart-dialog .visual-flowchart-viewport {
    background-color: var(--bg-alt);
    background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  }
  [data-theme="dark"] .program-prompt-card,
  [data-theme="dark"] .program-prompt-btn,
  [data-theme="dark"] .program-prompt-continue,
  [data-theme="dark"] .home-feedback,
  [data-theme="dark"] .explore-more-eyebrow,
  [data-theme="dark"] .explore-card,
  [data-theme="dark"] .about-feedback-btn {
    background: var(--bg);
  }
  [data-theme="dark"] .program-prompt-btn:hover,
  [data-theme="dark"] .program-prompt-continue:hover {
    background: var(--bg-muted);
  }
  [data-theme="dark"] .explore-more {
    background: var(--bg-alt);
  }
  [data-theme="dark"] .explore-more-sub { color: var(--text-secondary); }
  [data-theme="dark"] .guided-primary-btn {
    color: var(--primary);
  }
  [data-theme="dark"] .guided-primary-btn:hover:not(:disabled) {
    color: var(--text);
  }
  [data-theme="dark"] .scores-risk-blue { background: var(--info-light); }
  [data-theme="dark"] .scores-risk-green { background: var(--success-light); }
  [data-theme="dark"] .scores-risk-yellow { background: var(--warning-light); }
  [data-theme="dark"] .scores-risk-red { background: var(--danger-light); }
  [data-theme="dark"] .saved-session-current { background: var(--recommended-bg); }
  [data-theme="dark"] .saved-session-current .pathway-session-current { color: var(--recommended-text); }
  [data-theme="dark"] .session-tier-1 { color: var(--success-text); }
  [data-theme="dark"] .session-tier-2 { color: var(--warning-text); }
  [data-theme="dark"] .session-tier-3 { color: var(--ineffective-text); }
  [data-theme="dark"] .step-pill.completed { color: var(--success-text); }
  [data-theme="dark"] .cta-icon svg,
  [data-theme="dark"] .cta-card.cta-card-featured .cta-icon svg { stroke: var(--primary-text); }
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Material Symbols (MUI) icon base */
.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  flex-shrink: 0;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; border: none; background: none; text-align: left; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { color: var(--primary-light-text); text-decoration: none; }
button:hover { text-decoration: none; }
ul, ol { list-style: none; }
input, select, textarea { font: inherit; }

/* ------------------------------------------------------------
   2. TYPOGRAPHY
   ------------------------------------------------------------ */

h1, h2, h3, h4, h5, h6 {
  font-family: "Nunito", "Poppins", sans-serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: 0.95rem; }
h6 { font-size: 0.9rem; }

p { margin-bottom: 0.6rem; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }

.section-heading {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.section-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 1.02rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

/* ------------------------------------------------------------
   3. TOP NAVIGATION
   ------------------------------------------------------------ */

.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.nav-container {
  width: 100%;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  height: 100%;
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover { background: var(--bg-muted); color: var(--text); }

.logo-section {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-sm);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: auto;
  height: 38px;
}

.logo-text {
  font-family: "Nunito", sans-serif;
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--primary-text);
  letter-spacing: -0.01em;
  padding-top: 12px;
}

.mobile-page-title { display: none; }

.nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-left: auto;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1010;
  padding: 8px;
}

.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ------------------------------------------------------------
   Collapsible Side Navigation (desktop)
   ------------------------------------------------------------ */

.side-nav {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  bottom: 0;
  width: var(--side-nav-width);
  background: var(--bg);
  border-right: 1px solid var(--border);
  z-index: 900;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--duration-slow) var(--ease);
}

.side-nav.collapsed { width: var(--side-nav-collapsed-width); }

.side-nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-md) var(--space-sm);
  min-height: 100%;
  box-sizing: border-box;
}

.side-nav .nav-settings {
  margin-top: auto;
}

.side-nav.collapsed .nav-link[data-page="flowchart"]::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 12px;
  right: 12px;
  border-bottom: 1px solid var(--border);
}

.side-nav.collapsed .nav-link[data-page="flowchart"] {
  position: relative;
  margin-bottom: 14px;
}

.progress-monitoring-tools {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--primary-faint);
}

.progress-monitoring-tools ul {
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.progress-monitoring-tools > p,
.progress-monitoring-tools .pathway-card-action {
  font-size: 0.9rem;
}

.progress-monitoring-tools .pathway-card-action {
  display: inline-block;
  text-align: left;
  overflow-wrap: anywhere;
}

.progress-monitoring-tools a .material-symbols-rounded {
  font-size: 1em;
  margin-left: 0.35em;
  vertical-align: middle;
}

.side-nav .nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: 0.65rem var(--space-md);
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  text-align: left;
  white-space: normal;
  transition: background var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

.side-nav .nav-link .nav-link-label { flex: 1; text-align: left; }

.side-nav .nav-link:hover { background: var(--bg-muted); color: var(--text); }

.side-nav .nav-link.active {
  background: var(--primary);
  color: var(--text-on-primary);
}

.side-nav .nav-link .nav-icon { font-size: 22px; }

.nav-badge {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-muted);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
  flex-shrink: 0;
}
.nav-badge.is-empty { opacity: 0.55; }
.side-nav .nav-link.active .nav-badge { background: rgba(255, 255, 255, 0.25); color: var(--text-on-primary); }

/* Collapsed: icon-only, labels and badges hidden, stylized tooltip on hover (see .side-nav-tooltip) */
.side-nav.collapsed .nav-link { justify-content: center; padding: 0.65rem; }
.side-nav.collapsed .nav-link-label,
.side-nav.collapsed .nav-badge { display: none; }

/* Tooltip shown to the right of the cursor for collapsed side-nav items (positioned via JS) */
.side-nav-tooltip {
  position: fixed;
  z-index: 1300;
  background: var(--primary);
  color: var(--text-on-primary);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(0, -50%) translateX(-6px);
  transition: opacity var(--duration) var(--ease),
              transform var(--duration) var(--ease),
              visibility var(--duration) var(--ease);
}

.side-nav-tooltip::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: var(--primary);
}

.side-nav-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%) translateX(0);
}

/* Push page content over to make room for the fixed side nav (desktop only) */
.main-content { margin-left: var(--side-nav-width); transition: margin-left var(--duration-slow) var(--ease); }
body.side-nav-collapsed .main-content { margin-left: var(--side-nav-collapsed-width); }
.site-footer { margin-left: var(--side-nav-width); transition: margin-left var(--duration-slow) var(--ease); }
body.side-nav-collapsed .site-footer { margin-left: var(--side-nav-collapsed-width); }

/* ------------------------------------------------------------
   Top nav program/language controls
   ------------------------------------------------------------ */

.top-program-lang {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
}

.top-program-lang-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-program-lang-field[hidden] { display: none; }

.top-program-lang-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-light);
  line-height: 1;
}

.top-program-lang-select {
  min-width: 136px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

.top-program-lang-select:disabled {
  opacity: 0.75;
}

/* ------------------------------------------------------------
   4. MOBILE MENU
   ------------------------------------------------------------ */

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease);
}

.mobile-nav-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 280px;
  height: 100%;
  background: var(--bg);
  overflow-y: auto;
  padding: calc(var(--nav-height) + var(--space-lg)) var(--space-lg) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  transform: translateX(100%);
  transition: transform var(--duration-slow) var(--ease);
}

.mobile-nav-overlay.active .mobile-nav-content {
  transform: translateX(0);
}

.mobile-menu-program-lang {
  display: none;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0 var(--space-lg);
  height: 60px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  white-space: normal;
  line-height: 1.25;
  transition: background var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

.mobile-nav-item span:not(.material-symbols-rounded):not(.nav-badge) { text-align: left; }

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.mobile-nav-item .material-symbols-rounded {
  font-size: 24px;
  flex-shrink: 0;
}

.mobile-nav-item .nav-badge { margin-left: auto; }

.mobile-nav-item:hover,
.mobile-nav-item.active {
  background: var(--primary-faint);
  color: var(--primary-text);
}

/* ------------------------------------------------------------
   5. MAIN CONTENT & SECTIONS
   ------------------------------------------------------------ */

.main-content {
  padding-top: var(--nav-height);
  min-height: 100vh;
}

.home-content {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

/* ------------------------------------------------------------
   BUBBLE BACKGROUND
   ------------------------------------------------------------ */

.content-section {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - var(--nav-height));
  min-height: calc(100dvh - var(--nav-height));
}

.bubble-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  mix-blend-mode: multiply;
  animation: bubble-fade-in 1.2s ease forwards;
  will-change: transform;
}

@keyframes bubble-fade-in {
  to { opacity: var(--bubble-opacity, 0.18); }
}

/* Ensure content layers sit above bubbles */
.content-section > * {
  position: relative;
  z-index: 1;
}

.content-section > .bubble-bg {
  position: absolute;
  z-index: 0;
}

/* ------------------------------------------------------------
   6. HERO
   ------------------------------------------------------------ */

/* ── Home hero: navy background with dot-grid, two-column ── */
.home-hero {
  background-color: var(--primary);
  background-image: radial-gradient(circle, rgba(255,255,255,0.12) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  color: #fff;
  padding: var(--space-3xl) var(--space-lg);
  border-bottom: none;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-2xl);
}

.hero-content {
  text-align: left;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: var(--space-md);
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero-title .accent-word {
  color: var(--accent);
  display: inline;
}

.hero-subtitle {
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.82);
  max-width: 520px;
}

/* Photo column */
.hero-photo-wrap {
  position: relative;
  flex-shrink: 0;
}

.hero-photo {
  width: 460px;
  height: 308px;
  object-fit: cover;
  object-position: center 30%;
  border-radius: var(--radius-xl);
  display: block;
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
  border: 4px solid rgba(255,255,255,0.18);
}

/* Decorative accent blobs */
.hero-blob {
  position: absolute;
  border-radius: 50%;
}
.hero-blob-yellow {
  width: 56px;
  height: 56px;
  background: var(--accent);
  top: -16px;
  right: -16px;
  border-radius: var(--radius-lg);
}
.hero-blob-pink {
  width: 38px;
  height: 38px;
  background: #f06292;
  bottom: 24px;
  left: -18px;
  border-radius: 50%;
}

/* Responsive */
@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
  .hero-content {
    text-align: left;
  }
  .hero-subtitle {
    max-width: 100%;
    margin: 0;
  }
  .hero-photo-wrap {
    display: none;
  }
  .hero-title {
    font-size: 2.1rem;
  }
}

/* Keep legacy .hero-icon hidden (not used in new hero but referenced elsewhere) */
.hero-icon {
  display: none;
}

.hero-area {
  background: var(--primary);
  background-image: radial-gradient(circle, rgba(255,255,255,0.10) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  color: #fff;
  text-align: center;
  padding: var(--space-2xl) var(--space-lg) var(--space-xl);
  border-bottom: none;
}

.hero-area .section-title {
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
}

.hero-area .section-subtitle {
  color: rgba(255, 255, 255, 0.8);
}

/* Resource Centre */
.resource-centre-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.resource-centre-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.resource-centre-shell {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--nav-height) - 48px);
  min-height: 0;
  max-height: 1100px;
  max-width: 1480px;
  margin: 24px auto;
  padding: 0 24px;
}

.resource-centre-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 0 24px;
}

.resource-centre-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  color: var(--primary-text);
  background: var(--primary-faint);
  border: 1px solid var(--border);
}

.resource-centre-mark .resource-centre-icon { width: 28px; height: 28px; }
.resource-centre-header .section-title { margin: 0 0 4px; font-size: 1.85rem; }
.resource-centre-header p { margin: 0; color: var(--text-secondary); font-size: 0.95rem; }

.resource-centre-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg);
  box-shadow: 0 12px 40px rgba(15, 35, 65, 0.08);
}

.resource-centre-navigation {
  display: flex;
  flex: 0 0 240px;
  min-height: 0;
}

.resource-centre-tablist {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  padding: 24px 14px;
  overflow-y: auto;
  background: linear-gradient(160deg, var(--bg-alt), var(--primary-faint));
  border-right: 1px solid var(--border);
}

.resource-centre-mobile-browse { display: none; }

.resource-centre-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(380px, calc(100% - 24px));
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 24px 0 0 24px;
  background: var(--bg);
  color: var(--text);
  box-shadow: -12px 0 48px rgba(15, 35, 65, 0.18);
}

.resource-centre-drawer[open] { display: flex; flex-direction: column; }
.resource-centre-drawer::backdrop { background: rgba(15, 35, 65, 0.42); backdrop-filter: blur(4px); }

.resource-centre-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 20px 22px;
  border-bottom: 1px solid var(--border);
}

.resource-centre-drawer-header h2 { margin: 0 0 6px; color: var(--primary-text); font-size: 1.3rem; }
.resource-centre-drawer-header p { margin: 0; color: var(--text-secondary); font-size: 0.85rem; }

.resource-centre-drawer-header button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--primary-text);
  cursor: pointer;
}

.resource-centre-drawer-navigation { display: flex; flex: 1; min-height: 0; }
.resource-centre-drawer .resource-centre-tablist { border-right: 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }

.resource-centre-nav-caption {
  padding: 18px 12px 6px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.resource-centre-nav-caption:first-child { padding-top: 0; }

.resource-centre-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.resource-centre-tab:hover { background: var(--bg); color: var(--primary-text); }
.resource-centre-tab .resource-centre-icon { width: 20px; height: 20px; }
.resource-centre-tab .nav-badge { margin-left: auto; }

.resource-centre-tab.active {
  color: var(--text-on-primary);
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 35, 65, 0.12);
}

.resource-centre-tab.active .nav-badge {
  color: var(--text-on-primary);
  background: rgba(255, 255, 255, 0.18);
}

.resource-centre-tab:focus-visible,
.resource-centre-cycle-button:focus-visible,
.resource-centre-mobile-browse button:focus-visible,
.resource-centre-drawer-header button:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 2px;
}

.resource-centre-reader {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.resource-centre-reader-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 32px 22px;
  border-bottom: 1px solid var(--border);
}

.resource-centre-reader-header h3 {
  margin: 0 0 5px;
  color: var(--primary-text);
  font-size: 1.35rem;
  font-weight: 800;
}

#resource-centre-reader-title:focus { outline: none; }

.resource-centre-reader-header p {
  margin: 0;
  max-width: 65ch;
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.87rem;
}

.resource-centre-position {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 20px;
  background: var(--bg-alt);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.resource-centre-panels {
  display: flex;
  flex: 1;
  min-height: 0;
  background: var(--bg-alt);
}

.resource-centre-panel {
  width: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 24px 32px;
}

.resource-centre-panel[hidden] { display: none; }
.resource-centre-panel:focus-visible { outline: 2px solid var(--primary-light); outline-offset: -2px; }
.resource-centre-panel > div > .hero-area { display: none; }

.resource-centre-panel .scores-page-body,
.resource-centre-panel .resources-page-body,
.resource-centre-panel .about-page-body,
.resource-centre-panel .faq-page-wrapper,
.resource-centre-panel .favourites-page-wrapper {
  max-width: none;
  margin: 0;
  padding: 0;
}

.resource-centre-panel .faq-page-body { margin-top: 0; }
.resource-centre-panel .about-content { max-width: none; }
.resource-centre-panel .resource-group { border-width: 1px; border-radius: 16px; }
.resource-centre-panel .resource-group-title .resource-centre-icon { width: 20px; height: 20px; }
.resource-centre-panel .resource-link { flex-basis: 100%; }
.resource-centre-panel .saved-group { padding: 0; }
.resource-centre-panel .saved-group + .saved-group { margin-top: 24px; }
.resource-centre-panel .saved-group .results-empty {
  padding: 28px 24px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}
.resource-centre-panel .favourites-page-wrapper > .hero-area + .saved-group { padding-top: 0; }

.resource-centre-cycle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
}

.resource-centre-cycle-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  max-width: 42%;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--bg);
  color: var(--primary-text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.resource-centre-cycle-button:hover { background: var(--primary-faint); border-color: var(--border); }
.resource-centre-cycle-button > span { display: grid; gap: 3px; }
.resource-centre-cycle-label { color: var(--text-secondary); font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.resource-centre-cycle-next { text-align: right; }
.resource-centre-arrow-back { transform: rotate(180deg); }
.resource-centre-cycle-hint { color: var(--text-secondary); font-size: 0.75rem; text-align: center; }

@media (max-width: 1100px) {
  .resource-centre-navigation { flex-basis: 208px; }
  .resource-centre-reader-header { padding: 22px; }
  .resource-centre-panel { padding: 22px; }
  .resource-centre-cycle-hint { display: none; }
}

@media (max-width: 900px) {
  .resource-centre-workspace { flex-direction: column; }
  .resource-centre-navigation { display: none; }
  .resource-centre-mobile-browse {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--primary-faint);
  }
  .resource-centre-mobile-browse button {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--primary-text);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
  }
  .resource-centre-mobile-browse button > svg:last-child { margin-left: auto; width: 20px; height: 20px; }
}

@media (max-width: 480px) {
  .resource-centre-shell {
    height: calc(100dvh - var(--nav-height) - 24px);
    min-height: 0;
    margin: 12px auto;
    padding: 0 10px;
  }
  .resource-centre-header { display: none; }
  .resource-centre-workspace { border-radius: 18px; }
  .resource-centre-reader-header { padding: 18px 16px 14px; gap: 8px; }
  .resource-centre-reader-header h3 { font-size: 1.15rem; }
  .resource-centre-reader-header p { font-size: 0.8rem; }
  .resource-centre-panel { padding: 18px 16px; }
  .resource-centre-cycle { padding: 10px 8px; gap: 8px; }
  .resource-centre-cycle-button { max-width: 48%; font-size: 0.75rem; gap: 6px; }
  .resource-centre-cycle-button .resource-centre-icon { width: 18px; height: 18px; }
  .resource-centre-panel .scores-reference-grid { grid-template-columns: 1fr; }
  .resource-centre-panel .about-block { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .resource-centre-tab { transition: none; }
}

@media print {
  .resource-centre-shell { height: auto; max-height: none; }
  .resource-centre-navigation, .resource-centre-cycle, .resource-centre-mobile-browse { display: none; }
  .resource-centre-workspace { border: 0; box-shadow: none; }
  .resource-centre-panel { overflow: visible; }
}

/* ------------------------------------------------------------
   7. CONTENT CARDS
   ------------------------------------------------------------ */

.content-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}

.content-card:hover {
  border-color: var(--primary-lighter);
  box-shadow: var(--shadow-md);
}

/* Details summary used as a card heading (replaces card-header-row) */
.content-card details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.content-card details > summary::-webkit-details-marker { display: none; }

.details-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  padding: 0.1rem 0;
}

.details-card-header svg {
  color: var(--primary-text);
  flex-shrink: 0;
}

.content-card details > summary .details-card-header::after {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: auto;
  transition: transform var(--duration) var(--ease);
  flex-shrink: 0;
  color: var(--text-secondary);
}

.content-card details[open] > summary .details-card-header::after {
  transform: rotate(-135deg);
}

.content-card details[open] > summary {
  margin-bottom: var(--space-md);
}

/* --------------------------------------------------------
   Guide CTA Section
   -------------------------------------------------------- */

.guide-cta-section {
  margin-bottom: var(--space-md);
}

.cta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.cta-card {
  background: var(--bg);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg);
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: var(--space-sm);
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}

.cta-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

/* Individual card colour themes */
.cta-card.cta-card-featured,
.cta-card:nth-child(1) {
  background: var(--card-yellow-bg);
  border-color: var(--card-yellow-border);
}

.cta-card:nth-child(2) {
  background: var(--card-pink-bg);
  border-color: var(--card-pink-border);
}

.cta-card:nth-child(3) {
  background: var(--card-blue-bg);
  border-color: var(--card-blue-border);
}

.cta-card:nth-child(4) {
  background: var(--card-mint-bg);
  border-color: var(--card-mint-border);
}

.cta-badge {
  background: var(--primary-faint);
  color: var(--primary-text);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  align-self: flex-start;
}

.cta-icon {
  width: 58px;
  height: 58px;
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
  color: var(--primary-text);
}

.cta-card.cta-card-featured .cta-icon {
  background: rgba(255,255,255,0.7);
}

.cta-icon svg {
  stroke: var(--primary);
}

.cta-icon .material-symbols-rounded {
  font-size: 30px;
  color: var(--primary-text);
}

.cta-card.cta-card-featured .cta-icon svg {
  stroke: var(--primary);
}

.cta-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-text);
  margin: 0;
}

.cta-card.cta-card-featured .cta-title {
  color: var(--primary-text);
}

.cta-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  margin: 0;
}

.cta-card.cta-card-featured .cta-desc {
  color: var(--text-secondary);
}

.cta-btn {
  margin-top: var(--space-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.35rem;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--duration) var(--ease),
              color var(--duration) var(--ease);
  border: 2px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.cta-btn-arrow {
  font-size: 18px;
  transition: transform var(--duration) var(--ease);
}

.cta-card:hover .cta-btn-arrow {
  transform: translateX(3px);
}

.cta-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

.cta-card.cta-card-featured .cta-btn {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.cta-card.cta-card-featured .cta-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

@media (max-width: 1024px) {
  .cta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .cta-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------
   Home "Go deeper" section — reference & resources
   Full-bleed happy/bright band with a dot-grid + circle
   motif that echoes the header dot-grid and bubble circles,
   while its content stays aligned to the page's content width.
   -------------------------------------------------------- */

.explore-more {
  position: relative;
  isolation: isolate;
  width: 100%;
  margin-top: var(--space-2xl);
  padding: var(--space-2xl) 0;
  overflow: hidden;
  background-color: #e2f2eb;
  background-image:
    linear-gradient(135deg, #fef2da 0%, #daf1f3 42%, #e8f5e9 70%, #fce7e3 100%),
    radial-gradient(circle, rgba(27, 45, 107, 0.12) 1.5px, transparent 1.5px);
  background-size: 100% 100%, 26px 26px;
  background-position: center, center;
  color: var(--primary-text);
}

.explore-more-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.explore-more-blob {
  position: absolute;
  border-radius: 50%;
  opacity: 0.32;
  mix-blend-mode: multiply;
}

.explore-more-blob-1 {
  width: 200px;
  height: 200px;
  top: -70px;
  left: -50px;
  background: #66bb6a;
}

.explore-more-blob-2 {
  width: 150px;
  height: 150px;
  bottom: -60px;
  right: 10%;
  background: #64b5f6;
}

.explore-more-blob-3 {
  width: 100px;
  height: 100px;
  top: 18%;
  right: -30px;
  background: #7986cb;
}

.explore-more-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.explore-more-head {
  margin-bottom: var(--space-lg);
}

.explore-more-eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary-text);
  background: rgba(255, 255, 255, 0.55);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

.explore-more-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-text);
  margin: 0 0 0.35rem;
}

.explore-more-sub {
  font-size: 0.95rem;
  color: rgba(27, 45, 107, 0.78);
  margin: 0;
  max-width: 60ch;
}

.explore-more-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.explore-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(27, 45, 107, 0.12);
  background: rgba(255, 255, 255, 0.6);
  color: var(--primary-text);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              transform var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}

.explore-card:hover {
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.explore-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.explore-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
}

.explore-card-icon .material-symbols-rounded { font-size: 24px; }

.explore-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--primary-text);
}

.explore-card-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(27, 45, 107, 0.78);
  flex: 1;
}

.explore-card-arrow {
  align-self: flex-end;
  margin-top: auto;
  display: inline-flex;
  font-size: 20px;
  color: var(--primary-text);
  transition: transform var(--duration) var(--ease);
}

.explore-card:hover .explore-card-arrow { transform: translateX(3px); }

@media (max-width: 1024px) {
  .explore-more-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .explore-more { padding: var(--space-xl) 0; }
  .explore-more-list {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------
   Resources page
   -------------------------------------------------------- */

.resources-page-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) 3rem;
}

.resources-note {
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

.resource-group-intro {
  max-width: 70ch;
  margin: 0 0 var(--space-md);
  line-height: 1.6;
}

.resources-page-body .pillar-definitions {
  max-width: 75ch;
}

.resources-page-body .pillar-definition {
  border-top: 1px solid var(--border);
}

.resource-group {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.resource-group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-text);
  margin: 0 0 var(--space-md);
}

.resource-group-title .material-symbols-rounded {
  font-size: 22px;
  color: var(--primary-text);
}

.resource-link-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-sm);
}

.resource-link {
  display: flex;
  flex: 0 1 28rem;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-alt, var(--bg));
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--duration) var(--ease),
              background var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}

.resource-link:hover {
  border-color: var(--primary);
  background: var(--primary-faint);
  transform: translateX(3px);
}

.resource-link:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.resource-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--card-yellow-bg);
  color: var(--primary-text);
}

.resource-link-icon .material-symbols-rounded { font-size: 20px; }

.resource-link-label {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.resource-link-arrow {
  flex-shrink: 0;
  font-size: 18px;
  color: var(--text-light);
}

.resource-link:hover .resource-link-arrow { color: var(--primary-text); }

.infographic-dialog {
  width: min(1200px, calc(100vw - 48px));
  max-width: 1200px;
  max-height: calc(100dvh - 48px);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.infographic-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.infographic-dialog::backdrop { background: rgba(15, 35, 65, 0.72); }

.infographic-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.infographic-dialog-header h2 {
  color: var(--primary-text);
  font-size: 1.15rem;
}

.infographic-dialog-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.infographic-dialog-actions a,
.infographic-dialog-actions button {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  color: var(--primary-text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.infographic-dialog > img {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 140px);
  object-fit: contain;
}

@media (max-width: 600px) {
  .infographic-dialog { width: 100vw; max-height: 100dvh; border: 0; border-radius: 0; }
  .infographic-dialog-header { align-items: flex-start; flex-direction: column; }
  .infographic-dialog > img { max-height: calc(100dvh - 180px); }
}

.card-header-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.card-header-row svg {
  width: 18px;
  height: 18px;
  color: var(--primary-text);
  flex-shrink: 0;
}

/* ------------------------------------------------------------
   8. DETAILS / SUMMARY
   ------------------------------------------------------------ */

details {
  border-bottom: 1px solid var(--border);
}

details:last-of-type {
  border-bottom: none;
}

summary {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.6rem 0;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--text);
  list-style: none;
  user-select: none;
}

summary::-webkit-details-marker { display: none; }
summary::marker { display: none; content: ""; }

summary::before {
  content: "\25B6";
  display: inline-block;
  font-size: 0.6rem;
  margin-right: var(--space-sm);
  transition: transform var(--duration-slow) var(--ease);
  color: var(--text-secondary);
}

details[open] > summary::before {
  transform: rotate(90deg);
}

details > div,
details > p {
  padding: 0 0 0.6rem 1.1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ------------------------------------------------------------
   9. TIER PYRAMID
   ------------------------------------------------------------ */

.tier-pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: var(--space-lg) auto;
  max-width: 500px;
}

.tier-level {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem var(--space-md);
  border-radius: var(--radius);
  color: var(--text-on-primary);
  font-weight: 500;
  text-align: center;
  width: 100%;
  gap: var(--space-sm);
}

.tier-3-level { max-width: 60%; background: var(--tier-3); }
.tier-2-level { max-width: 80%; background: var(--tier-2); }
.tier-1-level { max-width: 100%; background: var(--tier-1); }

.tier-label {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.tier-desc {
  font-size: 0.7rem;
  opacity: 0.9;
  font-weight: 400;
}

.tier-1-theme { --tier-color: var(--tier-1); --tier-bg: var(--tier-1-bg); }
.tier-2-theme { --tier-color: var(--tier-2); --tier-bg: var(--tier-2-bg); }
.tier-3-theme { --tier-color: var(--tier-3); --tier-bg: var(--tier-3-bg); }

/* ------------------------------------------------------------
   10. INFO GRID
   ------------------------------------------------------------ */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.info-block {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: var(--space-sm);
  border: 1px solid var(--border);
}

.info-block h4 {
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--primary-text);
}

.info-block p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ------------------------------------------------------------
   11. SCORE LIST
   ------------------------------------------------------------ */

.score-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.score-list li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.color-badge {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.color-badge.green  { background: var(--success); }
.color-badge.yellow { background: var(--warning); }
.color-badge.red    { background: var(--danger); }
.color-badge.blue   { background: var(--info); }

/* ------------------------------------------------------------
   12. FAQ ACCORDION
   ------------------------------------------------------------ */

.faq-container {
  margin-top: var(--space-md);
}

.faq-category {
  margin-bottom: var(--space-lg);
}

.faq-category-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  margin-bottom: var(--space-xs);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border);
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-sm);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--duration) var(--ease);
}

.faq-question:hover {
  color: var(--primary-text);
}
.faq-item.active .faq-question {
  background: var(--primary-faint);
  color: var(--primary-text);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.faq-icon {
  position: relative;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-left: var(--space-md);
}

.faq-icon .plus {
  position: absolute;
  inset: 0;
  transition: transform var(--duration-slow) var(--ease);
}

.faq-icon .plus::before,
.faq-icon .plus::after {
  content: "";
  position: absolute;
  background: var(--text-light);
  border-radius: 1px;
  transition: background var(--duration) var(--ease);
}

.faq-icon .plus::before {
  top: 50%;
  left: 2px;
  right: 2px;
  height: 2px;
  transform: translateY(-50%);
}

.faq-icon .plus::after {
  left: 50%;
  top: 2px;
  bottom: 2px;
  width: 2px;
  transform: translateX(-50%);
}

.faq-item.active .faq-icon .plus {
  transform: rotate(45deg);
}

.faq-item.active .faq-icon .plus::before,
.faq-item.active .faq-icon .plus::after {
  background: var(--primary);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}

.faq-item.active .faq-answer {
  max-height: 4000px;
  padding-top: var(--space-sm);
  border-left: 3px solid var(--primary-light);
}

.faq-answer > div,
.faq-answer > p {
  padding: 0 var(--space-sm) var(--space-sm) var(--space-sm);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.faq-answer > p + p {
  padding-top: 0;
}

.faq-answer a {
  color: var(--primary-light-text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.faq-answer a:hover {
  color: var(--primary-text);
}

.faq-footnote {
  margin-top: var(--space-md);
  font-size: 0.72rem;
  font-style: italic;
  color: var(--text-light);
}

.faq-page-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

.faq-page-body {
  margin-top: var(--space-xl);
}

.faq-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.faq-search {
  position: relative;
}

.faq-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.faq-search-input {
  width: 100%;
  min-height: 46px;
  padding: 0.6rem 0.9rem 0.6rem 2.4rem;
  border: 1px solid rgba(107, 123, 141, 0.18);
  border-radius: var(--radius);
  background-color: var(--bg);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
}

.faq-search-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(78, 163, 211, 0.16);
}

.faq-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--space-xs);
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 80px;
}

.faq-category-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.55rem 0.9rem;
  margin-bottom: -1px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.faq-category-tab:hover:not(:disabled) {
  color: var(--primary-text);
}

.faq-category-tab[aria-selected="true"] {
  color: var(--primary-text);
  font-weight: 600;
  border-bottom-color: var(--primary);
}

.faq-category-tab:disabled {
  opacity: 0.4;
  cursor: default;
}

.faq-results-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-light);
}

.faq-clear-btn {
  padding: 0;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--primary-light-text);
  background: none;
  border: none;
  cursor: pointer;
}
.faq-clear-btn:hover { color: var(--primary-text); }

/* The active tab labels each category panel, so the inline heading is redundant. */
.faq-toolbar ~ .faq-container .faq-category-title {
  display: none;
}

.faq-category[hidden],
.faq-item[hidden],
.faq-empty[hidden] {
  display: none;
}

.faq-empty {
  padding: var(--space-lg) var(--space-sm);
  font-size: 0.82rem;
  text-align: center;
  color: var(--text-secondary);
}

.faq-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.faq-pager-side {
  flex: 1;
  display: flex;
}

.faq-pager-side--next {
  justify-content: flex-end;
}

.faq-pager-info {
  font-size: 0.75rem;
  color: var(--text-light);
  white-space: nowrap;
}

.faq-pager-btn {
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.faq-pager-btn:hover {
  color: var(--primary-text);
  background: var(--primary-faint);
}

.faq-pager-btn--primary {
  color: #fff;
  background: var(--primary);
}

.faq-pager-btn--primary:hover {
  color: #fff;
  background: var(--primary-light);
}

@media (max-width: 768px) {
  .faq-category-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .faq-category-tab {
    flex-shrink: 0;
  }

  .faq-pager {
    flex-wrap: wrap;
  }

  .faq-pager-info {
    order: -1;
    width: 100%;
    text-align: center;
  }
}

/* ------------------------------------------------------------
   13. FEEDBACK SECTION
   ------------------------------------------------------------ */

.feedback-section {
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  margin-top: var(--space-md);
}

.feedback-section p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.feedback-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.4rem 1rem;
  background: var(--primary);
  color: var(--text-on-primary);
  border-radius: var(--radius);
  font-weight: 400;
  font-size: 0.78rem;
  transition: background var(--duration) var(--ease);
}

.feedback-button:hover {
  background: var(--primary-light);
  text-decoration: none;
  color: var(--text-on-primary);
}

/* ------------------------------------------------------------
   14. SUB-TAB BAR
   ------------------------------------------------------------ */

.subtab-bar {
  position: sticky;
  top: var(--nav-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  z-index: 50;
}

.subtab-bar::-webkit-scrollbar { display: none; }

.subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  white-space: nowrap;
  transition: background var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

.subtab-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.subtab-btn:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.subtab-btn.active {
  background: var(--primary);
  color: var(--text-on-primary);
}

.subtab-panel {
  display: none;
}

.subtab-panel.active {
  display: block;
}

/* ------------------------------------------------------------
   15. ASSESSMENT SCHEDULES — yearly, month-by-month calendar
   ------------------------------------------------------------ */

.content-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-md);
}

/* Calendar app shell */
.calendar-container {
  display: block;
}

.cal-app {
  --cal-label-width: 132px;
  --cal-lane-height: 22px;
  --cal-columns: 22;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

/* Toolbar: current program + the English / French filter */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.cal-toolbar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  gap: 0.18rem;
}

.cal-toolbar-label {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
}

.cal-toolbar-program {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-text);
}

.cal-filters-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.cal-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-grade-dropdown {
  position: relative;
  min-width: 200px;
  max-width: min(400px, 80vw);
}

.cal-grade-dropdown > summary {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 0.85rem;
  cursor: pointer;
}

.cal-grade-options {
  display: flex;
  flex-direction: column;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 100%;
  max-height: min(420px, 60vh);
  overflow: hidden;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-md);
}

.cal-grade-dropdown > .cal-grade-options[data-floating-menu] {
  position: fixed;
  inset: auto;
  top: var(--dropdown-top, auto);
  bottom: var(--dropdown-bottom, auto);
  left: var(--dropdown-left);
  width: var(--dropdown-width);
  min-width: 0;
  max-width: none;
  max-height: var(--dropdown-height);
  margin: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cal-grade-options[popover]:not(:popover-open) { display: none; }
.multiselect-options-list { min-height: 0; overflow-y: auto; }
/* In very short menus, scroll the whole panel rather than squeezing the options out. */
.cal-grade-options[data-compact-menu] .multiselect-options-list { flex-shrink: 0; }
.multiselect-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.cal-grade-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  white-space: normal;
  cursor: pointer;
}

.cal-grade-option:has(input:disabled) {
  color: var(--text-light);
  cursor: not-allowed;
}

.cal-grade-option input:disabled { pointer-events: none; }

.cal-grade-dropdown summary:focus-visible,
.cal-grade-option:focus-visible,
.cal-grade-option input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cal-filter-label {
  padding-left: 8px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
}

.cal-filter {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--bg-muted);
  border-radius: var(--radius-pill);
}

.cal-filter-btn {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  cursor: pointer;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.cal-filter-btn:hover { color: var(--primary-text); }

.cal-filter-btn.active {
  background: var(--bg);
  color: var(--primary-text);
  box-shadow: var(--shadow-xs);
}

.cal-filter-btn:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.cal-filter-btn-short { display: none; }

.cal-grade-filter {
  min-height: 32px;
  padding: 6px 30px 6px 12px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary-text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}

.cal-grade-filter:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* Sheet: a fixed grade-label column + 11 month columns, each month split
   into two identical half-month slots. */
.cal-scroll {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  -webkit-overflow-scrolling: touch;
}

.cal-sheet {
  min-width: 780px;
}

.cal-head {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}

.cal-corner {
  flex: 0 0 var(--cal-label-width);
  width: var(--cal-label-width);
  display: flex;
  align-items: flex-end;
  padding: var(--space-sm);
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  border-right: 1px solid var(--border);
}

.cal-months {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(var(--cal-columns), minmax(0, 1fr));
}

.cal-month-head {
  padding: 10px 2px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-text);
  border-left: 1px solid var(--border);
}

.cal-months .cal-month-head:first-child { border-left: none; }

.cal-row {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--border);
}

.cal-head + .cal-row { border-top: none; }

.cal-row:hover { background: rgba(27, 45, 107, 0.02); }

.cal-row-label {
  flex: 0 0 var(--cal-label-width);
  width: var(--cal-label-width);
  display: flex;
  align-items: center;
  padding: var(--space-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
}

.cal-track {
  position: relative;
  flex: 1 1 auto;
  min-height: 52px;
  padding: 8px 0;
}

/* Background grid — drawn identically for every month so a bar that starts
   mid-month always lines up with a visible mid-month divider. */
.cal-slots {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--cal-columns), minmax(0, 1fr));
  pointer-events: none;
}

.cal-slot { border-left: 1px solid var(--border); }
.cal-slot-second { border-left: 1px dashed var(--border); }
.cal-slots .cal-slot:first-child { border-left: none; }

.cal-lanes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cal-columns), minmax(0, 1fr));
  row-gap: 4px;
  align-content: center;
}

/* Calendar items (assessments, interventions, report cards) */
.cal-item {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  height: var(--cal-lane-height);
  margin: 0 2px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  border-left: 3px solid transparent;
  font-size: 0.66rem;
  font-weight: 600;
  cursor: default;
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.cal-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.cal-item:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 1px;
}

.cal-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-item-intervention {
  background: repeating-linear-gradient(135deg, var(--warning-light), var(--warning-light) 6px, var(--bg) 6px, var(--bg) 12px);
  border-left-color: var(--warning);
  color: var(--warning-text);
}

.cal-item-report {
  background: #fbe5dc;
  border-left-color: #b85c38;
  color: #763b24;
}

.cal-scroll .cal-item-report {
  height: auto;
  min-width: max-content;
  padding: 3px 8px;
}

.cal-scroll .cal-item-report .cal-item-label {
  width: min-content;
  overflow: visible;
  white-space: normal;
  line-height: 1.1;
}

.cal-item-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b85c38;
  flex-shrink: 0;
}

/* Hover / focus tooltip */
.cal-tooltip {
  position: fixed;
  z-index: 1200;
  max-width: 260px;
  padding: 10px 12px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.74rem;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.cal-tooltip.visible { opacity: 1; }

.cal-tooltip-title {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.cal-tooltip-meta {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.cal-tooltip-note {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.75);
}

.cal-mobile-list {
  display: none;
  overflow: hidden;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.cal-mobile-grade {
  padding: var(--space-md);
  border-top: 1px solid var(--border);
}

.cal-mobile-grade-title {
  margin-bottom: var(--space-sm);
  font-size: 0.92rem;
  color: var(--primary-text);
}

/* Vertical (mobile) timeline: the same month-by-month grid as the desktop
   sheet, rotated so months run top-to-bottom and overlapping lanes sit
   side-by-side left-to-right instead of stacked. */
.cal-vert-track {
  --cal-v-label-width: 58px;
  position: relative;
  display: grid;
  column-gap: 4px;
}

.cal-vert-month-label {
  grid-column: 1;
  display: flex;
  align-items: flex-start;
  padding: 4px 6px 0 0;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  border-top: 1px solid var(--border);
}

.cal-vert-track > .cal-vert-month-label:first-child { border-top: none; }

.cal-vert-slot {
  grid-column: 2 / -1;
  border-top: 1px solid var(--border);
  pointer-events: none;
}

.cal-vert-slot-second { border-top: 1px dashed var(--border); }

.cal-vert-track > .cal-vert-slot:first-child { border-top: none; }

.cal-item--vert {
  height: auto;
  min-height: 24px;
  margin: 2px 0;
  padding: 4px 8px;
  align-items: flex-start;
  border-radius: var(--radius-md);
  white-space: normal;
}

.cal-item--vert .cal-item-label {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.25;
}

/* Legend */
.calendar-legend {
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.legend-section {
  margin-bottom: var(--space-md);
}

.legend-section:last-child { margin-bottom: 0; }

.legend-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: var(--space-sm);
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  align-items: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
}

.legend-swatch {
  display: inline-block;
  width: 22px;
  height: 10px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.legend-swatch-intervention {
  background: repeating-linear-gradient(135deg, var(--warning-light), var(--warning-light) 6px, var(--bg) 6px, var(--bg) 12px);
  border: 1px solid var(--warning);
}

.legend-swatch-report {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #b85c38;
}

.legend-swatch-half {
  width: 0;
  height: 16px;
  border-left: 1px dashed var(--text-light);
  border-radius: 0;
}

.notes-section {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-alt);
  border-radius: var(--radius);
}

.note-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Item / legend colour variants (mapped from the JSON legend colours) */
.cal-item-assessment.blue,   .legend-badge.blue   { background: var(--info-light);    color: var(--info-text); }
.cal-item-assessment.orange, .legend-badge.orange { background: #faf0f5;              color: #a37590; }
.cal-item-assessment.green,  .legend-badge.green  { background: var(--success-light); color: var(--success-text); }
.cal-item-assessment.purple, .legend-badge.purple { background: var(--warning-light); color: var(--warning-text); }
.cal-item-assessment.gray,   .legend-badge.gray   { background: var(--bg-muted);      color: var(--text-secondary); }

.cal-item-assessment.blue   { border-left-color: var(--info); }
.cal-item-assessment.orange { border-left-color: #d190b3; }
.cal-item-assessment.green  { border-left-color: var(--success); }
.cal-item-assessment.purple { border-left-color: var(--warning); }
.cal-item-assessment.gray   { border-left-color: var(--text-light); }

/* ------------------------------------------------------------
   16. BEST PRACTICES
   ------------------------------------------------------------ */

.best-practices {
  margin-top: var(--space-md);
}

.practice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.practice-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.practice-icon {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

/* ------------------------------------------------------------
   17. DROPDOWN WIZARD
   ------------------------------------------------------------ */

.dropdown-wizard {
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: var(--space-xl);
  margin-bottom: var(--space-md);
}

.dropdown-wizard-header {
  margin-bottom: var(--space-md);
}

.wizard-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.wizard-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.wizard-title .material-symbols-rounded {
  font-size: 22px;
  color: var(--primary-text);
}

.dropdown-row {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.dropdown-group {
  flex: 1;
  min-width: 180px;
}

.dropdown-group-small {
  flex: 0 1 auto;
  min-width: 140px;
}

.dropdown-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.styled-select {
  width: 100%;
  padding: 0.65rem 2rem 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath fill='%236e7787' d='M2 4l4 4 4-4'/%3e%3c/svg%3e") no-repeat right 0.7rem center;
  background-size: 12px;
  appearance: none;
  -webkit-appearance: none;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--duration) var(--ease);
}

.styled-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-faint);
}

.styled-select:disabled {
  cursor: not-allowed;
  color: var(--text-light);
  background-color: var(--bg-muted);
  border-color: var(--border);
  opacity: 0.75;
}

.filter-search-input.styled-select {
  background-image: none;
  padding: 0.65rem 0.85rem;
  cursor: text;
}

.back-btn-minimal,
.reset-btn-minimal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--duration) var(--ease),
              color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}

.back-btn-minimal:hover,
.reset-btn-minimal:hover {
  background: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.back-btn-minimal .material-symbols-rounded,
.reset-btn-minimal .material-symbols-rounded {
  font-size: 18px;
}

.subtest-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--bg-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.subtest-btn:hover,
.subtest-btn.active {
  background: var(--primary-faint);
  border-color: var(--primary);
  color: var(--primary-text);
}

.option-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
  border: 1px solid var(--border);
}

.option-item:hover { background: var(--bg-alt); box-shadow: var(--shadow-xs); }

.option-item-content { flex: 1; }

.option-item-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.option-item-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.option-item-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--text-light);
}

.pillar-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--primary-faint);
  color: var(--primary-text);
  margin-right: 4px;
  margin-bottom: 3px;
}

.pillar-checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 0.95rem;
}

/* Interventions views */
.interventions-options,
.interventions-detail-view,
.interventions-options-screen,
.interventions-menu-full-view {
  padding: var(--space-lg);
}

.interventions-menu-header {
  margin-bottom: var(--space-lg);
}

.interventions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-md);
}

.interventions-menu {
  margin-top: var(--space-md);
}

.menu-view-btn,
.flowchart-view-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.menu-view-btn:hover,
.flowchart-view-btn:hover,
.menu-view-btn.active,
.flowchart-view-btn.active {
  background: var(--primary);
  color: var(--text-on-primary);
  border-color: var(--primary);
}

/* ------------------------------------------------------------
   18. RESULTS
   ------------------------------------------------------------ */

.dropdown-results {
  margin-top: var(--space-md);
}

.results-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.results-count-compact,
.results-count {
  font-size: 0.85rem;
  color: var(--text-light);
}

.results-list-compact {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}

.result-row:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--primary-lighter);
}

.result-badges {
  display: flex;
  gap: var(--space-xs);
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-muted);
}

.results-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-light);
  font-size: 0.95rem;
}

.results-empty strong {
  display: block;
  color: var(--text);
}

.results-empty-detail {
  margin-top: var(--space-xs);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.resource-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-width: 0;
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}

.resource-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--primary-lighter);
}

.interventions-results-panel .resource-card {
  border-color: var(--card-blue-border);
  background: var(--card-blue-bg);
}

.resource-card-main {
  min-width: 0;
  flex: 1;
}

.resource-card-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.resource-card-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--resource-tag-bg);
  color: var(--resource-tag-text);
  font-size: 0.76rem;
  line-height: 1.3;
}

.resource-card-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.resource-card-grade {
  font-weight: 600;
  color: var(--text-secondary);
}

.resource-card-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.resource-card-note-block {
  margin-top: 10px;
}

.resource-card-note-label {
  display: inline-block;
  margin-bottom: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-light);
}

.resource-card-notes {
  font-style: italic;
}

.resource-link-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
  min-height: 40px;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  white-space: nowrap;
  transition: background var(--duration) var(--ease);
}

.resource-link-btn:hover {
  background: var(--primary-light);
  color: #fff;
}

.resource-link-btn .material-symbols-rounded {
  font-size: 16px;
}

.resource-link-btn-disabled {
  color: var(--text-light);
  background: var(--bg-muted);
  cursor: default;
}

.resource-card-links {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  align-self: center;
}

.resource-link-btn.resource-action {
  width: 40px;
  height: 40px;
  padding: 0;
}
.resource-action { position: relative; }
.resource-action::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: max-content;
  max-width: min(240px, calc(100vw - 2rem));
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  text-align: center;
  pointer-events: none;
  visibility: hidden;
}
.resource-action:hover::after,
.resource-action:focus-visible::after { visibility: visible; }

.results-prompt {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-light);
  font-size: 0.95rem;
}

.results-panel { margin-top: var(--space-md); }

.results-grid-compact {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.result-card-compact {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration) var(--ease);
}

.result-card-compact:hover { box-shadow: var(--shadow-md); }

.result-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  cursor: pointer;
}

.result-name-compact {
  font-weight: 600;
  color: var(--text);
  font-size: 1.05rem;
}

.result-meta-compact {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.result-expand-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-light);
  transition: transform var(--duration) var(--ease);
}

.result-card-compact.expanded .result-expand-icon {
  transform: rotate(180deg);
}

.result-details-compact {
  display: none;
  padding: 0 var(--space-md) var(--space-md);
  border-top: 1px solid var(--border);
}

.result-card-compact.expanded .result-details-compact {
  display: block;
}

.result-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: var(--space-sm);
}

.result-link-compact,
.result-local-compact {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--primary-light-text);
  margin-top: var(--space-sm);
}

.result-link-compact:hover,
.result-local-compact:hover {
  color: var(--primary-text);
}

/* Badges */
.badge-grade {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.badge-program {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--primary-faint);
  color: var(--primary-text);
}

.badge-tier {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 600;
}

/* Result card (flowchart) */
.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.result-card-header {
  padding: var(--space-md);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.result-card-body {
  padding: var(--space-md);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.result-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-secondary);
  margin-right: 4px;
}

/* ------------------------------------------------------------
   19. FLOWCHART
   ------------------------------------------------------------ */

.flowchart-view-hidden {
}

.flowchart-view {
  display: block;
}

/* Integrated flowchart */
.integrated-flowchart-container,
.integrated-flowchart {
  max-width: 100%;
  margin: 0 auto;
  padding: var(--space-sm) var(--space-xl) var(--space-xl);
}

.integrated-flowchart-header,
.flowchart-glass-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-sm);
  gap: var(--space-xs);
}

/* Pin the tier tab bar just below the fixed top navigation so the
   Tier 1/2/3 tabs stay visible while the user scrolls the flowchart. */
.flowchart-glass-header {
  position: sticky;
  top: var(--nav-height);
  z-index: 900;
}

/* Back button stays left, tier tabs centred, screener indicator right */
.flowchart-glass-header .flowchart-back-btn { justify-self: start; }
.flowchart-glass-header .tier-tabs { justify-self: center; margin-bottom: 0; }
.flowchart-glass-header .flowchart-screener-indicator { justify-self: end; }

/* Currently-selected screener indicator */
.flowchart-screener-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  background: var(--step-bg);
  border: 1px solid var(--step-soft);
  color: var(--step-text);
  font-size: 0.78rem;
  font-weight: 600;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}
.flowchart-screener-indicator[hidden] { display: none; }
.flowchart-screener-indicator svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--step); }
.flowchart-screener-indicator-label { color: var(--text-secondary); font-weight: 600; }
.flowchart-screener-indicator-value {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flowchart-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.flowchart-back-btn svg { width: 16px; height: 16px; }

.flowchart-back-btn:hover {
  background: var(--border);
  color: var(--text);
}

.flowchart-header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.flowchart-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.flowchart-title-bar h2 { font-size: 1.05rem; font-weight: 700; }

/* Tier name bar shown just below the flowchart page hero and above the tier tabs. */
.flowchart-tier-name-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem var(--space-lg);
  background: var(--tier-color, var(--primary));
  color: var(--text-on-primary, #fff);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: center;
  margin-bottom: var(--space-sm);
}

.flowchart-tier-name-value {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.header-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

/* Tier tabs */
.tier-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.tier-tab {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
}

.tier-tab:hover { background: var(--bg-alt); }
.tier-tab.active { background: var(--primary); color: var(--text-on-primary); border-color: var(--primary); box-shadow: var(--shadow-sm); }

.tier-number {
  font-weight: 700;
  font-size: 0.82rem;
}

/* Flowchart actions */
.flowchart-actions {
  display: flex;
  gap: var(--space-sm);
}

.flowchart-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.flowchart-action-btn svg { width: 16px; height: 16px; }

.flowchart-action-btn:hover {
  background: var(--border);
  color: var(--text);
}

.flowchart-done-btn {
  background: var(--success);
  color: var(--text-on-primary);
}

.flowchart-done-btn:hover { background: #0ea572; }

/* Progress bar */
.flowchart-progress-bar {
  height: 4px;
  background: var(--bg-muted);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width var(--duration-slow) var(--ease);
}

.step-indicator {
  font-size: 0.7rem;
  color: var(--text-light);
  text-align: center;
}

/* Flowchart content */
.flowchart-content-area,
.flowchart-content {
  position: relative;
  overflow-x: auto;
}

.flowchart-steps {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 200px;
}

/* Connector */
.flowchart-step-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  color: var(--text-light);
  align-self: center;
}

.flowchart-step-connector svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.flowchart-step-connector::after {
  display: none;
}

/* Step / Node base */
.flowchart-step,
.integrated-flow-node {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  opacity: 0;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
  min-width: 280px;
  max-width: 520px;
  width: 100%;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

/* Carousel slide-in animations */
.flowchart-step.carousel-enter-forward {
  animation: carouselSlideInRight 0.35s var(--ease) forwards;
}

.flowchart-step.carousel-enter-back {
  animation: carouselSlideInLeft 0.35s var(--ease) forwards;
}

@keyframes carouselSlideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes carouselSlideInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}

.flowchart-step.step-visible,
.integrated-flow-node.node-active {
  opacity: 1;
  transform: translateX(0);
}

.flowchart-step.step-completed {
  opacity: 0.55;
  pointer-events: none;
}

.flowchart-step.step-removing {
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

/* Step header */
.step-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 2px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--step-text);
  letter-spacing: 0.06em;
}

.step-badge-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.step-badge-icon svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

.step-text {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
}

.step-icon, .node-icon { font-size: 1rem; }
.node-number { font-size: 0.7rem; font-weight: 600; color: var(--text-light); }
.node-title { font-weight: 500; font-size: 0.85rem; color: var(--text); }

.step-content, .node-content {
  padding: var(--space-md) var(--space-xl) var(--space-xl);
}

/* Stronger typographic hierarchy: bold title, lighter supporting copy.
   Font sizes are kept on a tight, consistent scale (1.2 / 0.9 / 0.85rem)
   and section blocks use shades of the step colour to stand apart. */
.step-content h3,
.individual-outcome .individual-recommendation {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: var(--space-xs);
}
.benchmark-guidance-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--info-text);
  font: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  text-decoration: none;
  cursor: pointer;
}

.benchmark-guidance-link:hover {
  color: inherit;
}

.benchmark-guidance-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.step-content > p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}
/* Section sub-headings (e.g. "Key Characteristics") share one consistent size */
.step-content > h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--step-text);
  margin: var(--space-sm) 0 4px;
  letter-spacing: 0.01em;
}

.node-instruction, .node-description {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  line-height: 1.35;
}

/* Step type themes – coloured background tint + strong accent border */
.flowchart-step-checklist {
  background: var(--step-checklist-bg);
  border-left: 5px solid var(--step-checklist);
  border-color: var(--step-checklist);
}
.flowchart-step-selection {
  background: var(--step-selection-bg);
  border-left: 5px solid var(--step-selection);
  border-color: var(--step-selection);
}
.flowchart-step-decision {
  background: var(--step-decision-bg);
  border-left: 5px solid var(--step-decision);
  border-color: var(--step-decision);
}
.flowchart-step-info {
  background: var(--step-info-bg);
  border-left: 5px solid var(--step-info);
  border-color: var(--step-info);
}
.flowchart-step-endpoint {
  background: var(--step-endpoint-bg);
  border-left: 5px solid var(--step-endpoint);
  border-color: var(--step-endpoint);
}

/* Themed step headers per type */
.flowchart-step-checklist .step-header {
  background: var(--step-checklist-header);
  border-bottom-color: var(--step-soft);
}
.flowchart-step-checklist .step-badge { color: var(--step-checklist-text); }
.flowchart-step-checklist .step-badge-icon svg { opacity: 1; color: var(--step-checklist); }

.flowchart-step-selection .step-header {
  background: var(--step-selection-header);
  border-bottom-color: var(--step-soft);
}
.flowchart-step-selection .step-badge { color: var(--step-selection-text); }
.flowchart-step-selection .step-badge-icon svg { opacity: 1; color: var(--step-selection); }

.flowchart-step-decision .step-header {
  background: var(--step-decision-header);
  border-bottom-color: var(--step-soft);
}
.flowchart-step-decision .step-badge { color: var(--step-decision-text); }
.flowchart-step-decision .step-badge-icon svg { opacity: 1; color: var(--step-decision); }

.flowchart-step-info .step-header {
  background: var(--step-info-header);
  border-bottom-color: var(--step-soft);
}
.flowchart-step-info .step-badge { color: var(--step-info-text); }
.flowchart-step-info .step-badge-icon svg { opacity: 1; color: var(--step-info); }

.flowchart-step-endpoint .step-header {
  background: var(--step-endpoint-header);
  border-bottom-color: var(--step-soft);
}
.flowchart-step-endpoint .step-badge { color: var(--step-endpoint-text); }
.flowchart-step-endpoint .step-badge-icon svg { opacity: 1; color: var(--step-endpoint); }

/* Checklist items tinted to match step type */
.flowchart-step-checklist .checklist-item {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--step-soft);
}
.flowchart-step-checklist .checklist-item:hover { background: rgba(255, 255, 255, 0.9); }
.flowchart-step-checklist .checklist-item.checked,
.flowchart-step-checklist .checklist-item.item-checked {
  background: var(--step-soft);
  border-color: var(--step-checklist);
}
.flowchart-step-checklist .checklist-item.checked .checkbox-check,
.flowchart-step-checklist .checklist-item.item-checked .checkbox-check {
  background: var(--step-checklist);
  border-color: var(--step-checklist);
}

/* Selection options tinted to match step type */
.flowchart-step-selection .selection-option {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--step-soft);
}
.flowchart-step-selection .selection-option:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--step-selection);
}
.flowchart-step-selection .selection-option.selected,
.flowchart-step-selection .selection-option.option-selected {
  background: var(--step-soft);
  border-color: var(--step-selection);
  box-shadow: 0 0 0 1px var(--step-selection);
}

/* Undo button */
.undo-btn {
  display: none;
  margin-left: auto;
  padding: 2px 0.5rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-light);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  align-items: center;
  gap: 3px;
}

.undo-btn svg { width: 12px; height: 12px; }

.undo-btn:hover {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.step-completed .undo-btn {
  display: flex;
  pointer-events: auto;
}

/* Check All button */
.checklist-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.check-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary-text);
  background: var(--primary-faint);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.check-all-btn svg {
  width: 12px;
  height: 12px;
}

.check-all-btn:hover {
  background: var(--primary-light);
  color: var(--text-on-primary);
}

/* Checklist */
.checklist-container, .checklist-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.4;
}

.checklist-item input[type="checkbox"],
.vf-checklist-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.checklist-item:hover { background: var(--bg-alt); }

.checklist-item.checked,
.checklist-item.item-checked {
  background: var(--primary-faint);
  border-color: var(--primary-light);
}

.checkbox-check {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--duration) var(--ease);
}

.checklist-item.checked .checkbox-check {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-primary);
}

.checkbox-text { font-size: 0.8rem; color: var(--text); line-height: 1.4; }

.checklist-progress {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: var(--space-sm);
}

.continue-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.45rem 0.9rem;
  margin-top: var(--space-md);
  background: var(--bg-muted);
  color: var(--text-light);
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.8rem;
  cursor: not-allowed;
  transition: all var(--duration) var(--ease);
}

.continue-btn:not([disabled]) {
  background: var(--tier-color, var(--primary));
  color: #fff;
  cursor: pointer;
}

.continue-btn:not([disabled]):hover {
  filter: brightness(1.1);
}

.continue-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Post-section info blocks rendered after the checklist items */
.checklist-post-section {
  margin-top: var(--space-md);
}

.checklist-post-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.checklist-post-section-list {
  padding-left: 1.2rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.checklist-post-section-list li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Lead text shown before the checkbox list */
.checklist-lead-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.checklist-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.checklist-feature-list > li {
  position: relative;
  padding-left: 1.3rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.checklist-feature-list > li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--effective);
  font-weight: 600;
}

.checklist-principles > li {
  padding-left: 0;
}

.checklist-principles > li::before {
  content: none;
}

.checklist-groups,
.checklist-group-body {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.checklist-groups .checklist-lead-text {
  margin: 0;
}

.checklist-post-section-list.checklist-feature-list {
  padding: 0;
}


/* ============================================================
   FULL CHECKLIST — every point visible in one list
   All points stay on screen and each must be ticked off. A ticked
   point grows slightly larger and bolder for instant feedback.
   ============================================================ */
.checklist-full {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.checklist-intro {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

.checklist-meter {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.checklist-meter-bar {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-muted);
  overflow: hidden;
}

.checklist-meter-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--tier-color, var(--step));
  transition: width 0.35s var(--ease);
}

.checklist-meter-count {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  white-space: nowrap;
}

.checklist-lines {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
}

.checklist-line {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--duration) var(--ease),
              background var(--duration) var(--ease);
}

.flowchart-step[data-node-id="tier2-principles"] .checklist-lines {
  width: max-content;
  max-width: 100%;
}

.checklist-line:hover {
  border-color: var(--tier-color, var(--step));
  background: color-mix(in srgb, var(--tier-color, var(--step)) 4%, var(--bg));
}

/* Ticked points keep the exact same text size and weight; the selection is shown
   with colour and a solid accent bar down the left edge instead. */
.checklist-line.checked {
  border-color: var(--tier-color, var(--step));
  background: color-mix(in srgb, var(--tier-color, var(--step)) 8%, var(--bg));
  box-shadow: inset 4px 0 0 var(--tier-color, var(--step));
}

.checklist-line input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checklist-line-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: transparent;
  transition: background var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

.checklist-line-box svg { width: 12px; height: 12px; }

.checklist-line.checked .checklist-line-box {
  background: var(--tier-color, var(--step));
  border-color: var(--tier-color, var(--step));
  color: #fff;
}

.checklist-line-text {
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
  transition: color var(--duration) var(--ease);
}

/* Ticked points read exactly the same as unticked ones – no size or weight jump */
.checklist-line.checked .checklist-line-text {
  color: var(--text);
}

.checklist-line-link {
  color: var(--tier-color, var(--step));
  font-weight: inherit;
  text-decoration: underline;
}

.checklist-line input[type="checkbox"]:focus-visible + .checklist-line-box {
  outline: 2px solid var(--tier-color, var(--step));
  outline-offset: 2px;
}

.checklist-continue:not(:disabled) {
  background: var(--tier-color, var(--step));
  color: #fff;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .flowchart-step.carousel-enter-forward,
  .flowchart-step.carousel-enter-back {
    animation: none;
  }

  .flowchart-step,
  .integrated-flow-node {
    opacity: 1;
    transform: none;
  }
}

/* Selection grid */
.selection-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.selection-option {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0.85rem 1rem;
  border: 2px solid var(--step-soft);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  background: var(--bg);
}

.selection-option:hover {
  border-color: var(--primary-light);
  background: var(--primary-faint);
}

.selection-option.selected,
.selection-option.option-selected {
  border-color: var(--primary);
  background: var(--primary-faint);
  box-shadow: 0 0 0 1px var(--primary);
}

.selection-option.option-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.option-icon { flex-shrink: 0; }
.option-icon svg { width: 12px; height: 12px; }
.option-details { flex: 1; min-width: 0; }

.option-details strong,
.option-details h4 {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1px;
  line-height: 1.3;
}

.option-details p,
.option-details span {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.option-meta {
  font-size: 0.6rem;
  color: var(--text-light);
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-top: 1px;
}

.option-arrow {
  color: var(--text-light);
  flex-shrink: 0;
}

.option-arrow svg { width: 10px; height: 10px; }

/* ── Embedded Flowchart Intervention Wizard ─────────────────────────── */
.fw-wizard {
  margin-top: var(--space-md);
}

.fw-wizard-selects {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.integrated-flowchart.pathway-setup {
  max-width: 640px;
  margin-top: var(--space-lg);
  margin-inline: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
}

.pathway-setup .step-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.pathway-setup .step-content > h2,
.pathway-setup .step-content > p {
  margin: 0;
}

.pathway-setup .step-content > p {
  line-height: 1.6;
}

.pathway-setup .fw-wizard-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  margin: 0;
}

.pathway-setup-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.pathway-context {
  position: relative;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--step-text);
}

.pathway-context[hidden] { display: none; }

.pathway-context summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--step-soft);
  border-radius: var(--radius-pill);
  background: var(--step-bg);
  cursor: pointer;
  list-style: none;
}

.pathway-context summary::-webkit-details-marker { display: none; }
.pathway-context summary::before { display: none; }
.pathway-context summary .material-symbols-rounded { font-size: 18px; }
.pathway-context-summary { overflow-wrap: anywhere; }

.pathway-context-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 950;
  width: 250px;
  max-width: calc(100vw - 32px);
  padding: var(--space-sm);
  border: 1px solid var(--step-soft);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-md);
}

.favourites-page-wrapper {
  max-width: 1000px;
  margin: auto;
  padding: var(--space-lg);
}

.favourite-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
}

.favourite-toggle[aria-pressed="true"] {
  color: #875300;
  background: #fff1c2;
  border-color: #be8b2b;
}
.favourite-toggle:hover { background: var(--primary-faint); }
.favourite-toggle[aria-pressed="true"]:hover { background: #ffe39a; }

.resource-recommended-badge {
  display: inline-block;
  margin: 0 0.5rem;
  color: var(--recommended-text);
  font-size: 1.2rem;
}

.favourite-feedback {
  margin: 0.5rem 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid #be8b2b;
  border-radius: var(--radius);
  background: #fff5d6;
  color: #573900;
  font-weight: 600;
  scroll-margin-top: calc(var(--nav-height) + 0.5rem);
}

.favourite-feedback:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.resource-card-links:has(> .favourite-feedback:not(:empty)) { width: min(100%, 16rem); }
.resource-card-links > .favourite-feedback {
  flex: 1 1 100%;
  margin: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}
.flowchart-resource-tools { min-width: 0; }
.pathway-favourites h3,
.pathway-selections-list h3 { font-size: 0.95rem; margin: 0.75rem 0; }
.pathway-favourites-list { display: grid; gap: var(--space-sm); }

.legacy-resource-option { display: flex; align-items: center; gap: var(--space-sm); min-width: 0; }
.legacy-resource-option > .selection-option,
.legacy-resource-option > .vf-selection-option,
.legacy-resource-option > .screener-option { flex: 1; min-width: 0; }

.favourite-toggle:focus-visible,
.pathway-selections button:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.pathway-selections {
  position: fixed;
  right: 0;
  top: 48%;
  z-index: 18000;
}

.pathway-selections[hidden],
.pathway-selections-panel[hidden] { display: none; }

.pathway-selections-tab {
  padding: 0.75rem 0.5rem;
  writing-mode: vertical-rl;
  border: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  max-height: 42vh;
}

.pathway-selections-panel {
  position: fixed;
  right: 0;
  top: 12vh;
  width: min(390px, calc(100vw - 48px));
  max-height: 76vh;
  max-height: 76dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
}

.pathway-selections-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.pathway-selections-panel h2 { margin: 0; font-size: 1rem; }
.pathway-selections-close { border: 0; background: var(--bg); color: var(--text); font-size: 1.5rem; cursor: pointer; min-width: 40px; min-height: 40px; }
.pathway-selection-entry + .pathway-selection-entry { margin-top: var(--space-md); }
.pathway-selection-entry > p { font-size: 0.8rem; margin: 0 0 0.3rem; }
.pathway-selections-panel .resource-card { flex-direction: column; gap: var(--space-sm); }
.pathway-selections-panel .resource-card-links { flex-wrap: wrap; }

@media (max-width: 768px) {
  .pathway-selections {
    position: static;
    margin: 0.5rem 1rem;
  }
  .pathway-selections-tab {
    writing-mode: horizontal-tb;
    max-height: none;
    max-width: 100%;
    border-radius: var(--radius);
    padding: 0.6rem 0.8rem;
  }
  .pathway-selections-panel {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 0.5rem;
    border-radius: var(--radius);
    box-shadow: none;
  }
  .pathway-setup .fw-wizard-selects { grid-template-columns: minmax(0, 1fr); }
  .integrated-flowchart .flowchart-glass-header { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .flowchart-glass-header .flowchart-glass-header-end { display: flex; }
  .pathway-context-summary { display: none; }
  .pathway-context summary {
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
  }
}

.fw-select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fw-select-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.fw-select {
  width: 100%;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--duration) var(--ease);
}

.fw-select:focus {
  outline: none;
  border-color: var(--step);
}

.fw-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fw-results {
  margin-top: var(--space-sm);
}

.fw-results-header {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.resource-list-header {
  grid-column: 1 / -1;
}

* + .resource-list-header {
  margin-top: var(--space-md);
}

.step-content-resource-picker {
  padding-bottom: var(--space-sm);
}

.fw-results-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fw-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  width: 100%;
  padding: 0.65rem var(--space-md);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: all var(--duration) var(--ease);
}

.fw-result-item:hover {
  background: var(--step-soft);
  border-color: var(--step);
}

.fw-result-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.fw-result-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.fw-result-arrow {
  flex-shrink: 0;
  color: var(--step);
}

.fw-no-results {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  padding: var(--space-md);
}

.fw-no-results p { margin: 0 0 var(--space-sm); }

.fw-skip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--step);
  border-radius: 999px;
  background: var(--bg);
  color: var(--step);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.fw-skip-btn:hover { background: var(--primary-faint); }
.fw-skip-btn:focus-visible { outline: 3px solid #a66b00; outline-offset: 2px; }
.fw-skip-btn .material-symbols-rounded { font-size: 18px; }

.fw-select-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.fw-recommended-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: var(--space-lg) 0 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.interventions-results-panel > .fw-recommended-legend {
  margin: 0 0 var(--space-md);
}

.fw-recommended-swatch {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--recommended-text);
  font-size: 1.2rem;
  line-height: 1;
}

.fw-pillar-dropdown {
  max-width: 100%;
}

.fw-pillar-dropdown .cal-grade-options {
  left: 0;
  right: auto;
}

.fw-multi-hint {
  margin: 0 0 var(--space-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.fw-result-item .fw-result-info { flex: 1; min-width: 0; }

.fw-result-item.is-selected {
  background: var(--step-header);
  border-color: var(--step);
  outline: 2px solid var(--step);
  outline-offset: -1px;
}

.fw-result-item:focus-visible {
  outline: 3px solid #a66b00;
  outline-offset: 2px;
}

.fw-multi-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.fw-multi-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.fw-multi-actions .continue-btn { margin: 0; }

.fw-result-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  transition: background var(--duration) var(--ease);
}

.fw-result-link:hover {
  background: var(--primary-light);
  color: #fff;
}

.fw-result-link .material-symbols-rounded {
  font-size: 18px;
}

/* Screener grid */
.screener-grid,
.screener-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 280px));
  justify-content: start;
  gap: var(--space-sm);
}

.screener-card,
.screener-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: all var(--duration) var(--ease);
  font-size: 0.85rem;
}

.screener-card:hover, .screener-option:hover {
  border-color: var(--primary-light);
  background: var(--primary-faint);
  box-shadow: var(--shadow-sm);
}

.screener-card.selected, .screener-option.selected {
  border-color: var(--primary);
  background: var(--primary-faint);
}

.screener-icon { font-size: 1rem; }
.screener-icon svg { width: 16px; height: 16px; }

.card-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-muted);
  color: var(--text-secondary);
}

/* Area grid */
.area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-sm);
}

.area-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all var(--duration) var(--ease);
  font-size: 0.7rem;
}

.area-card:hover {
  border-color: var(--primary-light);
  background: var(--primary-faint);
}

.area-card.selected {
  border-color: var(--primary);
  background: var(--primary-faint);
}

.area-icon { font-size: 1rem; }
.area-icon svg { width: 16px; height: 16px; }

/* Callouts – informational boxes share the STEP colour.
   A left accent + tinted panel marks them as a distinct semantic block. */
.info-callout {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--step-bg);
  border: 1px solid var(--step-soft);
  border-left: 4px solid var(--step);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--step-text);
  margin-bottom: var(--space-md);
  line-height: 1.55;
}

.info-callout svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--step); }

.info-callout h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--step-text);
  margin-bottom: 4px;
}
.info-callout p { font-size: 0.85rem; line-height: 1.55; margin: 0; }
.info-callout ul { margin: 4px 0 0; padding-left: 1.1rem; }
.info-callout li { font-size: 0.85rem; line-height: 1.5; }

.warning-callout,
.warning-box {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--ineffective-bg);
  border: 1px solid var(--ineffective-soft);
  border-left: 4px solid var(--ineffective);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--ineffective-text);
  margin-bottom: var(--space-md);
  line-height: 1.55;
}

.warning-callout svg,
.warning-box svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--ineffective); }

.warning-callout h4,
.warning-box h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ineffective-text);
  margin-bottom: 4px;
}
.warning-callout p,
.warning-box p { font-size: 0.85rem; line-height: 1.55; margin: 0; }

/* Decision grid */
.decision-grid.decision-grid-with-hint {
  margin-top: var(--space-md);
}

.step-content .decision-hint {
  margin: var(--space-xs) 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.decision-grid,
.decision-buttons {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.decision-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.95rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  background: var(--bg);
  flex: 1;
  min-width: 100px;
}

.decision-btn:hover {
  border-color: var(--primary-light);
  background: var(--primary-faint);
}

.decision-btn.decision-selected {
  border-color: var(--primary);
  background: var(--primary-faint);
  box-shadow: 0 0 0 1px var(--primary);
}

.decision-btn.decision-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Effective routes: success / info / primary all share ONE colour */
.decision-btn-yes,
.decision-btn.decision-success,
.decision-btn.success,
.decision-btn.decision-info,
.decision-btn.info,
.decision-btn.decision-primary,
.decision-btn.primary {
  border-color: var(--effective);
  background: var(--effective-bg);
  color: var(--effective-text);
}

.decision-btn-yes:hover,
.decision-btn.decision-success:hover,
.decision-btn.success:hover,
.decision-btn.decision-info:hover,
.decision-btn.info:hover,
.decision-btn.decision-primary:hover,
.decision-btn.primary:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* Ineffective routes: warning / danger share ONE colour */
.decision-btn-no,
.decision-btn.decision-warning,
.decision-btn.warning,
.decision-btn.decision-danger,
.decision-btn.danger {
  border-color: var(--ineffective);
  background: var(--ineffective-bg);
  color: var(--ineffective-text);
}

.decision-btn-no:hover,
.decision-btn.decision-warning:hover,
.decision-btn.warning:hover,
.decision-btn.decision-danger:hover,
.decision-btn.danger:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.decision-btn.secondary {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

/* "Was instruction effective?" decisions in the visual pathway: stack the
   effective / ineffective choices vertically as full-width rectangular rows
   (instead of the default side-by-side layout) so the labels stay easy to read. */
.visual-flowchart-active-host .flowchart-step[data-node-id="tier1-effectiveness"] .decision-grid,
.visual-flowchart-active-host .flowchart-step[data-node-id="tier2-progress"] .decision-grid,
.visual-flowchart-active-host .flowchart-step[data-node-id="tier2-cycle2-progress"] .decision-grid,
.visual-flowchart-active-host .flowchart-step[data-node-id="tier3-progress"] .decision-grid {
  flex-direction: column;
}

.visual-flowchart-active-host .flowchart-step[data-node-id="tier1-effectiveness"] .decision-btn,
.visual-flowchart-active-host .flowchart-step[data-node-id="tier2-progress"] .decision-btn,
.visual-flowchart-active-host .flowchart-step[data-node-id="tier2-cycle2-progress"] .decision-btn,
.visual-flowchart-active-host .flowchart-step[data-node-id="tier3-progress"] .decision-btn {
  width: 100%;
  border-radius: var(--radius-sm);
}

.decision-icon { flex-shrink: 0; }
.decision-icon svg { width: 20px; height: 20px; }
.decision-trend-icon { font-size: 1.25rem; line-height: 1; }
.decision-content { flex: 1; min-width: 0; }
.decision-indicators { display: inline-flex; gap: 3px; margin-right: 5px; vertical-align: middle; }
.decision-indicators .tier1-indicator-dot { width: 11px; height: 11px; }

.decision-content strong,
.decision-content h4 {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1px;
  line-height: 1.3;
}

.decision-content p,
.decision-content span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.decision-btn.decision-single-line .decision-content strong {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
}

.decision-btn.decision-success .decision-content p,
.decision-btn.decision-success .decision-content span,
.decision-btn.decision-info .decision-content p,
.decision-btn.decision-info .decision-content span,
.decision-btn.decision-primary .decision-content p,
.decision-btn.decision-primary .decision-content span { color: var(--effective-text); }
.decision-btn.decision-warning .decision-content p,
.decision-btn.decision-warning .decision-content span,
.decision-btn.decision-danger .decision-content p,
.decision-btn.decision-danger .decision-content span { color: var(--ineffective-text); }

.decision-options {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Feature & indicator lists */
.feature-list {
  list-style: none;
  padding: 0;
  margin-top: var(--space-sm);
}

.info-section {
  margin-bottom: var(--space-md);
}

.info-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.info-section .feature-list {
  margin-top: 0;
}

.feature-list li {
  position: relative;
  padding-left: 1.3rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 5px;
  line-height: 1.5;
}

.feature-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--effective);
  font-weight: 600;
}

.indicator-list {
  list-style: none;
  padding: 0;
}

.indicator-list li {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 1px 0;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Endpoint */
.endpoint-card {
  text-align: left;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.endpoint-card h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: var(--space-xs); }
.endpoint-card p { font-size: 0.9rem; }

.endpoint-card.endpoint-success { background: var(--effective-bg); border-color: var(--effective); }
.endpoint-card.endpoint-info    { background: var(--effective-bg); border-color: var(--effective); }
.endpoint-card.endpoint-warning { background: var(--ineffective-bg); border-color: var(--ineffective); }
.endpoint-card.endpoint-danger  { background: var(--ineffective-bg); border-color: var(--ineffective); }

.endpoint-icon { margin-bottom: 2px; }

.endpoint-icon svg {
  width: 24px;
  height: 24px;
}

.endpoint-actions {
  display: flex;
  gap: var(--space-xs);
  justify-content: flex-end;
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.recommendations-box,
.recommendation-box {
  background: var(--bg);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-sm);
  text-align: left;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary-light);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.recommendations-box h4,
.recommendation-box h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.recommendations-box ul,
.recommendation-box ul { padding-left: 1.1rem; margin: 0; }
.recommendations-box li,
.recommendation-box li { font-size: 0.85rem; line-height: 1.5; }

/* Action buttons */
.action-buttons {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.action-btn:hover { background: var(--bg-muted); }

/* Inline SVG icons (e.g. the arrow on "Continue" buttons) have no intrinsic
   size once width/height attributes are omitted, so without an explicit rule
   they fall back to the browser's oversized default replaced-element box.
   Keep them the same compact scale as .continue-btn's icon. */
.action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.action-btn.action-primary,
.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
  border-color: var(--primary);
}

.action-btn.action-primary:hover,
.btn-primary:hover { background: var(--primary-light); }

.action-btn.action-secondary,
.btn-secondary {
  background: var(--bg-muted);
  color: var(--text-secondary);
  border-color: var(--border);
}

.action-btn.action-secondary:hover,
.btn-secondary:hover { background: var(--border); }

.action-summary {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Flow navigation */
.flow-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
}

.nav-btn:hover { background: var(--bg-muted); }

.nav-btn-next,
.nav-btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
  border-color: var(--primary);
}

.nav-btn-next:hover,
.nav-btn-primary:hover { background: var(--primary-light); }

/* Connection line */
.connection-line {
  width: 2px;
  height: 24px;
  background: var(--border);
  margin: 0 auto;
  transition: background var(--duration) var(--ease);
}

.connection-line-active,
.connection-line.active { background: var(--primary); }

.flow-path-indicator {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-light);
  padding: var(--space-xs) 0;
}

/* Intervention items */
.intervention-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.intervention-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  transition: box-shadow var(--duration) var(--ease);
}

.intervention-card:hover { box-shadow: var(--shadow-sm); }

.intervention-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.intervention-item {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

.intervention-item:last-child { border-bottom: none; }

.intervention-name { font-weight: 500; color: var(--text); font-size: 0.95rem; }
.intervention-detail { font-size: 0.85rem; color: var(--text-secondary); }

.intervention-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.intervention-meta {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.meta-item { font-size: 0.75rem; color: var(--text-light); }

.intervention-resources {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.pillar-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--secondary);
  color: var(--text-on-primary);
}

/* Carousel navigation button */
.carousel-prev-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.carousel-prev-btn svg {
  width: 14px;
  height: 14px;
}

.carousel-prev-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* Journey Review (end-of-tier visual flowchart) */
.journey-review {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.journey-review.journey-review-visible {
  opacity: 1;
  transform: translateY(0);
}

.journey-review-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.journey-review-header-copy {
  min-width: 0;
}

.journey-review-header h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.journey-review-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Journey Tier Sections (cross-tier final summary) ──────────────── */
.journey-tier-section {
  width: 100%;
  max-width: 420px;
}

.journey-tier-header {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-sm);
}

.journey-tier-badge {
  display: inline-block;
  padding: 4px 16px;
  background: var(--step-soft);
  color: var(--step-text);
  border: 1px solid var(--step);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.journey-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.journey-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  color: var(--text-light);
}

.journey-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  width: 100%;
  max-width: 420px;
  padding: var(--space-md);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.journey-step-checklist {
  background: var(--step-checklist-bg);
  border-left: 4px solid var(--step-checklist);
}
.journey-step-selection {
  background: var(--step-selection-bg);
  border-left: 4px solid var(--step-selection);
}
.journey-step-decision  {
  background: var(--step-decision-bg);
  border-left: 4px solid var(--step-decision);
}
.journey-step-info      {
  background: var(--step-info-bg);
  border-left: 4px solid var(--step-info);
}

.journey-step-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--step);
  flex-shrink: 0;
}

.journey-marker-icon {
  display: inline-flex;
  align-items: center;
}

.journey-marker-icon svg {
  width: 16px;
  height: 16px;
}

.journey-step-details {
  flex: 1;
}

.journey-step-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.journey-step-choice {
  font-size: 0.78rem;
  color: var(--step-text);
  margin-top: 2px;
}

/* Journey branches (decision alternatives) */
.journey-branches {
  display: flex;
  gap: var(--space-sm);
  width: 100%;
  max-width: 420px;
  margin-top: var(--space-xs);
  align-items: flex-start;
}

.journey-branch {
  flex: 1;
  padding: var(--space-sm);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.78rem;
}

.journey-branch-taken {
  background: var(--primary-faint);
  border-color: var(--primary);
}

/* Colour-coded branches based on choice type */
.journey-branch-taken.journey-branch-success,
.journey-branch-taken.journey-branch-info,
.journey-branch-taken.journey-branch-primary {
  background: var(--effective-bg);
  border-color: var(--effective);
}
.journey-branch-taken.journey-branch-warning,
.journey-branch-taken.journey-branch-danger {
  background: var(--ineffective-bg);
  border-color: var(--ineffective);
}

.journey-branch-indicator {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--step-text);
  margin-bottom: 2px;
}

/* Colour-coded indicators */
.journey-branch-success .journey-branch-indicator,
.journey-branch-info .journey-branch-indicator,
.journey-branch-primary .journey-branch-indicator {
  color: var(--effective-text);
}
.journey-branch-warning .journey-branch-indicator,
.journey-branch-danger .journey-branch-indicator {
  color: var(--ineffective-text);
}

.journey-branch-label {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 2px;
}

.journey-branch-sublabel {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.journey-branch-leads-to {
  font-size: 0.68rem;
  color: var(--text-light);
  margin-top: 4px;
  font-style: italic;
}

/* Journey selection chips */
.journey-selections {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
  max-width: 420px;
  margin-top: var(--space-xs);
  justify-content: center;
}

.journey-selection-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 500;
}

.journey-selection-chosen {
  background: var(--step-soft);
  color: var(--step-text);
  border: 1px solid var(--step);
}

/* Journey endpoint */
.journey-endpoint {
  text-align: center;
  width: 100%;
  max-width: 420px;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.journey-endpoint-icon { margin-bottom: 4px; }
.journey-endpoint-icon svg { width: 24px; height: 24px; }
.journey-endpoint h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: var(--space-xs); }
.journey-endpoint p { font-size: 0.9rem; color: var(--text-secondary); }

.journey-endpoint-success { background: var(--effective-bg); border-color: var(--effective); }
.journey-endpoint-info    { background: var(--effective-bg); border-color: var(--effective); }
.journey-endpoint-warning { background: var(--ineffective-bg); border-color: var(--ineffective); }
.journey-endpoint-danger  { background: var(--ineffective-bg); border-color: var(--ineffective); }

/* Journey actions */
.journey-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

/* ── Animated journey summary ──────────────────────────────────────── */

@keyframes anim-pop-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Wrapper that sequences the items */
.anim-journey-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* Each item starts invisible; .anim-visible triggers the pop */
.anim-journey-item {
  width: 100%;
  visibility: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
}

.anim-journey-item.anim-visible {
  visibility: visible;
  opacity: 1;
  transform: none;
}

.anim-kind-step.anim-visible,
.anim-kind-endpoint.anim-visible {
  animation: anim-pop-in 0.35s cubic-bezier(0.22, 1.18, 0.36, 1) both;
}

.anim-journey-item {
  transform-origin: center 70%;
}

.anim-summary-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
  background: rgba(10, 24, 43, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2vw, 20px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.anim-summary-modal-overlay.final-summary-modal-visible {
  opacity: 1;
}

body.final-summary-modal-open {
  overflow: hidden;
}

.journey-review.journey-review-modal {
  width: min(1100px, calc(100vw - 20px));
  max-width: none;
  max-height: 92vh;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border-radius: var(--radius-xl);
  background: var(--bg);
  box-shadow: 0 20px 50px rgba(14, 28, 45, 0.28);
}

.anim-summary-scroll {
  max-height: 92vh;
  overflow: auto;
  padding: clamp(16px, 2.4vw, 32px);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.anim-summary-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.anim-summary-scroll::-webkit-scrollbar-track {
  margin: 20px;
  background: transparent;
}

.anim-summary-scroll::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--border);
  background-clip: padding-box;
}

.anim-summary-scroll::-webkit-scrollbar-corner {
  background: transparent;
}

.journey-review.journey-review-modal .journey-review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  text-align: left;
}

@media (min-width: 769px) {
  .journey-review.journey-review-modal {
    width: min(1920px, calc(100vw - 40px));
  }

  .anim-journey-summary.anim-layout-rows {
    --anim-card-width: 280px;
    max-width: none;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
  }

  /* Fixed uniform width — bubbles never grow/shrink, they wrap to the next row */
  .anim-journey-summary.anim-layout-rows .anim-journey-item {
    flex: 0 0 var(--anim-card-width);
    width: var(--anim-card-width);
    max-width: var(--anim-card-width);
  }

  /* Tier badges span the full row as section separators */
  .anim-journey-summary.anim-layout-rows .anim-journey-item.anim-kind-tier {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
  }

  /* Endpoint cards use the same fixed width as step bubbles */
  .anim-journey-summary.anim-layout-rows .anim-journey-item.anim-kind-endpoint {
    flex: 0 0 var(--anim-card-width);
    width: var(--anim-card-width);
    max-width: var(--anim-card-width);
  }

  .anim-journey-summary.anim-layout-rows .anim-journey-item.anim-kind-connector {
    flex: 0 0 auto;
    max-width: none;
    width: auto;
    align-self: center;
  }

  .anim-journey-summary.anim-layout-rows .anim-tier-badge {
    justify-content: flex-start;
    margin: 6px 0 0;
  }

  /* Desktop bubbles: column layout so the icon sits above the text */
  .anim-journey-summary.anim-layout-rows .anim-step-bubble,
  .anim-journey-summary.anim-layout-rows .anim-endpoint-card {
    flex-direction: column;
    align-items: flex-start;
    min-height: 160px;
    height: auto;
    width: 100%;
    padding: 16px 18px 14px;
    gap: 0;
  }

  /* Larger, more prominent icon on desktop summary */
  .anim-journey-summary.anim-layout-rows .anim-step-bubble-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    margin-bottom: 12px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
  }

  .anim-journey-summary.anim-layout-rows .anim-step-bubble-icon svg {
    width: 28px;
    height: 28px;
  }

  /* Text fills the card so review buttons share a bottom baseline */
  .anim-journey-summary.anim-layout-rows .anim-step-bubble-text {
    flex: 1;
    width: 100%;
    min-width: 0;
  }

  /* Horizontal connectors in row layout */
  .anim-journey-summary.anim-layout-rows .anim-kind-connector .anim-connector {
    flex-direction: row;
    align-items: center;
    height: auto;
    padding: 0;
    width: 36px;
  }

  .anim-journey-summary.anim-layout-rows .anim-kind-connector .anim-connector-line {
    width: 100%;
    height: 2px;
    flex: 1;
    transform-origin: left center;
  }

  .anim-journey-summary.anim-layout-rows .anim-kind-connector .anim-connector-arrow {
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid var(--border);
    border-right: 0;
    margin-top: 0;
  }
}

@media (min-width: 1200px) {
  .anim-journey-summary.anim-layout-rows {
    --anim-card-width: calc((100% - 160px) / 5);
    gap: 8px;
  }

  .anim-journey-summary.anim-layout-rows .anim-kind-connector .anim-connector {
    width: 16px;
  }
}

/* Mobile: journey summary inside the step slot — full-width rectangles,
   shifted left to visually centre within the full item width
   (compensates for the 28px marker circle + 0.9rem gap on the left). */
@media (max-width: 1023px) {
  .journey-step-slot .anim-journey-summary {
    max-width: none;
    margin-left: calc(-1 * (28px + 0.9rem));
    width: calc(100% + 28px + 0.9rem);
  }

  .journey-step-slot .anim-step-bubble {
    border-radius: var(--radius);
    padding: 12px 14px;
  }

  .journey-step-slot .anim-endpoint-card {
    border-radius: var(--radius);
  }
}

/* Tier label pill */
.anim-tier-badge {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.anim-tier-badge-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 18px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Plain-language step bubble */
.anim-step-bubble {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 0;
  box-shadow: 0 4px 16px rgba(14, 28, 45, 0.06);
}

.anim-step-bubble-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--step-soft);
  color: var(--step);
  flex-shrink: 0;
}

.anim-step-bubble-icon svg {
  width: 16px;
  height: 16px;
}

.anim-step-bubble-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.anim-step-bubble-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  flex: 1;
}

.anim-step-bubble-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 2px;
}

.anim-step-bubble-main {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.anim-decision-options {
  display: grid;
  gap: 8px;
  margin-top: 0;
}

.anim-decision-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.4s cubic-bezier(0.22, 1.18, 0.36, 1), box-shadow 0.4s ease, background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, opacity 0.4s ease;
}

.anim-choice-marker {
  visibility: hidden;
  opacity: 0;
  transform: translateY(4px) scale(0.9);
  font-size: 0.75rem;
  transition: opacity 0.3s ease 0.08s, transform 0.35s cubic-bezier(0.22, 1.18, 0.36, 1) 0.08s;
}

.anim-choice-revealed .anim-option-chosen {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 4px 12px rgba(14, 28, 45, 0.1);
  background: var(--step-bg);
  border-color: var(--step);
  color: var(--step-text);
}

.anim-choice-revealed .anim-option-chosen.anim-option-effective {
  background: var(--effective-bg);
  border-color: var(--effective);
  color: var(--effective-text);
}

.anim-choice-revealed .anim-option-chosen.anim-option-ineffective {
  background: var(--ineffective-bg);
  border-color: var(--ineffective);
  color: var(--ineffective-text);
}

.anim-choice-revealed .anim-decision-option:not(.anim-option-chosen) {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text-light);
  opacity: 0.55;
  transform: scale(0.985);
}

.anim-choice-revealed .anim-choice-marker {
  visibility: visible;
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .journey-review .anim-decision-option,
  .journey-review .anim-choice-marker {
    transition: none;
    transform: none;
  }

  .journey-review .anim-choice-revealed .anim-decision-option {
    transform: none;
  }
}

.anim-step-bubble-sub {
  font-size: 0.82rem;
  color: var(--step-text);
  margin-top: 7px;
  font-weight: 500;
}

/* Colour variants */
.anim-step-bubble.anim-step-type-checklist {
  background: var(--step-checklist-bg);
  border-color: var(--step-checklist);
}
.anim-step-bubble.anim-step-type-checklist .anim-step-bubble-icon {
  background: var(--step-checklist-header);
  color: var(--step-checklist);
}

.anim-step-bubble.anim-step-type-selection {
  background: var(--step-selection-bg);
  border-color: var(--step-selection);
}
.anim-step-bubble.anim-step-type-selection .anim-step-bubble-icon {
  background: var(--step-selection-header);
  color: var(--step-selection);
}

.anim-step-bubble.anim-step-type-decision {
  background: var(--step-decision-bg);
  border-color: var(--step-decision);
}
.anim-step-bubble.anim-step-type-decision .anim-step-bubble-icon {
  background: var(--step-decision-header);
  color: var(--step-decision);
}

.anim-step-bubble.anim-step-type-info {
  background: var(--step-info-bg);
  border-color: var(--step-info);
}
.anim-step-bubble.anim-step-type-info .anim-step-bubble-icon {
  background: var(--step-info-header);
  color: var(--step-info);
}

.anim-step-bubble.anim-bubble-effective {
  border-color: var(--effective);
  background: var(--effective-bg);
}
.anim-step-bubble.anim-bubble-effective .anim-step-bubble-icon {
  background: var(--effective-soft);
  color: var(--effective-text);
}
.anim-step-bubble.anim-bubble-effective .anim-step-bubble-main {
  color: var(--effective-text);
}

.anim-step-bubble.anim-bubble-ineffective {
  border-color: var(--ineffective);
  background: var(--ineffective-bg);
}
.anim-step-bubble.anim-bubble-ineffective .anim-step-bubble-icon {
  background: var(--ineffective-soft);
  color: var(--ineffective-text);
}
.anim-step-bubble.anim-bubble-ineffective .anim-step-bubble-main {
  color: var(--ineffective-text);
}

/* Step 1 checklist bubbles – use the step (navy) colour prominently */
.anim-step-bubble.anim-bubble-step1 {
  border-color: var(--step);
  background: var(--step-bg);
}
.anim-step-bubble.anim-bubble-step1 .anim-step-bubble-icon {
  background: var(--step-soft);
  color: var(--step);
}
.anim-step-bubble.anim-bubble-step1 .anim-step-bubble-main {
  color: var(--step-text);
  font-weight: 600;
}

/* Assessment / intervention selection bubbles – use info (blue) colour */
.anim-step-bubble.anim-bubble-selection {
  border-color: var(--info);
  background: var(--info-light);
}
.anim-step-bubble.anim-bubble-selection .anim-step-bubble-icon {
  background: rgba(90, 158, 201, 0.18);
  color: var(--info-text);
}
.anim-step-bubble.anim-bubble-selection .anim-step-bubble-main {
  color: var(--info-text);
}

/* Animated connector line between bubbles */
.anim-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 0;
  height: 36px;
}

.anim-connector-line {
  width: 2px;
  flex: 1;
  background: var(--border);
  transform-origin: top center;
  transform: scaleY(0);
}

.anim-connector-line.anim-visible {
  transform: scaleY(1);
}

.anim-connector-arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--border);
  margin-top: 0;
  opacity: 0;
}

.anim-connector.anim-visible .anim-connector-arrow {
  opacity: 1;
}

/* Endpoint card in the animation */
.anim-endpoint-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 2px solid var(--effective);
  background: var(--effective-bg);
  text-align: center;
}

.anim-endpoint-card.anim-endpoint-ineffective {
  border-color: var(--ineffective);
  background: var(--ineffective-bg);
}

.anim-endpoint-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  color: var(--effective-text);
}

.anim-endpoint-card.anim-endpoint-ineffective .anim-endpoint-icon {
  color: var(--ineffective-text);
}

.anim-endpoint-icon svg {
  width: 28px;
  height: 28px;
}

.anim-endpoint-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--effective-text);
  margin-bottom: 4px;
}

.anim-endpoint-card.anim-endpoint-ineffective .anim-endpoint-title {
  color: var(--ineffective-text);
}

.anim-endpoint-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* Skip button (lets users jump to end without waiting) */
.anim-playback-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.anim-speed-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.anim-playback-speed {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.anim-playback-controls .anim-skip-btn {
  margin-bottom: 0;
}

.anim-playback-hint {
  margin: 8px 0 var(--space-md);
  font-size: 0.78rem;
  color: var(--text-light);
}

.anim-skip-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  color: var(--text-light);
  cursor: pointer;
  margin-bottom: var(--space-md);
  transition: border-color 0.2s, color 0.2s;
}

.anim-skip-btn:hover {
  border-color: var(--primary);
  color: var(--primary-text);
}

/* ── Route completion gate (pre-animation screen) ─────────────────── */
.route-complete-gate {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  max-width: 480px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.route-complete-gate.route-complete-gate-visible {
  opacity: 1;
  transform: translateY(0);
}

.gate-icon {
  width: 56px;
  height: 56px;
  background: color-mix(in srgb, var(--success, #059669) 12%, transparent);
  color: var(--success, #059669);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.gate-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.gate-subtitle {
  font-size: 0.93rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gate-tier-pill {
  display: inline-block;
  background: var(--step-soft);
  color: var(--step);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.gate-desc {
  font-size: 0.87rem;
  color: var(--text-light);
  margin-bottom: var(--space-lg);
}

.gate-summary-btn {
  gap: 8px;
  padding: 13px 28px;
  font-size: 0.97rem;
}

/* ── Review button on each animation summary bubble ───────────────── */
.anim-step-review-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  margin-top: 0;
  padding: 4px 10px;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-light);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
  white-space: nowrap;
}

.anim-step-review-btn:hover {
  color: var(--step);
  border-color: var(--step);
  background: var(--step-soft);
}

/* ── Step review modal ─────────────────────────────────────────────── */
.step-review-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: var(--space-lg);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.step-review-overlay.step-review-visible {
  opacity: 1;
}

.step-review-dialog {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.25s var(--ease);
}

.step-review-overlay.step-review-visible .step-review-dialog {
  transform: translateY(0) scale(1);
}

.step-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  gap: var(--space-sm);
}

.step-review-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
}

.step-badge-modal {
  font-size: 0.85rem;
}

.step-review-type-chip {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-muted);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.step-review-body {
  padding: var(--space-lg);
}

.review-subtitle {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-sm);
}

.review-description {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  white-space: pre-line;
  line-height: 1.5;
}

.review-checklist-intro {
  margin-bottom: var(--space-sm);
}

body.step-review-modal-open { overflow: hidden; }

/* Summary / Review modal */
.summary-overlay,
.review-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: var(--space-lg);
}

.summary-modal,
.review-modal-content {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: min(90vw, 1100px);
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.glass-panel { padding: var(--space-lg); }

.summary-header,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.close-summary-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}

.close-summary-btn:hover { background: var(--border); }

.summary-tier {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.summary-content,
.modal-body { padding: var(--space-lg); }

.summary-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.summary-item:last-child { border-bottom: none; }

.summary-item-checklist  {
  background: var(--step-checklist-bg);
  border-left: 4px solid var(--step-checklist);
  padding-left: var(--space-md);
}
.summary-item-selection  {
  background: var(--step-selection-bg);
  border-left: 4px solid var(--step-selection);
  padding-left: var(--space-md);
}
.summary-item-decision   {
  background: var(--step-decision-bg);
  border-left: 4px solid var(--step-decision);
  padding-left: var(--space-md);
}
.summary-item-info       {
  background: var(--step-info-bg);
  border-left: 4px solid var(--step-info);
  padding-left: var(--space-md);
}
.summary-item-endpoint   {
  background: var(--step-endpoint-bg);
  border-left: 4px solid var(--step-endpoint);
  padding-left: var(--space-md);
}

.summary-step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--step);
  flex-shrink: 0;
}

.summary-step-details {
  flex: 1;
}

.summary-step-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  margin-bottom: var(--space-xs);
}

.summary-choice-text { font-size: 1rem; color: var(--text); }

.summary-actions {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* Final summary */
.final-summary-container {
  max-width: 600px;
  margin: var(--space-xl) auto;
  text-align: center;
}

.final-summary {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
}

.final-summary-icon { font-size: 3rem; margin-bottom: var(--space-md); }

.final-summary-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-lg);
}

/* Back button */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: var(--space-md);
  transition: all var(--duration) var(--ease);
}

.back-button:hover { background: var(--border); color: var(--text); }

/* Flowchart start */
.flowchart-start {
  text-align: center;
  padding: var(--space-xl);
}

.start-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  max-width: 600px;
  margin: 0 auto;
}

.start-icon { font-size: 2.5rem; margin-bottom: var(--space-md); }

/* Tier selection */
.tier-selection {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.tier-option {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-align: left;
}

.tier-option:hover { border-color: var(--primary-light); background: var(--primary-faint); }

.tier-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  font-weight: 700;
  color: var(--text-on-primary);
  flex-shrink: 0;
}

.tier-info { flex: 1; }
.tier-info strong { display: block; margin-bottom: 2px; }
.tier-info p { font-size: 0.85rem; color: var(--text-secondary); }
.tier-arrow { color: var(--text-light); font-size: 1.25rem; }

/* Flowchart tier select */
.flowchart-tier-select {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
}

.tier-select-option {
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.tier-select-option:hover { border-color: var(--primary-light); }

.tier-select-card {
  padding: var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.tier-select-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-sm); }
.tier-select-card.active { border-color: var(--primary); background: var(--primary-faint); }

.tier-title,
.integrated-tier-title {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.flowchart-tier-view { padding: var(--space-xl); }

.step-content-box {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-xl);
  margin-bottom: var(--space-md);
  border: 1px solid var(--border);
}

.flowchart-step-wrapper { margin-bottom: var(--space-lg); }

/* Messages */
.success-message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--success-light);
  border-radius: var(--radius);
  color: var(--success-text);
  margin-bottom: var(--space-sm);
}

.success-icon, .info-icon, .warning-icon { font-size: 1rem; flex-shrink: 0; }

.info-message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--info-light);
  border-radius: var(--radius);
  color: var(--info-text);
  margin-bottom: var(--space-sm);
}

.warning-message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--warning-light);
  border-radius: var(--radius);
  color: var(--warning-text);
  margin-bottom: var(--space-sm);
}

/* Export */
.export-options {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.825rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.export-btn:hover { background: var(--bg-muted); border-color: var(--primary-light); }

/* Menu card / step sections */
.menu-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  transition: box-shadow var(--duration) var(--ease);
}

.menu-card:hover { box-shadow: var(--shadow-sm); }

.menu-step-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-sm);
  overflow: hidden;
}

.menu-step-section.disabled { opacity: 0.6; pointer-events: none; }
.menu-step-section.completed { border-color: var(--success); }

.step-section-selection { padding: var(--space-lg); }

.menu-step {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}

.menu-step:hover { background: var(--bg-alt); }

.single-page-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Step wizard */
.step-wizard { max-width: 800px; margin: 0 auto; }

.step-bar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}

.step-pill {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-light);
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
}

.step-pill.active { background: var(--primary); color: var(--text-on-primary); }
.step-pill.completed { background: var(--success-light); color: #065f46; }

.step-connector {
  width: 24px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}

.step-panels { position: relative; }
.step-panel { display: none; }
.step-panel.active { display: block; }

/* Visual flowchart header */
.visual-flowchart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
}

/* Visual Flowchart (vf-*) */
.vf-canvas { position: relative; padding: var(--space-lg) 0; }

.vf-node {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease),
              border-color var(--duration) var(--ease);
}

.vf-node.vf-node-visible { opacity: 1; transform: translateY(0); }
.vf-node.vf-node-completed { opacity: 0.5; pointer-events: none; }

.vf-node-checklist  {
  background: var(--step-checklist-bg);
  border-left: 5px solid var(--step-checklist);
  border-color: var(--step-checklist);
}
.vf-node-selection  {
  background: var(--step-selection-bg);
  border-left: 5px solid var(--step-selection);
  border-color: var(--step-selection);
}
.vf-node-decision   {
  background: var(--step-decision-bg);
  border-left: 5px solid var(--step-decision);
  border-color: var(--step-decision);
}
.vf-node-info       {
  background: var(--step-info-bg);
  border-left: 5px solid var(--step-info);
  border-color: var(--step-info);
}
.vf-node-endpoint   {
  background: var(--step-endpoint-bg);
  border-left: 5px solid var(--step-endpoint);
  border-color: var(--step-endpoint);
}

/* Themed vf-node headers per type */
.vf-node-checklist .vf-node-header {
  background: var(--step-checklist-header);
  border-bottom-color: var(--step-soft);
}
.vf-node-checklist .vf-node-step-badge { color: var(--step-checklist-text); }

.vf-node-selection .vf-node-header {
  background: var(--step-selection-header);
  border-bottom-color: var(--step-soft);
}
.vf-node-selection .vf-node-step-badge { color: var(--step-selection-text); }

.vf-node-decision .vf-node-header {
  background: var(--step-decision-header);
  border-bottom-color: var(--step-soft);
}
.vf-node-decision .vf-node-step-badge { color: var(--step-decision-text); }

.vf-node-info .vf-node-header {
  background: var(--step-info-header);
  border-bottom-color: var(--step-soft);
}
.vf-node-info .vf-node-step-badge { color: var(--step-info-text); }

.vf-node-endpoint .vf-node-header {
  background: var(--step-endpoint-header);
  border-bottom-color: var(--step-soft);
}
.vf-node-endpoint .vf-node-step-badge { color: var(--step-endpoint-text); }

/* Checklist items tinted within vf-node */
.vf-node-checklist .vf-checklist-item {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--step-soft);
}
.vf-node-checklist .vf-checklist-item:hover { background: rgba(255, 255, 255, 0.9); }
.vf-node-checklist .vf-checklist-item.checked {
  background: var(--step-soft);
  border-color: var(--step-checklist);
}
.vf-node-checklist .vf-checklist-item.checked .vf-checkbox-custom {
  background: var(--step-checklist);
  border-color: var(--step-checklist);
}

/* Selection options tinted within vf-node */
.vf-node-selection .vf-selection-option {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--step-soft);
}
.vf-node-selection .vf-selection-option:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--step-selection);
}
.vf-node-selection .vf-selection-option.vf-option-selected {
  background: var(--step-soft);
  border-color: var(--step-selection);
  box-shadow: 0 0 0 1px var(--step-selection);
}

.vf-node-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.vf-node-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 2px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.vf-node-content { padding: var(--space-lg); }

/* VF Checklist */
.vf-checklist {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.vf-checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all var(--duration) var(--ease);
}

.vf-checklist-item:hover { background: var(--bg-alt); }

.vf-checklist-item.checked {
  background: var(--primary-faint);
  border-color: var(--primary-light);
}

.vf-checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--duration) var(--ease);
}

.vf-checklist-item.checked .vf-checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-primary);
}

.vf-checkbox-label { font-size: 0.9rem; color: var(--text); }

.vf-continue-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.6rem 1.25rem;
  margin-top: var(--space-md);
  background: var(--bg-muted);
  color: var(--text-light);
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: not-allowed;
  transition: all var(--duration) var(--ease);
}

.vf-continue-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.vf-continue-btn.vf-btn-ready {
  background: var(--primary);
  color: var(--text-on-primary);
  cursor: pointer;
}

.vf-continue-btn.vf-btn-ready:hover { background: var(--primary-light); }

/* VF Selection */
.vf-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-sm);
}

.vf-selection-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.vf-selection-option:hover { border-color: var(--primary-light); background: var(--primary-faint); }

.vf-selection-option.vf-option-selected {
  border-color: var(--primary);
  background: var(--primary-faint);
  box-shadow: 0 0 0 1px var(--primary);
}

.vf-selection-option.vf-option-disabled { opacity: 0.5; pointer-events: none; }

.vf-option-icon { font-size: 1.5rem; flex-shrink: 0; }
.vf-option-content { flex: 1; }
.vf-option-meta { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }
.vf-option-arrow { color: var(--text-light); font-size: 1rem; }

/* VF Callouts */
.vf-info-box {
  padding: var(--space-sm);
  background: var(--info-light);
  border-radius: var(--radius);
  color: var(--info-text);
  font-size: 0.78rem;
  margin-bottom: var(--space-sm);
}

.vf-warning-box {
  padding: var(--space-sm);
  background: var(--warning-light);
  border-radius: var(--radius);
  color: var(--warning-text);
  font-size: 0.78rem;
  margin-bottom: var(--space-sm);
}

/* VF Decision */
.vf-decision-grid {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.vf-decision-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  background: var(--bg);
  flex: 1;
  min-width: 140px;
}

.vf-decision-btn:hover { border-color: var(--primary-light); }

.vf-decision-btn.vf-decision-selected {
  border-color: var(--primary);
  background: var(--primary-faint);
  box-shadow: 0 0 0 1px var(--primary);
}

.vf-decision-btn.vf-decision-disabled { opacity: 0.5; pointer-events: none; }

.vf-decision-success {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success-text);
}
.vf-decision-success:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.vf-decision-warning {
  border-color: var(--danger);
  background: var(--danger-light);
  color: #8b3535;
}
.vf-decision-warning:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.vf-decision-info {
  border-color: var(--info);
  background: var(--info-light);
  color: var(--info-text);
}
.vf-decision-info:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.vf-decision-icon { font-size: 1.25rem; flex-shrink: 0; }
.vf-decision-icon svg { width: 22px; height: 22px; }
.vf-decision-content { flex: 1; }

.vf-decision-content strong { display: block; font-size: 0.85rem; font-weight: 600; line-height: 1.3; }
.vf-decision-content span { font-size: 0.75rem; color: var(--text-secondary); }
.vf-decision-btn.vf-decision-single-line .vf-decision-content strong { font-size: 0.9rem; font-weight: 800; line-height: 1.35; }
.vf-decision-success .vf-decision-content span { color: var(--success-text); }
.vf-decision-warning .vf-decision-content span { color: #8b3535; }
.vf-decision-info .vf-decision-content span { color: var(--info-text); }

.vf-feature-list { list-style: none; padding: 0; margin-top: var(--space-sm); }

.vf-feature-list li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.vf-feature-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 600;
}

/* VF Endpoint */
.vf-endpoint {
  text-align: center;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.vf-endpoint.vf-endpoint-success { background: var(--success-light); border-color: var(--success); }
.vf-endpoint.vf-endpoint-info    { background: var(--info-light); border-color: var(--info); }
.vf-endpoint.vf-endpoint-warning { background: var(--warning-light); border-color: var(--warning); }
.vf-endpoint.vf-endpoint-danger  { background: var(--danger-light); border-color: var(--danger); }

.vf-endpoint-icon { margin-bottom: var(--space-sm); }

.vf-endpoint-icon svg {
  width: 32px;
  height: 32px;
}

.vf-endpoint-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.vf-action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.vf-action-btn:hover { background: var(--bg-muted); }
.vf-action-btn.vf-action-primary { background: var(--primary); color: var(--text-on-primary); border-color: var(--primary); }
.vf-action-btn.vf-action-primary:hover { background: var(--primary-light); }
.vf-action-btn.vf-action-secondary { background: var(--bg-muted); }
.vf-action-btn.vf-action-close { color: var(--danger); border-color: var(--danger); }
.vf-action-btn.vf-action-close:hover { background: var(--danger-light); }

.vf-recommendations {
  background: var(--bg);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-top: var(--space-md);
  text-align: left;
  border: 1px solid var(--border);
}

.vf-connection-path {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
}

.vf-connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

.vf-progress-text {
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
  margin-bottom: var(--space-sm);
}

/* ------------------------------------------------------------
   20. RESOURCES
   ------------------------------------------------------------ */

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-md);
}

.resource-category {
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.resource-category:hover {
  border-color: var(--primary-light);
}

.category-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--text);
}

.category-icon { font-size: 1rem; }

.resource-list { padding: var(--space-xs) var(--space-md); }

.resource-list li { border-bottom: 1px solid var(--border); }
.resource-list li:last-child { border-bottom: none; }

.resource-list a {
  display: block;
  padding: var(--space-xs) 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: color var(--duration) var(--ease);
}

.resource-list a:hover { color: var(--primary-text); text-decoration: none; }

/* ------------------------------------------------------------
   21. FOOTER
   ------------------------------------------------------------ */

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  color: var(--text-light);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.site-footer-division-logo {
  width: min(220px, 70vw);
  height: auto;
}

/* ------------------------------------------------------------
   22. ANIMATIONS
   ------------------------------------------------------------ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ------------------------------------------------------------
   23. RESPONSIVE - TABLET (max 768px)
   ------------------------------------------------------------ */

@media (max-width: 768px) {
  .side-nav { display: none; }
  .sidebar-toggle-btn { display: none !important; }
  .mobile-menu-btn { display: flex; }
  .main-content, .site-footer { margin-left: 0; }
  body.side-nav-collapsed .main-content,
  body.side-nav-collapsed .site-footer { margin-left: 0; }
  .nav-right > .top-program-lang { display: none; }
  .mobile-menu-program-lang {
    display: grid;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-sm) 0;
    border-top: 1px solid var(--border);
  }
  .mobile-menu-program-lang .top-program-lang-field {
    gap: 0.35rem;
  }
  .mobile-menu-program-lang .top-program-lang-label {
    display: block;
    font-size: 0.72rem;
  }
  .mobile-menu-program-lang .top-program-lang-select {
    width: 100%;
    min-width: 0;
    font-size: 0.88rem;
    padding: 0.4rem 0.5rem;
  }

  .home-hero { padding: var(--space-2xl) var(--space-md); }
  .hero-title { font-size: 1.6rem; }
  .hero-subtitle { font-size: 1rem; }
  .hero-icon { width: 64px; height: 64px; }
  .hero-icon .material-symbols-rounded { font-size: 34px; }
  .hero-area { padding: var(--space-xl) var(--space-md); }

  .home-content, .content-wrapper { padding: var(--space-md); }

  .content-card { padding: var(--space-md); margin-bottom: var(--space-md); }

  .info-grid { grid-template-columns: 1fr; }

  .tier-pyramid { max-width: 100%; }
  .tier-3-level { max-width: 70%; }
  .tier-2-level { max-width: 85%; }

  .subtab-bar { padding: var(--space-xs) var(--space-sm); }

  .resource-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); padding: var(--space-sm); }

  .dropdown-row { flex-direction: column; }

  .selection-grid,
  .screener-grid,
  .screener-selection-grid,
  .area-grid,
  .vf-selection-grid { grid-template-columns: 1fr; }

  .decision-grid,
  .decision-buttons,
  .vf-decision-grid { flex-direction: column; }

  .interventions-grid { grid-template-columns: 1fr; }

  .summary-modal, .review-modal-content { max-width: 95%; max-height: 90vh; }

  .practice-grid { grid-template-columns: 1fr; }
  .tier-tabs { flex-wrap: wrap; }

  /* Stack flowchart vertically on mobile */
  .integrated-flowchart,
  .integrated-flowchart-container {
    padding: var(--space-md) var(--space-sm);
  }
  .flowchart-steps {
    padding: 0 var(--space-sm);
  }
  .flowchart-step,
  .integrated-flow-node {
    min-width: unset;
    max-width: 100%;
    width: 100%;
  }
  .decision-btn, .vf-decision-btn {
    min-width: auto;
    padding: 0.5rem 0.75rem;
  }
  .flowchart-step-connector {
    width: auto;
    min-width: auto;
    height: 20px;
  }
  .flowchart-step-connector svg {
    transform: rotate(90deg);
  }
  /* Journey review mobile */
  .journey-review {
    padding: var(--space-md);
  }
  .journey-branches {
    flex-direction: column;
  }
  .journey-step,
  .journey-endpoint {
    max-width: 100%;
  }
  .journey-selections {
    max-width: 100%;
  }

  /* Align step content padding with step header for visual consistency on mobile */
  .step-content, .node-content {
    padding: var(--space-lg);
  }

  /* Centre the flowchart card content area on mobile */
  .journey-shell {
    align-items: center;
    max-width: 100%;
  }
  .journey-map {
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
  }

  /* Horizontal step-summary track: keep it (and everything below it) locked
     to the viewport width. Only the track itself scrolls sideways; the
     question area beneath it stays static and fully on-screen. */
  .journey-map-list,
  .horiz-track-li,
  .horiz-step-content-li {
    max-width: 100%;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
  }
  .horiz-track-scroll {
    width: 100%;
    max-width: 100%;
  }
}

/* ------------------------------------------------------------
   RESPONSIVE - MOBILE (max 480px)
   ------------------------------------------------------------ */

@media (max-width: 480px) {
  body { font-size: 0.95rem; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }

  .home-hero { padding: var(--space-xl) var(--space-md); }
  .hero-title { font-size: 1.45rem; }
  .hero-subtitle { font-size: 0.95rem; }

  .content-card { padding: var(--space-lg); }
  .dropdown-wizard { padding: var(--space-lg); }
  .resource-grid { grid-template-columns: 1fr; }
  .nav-container { padding: 0 var(--space-md); }

  .subtab-bar { gap: 3px; padding: var(--space-xs) var(--space-sm); }
  .subtab-btn { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

  .mobile-nav-content { width: 100%; }

  .summary-overlay, .review-modal { padding: var(--space-sm); }

  .faq-question { padding: var(--space-sm); font-size: 0.82rem; }

  .endpoint-card, .vf-endpoint { padding: var(--space-lg); }

  .integrated-flowchart-header {
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: var(--space-xs);
  }

  /* Mobile flowchart header: one compact row — back arrow, tier tabs, ? —
     with the selected screener (when shown) on a row of its own. */
  .flowchart-glass-header {
    position: relative;
    top: auto;
    grid-template-columns: 36px 1fr 36px;
    row-gap: var(--space-xs);
    padding: 6px;
  }
  .flowchart-glass-header .flowchart-back-btn {
    grid-column: 1;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
  }
  .flowchart-glass-header .flowchart-back-btn svg { width: 18px; height: 18px; }
  .flowchart-back-btn-label { display: none; }
  .flowchart-glass-header .tier-tabs {
    grid-column: 2;
    justify-self: center;
    justify-content: center;
    flex-wrap: nowrap;
    min-width: 0;
  }
  .flowchart-glass-header .tier-tab { padding: 0.35rem 0.65rem; }
  .flowchart-glass-header-end { display: contents; }
  .flowchart-glass-header .tier1-guidance {
    position: static;
    grid-column: 3;
    grid-row: 1;
  }
  .flowchart-glass-header .tier1-guidance-btn {
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
  }
  .flowchart-glass-header .tier1-guidance-btn .material-symbols-rounded { font-size: 22px; }
  .flowchart-glass-header .tier1-guidance-btn-label { display: none; }
  .flowchart-glass-header .tier1-guidance-popup.tier1-success-sidebar {
    left: 0;
    right: 0;
    width: auto;
  }
  .flowchart-glass-header .flowchart-screener-indicator {
    grid-column: 1 / -1;
    justify-self: center;
    justify-content: center;
  }

  /* "Universal Classroom" etc.: a small frosted tab hanging from the top bar
     that stays pinned while the flowchart scrolls. */
  #flowchart-section { overflow: clip; }
  #flowchart-container .integrated-flowchart.flowchart-tier-1,
  #flowchart-container .integrated-flowchart.flowchart-tier-2,
  #flowchart-container .integrated-flowchart.flowchart-tier-3 {
    border-top: 0;
    border-radius: 0;
  }
  .integrated-flowchart { padding-top: 0; }
  .flowchart-tier-name-bar {
    position: sticky;
    top: var(--nav-height);
    z-index: 901;
    width: fit-content;
    max-width: calc(100% - 2 * var(--space-lg));
    margin: 0 auto var(--space-sm);
    padding: 0.3rem 1.1rem 0.4rem;
    border-radius: 0 0 14px 14px;
    background: color-mix(in srgb, var(--tier-color, var(--primary)) 72%, transparent);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    backdrop-filter: blur(12px) saturate(160%);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  }
  .flowchart-tier-name-value { font-size: 0.8rem; }

  /* Mobile top bar on every page except Home: no site name or hero banner;
     the page title sits centred and the logo moves to the right corner. */
  .top-nav .nav-container { position: relative; }
  body:not([data-page="home"]) .logo-text { display: none; }
  body:not([data-page="home"]) .logo-section { order: 10; }
  body:not([data-page="home"]) .mobile-page-title {
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: calc(100% - 140px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: "Nunito", sans-serif;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--primary-text);
    pointer-events: none;
  }
  body:not([data-page="home"]) .hero-area { display: none; }

  .tier-selection { gap: var(--space-sm); }
  .tier-option { padding: var(--space-md); }

  .step-bar { gap: 3px; }
  .step-pill { padding: 0.35rem 0.6rem; font-size: 0.72rem; }
}

/* Skip-to-content */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--text-on-primary);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: top var(--duration) var(--ease);
}

.skip-to-content:focus {
  top: var(--space-md);
}

/* Smooth section transitions */
.content-section {
  display: none;
  animation: sectionFadeIn 0.35s var(--ease) both;
}

.content-section.active {
  display: block;
}

@keyframes sectionFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   24. PRINT
   ------------------------------------------------------------ */

@media print {
  .top-nav,
  .side-nav,
  .mobile-menu-btn,
  .mobile-nav-overlay,
  .subtab-bar,
  .feedback-section,
  .back-button,
  .flowchart-back-btn,
  .action-buttons,
  .export-options,

  body { background: white; color: black; font-size: 11pt; }
  .main-content { padding-top: 0; margin-left: 0; }
  .site-footer { margin-left: 0; }

  .content-card, .menu-card, .start-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .home-hero, .hero-area {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  a { color: #6b7b8d; text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
}

/* ------------------------------------------------------------
   HOMEPAGE & INTERVENTIONS LAYOUT (added for clear homepage)
   ------------------------------------------------------------ */

/* Interventions page layout */
.interventions-page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--nav-height));
}

.interventions-page-body {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

.interventions-page-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.interventions-page-layout[hidden],
#toolkit-table-view[hidden] { display: none; }

.interventions-page-body:has(#toolkit-table-view:not([hidden])) { max-width: 1500px; }

.toolkit-view-switch {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-sm);
}

.toolkit-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 32px;
  padding: 0.2rem 0.4rem;
  border: 0;
  border-radius: var(--radius-pill, 999px);
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.toolkit-view-toggle:hover { color: var(--primary-text); }
.toolkit-view-toggle[aria-checked="false"] .toolkit-view-toggle-label:first-child,
.toolkit-view-toggle[aria-checked="true"] .toolkit-view-toggle-label:last-child { color: var(--primary-text); font-weight: 700; }

.toolkit-view-toggle-track {
  position: relative;
  flex-shrink: 0;
  width: 30px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-muted, var(--bg-alt));
  transition: background var(--duration, 0.2s) var(--ease, ease);
}

.toolkit-view-toggle-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  transition: transform var(--duration, 0.2s) var(--ease, ease);
}

.toolkit-view-toggle[aria-checked="true"] .toolkit-view-toggle-track { background: var(--primary); border-color: var(--primary); }
.toolkit-view-toggle[aria-checked="true"] .toolkit-view-toggle-thumb { transform: translateX(14px); background: #fff; }

.toolkit-table-hint { margin: var(--space-sm) 0 var(--space-lg); color: var(--text-secondary); }
.toolkit-table-search { display: grid; gap: var(--space-xs); margin-bottom: var(--space-md); }
.toolkit-table-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); margin: var(--space-md) 0; }
.toolkit-table-toolbar p { margin: 0; }
.toolkit-table-clear { margin-left: auto; }
.toolkit-table-scroll { max-width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.toolkit-resource-table { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 0.85rem; }
.toolkit-resource-table th,
.toolkit-resource-table td { padding: 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.toolkit-resource-table th { background: var(--bg-alt); color: var(--primary-text); vertical-align: middle; }
.toolkit-th { display: flex; min-height: 44px; align-items: center; gap: 2px; }
.toolkit-column-label { flex: 1; }
.toolkit-resource-table .toolkit-sort-btn { display: flex; flex: 1; gap: 0.4rem; min-height: 44px; align-items: center; background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.toolkit-column-filter.cal-grade-dropdown { position: static; min-width: 0; max-width: none; flex-shrink: 0; }
.toolkit-column-filter > summary {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  color: var(--text-secondary);
  list-style: none;
}
.toolkit-column-filter > summary::-webkit-details-marker,
.toolkit-column-filter > summary::before { display: none; }
.toolkit-column-filter > summary:hover,
.toolkit-column-filter[open] > summary { border-color: var(--border); background: var(--bg); color: var(--primary-text); }
.toolkit-column-filter .cal-grade-options { font-weight: 400; font-size: 0.85rem; text-align: left; color: var(--text); }
/* Round "radio dial" markers that still allow several selections. */
.toolkit-column-filter .cal-grade-option input[type="checkbox"],
.toolkit-column-filter .cal-grade-option input[type="radio"] {
  appearance: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 2px solid var(--text-secondary);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer;
}
.toolkit-column-filter .cal-grade-option input[type="checkbox"]:checked,
.toolkit-column-filter .cal-grade-option input[type="radio"]:checked {
  border-color: var(--primary);
  background: radial-gradient(circle, var(--primary) 0 4px, var(--bg) 5px);
}
.toolkit-column-filter-empty { margin: 0; padding: 8px; color: var(--text-secondary); }
.toolkit-column-filter-footer { justify-content: space-between; gap: var(--space-sm); }
.toolkit-column-filter-clear { background: none; border: 0; padding: 6px 8px; color: var(--primary-text); font: inherit; text-decoration: underline; cursor: pointer; }
.toolkit-resource-table tbody tr { background: var(--bg); }
.toolkit-resource-table tbody tr:nth-child(even) { background: var(--bg-alt); }
.toolkit-resource-table td:first-child { min-width: 220px; }
.toolkit-resource-table td:last-child { min-width: 110px; }
.toolkit-table-notes { display: block; margin-top: var(--space-xs); color: var(--text-secondary); overflow-wrap: anywhere; }
.toolkit-table-links { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
.toolkit-link-unavailable::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 2px;
  background: currentColor;
  transform: rotate(-45deg);
}
.toolkit-link-unavailable:hover { color: var(--text-light); background: var(--bg-muted); }
.toolkit-view-toggle:focus-visible,
.toolkit-table-scroll:focus-visible,
.toolkit-resource-table th button:focus-visible,
.toolkit-column-filter > summary:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 2px; }

/* ── Search panel (the main area used to build a search) ─────────────── */
.menu-view-search .menu-search-panel {
  display: block;
}

.menu-search-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, var(--radius));
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  color: var(--text);
}

.menu-view-results .menu-search-panel {
  display: none;
}

.menu-search-panel-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.menu-search-panel-header .wizard-title {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text);
  margin-bottom: 4px;
}

.filter-required-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.menu-search-panel-body {
  display: grid;
  gap: var(--space-md);
}

.menu-search-panel-body > [hidden] {
  display: none;
}

.menu-pillar-dropdown {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.menu-pillar-dropdown .cal-grade-options {
  left: 0;
}

.menu-pillar-dropdown .cal-grade-option {
  white-space: normal;
}
.multiselect-done-btn {
  display: inline-block;
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.multiselect-done-btn:hover { background: var(--primary-light); }

.menu-search-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.menu-search-hint {
  margin: 0;
  flex: 1 1 auto;
  min-width: 160px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
}

.filter-clear-btn {
  border: none;
  background: transparent;
  padding: 0.6rem 0.2rem;
  color: var(--primary-text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-clear-btn:hover {
  color: var(--primary-light-text);
}

.menu-search-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--text-on-primary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              background var(--duration) var(--ease);
}

.menu-search-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md, var(--shadow-sm));
}

.menu-search-submit-btn:disabled {
  background: var(--bg-muted);
  color: var(--text-light);
  cursor: not-allowed;
  box-shadow: none;
}

/* Simple labelled filter fields */
.filter-group {
  margin-bottom: 0;
}

.filter-group-label {
  display: block;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary-text);
  background: var(--primary-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.filter-group[hidden] {
  display: none;
}

.menu-chip-group {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-md);
  row-gap: var(--space-xs);
}

.menu-chip-btn {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.3rem 0.1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

.menu-chip-btn:not(.menu-chip-btn-row-start)::before {
  content: '|';
  position: absolute;
  left: calc(0px - var(--space-sm));
  transform: translateX(-50%);
  color: var(--text-light);
  font-weight: 400;
  pointer-events: none;
}

.menu-chip-btn:hover,
.menu-chip-btn:focus-visible {
  border-color: var(--primary-light);
  background: transparent;
  color: var(--primary-text);
  outline: none;
}

.menu-chip-btn-selected {
  border-color: var(--primary);
  background: transparent;
  color: var(--primary-text);
  font-weight: 700;
}

.menu-chip-btn-selected:hover,
.menu-chip-btn-selected:focus-visible {
  color: var(--primary-text);
  background: transparent;
}

.menu-chip-btn:disabled {
  border-color: transparent;
  color: var(--text-light);
  cursor: not-allowed;
  opacity: 0.55;
}

.filter-search-input {
  width: 100%;
  min-height: 46px;
  padding: 0.6rem 0.9rem;
  border: 1px solid rgba(107, 123, 141, 0.18);
  border-radius: var(--radius);
  background-color: var(--bg);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
}

.filter-search-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(78, 163, 211, 0.16);
}

.filter-advanced {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.filter-advanced-summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  list-style: none;
}

.filter-advanced-summary::-webkit-details-marker {
  display: none;
}

.filter-advanced-summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  transition: transform var(--duration) var(--ease);
}

.filter-advanced[open] .filter-advanced-summary::before {
  transform: rotate(90deg);
}

/* ── Individually editable criteria + results ────────────────────────── */
.menu-criteria-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-md);
  flex-wrap: wrap;
}

.menu-view-results .menu-criteria-bar {
  display: flex;
}

.menu-criteria-summary-text {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.menu-criteria-value-btn {
  padding: 0.2rem 0;
  border: 0;
  border-bottom: 1px solid var(--primary-light);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

.menu-criteria-value-btn:hover,
.menu-criteria-value-btn:focus-visible,
.menu-criteria-value-btn[aria-expanded="true"] {
  border-color: var(--primary);
  color: var(--primary-text);
  outline: none;
}

.menu-criteria-separator {
  color: var(--text-light);
}

.menu-criteria-editor {
  flex: 1 0 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.menu-criteria-editor[hidden] {
  display: none;
}

.menu-criteria-editor-label {
  margin: 0 0 var(--space-xs);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.menu-new-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-height: 32px;
  padding: 0.3rem 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

.menu-new-search-btn:hover,
.menu-new-search-btn:focus-visible {
  border-color: var(--primary);
  color: var(--primary-text);
  outline: none;
}

.dropdown-results {
  display: none;
}

.menu-view-results .dropdown-results {
  display: block;
}

.interventions-results-panel {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}

.results-empty-required {
  color: var(--text-secondary);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 600px) {
  .menu-criteria-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .menu-new-search-btn {
    width: 100%;
  }

  .menu-search-panel-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .menu-search-hint {
    order: -1;
  }
}

/* Flowchart page layout */
.flowchart-page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--nav-height));
}

.flowchart-page-body {
  flex: 1;
  width: 100%;
}

/* Step panel helpers */
.step-panel-prompt {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.step-panel-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

/* Subtest options wrapper */
.subtest-options-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* Pillar layout helpers */
.pillar-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.pillar-options-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Item type stacked list */
.item-type-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Results breadcrumb & summary */
.results-breadcrumb {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.step5-summary {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-lg);
}

/* Screener icon sizing within screener-option */
.screener-option .screener-icon {
  width: 20px;
  height: 20px;
  color: var(--primary-text);
}

/* Make screener-option a bit more substantial */
.screener-option {
  padding: var(--space-md) var(--space-lg);
  gap: var(--space-sm);
  font-size: 0.875rem;
}

/* Mobile tweaks for interventions page */
@media (max-width: 600px) {
  .interventions-page-body {
    padding: var(--space-md);
  }

  .resource-card-links { max-width: 86px; }
}

/* ====================================================================
   VISUAL PATHWAY MODAL (desktop, plus a compact landscape mobile layout)
   ==================================================================== */

  .layout-toggle-btn-visual .material-symbols-rounded {
    font-size: 17px;
  }

  #visual-flowchart-open-btn:focus-visible,
  .visual-flowchart-modal button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }

  body.visual-flowchart-modal-open {
    overflow: hidden;
  }

  .visual-flowchart-modal {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(8, 23, 40, 0.62);
    opacity: 0;
    transition: opacity 0.18s ease;
  }

  .visual-flowchart-modal-visible {
    opacity: 1;
  }

  /* Full screen is the default view: the dialog fills the viewport even when the
     browser refuses the Fullscreen API request. */
  .visual-flowchart-dialog {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--bg);
    box-shadow: 0 28px 80px rgba(5, 20, 37, 0.32);
    transform: translateY(10px) scale(0.99);
    transition: transform 0.18s ease;
  }

  .visual-flowchart-dialog:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: 0;
  }

  .visual-flowchart-modal-visible .visual-flowchart-dialog {
    transform: none;
  }

  .visual-flowchart-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 8px 22px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--step-bg), var(--bg) 64%);
  }

  /* Title and short description share a single row to keep the header short. */
  .visual-flowchart-header-text {
    display: flex;
    flex: 1 1 16rem;
    align-items: baseline;
    gap: 14px;
    min-width: 0;
  }

  .visual-flowchart-header h2 {
    flex: 0 0 auto;
    margin: 0;
    color: var(--text);
    font-size: 1.2rem;
    white-space: nowrap;
  }

  .visual-flowchart-header p {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.82rem;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .visual-flowchart-header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
  }

  /* Houses the standard/summary/visual view switcher plus the program and
     language mini selector, so both stay reachable from inside the modal
     (the "Your Decisions" panel underneath is made inert while it's open). */
  .visual-flowchart-header-controls {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 220px;
  }

  .visual-flowchart-header-controls .program-lang-mini {
    padding: 0.4rem 0.7rem;
    box-shadow: none;
  }

  .visual-flowchart-close,
  .visual-flowchart-fullscreen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
  }

  .visual-flowchart-fullscreen-btn .material-symbols-rounded {
    font-size: 19px;
  }

  .visual-flowchart-close svg {
    width: 17px;
    height: 17px;
  }

  /* Tier context bar directly under the header, e.g. "Tier ONE · Universal Classroom",
     with the tier toggle and the zoom controls on the right. */
  .visual-flowchart-tier-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 22px;
    border-bottom: 1px solid var(--border);
    background: var(--step-bg);
  }

  .visual-flowchart-tier-bar-info {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .visual-flowchart-tier-bar-info[hidden] {
    display: none;
  }

  .visual-flowchart-tier-bar-chip {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: var(--step);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .visual-flowchart-tier-bar-name {
    color: var(--step-text);
    font-size: 0.95rem;
    font-weight: 800;
  }

  .visual-flowchart-tier-bar-chip[data-tier="tier1"],
  .visual-flowchart-card[data-tier="tier1"],
  .visual-flowchart-tier-tabs .tier-tab[data-tier="tier1"] {
    --visual-tier-colour: #0ea8b2;
  }

  .visual-flowchart-dialog:has(.visual-flowchart-tier-bar-chip[data-tier="tier2"]) .visual-flowchart-viewport,
  .visual-flowchart-tier-bar-chip[data-tier="tier2"],
  .visual-flowchart-card[data-tier="tier2"],
  .visual-flowchart-tier-tabs .tier-tab[data-tier="tier2"] {
    --visual-tier-colour: #f9aa0e;
  }

  .visual-flowchart-dialog:has(.visual-flowchart-tier-bar-chip[data-tier="tier3"]) .visual-flowchart-viewport,
  .visual-flowchart-tier-bar-chip[data-tier="tier3"],
  .visual-flowchart-card[data-tier="tier3"],
  .visual-flowchart-tier-tabs .tier-tab[data-tier="tier3"] {
    --visual-tier-colour: #ed5d49;
  }

  .visual-flowchart-tier-bar-chip,
  .visual-flowchart-tier-tabs .tier-tab {
    background: var(--visual-tier-colour);
    color: #071e35;
    border-color: var(--visual-tier-colour);
  }

  .visual-flowchart-tier-tabs .tier-tab.active {
    outline: 2px solid #0c3259;
    outline-offset: 2px;
    font-weight: 800;
  }

  /* The tier toggle re-uses the same .tier-tab styling as the standard view,
     pushed to the right of the tier name/chip so both stay visible together. */
  .visual-flowchart-tier-tabs {
    margin-left: auto;
    margin-bottom: 0;
  }

  .visual-flowchart-toolbar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    padding-left: 14px;
    border-left: 1px solid var(--border);
  }

  .visual-flowchart-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
  }

  .visual-flowchart-toolbar button:hover {
    border-color: var(--step);
    background: var(--step-bg);
  }

  .visual-flowchart-toolbar .material-symbols-rounded {
    font-size: 18px;
  }

  #visual-flowchart-zoom-value {
    width: 44px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    text-align: center;
  }

  .visual-flowchart-viewport {
    grid-row: 3;
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
    background-color: #f4f8fa;
    background-image: radial-gradient(circle, rgba(12, 49, 90, 0.13) 1px, transparent 1px);
    background-size: 22px 22px;
  }

  .visual-flowchart-viewport.is-panning {
    cursor: grabbing;
  }

  .visual-flowchart-dialog:has(.visual-flowchart-tier-bar-chip[data-tier="tier2"]) .visual-flowchart-viewport,
  .visual-flowchart-dialog:has(.visual-flowchart-tier-bar-chip[data-tier="tier3"]) .visual-flowchart-viewport {
    background-color: color-mix(in srgb, var(--visual-tier-colour) 8%, white);
  }

  .visual-flowchart-viewport:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
  }

  .visual-flowchart-stage {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    transition: transform 0.12s ease-out;
  }

  .visual-flowchart-viewport.is-panning .visual-flowchart-stage {
    transition: none;
  }

  .visual-flowchart-lines {
    position: absolute;
    inset: 0;
    overflow: visible;
    pointer-events: none;
  }

  .visual-flowchart-lines marker path {
    fill: var(--step);
  }

  .visual-flowchart-lines #visual-arrow-selection path { fill: var(--info); }
  .visual-flowchart-lines #visual-arrow-effective path { fill: var(--effective); }
  .visual-flowchart-lines #visual-arrow-ineffective path { fill: var(--ineffective); }

  .visual-flowchart-connector {
    fill: none;
    stroke: var(--step);
    stroke-width: 4;
    stroke-linecap: round;
    opacity: 0;
    stroke-dasharray: 12 8;
    animation: visual-route-draw 0.55s ease forwards;
  }

  .visual-flowchart-connector-selection { stroke: var(--info); }
  .visual-flowchart-connector-effective { stroke: var(--effective); }
  .visual-flowchart-connector-ineffective { stroke: var(--ineffective); }

  .visual-flowchart-card {
    position: absolute;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 5px;
    width: 260px;
    min-height: 150px;
    max-height: var(--visual-card-max-height, 480px);
    padding: 14px;
    border: 2px solid var(--step);
    border-radius: 18px;
    background: var(--step-bg);
    color: var(--text);
    font: inherit;
    text-align: left;
    /* Tier identity stays outside; the fill and border retain the card's meaning. */
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--visual-tier-colour) 20%, transparent),
                0 0 24px color-mix(in srgb, var(--visual-tier-colour) 35%, transparent);
    opacity: 0;
    transform: translateY(15px);
    overflow-y: auto;
    touch-action: pan-y;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    animation: visual-card-reveal 0.38s var(--ease) forwards;
  }

  button.visual-flowchart-card {
    cursor: pointer;
  }

  .visual-flowchart-card::-webkit-scrollbar {
    width: 6px;
  }

  .visual-flowchart-card::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
  }

  button.visual-flowchart-card:hover {
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--visual-tier-colour) 30%, transparent),
                0 0 32px color-mix(in srgb, var(--visual-tier-colour) 45%, transparent);
    transform: translateY(-2px);
  }

  .visual-flowchart-card-selection {
    border-color: var(--info);
    background: var(--info-light);
  }

  .visual-flowchart-card-effective {
    border-color: var(--effective);
    background: var(--effective-bg);
  }

  .visual-flowchart-card-ineffective {
    border-color: var(--ineffective);
    background: var(--ineffective-bg);
  }

  .visual-flowchart-card-current {
    border-width: 3px;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--visual-tier-colour) 30%, transparent),
                0 0 32px color-mix(in srgb, var(--visual-tier-colour) 45%, transparent);
  }

  /* Interstitial "review this tier, then continue" card shown in the visual
     pathway after a tier's last step, before it collapses into the next tier. */
  .visual-flowchart-card-tier-review {
    align-items: start;
  }

  .visual-flowchart-tier-review-btn {
    align-self: start;
    margin-top: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--step);
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(12, 49, 90, 0.18);
  }

  .visual-flowchart-tier-review-btn:hover {
    filter: brightness(1.05);
  }

  .visual-flowchart-card-interactive {
    width: 360px;
    /* The live/interactive step (checklists, drill-down assessment and
       intervention wizards) is exempt from the shared reference-card height
       cap: its content is shown in full and the canvas zooms out to fit it
       instead, rather than shrinking the card and forcing it to scroll. */
    max-height: none;
  }

  /* Step 1 of each tier is usually the most text-heavy card (principles,
     definitions, etc.), so give it extra breathing room for easier reading. */
  .visual-flowchart-card-wide {
    width: 340px;
    min-height: 210px;
  }

  /* Tier 2 / Tier 3 step 1 (long entry information) stays a single column;
     the card is widened in JS just enough for it to fit the viewport height
     at 100% zoom, so the step content must be allowed to fill that width. */
  .visual-flowchart-card-fit-height .visual-flowchart-active-host .flowchart-step {
    max-width: none;
  }

  .visual-flowchart-card-collapsed {
    align-items: center;
    min-height: 90px;
    opacity: 0.9;
  }

  .visual-flowchart-card-collapsed:hover {
    opacity: 1;
  }

  .visual-flowchart-individual-group {
    position: absolute;
  }

  .visual-flowchart-individual-group > .visual-flowchart-card {
    position: relative;
    width: 100%;
  }

  .visual-flowchart-individual-review {
    position: absolute;
    top: 100%;
    left: -12px;
    right: -12px;
    z-index: 1;
    display: grid;
    gap: 12px;
    max-height: var(--individual-review-height, 400px);
    padding: 12px;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .visual-flowchart-individual-review > .visual-flowchart-card {
    position: relative;
    width: 100%;
    max-height: none;
    overflow: clip;
  }

  .visual-flowchart-individual-review[hidden] {
    display: none;
  }

  .visual-flowchart-individual-hint {
    display: grid;
  }

  .visual-flowchart-individual-hint > span {
    grid-area: 1 / 1;
  }

  .visual-flowchart-individual-group [aria-expanded="false"] .visual-flowchart-individual-collapse,
  .visual-flowchart-individual-group [aria-expanded="true"] .visual-flowchart-individual-expand {
    visibility: hidden;
  }

  /* The last card labels the same collapse action available on every tier card. */
  .visual-flowchart-collapse-tier {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    margin-top: 0.5rem;
    border: 1px solid var(--visual-tier-colour);
    border-radius: var(--radius-pill);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .visual-flowchart-collapse-tier .material-symbols-rounded {
    font-size: 16px;
  }

  .visual-flowchart-step-number {
    justify-self: start;
    align-self: start;
    color: var(--step-text);
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }

  .visual-flowchart-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--step-text);
  }

  .visual-flowchart-card-icon svg {
    width: 18px;
    height: 18px;
  }

  .visual-flowchart-card-icon .material-symbols-rounded {
    font-size: 19px;
  }

  .visual-flowchart-card-header {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .visual-flowchart-card-header:has(~ .visual-flowchart-active-host, + .visual-flowchart-card-copy > *) {
    margin: -14px -14px 0;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-muted);
  }

  .visual-flowchart-card-header:has(~ .visual-flowchart-active-host, + .visual-flowchart-card-copy > *) strong {
    color: var(--text-secondary);
    font-size: 0.85rem;
  }

  .visual-flowchart-card-header .visual-flowchart-card-icon {
    align-self: start;
    width: 28px;
    height: 28px;
  }

  .visual-flowchart-card-heading,
  .visual-flowchart-card-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
  }

  .visual-flowchart-card:has(> .visual-flowchart-card-header) {
    align-content: start;
  }

  .visual-flowchart-card-header + .visual-flowchart-card-copy {
    grid-column: 1 / -1;
    gap: 8px;
  }

  .visual-flowchart-card-header + .visual-flowchart-card-copy:not(:has(> *)) {
    display: none;
  }

  .visual-flowchart-card-header + .visual-flowchart-card-copy:has(> *) {
    padding-top: 8px;
  }

  .visual-flowchart-card-meta {
    color: var(--text-secondary);
    font-size: 0.64rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .visual-flowchart-card-copy strong,
  .visual-flowchart-card-heading strong {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.3;
  }

  .visual-flowchart-card-answer {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1.35;
  }

  .visual-flowchart-card-header + .visual-flowchart-card-copy > .visual-flowchart-card-answer {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.45;
  }

  .visual-flowchart-individual-heading {
    margin: 0.5rem 0;
    color: var(--text);
    font-size: 1.15rem;
    line-height: 1.3;
  }

  .visual-flowchart-active-host {
    grid-column: 1 / -1;
    min-width: 0;
    margin: 0 -8px -8px;
  }

  .visual-flowchart-active-host .flowchart-step {
    width: 100%;
    margin: 0;
    padding: 16px 8px 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .visual-flowchart-active-host .step-header {
    display: none;
  }

  .visual-flowchart-active-host .flowchart-step[data-node-id="tier1-percentage"] {
    padding-top: 12px;
  }

  .flowchart-step[data-node-id="tier1-percentage"] .step-content {
    padding-top: 0;
  }

  .flowchart-step[data-node-id="tier1-percentage"] .step-content > h3 {
    margin-bottom: var(--space-lg);
  }

  .visual-flowchart-active-host .decision-grid,
  .visual-flowchart-active-host .screener-selection-grid {
    grid-template-columns: 1fr;
  }

  .visual-flowchart-active-host .flowchart-step[data-node-id="tier1-effectiveness"] .decision-btn,
  .visual-flowchart-active-host .flowchart-step[data-node-id="tier2-progress"] .decision-btn,
  .visual-flowchart-active-host .flowchart-step[data-node-id="tier2-cycle2-progress"] .decision-btn,
  .visual-flowchart-active-host .flowchart-step[data-node-id="tier3-progress"] .decision-btn {
    padding-block: 0.75rem;
  }

  .visual-flowchart-active-host .flowchart-step[data-node-id="tier1-effectiveness"] .decision-content span,
  .visual-flowchart-active-host .flowchart-step[data-node-id="tier2-progress"] .decision-content span,
  .visual-flowchart-active-host .flowchart-step[data-node-id="tier2-cycle2-progress"] .decision-content span,
  .visual-flowchart-active-host .flowchart-step[data-node-id="tier3-progress"] .decision-content span {
    line-height: 1.2;
  }

  @keyframes visual-route-draw {
    from { opacity: 0; stroke-dashoffset: 38; }
    to { opacity: 1; stroke-dashoffset: 0; }
  }

  @keyframes visual-card-reveal {
    to { opacity: 1; transform: none; }
  }

  .visual-flowchart-tier-bar {
    position: relative;
    z-index: 2;
  }

  /* ---------- Mobile visual pathway (always landscape) ----------
     JS sets --vf-screen-w/--vf-screen-h to the window size. On phones held
     upright (where the screen orientation can't be locked) the dialog is
     rotated a quarter turn so the pathway is still shown in landscape. */
  .visual-flowchart-mobile .visual-flowchart-dialog {
    width: var(--vf-screen-w, 100vw);
    height: var(--vf-screen-h, 100vh);
  }

  .visual-flowchart-modal.visual-flowchart-rotated .visual-flowchart-dialog {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--vf-screen-h, 100vh);
    height: var(--vf-screen-w, 100vw);
    transform-origin: top left;
    transform: translateX(var(--vf-screen-w, 100vw)) rotate(90deg);
    transition: none;
  }

  /* When controls are tucked away, the canvas takes both header rows. */
  .visual-flowchart-chrome {
    display: contents;
  }

  .visual-flowchart-drawer-toggle,
  .visual-flowchart-drawer-scrim {
    display: none;
  }

  .visual-flowchart-compact-controls .visual-flowchart-controls-toggle {
    display: none;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-viewport {
    position: absolute;
    inset: 0;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-drawer-toggle {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg);
    color: var(--step-text);
    box-shadow: var(--shadow-md, 0 4px 14px rgba(5, 20, 37, 0.18));
    cursor: pointer;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-drawer-toggle .material-symbols-rounded {
    font-size: 22px;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-drawer-scrim {
    position: absolute;
    inset: 0;
    z-index: 7;
    display: block;
    background: rgba(8, 23, 40, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  .visual-flowchart-overlay-controls.visual-flowchart-drawer-open .visual-flowchart-drawer-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-chrome {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    width: min(340px, 88%);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    box-shadow: 8px 0 28px rgba(5, 20, 37, 0.24);
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }

  .visual-flowchart-overlay-controls.visual-flowchart-drawer-open .visual-flowchart-chrome {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-header {
    position: relative;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-header-text {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-header h2 {
    font-size: 1.05rem;
    white-space: normal;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-header p {
    white-space: normal;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-header-controls {
    justify-content: flex-start;
    min-width: 0;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-header-actions {
    flex-wrap: wrap;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-tier-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 0;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-tier-bar-info {
    flex-wrap: wrap;
    gap: 8px 10px;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-tier-tabs {
    margin-left: 0;
  }

  .visual-flowchart-overlay-controls .visual-flowchart-toolbar {
    margin-left: 0;
    padding-top: 12px;
    padding-left: 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  /* In the drawer the guidance opens inline, below its button. */
  .visual-flowchart-overlay-controls .tier1-guidance {
    flex-basis: 100%;
  }

  .visual-flowchart-overlay-controls .tier1-guidance-popup.tier1-success-sidebar {
    position: static;
    width: auto;
    max-height: none;
    margin-top: 8px;
    padding: var(--space-sm) var(--space-md) var(--space-md);
    box-shadow: none;
  }

  @media (prefers-reduced-motion: reduce) {
    .visual-flowchart-modal,
    .visual-flowchart-dialog,
    .visual-flowchart-stage,
    .visual-flowchart-connector,
    .visual-flowchart-card {
      transition: none;
      animation: none;
      opacity: 1;
      transform: none;
    }
  }

/* ============================================
   GO TO TIER TRANSITION STEP
   ============================================ */
.go-to-tier-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  padding: var(--space-xl) var(--space-lg);
  background: var(--bg);
  border-radius: var(--radius-lg, var(--radius));
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.go-to-tier-step.go-to-tier-visible {
  opacity: 1;
  transform: translateY(0);
}

.go-to-tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--tier-color, var(--primary));
}

.go-to-tier-heading {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--tier-color, var(--text));
  margin: 0;
}

.go-to-tier-sub {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.go-to-tier-note {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

.go-to-tier-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-sm);
  background: var(--tier-color, var(--primary));
  color: var(--text-on-primary);
  border-color: var(--tier-color, var(--primary));
  cursor: pointer;
}

.go-to-tier-1 { --tier-color: var(--tier-1); }
.go-to-tier-2 { --tier-color: var(--tier-2); }
.go-to-tier-3 { --tier-color: var(--tier-3); }

/* ============================================
   ACTIVE TIER COLOUR INDICATOR
   ============================================ */
.integrated-flowchart.flowchart-tier-1 { --tier-color: var(--tier-1); --tier-bg: var(--tier-1-bg); }
.integrated-flowchart.flowchart-tier-2 { --tier-color: var(--tier-2); --tier-bg: var(--tier-2-bg); }
.integrated-flowchart.flowchart-tier-3 { --tier-color: var(--tier-3); --tier-bg: var(--tier-3-bg); }

.integrated-flowchart.flowchart-tier-1,
.integrated-flowchart.flowchart-tier-2,
.integrated-flowchart.flowchart-tier-3 {
  border-top: 4px solid var(--tier-color);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--tier-bg) 0%, transparent 140px);
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}

.integrated-flowchart.flowchart-tier-1 .flowchart-title-bar h2,
.integrated-flowchart.flowchart-tier-2 .flowchart-title-bar h2,
.integrated-flowchart.flowchart-tier-3 .flowchart-title-bar h2 {
  color: var(--tier-color);
}

.integrated-flowchart.flowchart-tier-1 .step-indicator,
.integrated-flowchart.flowchart-tier-2 .step-indicator,
.integrated-flowchart.flowchart-tier-3 .step-indicator {
  color: var(--tier-color);
  font-weight: 700;
}

/* ============================================================
   JOURNEY TRAIL & DECISION SUMMARY PANEL
   ------------------------------------------------------------
   The flowchart is a two-column experience: the current active
   step fills the left, while a persistent Decision Summary
   panel builds on the right — every answer recorded as a
   rich card so the complete pathway is always visible.
   ============================================================ */

.journey-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-lg) 0;
}

/* Small, sleek program/language selector shown beside the flowchart. */
.program-lang-mini {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem 0.85rem;
}

.program-lang-mini-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
}

.program-lang-mini-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-light);
  white-space: nowrap;
}

.program-lang-mini-select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.3rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.program-lang-mini-select:hover,
.program-lang-mini-select:focus-visible {
  border-color: var(--primary);
  outline: none;
}

/* Tier 1 "effective or ineffective?" guidance: a button that opens the
   guidance as a popup, used in the summary view header and the visual
   pathway's tier bar. */
.tier1-guidance {
  position: relative;
  flex: 0 0 auto;
}

.tier1-guidance-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--step-text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.tier1-guidance-btn .material-symbols-rounded {
  font-size: 18px;
  color: var(--tier-1, #5eb892);
}

.tier1-guidance-btn:hover,
.tier1-guidance-btn[aria-expanded="true"] {
  border-color: var(--step);
  background: var(--step-bg);
}

.tier1-guidance-btn:focus-visible,
.tier1-guidance-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.tier1-guidance-popup.tier1-success-sidebar {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  width: min(380px, 90vw);
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  text-align: left;
}

.tier1-guidance-popup[hidden] {
  display: none;
}

.tier1-guidance-popup .tier1-success-sidebar-head h3 {
  flex: 1 1 auto;
  font-size: 1.05rem;
}

.tier1-guidance-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
}

.tier1-guidance-close svg {
  width: 15px;
  height: 15px;
}

/* Summary view: the guidance button sits at the right of the sticky header,
   alongside the screener indicator. */
.flowchart-glass-header-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-xs);
  justify-self: end;
  min-width: 0;
}

.tier1-success-sidebar {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-lg);
}

.tier1-success-sidebar-head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.tier1-success-sidebar-icon {
  font-size: 1.5rem;
  color: var(--tier-1, #5eb892);
  line-height: 1;
}

.tier1-success-sidebar h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
}

.tier1-success-sidebar-block + .tier1-success-sidebar-block {
  margin-top: 0.85rem;
}

.tier1-success-sidebar-label {
  margin: 0 0 0.3rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
}

.tier1-success-sidebar-indicators {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.tier1-success-sidebar-block p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.tier1-success-sidebar-note {
  margin-top: 0.5rem !important;
  font-weight: 600;
}

.tier1-indicator-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.tier1-indicator-blue { background: #3b82f6; }
.tier1-indicator-green { background: #16a34a; }
.tier1-indicator-yellow { background: #facc15; }
.tier1-indicator-red { background: #ef4444; }

/* ---------- Decision Summary Panel — central full-width card ---------- */
.journey-map {
  position: static;
  top: auto;
  width: 100%;
  max-width: 760px;
  max-height: none;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow-x: hidden;
  overflow-y: visible;
  padding-bottom: var(--space-md);
}

.journey-map-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1rem var(--space-lg);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: var(--space-sm);
}

.journey-map-head-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: start;
  min-width: 0;
}

.layout-toggle-group {
  justify-self: center;
}

.journey-map-head-icon {
  width: 16px;
  height: 16px;
  color: var(--tier-color, var(--step));
  flex-shrink: 0;
}

.journey-map-title {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tier-color, var(--step));
}

.journey-map-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
  flex-shrink: 0;
  justify-self: end;
}

.journey-map-bar {
  flex-shrink: 0;
  height: 3px;
  background: var(--bg-muted);
  overflow: hidden;
}

.journey-map-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--tier-color, var(--step));
  transition: width 0.5s var(--ease);
}

.journey-map-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  min-width: 0;
  overflow-y: visible;
  overscroll-behavior: contain;
}

/* ---- Each decision entry ---- */
.journey-map-item {
  position: relative;
  display: flex;
  gap: 0.9rem;
  padding: 0.95rem var(--space-lg);
  border-bottom: 1px solid var(--border);
  transition: background var(--duration) var(--ease);
  animation: smEntryIn 0.28s var(--ease) both;
}

.journey-map-item:last-child { border-bottom: none; }

/* Remove old connector-line pseudo-element */
.journey-map-item::before { display: none; }

@keyframes smEntryIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: none; }
}

/* Step number marker circle */
.journey-map-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text-light);
  margin-top: 2px;
}
.journey-map-marker svg { width: 13px; height: 13px; }

.journey-map-done .journey-map-marker {
  background: var(--tier-color, var(--step));
  border-color: var(--tier-color, var(--step));
  color: #fff;
}

.journey-map-current .journey-map-marker {
  background: var(--bg);
  border-color: var(--tier-color, var(--step));
  color: var(--tier-color, var(--step));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tier-color, var(--step)) 18%, transparent);
  animation: smMarkerPulse 2s ease-in-out infinite;
}

@keyframes smMarkerPulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tier-color, var(--step)) 18%, transparent); }
  50%       { box-shadow: 0 0 0 9px color-mix(in srgb, var(--tier-color, var(--step)) 7%, transparent); }
}

.journey-map-upcoming { opacity: 0.5; }
.journey-map-upcoming .journey-map-marker { border-style: dashed; }

/* Text content column */
.journey-map-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

/* Step-number + type chip row */
.journey-map-step-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.journey-map-step-num {
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-light);
}

.journey-map-type-chip {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tier-color, var(--step));
  padding: 1px 7px;
  background: color-mix(in srgb, var(--tier-color, var(--step)) 10%, transparent);
  border-radius: var(--radius-pill);
}

/* Question / step title */
.journey-map-label {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.journey-map-current .journey-map-label {
  color: var(--tier-color, var(--step));
  font-weight: 700;
}

/* ⭐ The answer — the star of the summary panel */
.journey-map-answer {
  display: inline-flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--tier-color, var(--step));
  line-height: 1.3;
  padding: 3px 9px 3px 5px;
  background: color-mix(in srgb, var(--tier-color, var(--step)) 9%, transparent);
  border-radius: var(--radius-sm);
  margin-top: 3px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  border-left: 3px solid var(--tier-color, var(--step));
}
.journey-map-answer svg {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  margin-top: 3px;
  color: var(--tier-color, var(--step));
}

/* "In progress" indicator */
.journey-map-now {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tier-color, var(--step));
  margin-top: 2px;
}

.journey-map-now-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tier-color, var(--step));
  flex-shrink: 0;
  animation: smNowPulse 1.6s ease-in-out infinite;
}

@keyframes smNowPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.6); }
}

/* Revisit on hover */
.journey-map-done[role="button"] { cursor: pointer; }
.journey-map-done[role="button"]:hover {
  background: color-mix(in srgb, var(--tier-color, var(--step)) 5%, var(--bg-alt));
}
.journey-map-done[role="button"]:focus-visible {
  outline: 2px solid var(--tier-color, var(--step));
  outline-offset: -2px;
}

/* "Back one step" button inside the panel */
.journey-map-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: var(--space-md) var(--space-lg);
  padding: 0.45rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
  align-self: flex-start;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.journey-map-back svg { width: 15px; height: 15px; }
.journey-map-back:hover { background: var(--border); color: var(--text); }

/* ---- Colour coding for completed steps ----
   Mirrors the journey summary bubbles (.anim-step-bubble / .anim-bubble-*)
   so a step is coded the same way in both views. */
.journey-map-item.journey-map-type-checklist {
  background: var(--step-checklist-bg);
  --tier-color: var(--step-checklist);
}
.journey-map-item.journey-map-type-selection {
  background: var(--step-selection-bg);
  --tier-color: var(--step-selection);
}
.journey-map-item.journey-map-type-decision {
  background: var(--step-decision-bg);
  --tier-color: var(--step-decision);
}
.journey-map-item.journey-map-type-info {
  background: var(--step-info-bg);
  --tier-color: var(--step-info);
}

.journey-map-item.journey-map-variant-step1 {
  background: var(--step-bg);
  --tier-color: var(--step);
}
.journey-map-item.journey-map-variant-selection {
  background: var(--info-light);
  --tier-color: var(--info-text);
}
.journey-map-item.journey-map-variant-effective {
  background: var(--effective-bg);
  --tier-color: var(--effective-text);
}
.journey-map-item.journey-map-variant-ineffective {
  background: var(--ineffective-bg);
  --tier-color: var(--ineffective-text);
}

.journey-map-item.journey-map-done[role="button"]:hover {
  background: color-mix(in srgb, var(--tier-color, var(--step)) 12%, var(--bg));
}

/* ---------- The active step opens inside its own row ----------
   Step 1 happens entirely inside the Step 1 row, then Step 2 opens
   below it, and so on — there is no separate working area. */
.journey-map-item.journey-map-current {
  background: color-mix(in srgb, var(--tier-color, var(--step)) 4%, var(--bg));
}

.journey-step-slot {
  display: block;
  margin-top: 0.65rem;
}

.journey-step-slot .flowchart-step {
  min-width: 0;
  max-width: none;
  width: 100%;
  background: transparent;
  border: none;
  border-left: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  opacity: 1;
}

/* The row itself already names the step, so the card header is redundant */
.journey-step-slot .step-header { display: none; }

.journey-step-slot .step-content { padding: 0; }

.journey-step-slot .step-content h3,
.journey-step-slot .individual-outcome .individual-recommendation {
  font-size: 0.95rem;
  font-weight: 700;
}

.journey-step-slot .step-content > p {
  font-size: 0.84rem;
  margin-bottom: 0.7rem;
}

.journey-step-slot .flowchart-step.carousel-enter-forward {
  animation: journeyStepOpen 0.32s var(--ease) forwards;
}
.journey-step-slot .flowchart-step.carousel-enter-back {
  animation: journeyStepOpenBack 0.32s var(--ease) forwards;
}

@keyframes journeyStepOpen {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes journeyStepOpenBack {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .journey-step-slot .flowchart-step.carousel-enter-forward,
  .journey-step-slot .flowchart-step.carousel-enter-back { animation: none; opacity: 1; }
}

/* ================================================================
   PANEL-STYLE OVERRIDES — all interactive step elements inside the
   Your Decisions panel adopt its compact, sleek visual language.
   ================================================================ */

/* Decision buttons: compact pills instead of large cards */
.journey-step-slot .decision-grid,
.journey-step-slot .decision-buttons {
  gap: var(--space-xs);
}

.journey-step-slot .decision-btn {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  border-width: 1.5px;
  font-size: 0.84rem;
  gap: var(--space-xs);
}

.journey-step-slot .decision-icon { display: none; }

.journey-step-slot .decision-content strong,
.journey-step-slot .decision-content h4 {
  font-size: 0.84rem;
}

.journey-step-slot .decision-content span,
.journey-step-slot .decision-content p {
  font-size: 0.72rem;
}

/* Selection options: reduced padding and border weight */
.journey-step-slot .selection-option {
  padding: 0.55rem 0.8rem;
  border-width: 1.5px;
  gap: var(--space-sm);
}

.journey-step-slot .option-details h4,
.journey-step-slot .option-details strong {
  font-size: 0.88rem;
}

.journey-step-slot .option-icon { display: none; }

/* Continue / Go-to-Tier buttons */
.journey-step-slot .continue-btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  margin-top: var(--space-sm);
}

/* Action buttons on endpoint cards */
.journey-step-slot .action-btn,
.journey-step-slot .endpoint-actions .action-btn {
  font-size: 0.8rem;
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius);
}

/* Go-to-Tier transition screen: compact, matching panel scale */
.journey-step-slot .go-to-tier-step {
  padding: var(--space-lg) var(--space-md);
  gap: var(--space-xs);
  border: none;
  box-shadow: none;
  background: transparent;
}

.journey-step-slot .go-to-tier-heading {
  font-size: 1.25rem;
}

.journey-step-slot .go-to-tier-sub {
  font-size: 0.9rem;
}

.journey-step-slot .go-to-tier-note {
  font-size: 0.82rem;
}

.journey-step-slot .go-to-tier-btn {
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  margin-top: 0;
}

/* Endpoint card inside the panel */
.journey-step-slot .endpoint-card {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
}

.journey-step-slot .endpoint-card h2 {
  font-size: 1.05rem;
}

.journey-step-slot .endpoint-icon svg {
  width: 20px;
  height: 20px;
}

/* ----------------------------------------------------------------
   Completed step view — shown when a step stays open after being
   answered (replaces the interactive controls with a locked receipt).
   ---------------------------------------------------------------- */
.journey-step-slot-done {
  margin-top: 0.35rem;
}

.completed-step-view {
  margin-top: 0.1rem;
}

.completed-step-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
  line-height: 1.4;
}

/* Completed decision grid: pointer-events off, non-taken options dimmed */
.completed-grid {
  pointer-events: none;
  user-select: none;
  gap: var(--space-xs);
}

.completed-grid .decision-btn {
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  border-width: 1.5px;
  font-size: 0.82rem;
  cursor: default;
}

.completed-grid .decision-content strong,
.completed-grid .decision-content h4 { font-size: 0.82rem; }

.completed-grid .decision-content span,
.completed-grid .decision-content p  { font-size: 0.7rem; }

.decision-btn.decision-not-taken {
  opacity: 0.22;
}

/* Re-use the panel's answer chip style for selection/checklist answers */
.completed-step-answer {
  display: inline-flex;
}

/* ---------- The trail (only used for tier-transition & summary screens) ---------- */
.journey-track {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

.journey-track:empty {
  border-top: none;
  padding-top: 0;
}

.trail-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: var(--space-md);
  align-items: stretch;
}

.trail-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 42px;
}

.trail-line {
  width: 2px;
  flex: 1 1 auto;
  min-height: 10px;
  background: linear-gradient(180deg, var(--border), var(--border));
}
.trail-line-top { min-height: 6px; }
.trail-item:first-child .trail-line-top { opacity: 0; }
.trail-item:last-child .trail-line-bottom { opacity: 0; }

.trail-item-done .trail-line { background: var(--tier-color, var(--step)); opacity: 0.4; }
.trail-item-active .trail-line-top { background: var(--tier-color, var(--step)); opacity: 0.4; }
.trail-item-upcoming .trail-line { background: repeating-linear-gradient(180deg, var(--border) 0 5px, transparent 5px 10px); }

.trail-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: 2px 0;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 800;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text-light);
}
.trail-marker svg { width: 16px; height: 16px; }

.trail-marker-done {
  background: var(--tier-color, var(--step));
  border-color: var(--tier-color, var(--step));
  color: #fff;
}

.trail-marker-active {
  background: var(--tier-color, var(--step));
  border-color: var(--tier-color, var(--step));
  color: #fff;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--tier-color, var(--step)) 16%, transparent);
  animation: trailMarkerPulse 2.4s var(--ease) infinite;
}

.trail-marker-upcoming { border-style: dashed; background: var(--bg-alt); }

@keyframes trailMarkerPulse {
  0%, 100% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--tier-color, var(--step)) 16%, transparent); }
  50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--tier-color, var(--step)) 6%, transparent); }
}

/* Completed step — compact, still fully readable, click to revisit */
.trail-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin-bottom: var(--space-sm);
  padding: 0.7rem 0.95rem;
  text-align: left;
  font: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--tier-color, var(--step));
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              opacity var(--duration) var(--ease);
}

.trail-card-done {
  cursor: pointer;
  opacity: 0.8;
  animation: trailCardSettle 0.35s var(--ease) both;
}
.trail-card-done:hover {
  opacity: 1;
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}
.trail-card-done:focus-visible {
  outline: 2px solid var(--tier-color, var(--step));
  outline-offset: 2px;
}

@keyframes trailCardSettle {
  from { opacity: 0; transform: translateY(-6px) scale(0.99); }
  to { opacity: 0.8; transform: none; }
}

.trail-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
}

.trail-card-type {
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--step-bg);
  color: var(--step-text);
  letter-spacing: 0.06em;
}

.trail-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.trail-card-answer {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--effective-text);
}
.trail-card-answer svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--effective); }

.trail-card-revisit {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--tier-color, var(--step));
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}
.trail-card-done:hover .trail-card-revisit,
.trail-card-done:focus-visible .trail-card-revisit { opacity: 1; }

/* Upcoming ghost card so the next move is always previewed */
.trail-card-upcoming {
  border-style: dashed;
  border-left-style: dashed;
  border-left-color: var(--border);
  background: var(--bg-alt);
  opacity: 0.75;
  box-shadow: none;
}
.trail-card-upcoming .trail-card-title { color: var(--text-secondary); }
.trail-card-next {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
}

/* ---------- Spotlighted active step (full width inside the panel) ---------- */
.trail-item-active {
  display: flex;
  flex-direction: column;
  padding: 0 var(--space-lg);
}

.trail-active-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.trail-active-flag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-on-primary, #fff);
  background: var(--tier-color, var(--step));
  box-shadow: var(--shadow-xs);
  margin-bottom: 0.5rem;
}

.trail-active-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: trailFlagPulse 1.8s var(--ease) infinite;
}

@keyframes trailFlagPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

.trail-item-active .flowchart-step {
  max-width: none;
  opacity: 1;
  border-width: 2px;
  border-color: var(--tier-color, var(--step));
  box-shadow: 0 10px 30px -14px color-mix(in srgb, var(--tier-color, var(--step)) 55%, transparent),
              var(--shadow-md);
}

.trail-item-active .flowchart-step.carousel-enter-forward {
  animation: trailStepIn 0.38s var(--ease) forwards;
}
.trail-item-active .flowchart-step.carousel-enter-back {
  animation: trailStepInBack 0.38s var(--ease) forwards;
}

@keyframes trailStepIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes trailStepInBack {
  from { opacity: 0; transform: translateY(-14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* Endpoint / summary cards sit directly in the track */
.journey-track > .journey-review,
.journey-track > .go-to-tier-step { margin-left: 0; }

/* ---------- Responsive: narrow screens ---------- */
@media (max-width: 1260px) {
  .journey-map {
    border-radius: var(--radius);
  }

  .journey-map-head {
    padding: 0.85rem var(--space-md);
  }

  .journey-map-item {
    padding: 0.85rem var(--space-md);
  }

  .trail-item-active {
    padding: 0 var(--space-md);
  }

  .journey-map-back {
    margin: var(--space-sm) var(--space-md);
  }
}

@media (prefers-reduced-motion: reduce) {
  .trail-active-pulse,
  .journey-map-now-dot,
  .journey-map-current .journey-map-marker { animation: none; }
  .trail-card-done { animation: none; opacity: 0.85; }
  .journey-map-item { animation: none; opacity: 1; }
  .trail-item-active .flowchart-step.carousel-enter-forward,
  .trail-item-active .flowchart-step.carousel-enter-back { animation: none; opacity: 1; }
}

/* ============================================
   SCREENER PILL BUTTONS — compact 2-column grid
   ============================================ */
.screener-pill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

@media (max-width: 440px) {
  .screener-pill-grid { grid-template-columns: 1fr; }
}

.screener-pill-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0.55rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  transition: all var(--duration) var(--ease);
  font-family: inherit;
}

.screener-pill-btn:hover {
  border-color: var(--primary-light);
  background: var(--primary-faint);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.screener-pill-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.screener-pill-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.screener-pill-btn.screener-pill-selected {
  border-color: var(--primary);
  background: var(--primary-faint);
  box-shadow: 0 0 0 2px var(--primary);
  pointer-events: none;
}

.screener-pill-btn.screener-pill-selected .screener-pill-name {
  color: var(--primary-text);
}

.screener-pill-btn.screener-pill-other {
  opacity: 0.35;
  pointer-events: none;
}

.visual-flowchart-tier-review-btn {
  border-radius: var(--radius);
}

/* ============================================
   COMPLETED SCREENER GRID — shown after selection
   ============================================ */
.completed-screener-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  pointer-events: none;
  user-select: none;
  margin-top: 0.3rem;
}

@media (max-width: 440px) {
  .completed-screener-grid { grid-template-columns: 1fr; }
}

.completed-screener-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0.4rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

.completed-screener-taken {
  border-color: var(--primary);
  background: var(--primary-faint);
  color: var(--primary-text);
}

.completed-screener-check {
  width: 13px;
  height: 13px;
  color: var(--primary-text);
  flex-shrink: 0;
}

.completed-screener-other {
  opacity: 0.22;
  color: var(--text-secondary);
}

/* ============================================
   COMPLETED CHECKLIST — full items checked
   ============================================ */
.completed-checklist {
  list-style: none;
  padding: 0;
  margin: 0.3rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.completed-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.completed-checklist-item svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--success, #22c55e);
  stroke: var(--success, #22c55e);
}

/* ============================================
   FILE PATHWAY BREADCRUMB — drill-down selections
   ============================================ */
.step-pathway {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px 4px;
  font-size: 0.76rem;
  line-height: 1.35;
  margin-top: 0.3rem;
}

.step-pathway-sep {
  color: var(--text-light);
  font-size: 0.7rem;
}

.step-pathway-item {
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-muted);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.step-pathway-final {
  background: var(--primary-faint);
  color: var(--primary-text);
  font-weight: 700;
}

/* ============================================
   GO-TO-TIER button — override continue-btn grey
   ============================================ */
.go-to-tier-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-sm);
  background: var(--tier-color, var(--primary));
  color: var(--text-on-primary);
  border-color: var(--tier-color, var(--primary));
  cursor: pointer !important;
  opacity: 1 !important;
}

.go-to-tier-btn:hover,
.action-btn.go-to-tier-btn:hover {
  background: color-mix(in srgb, var(--tier-color, var(--primary)) 85%, #000 15%);
  border-color: color-mix(in srgb, var(--tier-color, var(--primary)) 85%, #000 15%);
  color: var(--text-on-primary);
}

/* journey-step-slot override for go-to-tier-btn */
.journey-step-slot .go-to-tier-btn {
  font-size: 0.82rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  margin-top: 0;
}

/* Literacy pillar contextual help */
.pillar-dialog-body > p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.pillar-help-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.pillar-help-button {
  min-height: 44px;
  padding: 0.5rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--primary-text);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.pillar-help-button:hover { background: var(--primary-faint); }
.pillar-help-button:focus-visible,
.pillar-definition > summary:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

.pillar-definition > summary {
  min-height: 48px;
  padding: 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-text);
}

.pillar-definition > p {
  font-size: 1rem;
  line-height: 1.7;
  padding-bottom: 1rem;
}

.literacy-pillars-dialog {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(560px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.literacy-pillars-dialog[open] { display: flex; flex-direction: column; }
.literacy-pillars-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
body:has(.literacy-pillars-dialog[open]) { overflow: hidden; }
.pillar-dialog-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  flex-shrink: 0;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.pillar-dialog-header h2 { font-size: 1.3rem; }
.pillar-dialog-body { padding: 1rem; overflow-y: auto; overscroll-behavior: contain; }

@media (max-width: 600px) {
  .literacy-pillars-dialog { width: 100vw; border: 0; }
}

/* ============================================================
   SCORES & PERCENTILES PAGE
   ============================================================ */

.scores-page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--nav-height));
}

.scores-page-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg) 3rem;
}

.scores-topic-title {
  margin: 0 0 1rem;
  color: var(--primary-text);
  font-size: 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--border);
}

.scores-reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1rem;
}

.scores-reference-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.scores-reference-card > h4 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.95rem 1.1rem;
  background: var(--primary-faint);
}

.scores-reference-card > h4 .material-symbols-rounded {
  color: var(--primary-light-text);
}

.scores-reference-content {
  padding: 1rem 1.1rem 1.1rem;
}

.scores-reference-content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.97rem;
  line-height: 1.65;
}

.scores-reference-content p + p {
  margin-top: 0.65rem;
}

.scores-reference-content .scores-key-takeaway {
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--primary-light);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--primary-faint);
  color: var(--text);
}

.scores-risk-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.scores-risk-item {
  border-radius: var(--radius-md);
  padding: 0.75rem 0.8rem;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.scores-risk-item h5 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.scores-risk-item p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.scores-risk-blue {
  background: #edf5fc;
  border-color: #c7deef;
}

.scores-risk-green {
  background: #ecf8f2;
  border-color: #cde8dd;
}

.scores-risk-yellow {
  background: #fdf6e8;
  border-color: #ead8b5;
}

.scores-risk-red {
  background: #fdf0f0;
  border-color: #ebc7c7;
}

@media (max-width: 720px) {
  .scores-reference-grid,
  .scores-risk-list {
    grid-template-columns: 1fr;
  }
}

/* ── Scores reference button (flowchart sidebar) ── */
.scores-ref-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--info-text);
  background: var(--info-light);
  border: 1.5px solid var(--info);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  line-height: 1;
}

.scores-ref-btn .material-symbols-rounded {
  font-size: 1.05rem;
}

.scores-ref-btn:hover,
.scores-ref-btn:focus-visible {
  background: var(--info);
  color: #fff;
  outline: none;
}

/* ── ABOUT SECTION ──────────────────────────────────────── */
.about-page-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

.about-page-body {
  margin-top: var(--space-xl);
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.about-block {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  box-shadow: var(--shadow-sm);
}

.about-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-text);
  margin-bottom: var(--space-md);
}

.about-block p {
  color: var(--text-body);
  line-height: 1.75;
  margin-bottom: var(--space-sm);
}

.about-block p:last-child {
  margin-bottom: 0;
}

.about-list {
  list-style: none;
  padding: 0;
  margin: var(--space-sm) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.about-list li {
  padding: var(--space-xs) var(--space-md);
  background: var(--bg);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-body);
  line-height: 1.6;
}

.about-feedback {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary, #6366f1) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.about-feedback-text {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.5;
}

.about-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: #fff;
  color: var(--primary-text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full, 9999px);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.about-feedback-btn:hover,
.about-feedback-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  outline: none;
}

/* ============================================================
   ASSESSMENT SCHEDULE PAGE
   ============================================================ */

.schedule-page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--nav-height));
}

.schedule-page-body {
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg) 3rem;
}

@media (max-width: 640px) {
  .schedule-page-body { padding: var(--space-xl) var(--space-md) 2.5rem; }
  .cal-toolbar {
    align-items: stretch;
    padding: var(--space-md);
  }
  .cal-filters-wrap {
    width: 100%;
    justify-content: stretch;
  }
  .cal-filter-group {
    width: 100%;
  }
  .cal-filter {
    display: flex;
  }
  .cal-filter-btn {
    flex: 1 1 auto;
  }
  .cal-filter-btn-full { display: none; }
  .cal-filter-btn-short { display: inline; }
  .cal-toolbar-program { font-size: 0.95rem; }
  .cal-scroll { display: none; }
  .cal-mobile-list { display: block; }
  .cal-mobile-grade:first-child { border-top: none; }
}

/* ====================================================================
   LAYOUT TOGGLE GROUP — "Your Decisions" panel header
   Icon toggle: summary bubbles plus the visual pathway on desktop, or the
   Alt (standard list) view on mobile. Keep the media query in sync with
   VISUAL_FLOWCHART_MOBILE_QUERY in app.js.
   ==================================================================== */

.layout-toggle-group {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 3px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.layout-toggle-btn {
  width: 30px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-light);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease), box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.layout-toggle-btn:hover {
  color: var(--step-text);
}

.layout-toggle-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.layout-toggle-btn[aria-pressed="true"] {
  background: var(--bg);
  color: var(--step-text);
  box-shadow: var(--shadow-sm);
}

.layout-toggle-btn-visual {
  color: var(--step-text);
}

.layout-toggle-btn-visual:hover {
  transform: translateY(-1px);
}

.layout-toggle-icon-visual {
  font-size: 16px;
}

.layout-toggle-btn-standard { display: none; }

@media (max-width: 768px), (pointer: coarse) and (max-height: 600px) {
  .layout-toggle-btn-standard { display: inline-flex; }
  #visual-flowchart-open-btn { display: none; }
}

/* ====================================================================
   HORIZONTAL / SUMMARY-VIEW LAYOUT MODE
   Used when layoutMode === 'horizontal'. The journey-map-list shows a
   left-to-right scrollable row of step bubbles instead of a stacked list.
   ==================================================================== */

/* List items that hold the track and the active step form */
.horiz-track-li,
.horiz-step-content-li {
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

/* ── Horizontal scrollable bubble track ── */
.horiz-track-scroll {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  overflow-x: auto;
  padding: var(--space-md) var(--space-lg);
  gap: 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.horiz-track-scroll::-webkit-scrollbar {
  height: 4px;
}
.horiz-track-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ── Individual step bubble ── */
.horiz-bubble {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  min-width: 164px;
  max-width: 200px;
  flex-shrink: 0;
  padding: 12px 14px 11px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  gap: 7px;
  text-align: left;
  font-family: inherit;
  font-size: 1rem;
  transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}

/* Completed (clickable) bubble */
button.horiz-bubble-done {
  cursor: pointer;
}
button.horiz-bubble-done:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
button.horiz-bubble-done:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Active (in-progress) bubble.
   The outline uses the same colour the step will keep once it is completed
   (its step-type colour) rather than the Tier colour; the background stays
   white until the step is done, when the type/variant shading fills in. */
.horiz-bubble-active {
  background: var(--bg);
  border-color: var(--bubble-outline, var(--step));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bubble-outline, var(--step)) 14%, transparent);
}

/* Small checkmark badge on completed bubbles (top-right corner) */
.horiz-bubble-check {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 18px;
  height: 18px;
  background: var(--effective);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: 1.5px solid var(--bg);
}

/* ── Bubble icon ── */
.horiz-bubble-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--step-bg);
  color: var(--step-text);
}

.horiz-bubble-icon svg {
  width: 15px;
  height: 15px;
}

/* Type-specific icon colours (reuse flowchart step variables) */
.horiz-bubble-type-checklist .horiz-bubble-icon {
  background: var(--step-checklist-bg);
  color: var(--step-checklist);
}
.horiz-bubble-type-selection .horiz-bubble-icon {
  background: var(--step-selection-bg);
  color: var(--step-selection);
}
.horiz-bubble-type-decision .horiz-bubble-icon {
  background: var(--step-decision-bg);
  color: var(--step-decision);
}
.horiz-bubble-type-info .horiz-bubble-icon {
  background: var(--step-info-bg);
  color: var(--step-info);
}

/* ---- Colour coding for completed bubbles in Summary View ----
   Mirrors the completed step colouring in the Standard View journey list
   (.journey-map-item.journey-map-type-* / journey-map-variant-*) and the
   final journey summary bubbles (.anim-step-bubble / .anim-bubble-*), so a
   step is styled the same way in every view. */
/* Outline colour per step type — shared by the in-progress bubble and the
   completed bubble so the outline colour does not change on completion. */
.horiz-bubble-type-checklist { --bubble-outline: var(--step-checklist); }
.horiz-bubble-type-selection { --bubble-outline: var(--step-selection); }
.horiz-bubble-type-decision  { --bubble-outline: var(--step-decision); }
.horiz-bubble-type-info      { --bubble-outline: var(--step-info); }

.horiz-bubble-done.horiz-bubble-type-checklist {
  background: var(--step-checklist-bg);
  border-color: var(--step-checklist);
}
.horiz-bubble-done.horiz-bubble-type-selection {
  background: var(--step-selection-bg);
  border-color: var(--step-selection);
}
.horiz-bubble-done.horiz-bubble-type-decision {
  background: var(--step-decision-bg);
  border-color: var(--step-decision);
}
.horiz-bubble-done.horiz-bubble-type-info {
  background: var(--step-info-bg);
  border-color: var(--step-info);
}

.horiz-bubble-done.horiz-bubble-variant-step1 {
  background: var(--step-bg);
  border-color: var(--step);
}
.horiz-bubble-done.horiz-bubble-variant-selection {
  background: var(--info-light);
  border-color: var(--info);
}
.horiz-bubble-done.horiz-bubble-variant-effective {
  background: var(--effective-bg);
  border-color: var(--effective);
}
.horiz-bubble-done.horiz-bubble-variant-ineffective {
  background: var(--ineffective-bg);
  border-color: var(--ineffective);
}

/* ── Bubble text area ── */
.horiz-bubble-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  width: 100%;
}

.horiz-bubble-meta {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.horiz-bubble-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.horiz-bubble-answer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--effective);
  line-height: 1.3;
}

.horiz-bubble-answer svg {
  flex-shrink: 0;
  color: var(--effective);
}

.horiz-bubble-revisit {
  margin-top: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--step);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

button.horiz-bubble-done:hover .horiz-bubble-revisit,
button.horiz-bubble-done:focus-visible .horiz-bubble-revisit {
  opacity: 1;
}

.horiz-bubble-now {
  margin-top: 3px;
  display: inline-flex;
  font-size: 0.72rem;
}

/* ── Connector arrow between bubbles ── */
.horiz-connector {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-shrink: 0;
  width: 32px;
  align-self: center;
}

.horiz-connector-line {
  flex: 1;
  height: 2px;
  background: var(--border);
}

.horiz-connector-arrow {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--border);
  flex-shrink: 0;
}

/* ── Active step content area (below the track) ── */
.horiz-step-content-li {
  border-top: 1px solid var(--border);
}

.horiz-step-content-li .journey-step-slot {
  padding: var(--space-sm) var(--space-lg) var(--space-md);
}

/* On small screens, reduce bubble size slightly */
@media (max-width: 600px) {
  .horiz-bubble {
    min-width: 140px;
    max-width: 170px;
    padding: 10px 11px 9px;
  }
  .horiz-bubble-title {
    font-size: 0.78rem;
  }
  .horiz-track-scroll {
    padding: var(--space-sm) var(--space-md);
  }
}

/* ------------------------------------------------------------
   PWA INSTALL — top-nav button, first-visit banner, iOS modal
   ------------------------------------------------------------ */

/* Install App button in the top navigation. It is rendered with the `hidden`
   attribute and only revealed by app.js when installation is possible. */
.install-app-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-pill);
  color: var(--text-on-primary);
  cursor: pointer;
  padding: 5px 14px;
  font-family: "Nunito", var(--font-ui, inherit);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  flex-shrink: 0;
  transition: background var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              transform var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}

.install-app-btn[hidden] { display: none; }
.install-app-menu-btn[hidden] { display: none; }

.install-app-btn:hover,
.install-app-btn:focus-visible {
  background: var(--primary-light);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.install-app-btn .material-symbols-rounded { font-size: 18px; }

@media (max-width: 768px) {
  .nav-right > .install-app-btn { display: none; }
}

@media (max-width: 560px) {
  .top-program-lang-select {
    min-width: 82px;
    font-size: 0.72rem;
  }
}

/* ── First-visit install banner ──────────────────────────────── */
.install-banner {
  position: fixed;
  left: 50%;
  bottom: var(--space-md);
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: min(560px, calc(100% - 2 * var(--space-md)));
  padding: var(--space-md);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  /* Start slightly below and transparent; app.js adds the visible class. */
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity var(--duration-slow) var(--ease),
              transform var(--duration-slow) var(--ease);
}

.install-banner[hidden] { display: none; }

.install-banner.install-banner-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.install-banner-icon {
  font-size: 26px;
  color: var(--primary-text);
  flex-shrink: 0;
}

.install-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.install-banner-text strong {
  font-family: "Nunito", inherit;
  font-size: 0.95rem;
  color: var(--text);
}

.install-banner-text span {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.install-banner-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.install-banner-btn {
  border-radius: var(--radius-pill);
  padding: 7px 15px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background var(--duration) var(--ease),
              color var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}

.install-banner-btn-primary {
  background: var(--primary);
  border: 1.5px solid var(--primary);
  color: var(--text-on-primary);
}

.install-banner-btn-primary:hover,
.install-banner-btn-primary:focus-visible {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

.install-banner-btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}

.install-banner-btn-ghost:hover,
.install-banner-btn-ghost:focus-visible {
  background: var(--bg-muted);
  color: var(--text);
}

@media (max-width: 560px) {
  .install-banner {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }
  .install-banner-actions { width: 100%; justify-content: flex-end; }
}

/* ── Install instructions modal (iOS / unsupported browsers) ─── */
.install-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: rgba(15, 26, 40, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease);
}

.install-modal-overlay[hidden] { display: none; }

.install-modal-overlay.install-modal-visible { opacity: 1; }

/* Prevent the page behind the dialog from scrolling. */
body.install-modal-open { overflow: hidden; }

.install-modal {
  width: min(440px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.98);
  transition: transform var(--duration-slow) var(--ease);
}

.install-modal-overlay.install-modal-visible .install-modal {
  transform: translateY(0) scale(1);
}

.install-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-lg) var(--space-sm);
}

.install-modal-title {
  font-family: "Nunito", inherit;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-text);
}

.install-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-secondary);
  background: var(--bg-muted);
  flex-shrink: 0;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.install-modal-close:hover,
.install-modal-close:focus-visible {
  background: var(--border);
  color: var(--text);
}

.install-modal-body { padding: 0 var(--space-lg); }

.install-modal-desc {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.install-modal-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.install-modal-steps li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--step-bg);
  border-radius: var(--radius);
}

.install-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-on-primary);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.install-step-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.install-step-text {
  font-size: 0.9rem;
  color: var(--text);
}

.install-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.install-modal-btn {
  background: var(--primary);
  border-radius: var(--radius-pill);
  color: var(--text-on-primary);
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  transition: background var(--duration) var(--ease);
}

.install-modal-btn:hover,
.install-modal-btn:focus-visible { background: var(--primary-light); }

/* Program onboarding prompt */
.program-prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 3300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: rgba(15, 26, 40, 0.5);
  backdrop-filter: blur(4px);
}

.program-prompt-overlay[hidden] { display: none; }
body.program-prompt-open { overflow: hidden; }

.program-prompt-card {
  position: relative;
  width: min(560px, 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  background: #fff;
  border: 1px solid rgba(12, 49, 90, 0.1);
  border-radius: calc(var(--radius-lg) + 8px);
  box-shadow: 0 24px 60px rgba(12, 49, 90, 0.14);
  padding: clamp(1.4rem, 3vw, 2rem);
}

.program-prompt-branding {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  margin-bottom: 0;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(12, 49, 90, 0.14);
}

.program-prompt-brand-app {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.program-prompt-brand-app-icon {
  width: 3.7rem;
  height: 3.7rem;
  flex: 0 0 auto;
}

.program-prompt-brand-app-name {
  color: var(--primary-text);
  font-size: 0.94rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  line-height: 1.2;
}

.program-prompt-brand-division-wrap {
  width: min(190px, 42%);
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
  align-self: flex-end;
  margin-top: var(--space-xs);
}

.program-prompt-brand-division {
  width: 100%;
  height: auto;
}

.program-prompt-title {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--primary-text);
  font-size: clamp(1.65rem, 3vw, 2.15rem);
}

.program-prompt-desc {
  position: relative;
  z-index: 1;
  color: var(--text-secondary);
  margin: 0;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(12, 49, 90, 0.12);
  max-width: 34rem;
  line-height: 1.55;
}

.program-prompt-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  padding: var(--space-xs) 0 var(--space-md);
  border-bottom: 1px solid rgba(12, 49, 90, 0.12);
}

.program-prompt-actions[hidden] {
  display: none;
}

.program-prompt-btn,
.program-prompt-continue {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-height: 100%;
  border: 2px solid color-mix(in srgb, var(--primary) 30%, #ffffff);
  background: color-mix(in srgb, var(--primary) 8%, #ffffff);
  color: var(--text);
  border-radius: calc(var(--radius) + 6px);
  padding: 1rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 10px 20px rgba(12, 49, 90, 0.08);
  transition:
    transform var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    background var(--duration) var(--ease),
    color var(--duration) var(--ease),
    outline-color var(--duration) var(--ease);
}

.program-prompt-btn:hover,
.program-prompt-continue:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 55%, #ffffff);
  background: color-mix(in srgb, var(--primary) 20%, #ffffff);
  color: var(--primary-text);
  box-shadow: 0 18px 30px rgba(12, 49, 90, 0.12);
}

.program-prompt-btn:focus-visible,
.program-prompt-continue:focus-visible {
  outline: none;
  border-radius: calc(var(--radius) + 6px);
}

.program-prompt-btn-title {
  color: var(--primary-text);
  font-size: 1.05rem;
  width: 100%;
  text-align: center;
}

.program-prompt-btn-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.45;
}

.program-prompt-language {
  position: relative;
  z-index: 1;
  margin-top: 0;
  padding: var(--space-xs) 0 var(--space-md);
  border-bottom: 1px solid rgba(12, 49, 90, 0.12);
  display: grid;
  gap: var(--space-md);
}

.program-prompt-language[hidden] {
  display: none;
}

.program-prompt-language-group {
  border: none;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.program-prompt-language-label {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--primary-text);
  margin-bottom: var(--space-sm);
}

.program-prompt-language-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.program-prompt-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: none;
  background: transparent;
  color: var(--primary-text);
  font-weight: 800;
  padding: 0.1rem 0;
}

.program-prompt-back .material-symbols-rounded {
  font-size: 1.1rem;
}

.program-prompt-back:hover,
.program-prompt-back:focus-visible {
  color: var(--primary-light-text);
}

#program-prompt-modal[data-step="language"] .program-prompt-card {
  width: min(520px, 100%);
}

@media (max-width: 640px) {
  .program-prompt-actions,
  .program-prompt-language-options {
    grid-template-columns: 1fr;
  }

  .program-prompt-card {
    padding: 1.2rem;
  }

  .program-prompt-branding {
    flex-direction: column;
    align-items: flex-start;
  }

  .program-prompt-brand-division-wrap {
    width: min(210px, 100%);
    align-self: center;
    justify-content: center;
  }
}

/* Respect users who prefer reduced motion: show/hide without movement. */
@media (prefers-reduced-motion: reduce) {
  .install-banner,
  .install-modal-overlay,
  .install-modal,
  .install-app-btn,
  .program-prompt-btn,
  .program-prompt-continue {
    transition: none;
  }
  .install-banner { transform: translate(-50%, 0); }
  .install-modal { transform: none; }
  .program-prompt-btn:hover,
  .program-prompt-btn:focus-visible,
  .program-prompt-continue:hover,
  .program-prompt-continue:focus-visible {
    transform: none;
  }
}

/* Guided journey: one primary action, with references kept secondary. */
.nav-group-label {
  padding: 1rem 0.85rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}
.side-nav.collapsed .nav-group-label { display: none; }
.guided-home-hero .hero-inner { grid-template-columns: minmax(0, 1fr) minmax(180px, 300px); }
.guided-home-hero .hero-title { font-size: clamp(1.7rem, 3vw, 2.5rem); }
.guided-home-hero .hero-subtitle { max-width: 650px; }
.guided-home-hero .hero-photo { width: 300px; height: 270px; }
.home-start-annotation {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  margin-top: 1rem;
  color: #ff7770;
  pointer-events: none;
}
.home-start-lettering {
  width: 300px;
  min-width: 0;
  margin-top: 0.3rem;
  transform: rotate(-6deg);
}
.home-start-arrow,
.home-start-lettering {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.home-start-arrow {
  width: 96px;
  height: 76px;
  flex-shrink: 0;
}
.home-start-lettering-fr { display: none; }
.home-start-lettering:lang(fr) .home-start-lettering-en { display: none; }
.home-start-lettering:lang(fr) .home-start-lettering-fr { display: inline; }
.home-start-arrow-retrace { stroke-width: 2; opacity: 0.5; }
.home-start-annotation + .home-program-controls { margin-top: 0.25rem; }
.home-program-controls { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.25rem; }
.home-program-controls label { gap: 0.35rem; font-size: 0.9rem; font-weight: 600; }
.home-program-controls #home-display-language { gap: 0.35rem; font-size: 0.9rem; font-weight: 600; }
.home-language-toggle {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.home-language-toggle button {
  min-height: 38px;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--primary-text);
}
.home-language-toggle button[aria-pressed="true"] { background: var(--primary); color: #fff; }
.home-language-toggle button:hover { background: var(--primary-faint); }
.home-language-toggle button[aria-pressed="true"]:hover { background: var(--primary-light); }
.guided-home-hero .home-language-toggle button:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.guided-home-hero .home-language-toggle button[aria-pressed="true"]:focus-visible { outline-color: #fff; }
.home-program-controls select {
  width: 100%;
  min-height: 44px;
  max-width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background-color: var(--bg);
}
.home-program-status { margin: 0.65rem 0 1rem; font-size: 0.85rem; color: #e0eaf5; }
.home-guided-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.guided-primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--primary-text);
  font-weight: 700;
  line-height: 1.4;
}
.guided-primary-btn:hover:not(:disabled) { background: var(--accent-light); }
.home-guided-actions button:disabled { opacity: 0.65; cursor: not-allowed; }
.guided-secondary-btn,
.home-resource-shortcut {
  min-height: 44px;
  color: #fff;
  text-decoration: none;
  text-underline-offset: 0.2em;
  font-size: 0.9rem;
}
.home-resource-shortcut { margin-top: 0.65rem; }
.home-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid #b3d9d4;
  border-radius: var(--radius);
  background: #effaf8;
  color: var(--text);
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.home-feedback:hover,
.home-feedback:focus-visible {
  color: var(--text);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.home-feedback:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  .home-feedback { transition: none; }
  .home-feedback:hover, .home-feedback:focus-visible { transform: none; }
}
.home-feedback > div { flex: 1 1 280px; }
.home-feedback-heading { color: #23665e; }
.home-feedback p { margin-top: 0.5rem; color: var(--text-secondary); font-size: 0.92rem; }
.home-feedback-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  max-width: 100%;
  padding: 0.7rem 1rem;
  background: #23665e;
  color: #fff;
  font-weight: 700;
  border-radius: var(--radius-sm);
}
.home-feedback-lettering {
  width: 190px;
  max-width: calc(100% - 2rem);
  transform: rotate(-3deg);
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.home-feedback-lettering-fr { display: none; }
.home-feedback-lettering:lang(fr) .home-feedback-lettering-en { display: none; }
.home-feedback-lettering:lang(fr) .home-feedback-lettering-fr { display: inline; }
.home-feedback:hover .home-feedback-link,
.home-feedback:focus-visible .home-feedback-link { background: #b9e7df; color: #163e39; }
.home-progress-privacy { margin-top: 0.75rem; max-width: 650px; color: #e0eaf5; font-size: 0.8rem; }
.guided-home-hero button:focus-visible,
.guided-home-hero select:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.home-guided-actions [hidden],
.pathway-return-banner[hidden] { display: none; }
.guided-home-content { max-width: 1100px; }
.journey-overview > p,
.home-reference > p { margin-top: 0.5rem; color: var(--text-secondary); font-size: 0.92rem; }
.journey-stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.journey-stages li { border-top: 3px solid var(--secondary); padding-top: 0.8rem; }
.journey-stage-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 0.6rem;
  border-radius: 50%;
  background: var(--step-header);
  color: var(--primary-text);
  font-weight: 700;
}
.journey-stages h4 { margin-bottom: 0.4rem; }
.journey-stages p { font-size: 0.87rem; color: var(--text-secondary); }
.journey-alternate-starts {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
}
.journey-alternate-starts summary { cursor: pointer; font-weight: 600; }
.journey-alternate-starts summary:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 4px; }
.journey-alternate-starts > p { margin-top: 1rem; font-size: 0.9rem; color: var(--text-secondary); }
.journey-tier-starts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; margin-top: 1rem; }
.journey-tier-starts p { margin: 0.5rem 0 0.75rem; font-size: 0.88rem; }
.guided-outline-btn {
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--primary-text);
  font-weight: 600;
  font-size: 0.9rem;
}
.guided-outline-btn:hover { background: var(--primary-faint); }
.home-reference { padding-top: 1.25rem; border-top: 1px solid var(--border); }
.home-reference-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin-top: 0.5rem; }
.home-reference-links button { min-height: 44px; color: var(--primary-text); font-size: 0.87rem; }
.home-resource-shortcut:hover { color: #8edbd1; }
.home-reference-links button:hover,
.pathway-return-banner button:hover { color: var(--primary-light-text); }
.pathway-return-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--step-header);
  border-bottom: 1px solid var(--step-soft);
  color: var(--primary-text);
  font-size: 0.88rem;
}
.pathway-return-banner button { min-height: 44px; font-weight: 700; color: var(--primary-text); }
@media (max-width: 1100px) {
  .guided-home-hero .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .guided-home-hero .hero-photo-wrap { display: none; }
}
@media (max-width: 700px) {
  .journey-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journey-tier-starts { grid-template-columns: minmax(0, 1fr); }
  .pathway-return-banner { padding: 0.75rem 1rem; }
}
@media (max-width: 420px) {
  .journey-stages { grid-template-columns: minmax(0, 1fr); }
  .home-program-controls { flex-direction: column; }
  .guided-primary-btn { width: 100%; }
}

/* ── Home: screener + grade setup ── */
.home-program-controls select:disabled { opacity: 0.65; cursor: not-allowed; }

/* ── Home as a drawer over the flowchart ── */
.home-drawer-bar { display: none; }
.home-drawer-scrim[hidden] { display: none; }
body.home-drawer-open #home-section,
body.home-drawer-closing[data-page="flowchart"] #home-section {
  display: block;
  position: fixed;
  top: var(--nav-height);
  bottom: 0;
  left: var(--side-nav-width);
  z-index: 860;
  width: calc((100vw - var(--side-nav-width)) * 0.9);
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  background: var(--bg);
  box-shadow: 12px 0 40px rgba(5, 20, 37, 0.28);
  animation: homeDrawerIn 0.3s var(--ease) both;
}
body.home-drawer-closing[data-page="flowchart"] #home-section {
  animation: homeDrawerOut 0.25s var(--ease) both;
  pointer-events: none;
}
body.home-drawer-open.side-nav-collapsed #home-section,
body.home-drawer-closing.side-nav-collapsed[data-page="flowchart"] #home-section {
  left: var(--side-nav-collapsed-width);
  width: calc((100vw - var(--side-nav-collapsed-width)) * 0.9);
}
body.home-drawer-open .home-drawer-bar,
body.home-drawer-closing[data-page="flowchart"] .home-drawer-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  padding: 0.5rem 1rem;
  background: var(--primary);
}
.home-drawer-close {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-pill);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
}
.home-drawer-close:hover { background: rgba(255, 255, 255, 0.14); }
.home-drawer-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.home-drawer-scrim {
  position: fixed;
  inset: var(--nav-height) 0 0 0;
  z-index: 850;
  background: rgba(8, 23, 40, 0.45);
  animation: homeDrawerScrimIn 0.3s var(--ease) both;
}
@keyframes homeDrawerIn {
  from { transform: translateX(-100%); }
  to   { transform: none; }
}
@keyframes homeDrawerOut {
  from { transform: none; }
  to   { transform: translateX(-100%); }
}
@keyframes homeDrawerScrimIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (max-width: 768px) {
  body.home-drawer-open #home-section,
  body.home-drawer-open.side-nav-collapsed #home-section,
  body.home-drawer-closing[data-page="flowchart"] #home-section {
    left: 0;
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.home-drawer-open #home-section,
  .home-drawer-scrim { animation: none; }
  body.home-drawer-closing[data-page="flowchart"] #home-section { display: none; }
}

/* ── Home: icon-only reset button ── */
.guided-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: #fff;
  transition: background var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.guided-icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
.guided-icon-btn:hover .guided-restart-icon { transform: rotate(-90deg); }
.guided-restart-icon { display: inline-flex; transition: transform var(--duration-slow) var(--ease); }
#home-restart-btn .material-symbols-rounded { transform: scaleX(-1); }
.guided-icon-btn .material-symbols-rounded { font-size: 22px; transition: transform var(--duration-slow) var(--ease); }

/* ── Visual pathway as a full screen beside the top bar and side menu ── */
.visual-flowchart-modal {
  inset: var(--nav-height) 0 0 var(--side-nav-width);
  z-index: 800;
  background: var(--bg);
  transition: opacity 0.18s ease, left var(--duration-slow) var(--ease);
}
body.side-nav-collapsed .visual-flowchart-modal { left: var(--side-nav-collapsed-width); }
.visual-flowchart-modal:fullscreen { inset: 0; }
.visual-flowchart-modal .visual-flowchart-dialog {
  width: 100%;
  height: 100%;
  box-shadow: none;
}
.visual-flowchart-modal .visual-flowchart-dialog:fullscreen {
  width: 100vw;
  height: 100vh;
}
.visual-flowchart-header .visual-flowchart-home-btn { flex: 0 0 auto; }
.home-drawer-toggle .material-symbols-rounded { font-size: 18px; }
.home-drawer-toggle[aria-expanded="true"] {
  background: var(--primary);
  color: #fff;
}

.pathway-sessions-toggle {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 850;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 0.65rem;
  writing-mode: vertical-rl;
  border: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}
.pathway-sessions-toggle[hidden] { display: none; }
.pathway-sessions-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(380px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  box-sizing: border-box;
  padding: 1rem;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
}
.pathway-sessions-drawer::backdrop { background: rgba(0, 0, 0, 0.35); }
.pathway-sessions-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pathway-sessions-header h2 { margin: 0; }
.pathway-sessions-header button {
  display: grid;
  place-items: center;
  padding: 0.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
details.pathway-session {
  margin: 0;
  padding: 0.75rem 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}
details.pathway-session[open] { box-shadow: none; }
.saved-session-card {
  margin-top: 0.75rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.saved-session-card .pathway-session-title { margin: 0; }
.saved-session-card .pathway-session-title::after { content: none; }
.saved-session-card .pathway-session-meta { margin: 0.4rem 0 0; }
.saved-session-card .pathway-session-actions { margin-top: 0.5rem; }
.saved-session-current {
  background: #fff1bf;
  border-color: var(--card-yellow-border);
  box-shadow: inset 4px 0 var(--card-yellow-border);
  animation: current-session-glow 3s ease-in-out infinite;
}
.saved-session-current .pathway-session-current { color: #7a4d00; }
@keyframes current-session-glow {
  0%, 100% { box-shadow: inset 4px 0 var(--card-yellow-border), 0 0 4px rgba(246, 174, 8, 0.12); }
  50% { box-shadow: inset 4px 0 var(--card-yellow-border), 0 0 14px rgba(246, 174, 8, 0.3); }
}
@media (prefers-reduced-motion: reduce) {
  .saved-session-current { animation: none; }
}
.pathway-session-download.session-delete { color: var(--ineffective-text); }
.pathway-session > summary {
  display: grid;
  gap: 0.1rem;
  cursor: pointer;
  list-style: none;
  overflow-wrap: anywhere;
}
.pathway-session > summary::before { display: none; }
.pathway-session summary::-webkit-details-marker { display: none; }
.pathway-session-title { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.92rem; }
.pathway-session-title::after {
  content: "expand_more";
  font-family: "Material Symbols Rounded";
  font-weight: 400;
  font-size: 1.15rem;
  margin-left: auto;
  color: var(--text-secondary);
  transition: transform var(--duration, 0.2s) var(--ease, ease);
}
.pathway-session[open] .pathway-session-title::after { transform: rotate(180deg); }
.pathway-session-current {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
}
.pathway-session-meta { font-size: 0.75rem; color: var(--text-secondary); }
.pathway-session-title { flex-wrap: wrap; }
.favourites-page-wrapper > .hero-area + .saved-group { padding-top: 2rem; }
.saved-group + .saved-group { margin-top: 2rem; }
.saved-group h3 { margin-bottom: 0.5rem; }
.saved-sessions-hint { margin: 0 0 1rem; font-size: 0.85rem; color: var(--text-secondary); }
.pathway-session-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 0 0; }
.session-notes { margin-top: 0.75rem; font-size: 0.85rem; }
.session-notes ol { padding-left: 1.25rem; }
.session-notes li + li { margin-top: 0.4rem; }
.pathway-session-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--primary-text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.pathway-session-close:hover { background: var(--primary-faint); }
.pathway-session-close .material-symbols-rounded { font-size: 1rem; }
.pathway-session-close:focus-visible,
.pathway-session-download:focus-visible { outline: 3px solid #a66b00; outline-offset: 3px; }
.individual-outcome .individual-recommendation {
  margin: 0.75rem 0 var(--space-xs);
}

.pathway-resource-selection {
  margin-block: var(--space-md) 0;
  padding: 0.75rem 14px;
  border-top: 1px solid color-mix(in srgb, var(--primary-light-text) 25%, var(--border));
  background: color-mix(in srgb, var(--primary-light-text) 12%, var(--bg));
}

.visual-flowchart-active-host .pathway-resource-selection {
  margin-inline: -14px;
  margin-bottom: -14px;
  border-radius: 0 0 15px 15px;
  background: var(--bg-muted);
}

.visual-flowchart-active-host .step-content:has(> .pathway-resource-selection) {
  padding-inline: 0;
  padding-bottom: 0;
}

.pathway-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-top: var(--space-md);
  padding: 0.375rem var(--space-lg);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--bg-muted);
}

.visual-flowchart-card > .pathway-card-actions {
  grid-column: 1 / -1;
  margin: 8px -14px -14px;
  padding-inline: 14px;
  border-radius: 0 0 15px 15px;
}

.endpoint-card > .pathway-card-actions {
  margin: var(--space-md) calc(-1 * var(--space-lg)) calc(-1 * var(--space-lg));
}

.journey-step-slot .endpoint-card > .pathway-card-actions {
  margin-bottom: calc(-1 * var(--space-md));
}

.pathway-card-action {
  position: relative;
  width: auto;
  min-width: 24px;
  max-width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 0.25rem 0 0.25rem 0.875rem;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--primary-text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: none;
  cursor: pointer;
}

.pathway-card-actions > .pathway-card-action { text-align: right; }

@media (hover: hover) {
  .pathway-card-action:hover {
    color: color-mix(in srgb, var(--primary-text) 35%, var(--primary-light-text));
  }

  .pathway-card-action:hover::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    border-block: 0.25rem solid transparent;
    border-left: 0.375rem solid currentColor;
  }
}

.pathway-card-action:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 3px;
}

.pathway-session-label {
  margin: 0.6rem 0 0.2rem;
  padding: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.pathway-session-next {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
  padding: 0.4rem 0;
  font-size: 0.8rem;
}
.pathway-session-next .material-symbols-rounded { font-size: 1rem; color: var(--primary-light-text); }
.pathway-session-next .pathway-session-label { margin: 0; display: inline; }
.pathway-session-outcomes { list-style: none; margin: 0.55rem 0 0; padding: 0; display: grid; gap: 0.3rem; }
.pathway-session-outcome {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.4rem 0;
  font-size: 0.8rem;
}
.pathway-session-outcome .material-symbols-rounded { font-size: 1rem; color: var(--primary-light-text); }
.pathway-session-outcome .pathway-session-label { margin: 0; display: inline; color: var(--primary-text); }
.pathway-session-outcome.is-final { font-weight: 600; }
.pathway-session-outcome.is-final .material-symbols-rounded { color: var(--accent-dark); }
.pathway-session-empty { margin: 0.25rem 0; padding: 0; font-size: 0.8rem; color: var(--text-secondary); }
.session-resources { list-style: none; margin: 0; padding: 0; }
.session-resource {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.session-resource:first-child { border-top: 0; }
.session-tier {
  flex: 0 0 auto;
  min-width: 1.75rem;
  padding: 0.1rem 0.3rem;
  border-radius: 6px;
  background: var(--card-blue-bg);
  color: var(--primary-text);
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}
.session-tier-1 { background: var(--card-mint-bg); color: #2e6b31; }
.session-tier-2 { background: var(--card-yellow-bg); color: #7a4d00; }
.session-tier-3 { background: var(--card-pink-bg); color: #9b2f1d; }
.session-resource-main { flex: 1 1 auto; min-width: 0; display: grid; }
.session-resource-main strong { font-size: 0.85rem; line-height: 1.25; }
.session-resource-meta { font-size: 0.72rem; color: var(--text-secondary); }
.session-resource-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 30px;
  height: 30px;
  padding: 0 4px;
  border-radius: 8px;
  color: var(--primary-light-text);
  text-decoration: none;
  transition: background var(--duration, 0.2s) var(--ease, ease);
}
.session-resource-link:hover { background: var(--primary-faint); }
.session-resource-link .material-symbols-rounded { width: 18px; overflow: hidden; font-size: 18px; }
.session-resource-lang { font-size: 0.6rem; font-weight: 700; }
.pathway-session-download {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.55rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--primary-text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.pathway-session-download:hover { background: var(--primary-faint); border-color: var(--primary-light); }
.pathway-session-download .material-symbols-rounded { font-size: 1rem; }
.pathway-sessions-toggle:focus-visible,
.pathway-sessions-drawer button:focus-visible,
.session-resource-link:focus-visible,
.pathway-session summary:focus-visible { outline: 3px solid #a66b00; outline-offset: 3px; }
@media (max-width: 768px) {
  .pathway-sessions-toggle {
    top: auto;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    right: 0.75rem;
    writing-mode: horizontal-tb;
    border-radius: var(--radius);
  }
  .pathway-sessions-drawer {
    inset: auto 0 0;
    width: 100%;
    height: 80dvh;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }
  body[data-page="flowchart"] .flowchart-page-wrapper { padding-bottom: 5rem; }
}

/* Settings screen */
.settings-layout {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}
.settings-layout [hidden] { display: none !important; }
.settings-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.settings-header .section-title { margin: 0 0 0.4rem; }
.settings-header .section-title:focus { outline: none; }
.settings-header p,
.settings-card p { color: var(--text-secondary); line-height: 1.65; }
.settings-page-icon {
  width: 56px;
  flex: 0 0 56px;
  height: 56px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--primary-faint);
  color: var(--primary-text);
  font-size: 28px;
}
.settings-card {
  margin-top: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow-xs);
}
.settings-card h3 { margin: 0; font-size: 1.15rem; color: var(--primary-text); }
.settings-card p { margin: 0.65rem 0; }
.settings-card .settings-hint { font-size: 0.9rem; }
.settings-theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 44px;
  margin-top: 1.25rem;
  cursor: pointer;
}
.settings-theme-copy { display: grid; gap: 0.35rem; }
.settings-option-title { font-weight: 600; }
#settings-theme-hint,
#settings-pathway-layout-hint { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }
.settings-pathway-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-top: 1.25rem;
}
.settings-pathway-layout > div { flex: 1 1 18rem; }
.settings-pathway-layout select {
  max-width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.settings-theme-toggle input {
  position: absolute;
  right: 0;
  width: 52px;
  height: 44px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.settings-switch-track {
  flex: 0 0 52px;
  height: 30px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--text-light);
  transition: background var(--duration) var(--ease);
  pointer-events: none;
}
.settings-switch-track::before {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration) var(--ease);
}
.settings-theme-toggle input:checked + .settings-switch-track { background: var(--primary-light); }
.settings-theme-toggle input:checked + .settings-switch-track::before { transform: translateX(22px); }
.settings-theme-toggle input:focus-visible + .settings-switch-track {
  outline: 3px solid var(--border-focus);
  outline-offset: 4px;
}
#settings-theme-status:empty,
#settings-visual-flowchart-layout-status:empty,
#transfer-status:empty { display: none; }
.transfer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1.5rem; }
.transfer-card-heading { display: flex; align-items: center; gap: 0.65rem; color: var(--primary-text); }
.transfer-card-heading .resource-centre-icon { width: 26px; height: 26px; }
.transfer-card-heading h4 { font-size: 1rem; }
.transfer-steps { list-style: decimal outside; padding-left: 1.4rem; margin: 1.25rem 0; }
.transfer-steps li { padding-left: 0.3rem; margin-bottom: 0.85rem; line-height: 1.6; color: var(--text-secondary); }
.transfer-steps li::marker { color: var(--primary-text); font-weight: 700; }
.transfer-notice {
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--warning-text);
  border-radius: var(--radius-sm);
  background: var(--warning-light);
  font-size: 0.9rem;
}
.settings-card .transfer-notice { margin-top: 1.25rem; color: var(--warning-text); }
.transfer-replace-notice { font-size: 0.9rem; }
.transfer-section {
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
}
.transfer-section label {
  display: block;
  margin: 0.75rem 0 0.4rem;
  font-weight: 600;
}
.settings-layout textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  resize: vertical;
}
.transfer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.settings-layout button {
  min-height: 44px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--primary-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.settings-layout button:hover:not(:disabled) { background: var(--primary-faint); }
.settings-layout button:disabled { opacity: 0.6; cursor: not-allowed; }
.settings-layout button:focus-visible,
.settings-layout textarea:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 3px;
}
.settings-layout .settings-primary-button { background: var(--primary); color: #fff; border-color: var(--primary); }
.settings-layout .settings-primary-button:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary-light); }
.settings-reset { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.settings-reset h3 { color: var(--ineffective-text); }
.settings-reset p { margin-bottom: 0; }
.settings-layout .menu-hard-reset { color: var(--ineffective-text); border-color: var(--ineffective-soft); }
.settings-layout .menu-hard-reset:hover { background: var(--ineffective-bg); }
.transfer-preview,
#transfer-status { overflow-wrap: anywhere; }
.transfer-preview:not(:empty) { padding: 1rem; background: var(--primary-faint); border-radius: var(--radius-sm); }
.transfer-preview ul { padding-left: 1.25rem; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }
@media (max-width: 1000px) {
  .transfer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .settings-layout {
    padding: 1.5rem 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  .settings-card { padding: 1.25rem; }
  .settings-page-icon { display: none; }
  .settings-reset { flex-direction: column; align-items: stretch; }
  .settings-layout .transfer-actions { flex-direction: column; }
  .settings-layout .transfer-actions button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .settings-switch-track,
  .settings-switch-track::before { transition: none; }
}
@media (forced-colors: active) {
  .settings-switch-track { border: 1px solid ButtonText; background: Canvas; }
  .settings-switch-track::before { background: ButtonText; }
  .settings-theme-toggle input:checked + .settings-switch-track { background: Highlight; }
  .settings-theme-toggle input:checked + .settings-switch-track::before { background: HighlightText; }
}
