/* ============================================================================
   CHAFM 3.0 — "Sunlit Sanctuary" Design System
   Warm, trustworthy, modern child-protection UI with crisp photographic framing,
   refined depth, WCAG AA/AAA accessibility, and zero legacy clutter.
   ============================================================================ */

:root {
  --bg: #f4f9f8;
  --surface: #ffffff;
  --surface-soft: #f0f7f6;
  --ink: #0f2c38;
  --ink-soft: #3c5966;
  --ink-muted: #5d7784;
  --border: #d5e6e9;
  --border-strong: #b4d2d8;

  --teal-950: #09353f;
  --teal-900: #0c4b56;
  --teal-700: #0f6e78;
  --teal-600: #128588;
  --teal-500: #1aa098;
  --teal-100: #e2f6f3;
  --teal-50: #effbf9;

  --amber-100: #fff3dc;
  --amber-300: #f3c677;
  --amber-800: #6c450d;

  --danger-700: #b71d32;
  --danger-600: #d62839;
  --danger-100: #fff1f0;
  --danger-border: #f3b5b9;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 28px;
  --shadow-sm: 0 4px 14px rgba(13, 52, 66, 0.06);
  --shadow-md: 0 12px 30px rgba(13, 52, 66, 0.09);
  --shadow-lg: 0 20px 44px rgba(13, 52, 66, 0.12);

  --max-w: 1080px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(168, 232, 224, 0.28) 0, transparent 38%),
    radial-gradient(circle at 88% 8%, rgba(255, 220, 174, 0.25) 0, transparent 36%),
    var(--bg);
  min-height: 100vh;
}

img { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal-700); }
:focus-visible { outline: 3px solid #e09114; outline-offset: 3px; }
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, section[tabindex="-1"]:focus, div[tabindex="-1"]:focus { outline: none; }

.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--teal-900); color: #fff; padding: 10px 16px;
  border-radius: 10px; font-weight: 700; z-index: 9999; text-decoration: none;
}
.skip-link:focus { left: 12px; }

/* ---- App Shell & Header ---- */
.app-shell {
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100vh;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 60px rgba(12, 54, 68, 0.08);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(125deg, #093742 0%, #0d5863 55%, #12777a 100%);
  color: #fff;
  box-shadow: 0 6px 22px rgba(9, 53, 63, 0.22);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
}

.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 0;
  padding: 2px 4px;
  color: #fff;
  text-align: left;
  border-radius: 12px;
}
.brand-logo {
  width: 40px;
  height: 44px;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.22));
}
.brand-text strong {
  display: block;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.05;
}
.brand-text small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #a4ebe3;
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(164, 235, 227, 0.28);
  font-size: 12.5px;
  font-weight: 700;
  color: #d8faf5;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5ef2b6;
  box-shadow: 0 0 0 3px rgba(94, 242, 182, 0.28);
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1.5px solid rgba(173, 240, 233, 0.5);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13.5px;
  font-weight: 750;
  max-width: 195px;
  transition: background 0.16s, transform 0.12s, border-color 0.16s;
}
.account-pill:hover { background: rgba(255, 255, 255, 0.24); border-color: #aef7ed; transform: translateY(-1px); }
.account-pill.is-signed-in {
  background: linear-gradient(135deg, #1aa08f, #137873);
  border-color: #93f7e7;
  box-shadow: 0 4px 16px rgba(15, 130, 118, 0.38);
}
.account-pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #8fffce; box-shadow: 0 0 0 3px rgba(143, 255, 206, 0.3); flex-shrink: 0;
}

/* ---- Trust Strip ---- */
.trust-strip {
  background: linear-gradient(90deg, #e5f7f2 0%, #edf7fb 50%, #fff6e8 100%);
  border-bottom: 1px solid #cce5e2;
  color: #0e4e4a;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 7px 14px;
}
.trust-strip a { color: #b71d32; font-weight: 850; text-decoration: none; }
.trust-strip a:hover { text-decoration: underline; }

/* ---- Desktop Nav ---- */
.desktop-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 9px 14px;
  background: #fff;
  border-bottom: 1px solid #dfecee;
  overflow-x: auto;
  scrollbar-width: none;
}
.desktop-nav::-webkit-scrollbar { display: none; }
.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 750;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-tab:hover { background: var(--teal-50); color: var(--teal-900); }
.nav-tab.active {
  background: var(--teal-100);
  color: var(--teal-900);
  border-color: #a6ded7;
}
.nav-tab.nav-sos { color: var(--danger-700); }
.nav-tab.nav-sos.active { background: var(--danger-100); border-color: var(--danger-border); color: var(--danger-700); }

/* ---- Accessibility Bar ---- */
.a11y-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 22px 4px;
}
.a11y-label { font-size: 13px; font-weight: 750; color: var(--ink-muted); margin-right: 4px; }
.a11y-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 2px 6px rgba(15, 44, 56, 0.04);
  transition: all 0.15s;
}
.a11y-btn:hover { border-color: var(--teal-500); color: var(--teal-900); }
.a11y-btn[aria-pressed="true"] {
  background: var(--teal-900);
  border-color: var(--teal-900);
  color: #fff;
}
.a11y-veil {
  background: #edf6fb;
  border-color: #9ec3da;
  color: #123e59;
}
.a11y-veil:hover { background: #dff0fa; border-color: #5b99bd; }

/* ---- Main Viewport ---- */
.main-content {
  flex: 1;
  padding: 16px 24px 48px;
}
.main-content:focus { outline: none; }

/* ---- Buttons ---- */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #138a85 0%, #0d6a72 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(13, 106, 114, 0.26);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #159c96 0%, #0e7780 100%);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(13, 106, 114, 0.34);
}

.btn-danger {
  background: linear-gradient(135deg, #df3244 0%, #b71d32 100%);
  color: #fff;
  box-shadow: 0 8px 22px rgba(183, 29, 50, 0.28);
}
.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #e83b4d 0%, #c41e35 100%);
  transform: translateY(-1px);
}

.btn-gmail {
  background: linear-gradient(135deg, #147d7a 0%, #0c5d6b 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(12, 93, 107, 0.28);
}
.btn-gmail:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(12, 93, 107, 0.36); }

.btn-warm {
  background: linear-gradient(135deg, #f3a629 0%, #dd8310 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(221, 131, 16, 0.26);
}

.btn-outline {
  background: #fff;
  color: var(--teal-900);
  border-color: var(--border-strong);
}
.btn-outline:hover:not(:disabled) { background: var(--teal-50); border-color: var(--teal-600); }

.btn-soft {
  background: var(--teal-100);
  color: var(--teal-900);
  border-color: #b4e2dc;
}
.btn-soft:hover:not(:disabled) { background: #d2f1ec; }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-soft); color: var(--ink); }

.btn-full { width: 100%; }

/* ---- Eyebrow / Section Headings ---- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--teal-100);
  color: #0c625b;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.section-title {
  margin: 26px 0 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title h2 {
  margin: 0;
  font-size: clamp(21px, 3vw, 26px);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.section-title span { font-size: 14px; color: var(--ink-muted); font-weight: 600; }

/* ---- HOME HERO (Split Editorial Showcase) ---- */
.hero-card {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: center;
  padding: clamp(22px, 3.5vw, 34px);
  border-radius: var(--radius-xl);
  border: 1.5px solid #cbe6e6;
  background:
    radial-gradient(circle at 90% 15%, rgba(255, 214, 156, 0.45) 0, transparent 48%),
    radial-gradient(circle at 8% 92%, rgba(162, 236, 224, 0.38) 0, transparent 46%),
    linear-gradient(135deg, #ffffff 0%, #effaf7 58%, #fff8ee 100%);
  box-shadow: var(--shadow-md);
}
.hero-copy h1 {
  margin: 12px 0 10px;
  font-size: clamp(28px, 4.2vw, 40px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #0c2f3e;
}
.hero-lead {
  margin: 0 0 14px;
  font-size: clamp(16px, 2vw, 18px);
  color: var(--ink-soft);
  max-width: 520px;
}
.reassure-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid var(--amber-300);
  color: var(--amber-800);
  font-size: 14.5px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(198, 134, 34, 0.10);
}
.hero-media {
  position: relative;
}
.hero-photo-frame {
  border-radius: 22px;
  overflow: hidden;
  border: 4px solid #ffffff;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 4 / 3;
  background: #e5f3f0;
}
.hero-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}
.hero-floating-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(12, 55, 66, 0.88);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 750;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

/* ---- Urgent SOS Strip ---- */
.sos-banner {
  margin-top: 18px;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--danger-border);
  background: linear-gradient(135deg, #fff5f4 0%, #fff1e6 100%);
  box-shadow: 0 10px 26px rgba(183, 29, 50, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.sos-banner-copy { flex: 1 1 360px; }
.sos-banner-copy strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  color: #8f1627;
}
.sos-banner-copy p {
  margin: 4px 0 0;
  font-size: 14.5px;
  color: #6b353c;
}
.sos-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- 5 Domain Grid (exact 2x2 + 1 full-width 5th card preserved!) ---- */
.domain-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.domain-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.18s ease;
}
.domain-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--teal-500);
}
.domain-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-soft);
}
.domain-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  transition: transform 0.35s ease;
}
.domain-card:hover .domain-card-media img { transform: scale(1.04); }
.domain-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  color: #fff;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.tag-info { background: rgba(29, 108, 214, 0.90); }
.tag-health { background: rgba(33, 148, 76, 0.90); }
.tag-support { background: rgba(124, 67, 204, 0.90); }
.tag-monitor { background: rgba(214, 114, 18, 0.92); }
.tag-legal { background: rgba(168, 121, 14, 0.92); }

.domain-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}
.domain-card-body strong {
  font-size: 20px;
  font-weight: 850;
  color: var(--ink);
  line-height: 1.25;
}
.domain-card-body small {
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.domain-card-foot {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--teal-700);
}

/* 5th domain card spans full width cleanly as horizontal spotlight on wider screens */
.domain-card.is-wide {
  grid-column: span 2;
  flex-direction: row;
  align-items: stretch;
}
.domain-card.is-wide .domain-card-media {
  width: 44%;
  aspect-ratio: auto;
  min-height: 210px;
}
.domain-card.is-wide .domain-card-body {
  justify-content: center;
  padding: 22px 26px;
}

/* ---- Adult Companion Home Card ---- */
.companion-banner {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 0.42fr 1fr;
  gap: 20px;
  align-items: center;
  padding: 20px;
  border-radius: var(--radius-xl);
  border: 1.5px solid #cde2ea;
  background: linear-gradient(135deg, #ffffff 0%, #eef7fb 100%);
  box-shadow: var(--shadow-sm);
}
.companion-banner-photo {
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow-sm);
}
.companion-banner-photo img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 20%;
}
.companion-banner h3 { margin: 6px 0 6px; font-size: 20px; font-weight: 850; color: var(--ink); }
.companion-banner p { margin: 0; font-size: 14.5px; color: var(--ink-soft); }

/* ---- Domain Scenarios Page & Guided 4-Step Viewer ---- */
.page-hero {
  padding: 22px 24px;
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--border);
  background: linear-gradient(135deg, #ffffff 0%, var(--teal-50) 100%);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.page-hero h1 {
  margin: 10px 0 6px;
  font-size: clamp(24px, 3.8vw, 33px);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.page-hero p { margin: 0; color: var(--ink-soft); font-size: 15.5px; max-width: 680px; }

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.scenario-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  overflow: hidden;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s, box-shadow 0.18s, border-color 0.16s;
}
.scenario-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--teal-500); }
.scenario-card-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-soft);
}
.scenario-card-img img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.scenario-card-body { padding: 15px 17px 17px; display: flex; flex-direction: column; gap: 5px; }
.scenario-card-body strong { font-size: 18px; color: var(--ink); line-height: 1.3; }
.scenario-card-body small { font-size: 14px; color: var(--ink-soft); }

/* Guided Step Card */
.step-shell {
  max-width: 780px;
  margin: 0 auto;
}
.step-card {
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  background: var(--teal-50);
  border-bottom: 1px solid #d7ece9;
}
.step-counter {
  font-weight: 850;
  font-size: 14px;
  color: var(--teal-900);
  white-space: nowrap;
}
.step-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}
.step-dot-btn {
  width: 32px;
  height: 10px;
  border-radius: 999px;
  border: 0;
  background: #c8e3e0;
  padding: 0;
  transition: background 0.18s, width 0.18s;
}
.step-dot-btn.is-done { background: #52b8ac; }
.step-dot-btn.is-active { background: var(--teal-700); width: 44px; }

.step-media {
  width: 100%;
  max-height: 440px;
  background: #f0f6f6;
  overflow: hidden;
}
.step-media img {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  object-position: center 22%;
}
.step-body {
  padding: 22px 24px 24px;
}
.step-body h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 3.2vw, 28px);
  color: var(--ink);
}
.step-body p.step-text {
  margin: 0 0 18px;
  font-size: 17.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* Human Voice Audio Player */
.voice-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eaf8f5 0%, #eff5ff 100%);
  border: 1.5px solid #b5ded8;
  margin-bottom: 18px;
}
.voice-player-meta strong { display: block; font-size: 14.5px; color: var(--teal-900); }
.voice-player-meta small { font-size: 13px; color: var(--ink-muted); }

/* 30-second Calming Breathing Orb */
.breath-card {
  margin: 18px 0;
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1.5px solid #a2dad3;
  background: linear-gradient(145deg, #ecfbf8 0%, #eef5ff 100%);
  text-align: center;
}
.breath-card h3 { margin: 0 0 6px; font-size: 19px; color: var(--teal-900); }
.breath-card p { margin: 0 0 14px; font-size: 14.5px; color: var(--ink-soft); }
.breath-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 12px 0 16px;
}
.breath-ring {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(26, 160, 152, 0.18) 0%, rgba(26, 160, 152, 0.04) 70%);
}
.breath-orb {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #a6f7e8, #148b86);
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 28px rgba(20, 139, 134, 0.30);
  transition: transform 1.2s ease-in-out;
}
.breath-orb.is-running { animation: chafmBreath 12s ease-in-out infinite; }
@keyframes chafmBreath {
  0%, 100% { transform: scale(0.84); box-shadow: 0 8px 20px rgba(20, 139, 134, 0.22); }
  33% { transform: scale(1.22); box-shadow: 0 16px 36px rgba(20, 139, 134, 0.42); }
  50% { transform: scale(1.22); }
  88% { transform: scale(0.84); }
}
.breath-cue { font-size: 16px; font-weight: 850; color: var(--teal-900); min-height: 24px; }

/* ---- 3-Step Direct Help / Rescue anh Hải ---- */
.rescue-shell { max-width: 780px; margin: 0 auto; }
.rescue-hero {
  display: grid;
  grid-template-columns: 1fr 0.52fr;
  gap: 18px;
  align-items: center;
  padding: 20px 22px;
  border-radius: var(--radius-xl);
  border: 1.5px solid #bde0e2;
  background: linear-gradient(135deg, #ffffff 0%, #ebfaf7 65%, #eef5ff 100%);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.rescue-hero-photo {
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 3px solid #fff;
  box-shadow: var(--shadow-sm);
}
.rescue-hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }

.hotline-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.hotline-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 13px 10px;
  border-radius: 16px;
  text-decoration: none;
  font-weight: 850;
  border: 1.5px solid var(--danger-border);
  background: #fff;
  color: var(--danger-700);
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s, background 0.14s;
}
.hotline-tile strong { font-size: 20px; line-height: 1.1; }
.hotline-tile span { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.hotline-tile:hover { background: var(--danger-100); transform: translateY(-2px); }

.stepper {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stepper li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink-muted);
  font-size: 13.5px;
  font-weight: 800;
}
.stepper li.is-active {
  border-color: var(--teal-600);
  background: var(--teal-50);
  color: var(--teal-900);
  box-shadow: 0 4px 12px rgba(18, 133, 136, 0.12);
}
.stepper li.is-done {
  border-color: #96dbd0;
  background: #e6f9f4;
  color: #0e6556;
}
.stepper .s-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: #dfecee; color: var(--ink-soft);
  font-size: 12px; font-weight: 900; flex-shrink: 0;
}
.stepper li.is-active .s-num { background: var(--teal-700); color: #fff; }
.stepper li.is-done .s-num { background: #14967c; color: #fff; }

.card {
  padding: clamp(18px, 3vw, 26px);
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 8px; font-size: 21px; color: var(--ink); }
.card h3 { margin: 0 0 8px; font-size: 18px; color: var(--ink); }

.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.topic-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 800;
  text-align: left;
  transition: all 0.15s;
}
.topic-btn span.t-ico { font-size: 24px; flex-shrink: 0; }
.topic-btn:hover { border-color: var(--teal-500); background: var(--teal-50); }
.topic-btn.chosen {
  border-color: var(--teal-700);
  background: linear-gradient(135deg, #e5f8f4, #eef6ff);
  box-shadow: 0 6px 16px rgba(15, 110, 120, 0.14);
}
.topic-btn:last-child:nth-child(odd) { grid-column: span 2; }

.recipient-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #edf9f6, #eef4ff);
  border: 1.5px solid #b5deda;
  margin-bottom: 14px;
}
.recipient-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #c6e0e4;
  font-size: 13px;
  font-weight: 750;
  color: var(--teal-900);
}

.field { margin: 12px 0; }
.field label { display: block; font-size: 14px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.field input:not([type="checkbox"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 13px;
  border: 1.5px solid #b8d2d9;
  background: #fbfdfe;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:not([type="checkbox"]):focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--teal-600);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 133, 136, 0.16);
}
.field-hint { margin: 5px 0 0; font-size: 13px; color: var(--ink-muted); }

.check-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid #c6e0e4;
  background: #f6fbfb;
  margin: 10px 0;
  font-size: 14px;
  cursor: pointer;
}
.check-box input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--teal-700); flex-shrink: 0; }

.live-submit-panel {
  padding: 18px 20px;
  border-radius: 20px;
  border: 1.5px solid #7dd0be;
  background: linear-gradient(135deg, #ebfbf6 0%, #eef6ff 100%);
  margin: 14px 0;
}
.receipt-card {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 2px solid #2aa88c;
  background: #fff;
  box-shadow: 0 8px 22px rgba(20, 140, 114, 0.12);
}
.receipt-code {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  background: #dff7f0;
  color: #0b5d4d;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 15px;
  font-weight: 850;
}

.preview-box {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1.5px dashed #b5d2da;
  background: #f8fbfc;
  margin: 14px 0;
}
.preview-box summary { font-weight: 800; color: var(--teal-900); cursor: pointer; }
.preview-text {
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #d9e8ec;
  white-space: pre-wrap;
  font-size: 14px;
  color: var(--ink);
}

.notice {
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 650;
  margin: 12px 0;
}
.notice-info { background: #ebf7f6; border: 1px solid #b5deda; color: #104e4a; }
.notice-warn { background: #fff7e6; border: 1px solid #f0cf8c; color: #6e480e; }
.notice-error { background: #fff2f1; border: 1px solid #f0b6b3; color: #8c1e24; }
.notice-ok { background: #e6f9f1; border: 1px solid #8fd8bc; color: #0c5d49; }

/* ---- Signal (Nói bằng hình) ---- */
.signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.signal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 128px;
  padding: 16px;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-size: 16.5px;
  font-weight: 850;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.signal-btn .sig-ico { font-size: 36px; line-height: 1; }
.signal-btn:hover { transform: translateY(-2px); border-color: var(--teal-500); box-shadow: var(--shadow-md); }
.signal-btn.chosen { border-color: var(--danger-600); background: var(--danger-100); }

.signal-display {
  margin: 18px 0;
  padding: 28px 22px;
  border-radius: var(--radius-xl);
  border: 3px solid var(--danger-600);
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.signal-display .big-msg {
  font-size: clamp(24px, 5vw, 38px);
  font-weight: 950;
  line-height: 1.25;
  color: #9e1225;
  margin: 10px 0 14px;
}

/* ---- Adult Hub: EXACT CHAFM Center + 5 Arrows Preserved! ---- */
.adult-hub-diagram {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto auto auto;
  gap: 18px;
  padding: 26px 20px;
  border-radius: var(--radius-xl);
  border: 1.5px solid #cde3e8;
  background: radial-gradient(circle at 50% 50%, #e7faf7 0%, #f5fafc 60%, #ffffff 100%);
  box-shadow: var(--shadow-md);
  margin: 18px 0;
  align-items: center;
  justify-items: center;
}
.hub-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.hub-arrows path {
  stroke: #1b6f7a;
  stroke-width: 2.8;
  stroke-linecap: round;
  fill: none;
}
.hub-arrows marker path { fill: #1b6f7a; stroke: none; }

.hub-center {
  position: relative;
  z-index: 2;
  grid-column: 2;
  grid-row: 2;
  width: 146px;
  height: 146px;
  border-radius: 26px;
  background: linear-gradient(145deg, #104252 0%, #0d6d76 100%);
  border: 3px solid #74e5d6;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 16px 34px rgba(12, 68, 82, 0.28);
  text-align: center;
}
.hub-center img { width: 52px; height: 56px; }
.hub-center strong { font-size: 16px; letter-spacing: 0.08em; }
.hub-center small { font-size: 10.5px; color: #a8f2e8; font-weight: 700; }

.hub-tile {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 220px;
  min-height: 104px;
  padding: 15px 14px;
  border-radius: 20px;
  border: 0;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 3px;
  box-shadow: var(--shadow-md);
  transition: transform 0.16s, box-shadow 0.18s;
}
.hub-tile:hover { transform: translateY(-3px) scale(1.02); box-shadow: var(--shadow-lg); }
.hub-tile strong { font-size: 17px; font-weight: 850; }
.hub-tile small { font-size: 12.5px; opacity: 0.92; }

.hub-tile-info    { grid-column: 1; grid-row: 1; background: linear-gradient(145deg, #3584f7, #1c5ec9); }
.hub-tile-health  { grid-column: 3; grid-row: 1; background: linear-gradient(145deg, #43be5a, #218f3b); }
.hub-tile-support { grid-column: 1; grid-row: 3; background: linear-gradient(145deg, #9553ef, #6b2ec2); }
.hub-tile-monitor { grid-column: 2; grid-row: 3; background: linear-gradient(145deg, #ee8c24, #c6620c); }
.hub-tile-legal   { grid-column: 3; grid-row: 3; background: linear-gradient(145deg, #f2c042, #d49617); color: #192b36; }

/* Checklist */
.checklist-card {
  padding: 22px 24px;
  border-radius: var(--radius-xl);
  border: 1.5px solid #c3e1df;
  background: linear-gradient(135deg, #ffffff 0%, #eef9f6 100%);
  box-shadow: var(--shadow-sm);
  margin: 18px 0;
}
.checklist-card ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 10px; color: var(--ink-soft); }
.checklist-card strong { color: var(--ink); }

/* ---- Adult Account Page ---- */
.auth-shell { max-width: 680px; margin: 0 auto; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 16px;
  background: #e2eff2;
  margin: 14px 0 16px;
}
.auth-tabs button {
  border: 0;
  border-radius: 12px;
  min-height: 46px;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 850;
  white-space: nowrap;
  transition: all 0.16s;
}
.auth-tabs button[aria-pressed="true"] {
  background: #fff;
  color: var(--teal-900);
  box-shadow: 0 4px 12px rgba(13, 52, 66, 0.10);
}
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { padding-right: 88px !important; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  min-height: 36px; padding: 4px 11px; border-radius: 9px;
  border: 1px solid #c0d6dd; background: #eef6f9; color: var(--teal-900);
  font-size: 12px; font-weight: 800;
}
.pw-meter {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px; font-size: 12.5px; font-weight: 750; color: var(--ink-muted);
}
.pw-meter.is-strong { color: #0e785c; }

.signed-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  background: #ddf6ec; color: #0b634f;
  font-size: 13px; font-weight: 850; margin-bottom: 10px;
}

.history-list { display: grid; gap: 10px; margin-top: 12px; }
.history-item {
  padding: 15px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #f8fcfc;
}
.history-item-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.status-pill {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800;
  background: #dff6ed; color: #0b624f;
}

.danger-zone {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 15px;
  border: 1px solid #f0ccca;
  background: #fff9f8;
}
.danger-zone summary { font-weight: 800; color: #8c2328; cursor: pointer; }

/* ---- Referral Directory & Resources ---- */
.dir-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.dir-card {
  padding: 16px;
  border-radius: 18px;
  border: 1.5px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.dir-card h3 { margin: 0 0 5px; font-size: 16.5px; color: var(--ink); }
.dir-card p { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-muted); }

/* ---- Mobile Bottom Nav ---- */
.mobile-nav { display: none; }

/* ---- Privacy Screen (Natural Study Notes) ---- */
.privacy-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #f7f5ee;
  display: grid;
  place-items: center;
  padding: 20px;
}
.privacy-screen[hidden] { display: none !important; }
.privacy-notebook {
  max-width: 560px;
  width: 100%;
  background: #fff;
  border: 1px solid #e3dfd2;
  border-radius: 18px;
  padding: 26px 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.07);
}
.privacy-nb-tag {
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: #7e857e;
}
.privacy-nb-head h1 {
  margin: 6px 0 14px; font-size: 22px; color: #28322e;
  border-bottom: 2px solid #ece8db; padding-bottom: 10px;
}
.privacy-nb-list { margin: 0 0 22px; padding-left: 20px; color: #444f4b; line-height: 1.85; }
.privacy-nb-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid #efece0; padding-top: 12px; font-size: 12.5px; color: #838a85;
}
.privacy-nb-foot button {
  border: 1px solid #dad5c6; background: #f7f5ee; color: #636b66;
  border-radius: 8px; padding: 6px 14px; font-size: 12.5px; font-weight: 700; min-height: 36px;
}

/* ---- Accessibility Modes ---- */
body.large-text { font-size: 19px; }
body.large-text .btn { min-height: 52px; font-size: 17px; }
body.easy-read { letter-spacing: 0.015em; line-height: 1.85; }
body.easy-read .hero-lead, body.easy-read p { max-width: 62ch; }

body.high-contrast { background: #fff !important; color: #000 !important; }
body.high-contrast .app-shell,
body.high-contrast .hero-card,
body.high-contrast .domain-card,
body.high-contrast .scenario-card,
body.high-contrast .step-card,
body.high-contrast .card,
body.high-contrast .sos-banner,
body.high-contrast .companion-banner,
body.high-contrast .rescue-hero,
body.high-contrast .live-submit-panel,
body.high-contrast .checklist-card,
body.high-contrast .breath-card,
body.high-contrast .dir-card,
body.high-contrast .adult-hub-diagram {
  background: #fff !important;
  color: #000 !important;
  border: 2px solid #000 !important;
  box-shadow: none !important;
}
body.high-contrast .topbar,
body.high-contrast .btn-primary,
body.high-contrast .btn-danger,
body.high-contrast .btn-gmail,
body.high-contrast .hub-center,
body.high-contrast .hub-tile {
  background: #000 !important;
  color: #fff !important;
  border: 2px solid #000 !important;
  box-shadow: none !important;
}
body.high-contrast .a11y-btn,
body.high-contrast .btn-outline,
body.high-contrast .topic-btn,
body.high-contrast .signal-btn {
  background: #fff !important;
  color: #000 !important;
  border: 2px solid #000 !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---- Responsive (Mobile <= 760px) ---- */
@media (max-width: 760px) {
  .topbar-inner { padding: 10px 14px; }
  .live-chip { display: none; }
  .account-pill { padding: 6px 11px; font-size: 12.5px; min-height: 38px; max-width: 150px; }
  .desktop-nav { display: none; }
  .trust-strip { font-size: 11.5px; padding: 6px 10px; }

  .a11y-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 14px 2px;
  }
  .a11y-label { display: none; }
  .a11y-btn { width: 100%; min-height: 42px; font-size: 12.5px; padding: 7px 8px; white-space: nowrap; }

  .main-content { padding: 12px 14px calc(92px + env(safe-area-inset-bottom, 0px)); }

  .hero-card { grid-template-columns: 1fr; padding: 18px; gap: 16px; }
  .hero-photo-frame { aspect-ratio: 16 / 10; }
  .sos-banner { padding: 16px; }
  .sos-actions { width: 100%; }
  .sos-actions .btn { flex: 1 1 100%; }

  .domain-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .domain-card-body { padding: 12px 12px 14px; }
  .domain-card-body strong { font-size: 16.5px; }
  .domain-card-body small { font-size: 13px; }
  .domain-card.is-wide { flex-direction: column; }
  .domain-card.is-wide .domain-card-media { width: 100%; aspect-ratio: 16 / 9; min-height: 0; }
  .domain-card.is-wide .domain-card-body { padding: 14px 15px 16px; }

  .companion-banner { grid-template-columns: 1fr; padding: 16px; gap: 14px; }
  .companion-banner .btn-row .btn { flex: 1 1 100%; }

  .scenario-grid { grid-template-columns: 1fr; }
  .rescue-hero { grid-template-columns: 1fr; padding: 16px; }
  .stepper { grid-template-columns: 1fr; gap: 6px; }
  .topic-grid { grid-template-columns: 1fr; }
  .topic-btn:last-child:nth-child(odd) { grid-column: auto; }
  .dir-grid { grid-template-columns: 1fr; }
  .auth-tabs button { font-size: 13.5px; padding: 8px 6px; }

  /* Adult Hub compact radial layout on phones */
  .adult-hub-diagram { gap: 10px; padding: 16px 10px; }
  .hub-center { width: 96px; height: 96px; border-radius: 18px; }
  .hub-center img { width: 34px; height: 37px; }
  .hub-center strong { font-size: 12px; }
  .hub-center small { display: none; }
  .hub-tile { min-height: 82px; padding: 10px 6px; border-radius: 14px; }
  .hub-tile strong { font-size: 13.5px; }
  .hub-tile small { font-size: 11px; }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid #d2e4e8;
    box-shadow: 0 -8px 24px rgba(12, 54, 68, 0.10);
    padding: 5px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    gap: 4px;
  }
  .mnav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 800;
    padding: 4px 2px;
  }
  .mnav-btn.active {
    background: var(--teal-100);
    color: var(--teal-900);
  }
  .mnav-btn.mnav-sos.active {
    background: var(--danger-100);
    color: var(--danger-700);
  }
}


/* ============================================================================
   CHAFM 3.1 — Growth, Quiz, Safe Circle, A4 QR Poster, Safeguarding & Coordinator
   ============================================================================ */

/* Home 3-card Growth & Community Strip */
.growth-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.growth-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px 18px 20px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: linear-gradient(145deg, #ffffff 0%, #f1faf8 100%);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s, box-shadow 0.18s, border-color 0.16s;
}
.growth-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--teal-500); }
.growth-ico {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center; font-size: 22px;
  background: var(--teal-100); margin-bottom: 4px;
}
.growth-card strong { font-size: 17px; font-weight: 850; color: var(--ink); line-height: 1.3; }
.growth-card small { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; flex: 1; }

/* Filter Pills & Directory Controls */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.filter-pill {
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 750;
  transition: all 0.15s;
}
.filter-pill:hover { border-color: var(--teal-500); color: var(--teal-900); }
.filter-pill.active {
  background: var(--teal-900);
  border-color: var(--teal-900);
  color: #fff;
}
.dir-controls {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 12px;
  margin-bottom: 14px;
}

/* Interactive Safety Quiz & Badges */
.quiz-bar {
  height: 12px;
  border-radius: 999px;
  background: #e1eff1;
  overflow: hidden;
  margin: 10px 0 14px;
}
.quiz-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #16a08c, #0e6f78);
  transition: width 0.25s ease;
}
.badge-shelf {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.badge-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px dashed #cbe0e4;
  background: #f8fbfb;
  opacity: 0.62;
  transition: all 0.18s;
}
.badge-item.is-unlocked {
  opacity: 1;
  border-style: solid;
  border-color: #6bc9b5;
  background: linear-gradient(135deg, #e8fbf4, #fff9ec);
  box-shadow: 0 4px 12px rgba(18, 138, 118, 0.10);
}
.badge-item .b-ico { font-size: 26px; flex-shrink: 0; }
.badge-item strong { display: block; font-size: 14px; color: var(--ink); }
.badge-item small { display: block; font-size: 12px; color: var(--ink-muted); }

.quiz-story {
  padding: 14px 16px;
  border-radius: 16px;
  background: #f3faf9;
  border-left: 4px solid var(--teal-600);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
}
.quiz-choices { display: grid; gap: 10px; }
.quiz-choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  transition: all 0.15s;
}
.quiz-choice-btn:hover { border-color: var(--teal-500); background: var(--teal-50); }
.quiz-choice-btn .qc-letter {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--teal-100); color: var(--teal-900);
  font-size: 13px; font-weight: 900; flex-shrink: 0;
}
.quiz-choice-btn.is-safe { border-color: #199b7d; background: #e8fbf4; }
.quiz-choice-btn.is-safe .qc-letter { background: #199b7d; color: #fff; }
.quiz-choice-btn.is-try { border-color: #e4a336; background: #fff8ea; }
.quiz-choice-btn.is-try .qc-letter { background: #e4a336; color: #fff; }

/* Safe Circle Generator & Live Card Preview */
.community-shell { max-width: 980px; margin: 0 auto; }
.community-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.community-tabs button { min-width: 0; }
.community-split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  align-items: start;
}
.sc-row-edit {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 10px;
  margin: 10px 0;
}
.circle-card-preview {
  border-radius: 26px;
  overflow: hidden;
  border: 2px solid #b5deda;
  background: linear-gradient(155deg, #eefbf8 0%, #ffffff 55%, #fff7e9 100%);
  box-shadow: var(--shadow-lg);
}
.ccp-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(130deg, #093742, #12777a);
  color: #fff;
}
.ccp-head small { display: block; font-size: 11px; letter-spacing: 0.1em; color: #a4ebe3; font-weight: 800; }
.ccp-head h3 { margin: 2px 0 0; font-size: 19px; color: #fff; }
.ccp-reassure {
  margin: 14px 18px 10px;
  padding: 10px 13px;
  border-radius: 13px;
  background: #fff5e0;
  border: 1px solid #f0c97c;
  color: #6c450d;
  font-size: 13.5px;
  font-weight: 750;
}
.ccp-list {
  list-style: none;
  margin: 0;
  padding: 4px 18px 14px;
  display: grid;
  gap: 9px;
}
.ccp-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #d1e6e8;
}
.ccp-num {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--teal-700); color: #fff;
  font-weight: 900; font-size: 13px; flex-shrink: 0;
}
.ccp-list strong { display: block; font-size: 14.5px; color: var(--ink); line-height: 1.25; }
.ccp-list small { display: block; font-size: 13px; color: var(--teal-700); font-weight: 750; }
.ccp-hotlines {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 18px 12px;
  padding: 11px 10px;
  border-radius: 14px;
  background: var(--danger-100);
  border: 1px solid var(--danger-border);
  text-align: center;
  font-size: 12px;
  color: #6b242c;
}
.ccp-hotlines strong { display: block; font-size: 18px; color: var(--danger-700); }
.ccp-foot { text-align: center; margin: 0 0 14px; font-size: 12px; color: var(--ink-muted); font-weight: 700; }

/* A4 Scannable QR Poster */
.a4-poster {
  background: #fff;
  border: 2px solid #b5deda;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.poster-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 26px 28px;
  background: linear-gradient(128deg, #093742 0%, #12777a 100%);
  color: #fff;
}
.poster-tag { display: block; font-size: 12px; letter-spacing: 0.12em; color: #a4ebe3; font-weight: 850; }
.poster-header h2 { margin: 4px 0 6px; font-size: clamp(24px, 3.6vw, 34px); color: #fff; letter-spacing: -0.02em; }
.poster-header p { margin: 0; font-size: 15px; color: #dcfaf6; }
.poster-mid {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 24px;
  align-items: center;
  padding: 26px 28px;
}
.poster-qr-frame {
  padding: 16px;
  border-radius: 20px;
  border: 2px solid #9bd8d1;
  background: #f2fbf9;
  text-align: center;
}
.poster-qr-frame svg { width: 100%; height: auto; display: block; border-radius: 10px; }
.poster-qr-frame span { display: block; margin-top: 10px; font-size: 13.5px; font-weight: 850; color: var(--teal-900); }
.poster-benefits h3 { margin: 0 0 10px; font-size: 20px; color: var(--ink); }
.poster-benefits ul { margin: 0; padding-left: 18px; display: grid; gap: 10px; font-size: 15px; color: var(--ink-soft); }
.poster-footer { padding: 0 28px 24px; }
.poster-hotlines {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: var(--danger-100);
  border: 1.5px solid var(--danger-border);
  text-align: center;
}
.poster-hotlines strong { display: block; font-size: 24px; color: var(--danger-700); }
.poster-hotlines span { font-size: 13px; font-weight: 700; color: #63272e; }
.poster-url { text-align: center; margin: 12px 0 0; font-size: 13.5px; font-weight: 750; color: var(--ink-muted); overflow-wrap: anywhere; }

/* Safeguarding Charter & Coordinator KPIs */
.safeguard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.kpi-card {
  padding: 16px 14px;
  border-radius: 18px;
  border: 1.5px solid var(--border);
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.kpi-card strong { display: block; font-size: 28px; font-weight: 900; color: var(--ink); line-height: 1.1; }
.kpi-card span { font-size: 12.5px; font-weight: 700; color: var(--ink-muted); }
.kpi-warn { background: #fff8eb; border-color: #f0cf8c; }
.kpi-warn strong { color: #b5650c; }
.kpi-info { background: #ecf6ff; border-color: #b4d4f3; }
.kpi-info strong { color: #165ea8; }
.kpi-ok { background: #e9faf3; border-color: #96dec0; }
.kpi-ok strong { color: #0c6e53; }

.status-received { background: #fff3d6; color: #8c5209; }
.status-ack { background: #e3f2ff; color: #135494; }
.status-progress { background: #ece7ff; color: #4f2da3; }
.status-resolved { background: #dcf7ec; color: #0b634f; }

.coord-update-form {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  align-items: center;
}
.coord-update-form select,
.coord-update-form input {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 11px;
  border: 1.5px solid #b8d2d9;
  background: #fff;
}

body.high-contrast .growth-card,
body.high-contrast .badge-item,
body.high-contrast .quiz-choice-btn,
body.high-contrast .circle-card-preview,
body.high-contrast .a4-poster,
body.high-contrast .kpi-card {
  background: #fff !important;
  color: #000 !important;
  border: 2px solid #000 !important;
  box-shadow: none !important;
}

@media (max-width: 760px) {
  .growth-grid { grid-template-columns: 1fr; }
  .dir-controls { grid-template-columns: 1fr; }
  .badge-shelf { grid-template-columns: 1fr; }
  .community-split { grid-template-columns: 1fr; }
  .community-tabs { gap: 5px; padding: 5px; }
  .community-tabs button { white-space: normal; font-size: 12px; line-height: 1.25; padding: 8px 4px; min-height: 44px; }
  .sc-row-edit { grid-template-columns: 1fr; }
  .poster-header { flex-direction: column; text-align: center; padding: 20px 16px; }
  .poster-mid { grid-template-columns: 1fr; padding: 18px 16px; }
  .poster-hotlines { grid-template-columns: 1fr; }
  .safeguard-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .coord-update-form { grid-template-columns: 1fr; }
}

/* Dedicated A4 Print Layout for Poster QR & Safe Circle Card */
@media print {
  body { background: #fff !important; }
  .topbar, .trust-strip, .desktop-nav, .a11y-bar, .mobile-nav, .no-print, .skip-link { display: none !important; }
  .app-shell { box-shadow: none !important; max-width: 100% !important; background: #fff !important; }
  .main-content { padding: 0 !important; }
  .a4-poster, .circle-card-preview { box-shadow: none !important; break-inside: avoid; }
}
