/* ============================================================
   OBS Assessment Tool — shared design system
   Covers: landing page (index.html) + future app (app.html)
   No external fonts or CDN dependencies.
   All contrast ratios verified ≥ 4.5:1 (WCAG AA).
   ============================================================ */

/* ── Custom properties ───────────────────────────────────── */
:root {
  /* Brand palette */
  --clr-navy:        #0f2545;   /* primary brand; L=0.019 */
  --clr-navy-hover:  #1a3560;
  --clr-accent:      #1c5db0;   /* interactive accent; white on this = 6.5:1 */
  --clr-accent-hover:#164a8a;
  --clr-sky-tint:    #dbeafe;   /* very light sky; navy text on this = 14:1 */

  /* Semantic surface / text */
  --clr-surface:     #ffffff;
  --clr-bg:          #f1f5f9;
  --clr-bg-alt:      #e8eef5;
  --clr-text:        #1e293b;   /* L=0.040; on white = 13.5:1 */
  --clr-text-muted:  #475569;   /* L=0.098; on white = 7.3:1 */
  --clr-text-light:  #f8fafc;   /* for dark backgrounds */
  --clr-border:      #cbd5e1;
  --clr-border-focus:#1c5db0;

  /* Status colours */
  --clr-compliant:   #16a34a;
  --clr-compliant-bg:#f0fdf4;
  --clr-partial:     #7c3aed;
  --clr-partial-bg:  #faf5ff;
  --clr-warning:     #d97706;
  --clr-warning-bg:  #fffbeb;
  --clr-danger:      #dc2626;
  --clr-danger-bg:   #fef2f2;
  --clr-na:          #64748b;
  --clr-na-bg:       #f8fafc;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code",
               Consolas, "Liberation Mono", monospace;

  /* Type scale (fluid-friendly rem steps) */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;

  /* Spacing scale */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;

  /* Border radius */
  --radius-sm: 0.25rem;
  --radius:    0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Elevation */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.10), 0 1px 2px -1px rgb(0 0 0 / 0.06);
  --shadow:    0 4px 6px -1px rgb(0 0 0 / 0.10), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.10), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.10), 0 8px 10px -6px rgb(0 0 0 / 0.04);

  /* Transitions */
  --t-fast:   100ms ease;
  --t-base:   160ms ease;
  --t-slow:   240ms ease;
}

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--clr-text);
  background: var(--clr-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--clr-accent); text-decoration: underline; }
a:hover { color: var(--clr-accent-hover); }

/* ── Accessibility — focus styles ────────────────────────── */
:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--clr-border-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── Skip link ───────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: var(--sp-4);
  z-index: 9999;
  padding: var(--sp-2) var(--sp-4);
  background: var(--clr-navy);
  color: var(--clr-text-light);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--t-base);
}
.skip-link:focus-visible {
  transform: translateY(0);
  outline-color: var(--clr-text-light);
}

/* ── Layout — container ──────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: var(--sp-6);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base),
              border-color var(--t-base), box-shadow var(--t-base),
              transform var(--t-fast);
  white-space: nowrap;
}

/* Primary: works on light backgrounds (accent bg + white text = 6.5:1) */
.btn-primary {
  background: var(--clr-accent);
  color: var(--clr-surface);
  border-color: var(--clr-accent);
}
.btn-primary:hover {
  background: var(--clr-accent-hover);
  border-color: var(--clr-accent-hover);
  color: var(--clr-surface);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }

/* Primary variant for dark backgrounds (sky-tint bg + navy text = 14:1)
   Applied to hero section and the open-source panel which share dark navy bg */
.hero .btn-primary,
.oss-panel .btn-primary {
  background: var(--clr-sky-tint);
  color: var(--clr-navy);
  border-color: var(--clr-sky-tint);
}
.hero .btn-primary:hover,
.oss-panel .btn-primary:hover {
  background: #bfdbfe;
  border-color: #bfdbfe;
  color: var(--clr-navy);
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.25);
}

/* Secondary (outlined) */
.btn-secondary {
  background: transparent;
  color: var(--clr-accent);
  border-color: var(--clr-accent);
}
.btn-secondary:hover {
  background: var(--clr-accent);
  color: var(--clr-surface);
  text-decoration: none;
}

/* ── Site nav / header ───────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--clr-navy);
  border-bottom: 1px solid rgba(255 255 255 / 0.10);
  box-shadow: var(--shadow-xs);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: var(--sp-3);
}

.nav-brand {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--clr-text-light);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-brand:hover { color: var(--clr-sky-tint); text-decoration: none; }

/* Language toggle */
.lang-toggle {
  display: flex;
  gap: var(--sp-1);
  align-items: center;
}

.lang-toggle button {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  background: transparent;
  color: rgba(248 250 252 / 0.70);
  border: 1px solid rgba(255 255 255 / 0.25);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base),
              border-color var(--t-base);
}

.lang-toggle button:hover {
  background: rgba(255 255 255 / 0.12);
  color: var(--clr-text-light);
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--clr-accent);
  color: var(--clr-text-light);
  border-color: var(--clr-accent);
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  background-color: var(--clr-navy);
  background-image:
    radial-gradient(ellipse at 15% 60%, rgba(28, 93, 176, 0.40) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(56, 189, 248, 0.08) 0%, transparent 50%),
    linear-gradient(rgba(255 255 255 / 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255 255 255 / 0.025) 1px, transparent 1px);
  background-size: auto, auto, 64px 64px, 64px 64px;
  padding-block: var(--sp-24) var(--sp-20);
  text-align: center;
  color: var(--clr-text-light);
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
  padding: var(--sp-1) var(--sp-4);
  background: rgba(28, 93, 176, 0.45);
  border: 1px solid rgba(56, 189, 248, 0.30);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: #93c5fd;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-6);
  color: var(--clr-text-light);
}

.hero__desc {
  font-size: clamp(var(--text-base), 2vw, var(--text-xl));
  line-height: 1.65;
  color: rgba(248 250 252 / 0.80);
  max-width: 640px;
  margin-inline: auto;
  margin-bottom: var(--sp-10);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-12);
}

.hero__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
}

.badge {
  padding: var(--sp-1) var(--sp-3);
  background: rgba(255 255 255 / 0.08);
  border: 1px solid rgba(255 255 255 / 0.15);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  color: rgba(248 250 252 / 0.75);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* ── Content sections ────────────────────────────────────── */
.section {
  padding-block: var(--sp-20);
}

.section--alt {
  background: var(--clr-bg);
}

.section__header {
  max-width: 640px;
  margin-bottom: var(--sp-12);
}

.section__header.centered {
  text-align: center;
  margin-inline: auto;
}

.section__label {
  display: inline-block;
  margin-bottom: var(--sp-3);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--clr-accent);
}

.section h2 {
  font-size: clamp(var(--text-2xl), 3.5vw, var(--text-4xl));
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--clr-navy);
  margin-bottom: var(--sp-4);
}

.section__desc {
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--clr-text-muted);
}

/* ── Feature card grid ───────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-6);
}

.feature-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-card__icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-bg);
  border-radius: var(--radius);
  margin-bottom: var(--sp-4);
  font-size: var(--text-xl);
}

.feature-card h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--clr-navy);
  margin-bottom: var(--sp-2);
}

.feature-card p {
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--clr-text-muted);
}

/* Ghost / outline variant for use on dark hero background */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  background: transparent;
  color: rgba(248, 250, 252, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.30);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-base), border-color var(--t-base),
              color var(--t-base), transform var(--t-fast);
  white-space: nowrap;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.55);
  color: var(--clr-text-light);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-ghost:active { transform: translateY(0); }

/* ── How-it-works steps ──────────────────────────────────── */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-8);
  counter-reset: step-counter;
}

.step {
  position: relative;
  padding-left: var(--sp-16);
}

.step__number {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-navy);
  color: var(--clr-text-light);
  border-radius: 50%;
  font-size: var(--text-sm);
  font-weight: 800;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.step h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--clr-navy);
  margin-bottom: var(--sp-2);
  padding-top: var(--sp-2);
}

.step p {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--clr-text-muted);
}

/* ── Open-source section ─────────────────────────────────── */
.oss-panel {
  background: var(--clr-navy);
  border-radius: var(--radius-xl);
  padding: var(--sp-12) var(--sp-10);
  text-align: center;
  color: var(--clr-text-light);
}

.oss-panel h2 {
  color: var(--clr-text-light);
}

.oss-panel .section__desc {
  color: rgba(248 250 252 / 0.75);
  max-width: 600px;
  margin-inline: auto;
  margin-bottom: var(--sp-8);
}

.oss-panel .section__label {
  color: #93c5fd;
}

/* ── Footer ──────────────────────────────────────────────── */
#site-footer {
  background: var(--clr-navy);
  border-top: 1px solid rgba(255 255 255 / 0.08);
  padding-block: var(--sp-8);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.footer-copy {
  font-size: var(--text-sm);
  color: rgba(248 250 252 / 0.55);
}

.footer-copy a {
  color: rgba(248 250 252 / 0.80);
  text-decoration: none;
  font-weight: 600;
}
.footer-copy a:hover {
  color: var(--clr-sky-tint);
  text-decoration: underline;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  color: rgba(248 250 252 / 0.45);
}

/* ── ─────────────────────────────────────────────────────── */
/*    APP STYLES (shared with app.html, used in later tasks) */
/* ── ─────────────────────────────────────────────────────── */

/* App layout shell */
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header header"
    "sidebar main";
  min-height: 100dvh;
}

.app-header {
  grid-area: header;
  background: var(--clr-navy);
  border-bottom: 1px solid rgba(255 255 255 / 0.10);
  padding-block: var(--sp-3);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  overflow-y: auto;
  padding: var(--sp-6) 0;
}

.sidebar-nav { list-style: none; }

.sidebar-nav__item { display: block; }

.sidebar-nav__link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--clr-text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--t-base), color var(--t-base),
              border-color var(--t-base);
}
.sidebar-nav__link:hover {
  background: var(--clr-bg);
  color: var(--clr-text);
}
.sidebar-nav__link.is-active {
  background: #eff6ff;
  color: var(--clr-accent);
  border-left-color: var(--clr-accent);
  font-weight: 600;
}

.sidebar-section-label {
  padding: var(--sp-5) var(--sp-6) var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-text-muted);
}

/* Progress indicator in sidebar */
.sidebar-progress {
  padding: var(--sp-4) var(--sp-6);
}
.sidebar-progress__bar-track {
  height: 4px;
  background: var(--clr-border);
  border-radius: 999px;
  overflow: hidden;
}
.sidebar-progress__bar-fill {
  height: 100%;
  background: var(--clr-accent);
  border-radius: 999px;
  transition: width var(--t-slow);
}
.sidebar-progress__label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  margin-bottom: var(--sp-1);
}

/* ── Main content area ───────────────────────────────────── */
.app-main {
  grid-area: main;
  overflow-y: auto;
  padding: var(--sp-8) var(--sp-10);
  background: var(--clr-bg);
}

/* ── Question card ───────────────────────────────────────── */
.question-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6) var(--sp-8);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.question-card:hover { box-shadow: var(--shadow-sm); }
.question-card.is-answered { border-left: 4px solid var(--clr-compliant); }
.question-card.is-partial  { border-left: 4px solid var(--clr-partial); }
.question-card.is-non-compliant { border-left: 4px solid var(--clr-danger); }
.question-card.is-na       { border-left: 4px solid var(--clr-na); }

.question-card__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.question-card__id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--clr-text-muted);
  background: var(--clr-bg);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
}

.question-card__critical {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--clr-danger);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.question-card__text {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--clr-text);
  line-height: 1.6;
  margin-bottom: var(--sp-5);
}

.question-card__refs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.ref-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 1px var(--sp-2);
  background: var(--clr-bg-alt);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  color: var(--clr-text-muted);
}

/* ── Status radio group ──────────────────────────────────── */
.status-radios {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.status-radio {
  position: relative;
}

.status-radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.status-radio label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 2px solid var(--clr-border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-base), border-color var(--t-base),
              color var(--t-base), box-shadow var(--t-base);
  user-select: none;
}
.status-radio label:hover {
  border-color: var(--clr-accent);
  background: #eff6ff;
}
.status-radio input:focus-visible + label {
  outline: 3px solid var(--clr-border-focus);
  outline-offset: 2px;
}

/* Selected states per status */
.status-radio--compliant input:checked + label {
  background: var(--clr-compliant-bg);
  border-color: var(--clr-compliant);
  color: #15803d;
}
.status-radio--partial input:checked + label {
  background: var(--clr-partial-bg);
  border-color: var(--clr-partial);
  color: #6d28d9;
}
.status-radio--non-compliant input:checked + label {
  background: var(--clr-danger-bg);
  border-color: var(--clr-danger);
  color: #b91c1c;
}
.status-radio--na input:checked + label {
  background: var(--clr-na-bg);
  border-color: var(--clr-na);
  color: var(--clr-na);
}

/* ── Dashboard ───────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.stat-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-6);
  box-shadow: var(--shadow-xs);
}
.stat-card__value {
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: 1;
  color: var(--clr-navy);
  font-variant-numeric: tabular-nums;
}
.stat-card__label {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  margin-top: var(--sp-1);
}
.stat-card--compliant .stat-card__value { color: var(--clr-compliant); }
.stat-card--partial .stat-card__value   { color: var(--clr-partial); }
.stat-card--danger .stat-card__value    { color: var(--clr-danger); }

.domain-score-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--clr-border);
}
.domain-score-bar:last-child { border-bottom: none; }
.domain-score-bar__name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clr-text);
}
.domain-score-bar__track {
  height: 8px;
  background: var(--clr-border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: var(--sp-1);
}
.domain-score-bar__fill {
  height: 100%;
  background: var(--clr-accent);
  border-radius: 999px;
  transition: width var(--t-slow);
}
.domain-score-bar__pct {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--clr-text);
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
  text-align: right;
}

/* ── Dashboard — domain drill-down ──────────────────────────────── */
.obs-domain-details {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.obs-domain-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
  outline: none;
}
.obs-domain-summary::-webkit-details-marker { display: none; }
.obs-domain-summary::marker { display: none; }

.obs-domain-summary:hover {
  background: var(--clr-bg);
}

.obs-domain-details[open] > .obs-domain-summary {
  background: var(--clr-bg);
}

/* ── Utility classes ─────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.mt-auto { margin-top: auto; }

/* ── Responsive adjustments ──────────────────────────────── */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }
  .sidebar { display: none; }
  .sidebar.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 200;
    width: min(320px, 90vw);
    box-shadow: var(--shadow-lg);
  }
  .app-main { padding: var(--sp-6) var(--sp-4); }
}

@media (max-width: 640px) {
  .container { padding-inline: var(--sp-4); }
  .hero { padding-block: var(--sp-16) var(--sp-12); }
  .section { padding-block: var(--sp-12); }
  .oss-panel { padding: var(--sp-8) var(--sp-5); }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .steps { gap: var(--sp-10); }
  .step { padding-left: var(--sp-14); }
}

/* ── Questionnaire: sidebar domain buttons ───────────────── */
button.sidebar-nav__link {
  width: 100%;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: left;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--clr-text-muted);
  transition: background var(--t-base), color var(--t-base), border-color var(--t-base);
}
button.sidebar-nav__link:hover {
  background: var(--clr-bg);
  color: var(--clr-text);
}
button.sidebar-nav__link.is-active {
  background: #eff6ff;
  color: var(--clr-accent);
  border-left-color: var(--clr-accent);
  font-weight: 600;
}
.sidebar-domain-title { flex: 1; min-width: 0; }
.sidebar-domain-prog {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--clr-text-muted);
  white-space: nowrap;
}

/* ── Questionnaire: domain panel ─────────────────────────── */
.domain-panel {
  padding: var(--sp-8) var(--sp-10);
  max-width: 960px;
}
.domain-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--clr-navy);
  margin-bottom: var(--sp-6);
}

/* Question number badge */
.question-card__number {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--clr-text-muted);
}

/* Good practice collapsible */
.good-practice {
  margin-bottom: var(--sp-4);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.good-practice__summary {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clr-accent);
  cursor: pointer;
  list-style: none;
  background: var(--clr-bg);
}
.good-practice__summary::-webkit-details-marker { display: none; }
.good-practice[open] .good-practice__summary {
  border-bottom: 1px solid var(--clr-border);
}
.good-practice__list {
  padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-8);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--clr-text-muted);
  list-style: disc;
}

/* Follow-up prompt */
.question-card__followup {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  margin-bottom: var(--sp-4);
  font-style: italic;
  line-height: 1.6;
}

/* Status fieldset — reset default browser styling */
.status-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 var(--sp-4) 0;
}
.status-fieldset legend {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clr-text);
  margin-bottom: var(--sp-2);
  padding: 0;
  float: left;
  width: 100%;
}
.status-fieldset legend + * { clear: both; }

/* Form fields inside domain panel */
.domain-panel .form-group {
  margin-bottom: var(--sp-4);
}
.domain-panel .form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clr-text);
  margin-bottom: var(--sp-2);
}
.domain-panel .form-group input[type="text"],
.domain-panel .form-group input[type="number"],
.domain-panel .form-group input[type="date"],
.domain-panel .form-group select,
.domain-panel .form-group textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--clr-text);
  background: var(--clr-surface);
  transition: border-color var(--t-base), box-shadow var(--t-base);
  resize: vertical;
}
.domain-panel .form-group input:focus,
.domain-panel .form-group select:focus,
.domain-panel .form-group textarea:focus {
  outline: none;
  border-color: var(--clr-border-focus);
  box-shadow: 0 0 0 3px rgba(28, 93, 176, 0.15);
}

/* Custom question card */
.question-card--custom { border-left: 4px dashed var(--clr-border); }
.question-card__custom-label {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  font-style: italic;
}

/* Remediation section */
.remediation-group {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px dashed var(--clr-border);
}
.remediation-group__label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-text-muted);
  margin-bottom: var(--sp-3);
}
.remediation-row {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.form-group--inline {
  flex: 1 1 160px;
  min-width: 0;
}

/* Domain narrative */
.narrative-section {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6) var(--sp-8);
  margin-top: var(--sp-8);
}
.narrative-section__title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--clr-navy);
  margin-bottom: var(--sp-3);
}
.narrative-section__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clr-text);
  margin-bottom: var(--sp-2);
}
.narrative-textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--clr-text);
  background: var(--clr-surface);
  resize: vertical;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.narrative-textarea:focus {
  outline: none;
  border-color: var(--clr-border-focus);
  box-shadow: 0 0 0 3px rgba(28, 93, 176, 0.15);
}

@media (max-width: 900px) {
  .domain-panel { padding: var(--sp-6) var(--sp-4); }
  .remediation-row { flex-direction: column; }
}

/* ── Custom question — add/remove controls ───────────────── */
.add-custom-question-btn {
  display: block;
  margin: var(--sp-4) 0 var(--sp-2);
  font-size: var(--text-sm);
}

.custom-question-remove-btn {
  margin-left: auto;
  padding: 2px var(--sp-3);
  font-size: var(--text-xs);
  font-weight: 600;
  background: transparent;
  color: var(--clr-danger);
  border: 1px solid var(--clr-danger);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--t-base), color var(--t-base);
  white-space: nowrap;
}
.custom-question-remove-btn:hover {
  background: var(--clr-danger-bg);
}

/* ── Template editor ─────────────────────────────────────── */
.editor-outer {
  background: var(--clr-bg);
  min-height: calc(100dvh - 148px);
  padding: var(--sp-8) var(--sp-6);
}

.editor-layout {
  max-width: 960px;
  margin-inline: auto;
}

/* Toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-6);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-xs);
}
.editor-toolbar__group {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.editor-toolbar__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clr-text-muted);
  white-space: nowrap;
}
.editor-toolbar__select {
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--clr-text);
  background: var(--clr-surface);
}
.editor-toolbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.editor-btn {
  white-space: nowrap;
}

/* Validation result banner */
.editor-val-result {
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-5);
  line-height: 1.6;
}
.editor-val-result--ok {
  background: var(--clr-compliant-bg);
  border: 1px solid var(--clr-compliant);
  color: #15803d;
}
.editor-val-result--error {
  background: var(--clr-danger-bg);
  border: 1px solid var(--clr-danger);
  color: #b91c1c;
}
.editor-val-result ul {
  list-style: disc;
  padding-left: var(--sp-6);
  margin-top: var(--sp-2);
}

/* Body sections */
.editor-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.editor-section {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

/* Fieldset / legend */
.editor-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}
.editor-legend {
  display: block;
  width: 100%;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--clr-text-muted);
  background: var(--clr-bg);
  border-bottom: 1px solid var(--clr-border);
  padding: var(--sp-3) var(--sp-6);
}

/* Metadata grid */
.editor-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4) var(--sp-6);
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
}
.editor-meta-grid .editor-field-group:nth-child(5),
.editor-meta-grid .editor-field-group:nth-child(6) {
  /* description spans full row on wide screens */
  grid-column: 1 / -1;
}
@media (max-width: 640px) {
  .editor-meta-grid { grid-template-columns: 1fr; }
  .editor-meta-grid .editor-field-group { grid-column: 1; }
}

/* Field group (label + input) */
.editor-field-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.editor-field-group label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clr-text);
}
.editor-field-group input[type="text"],
.editor-field-group input[type="number"],
.editor-field-group textarea,
.editor-field-group select {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--clr-text);
  background: var(--clr-surface);
  resize: vertical;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.editor-field-group input:focus,
.editor-field-group textarea:focus,
.editor-field-group select:focus {
  outline: none;
  border-color: var(--clr-border-focus);
  box-shadow: 0 0 0 3px rgba(28, 93, 176, 0.15);
}
.editor-field-group input[type="checkbox"] {
  width: auto;
  margin-top: var(--sp-2);
  cursor: pointer;
  width: 1.1em;
  height: 1.1em;
}

/* Section heading row */
.editor-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  background: var(--clr-bg);
  border-bottom: 1px solid var(--clr-border);
}
.editor-section-heading h3 {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--clr-text-muted);
  margin: 0;
}

/* Domain card (uses <details>) */
.editor-domain-details {
  border-bottom: 1px solid var(--clr-border);
}
.editor-domain-details:last-of-type {
  border-bottom: none;
}
.editor-domain-summary {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--clr-surface);
  transition: background var(--t-fast);
}
.editor-domain-summary::-webkit-details-marker { display: none; }
.editor-domain-summary::marker { display: none; }
.editor-domain-summary:hover { background: var(--clr-bg); }
.editor-domain-details[open] > .editor-domain-summary {
  background: var(--clr-bg);
  border-bottom: 1px solid var(--clr-border);
}

.editor-domain-chevron {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  transition: transform var(--t-fast);
}
.editor-domain-details[open] .editor-domain-chevron {
  transform: rotate(90deg);
}
.editor-domain-summary__title {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clr-text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-domain-move-btns {
  display: flex;
  gap: var(--sp-1);
}

.editor-icon-btn {
  padding: 2px var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 700;
  background: transparent;
  color: var(--clr-text-muted);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  line-height: 1.5;
  transition: background var(--t-fast), color var(--t-fast);
}
.editor-icon-btn:hover {
  background: var(--clr-bg-alt);
  color: var(--clr-text);
}
.editor-icon-btn--danger {
  color: var(--clr-danger);
  border-color: var(--clr-danger);
}
.editor-icon-btn--danger:hover {
  background: var(--clr-danger-bg);
}

.editor-domain-body {
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
}
.editor-domain-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4) var(--sp-6);
  margin-bottom: var(--sp-5);
}
@media (max-width: 640px) {
  .editor-domain-fields { grid-template-columns: 1fr; }
}

/* Questions within a domain */
.editor-questions-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.editor-questions-heading h4 {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-text-muted);
  margin: 0;
}
.editor-questions-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

/* Question card (also uses <details>) */
.editor-question-details {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.editor-question-summary {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--clr-bg);
  transition: background var(--t-fast);
}
.editor-question-summary::-webkit-details-marker { display: none; }
.editor-question-summary::marker { display: none; }
.editor-question-summary:hover { background: var(--clr-bg-alt); }
.editor-question-details[open] > .editor-question-summary {
  border-bottom: 1px solid var(--clr-border);
}

.editor-question-chevron {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  transition: transform var(--t-fast);
}
.editor-question-details[open] .editor-question-chevron {
  transform: rotate(90deg);
}
.editor-question-summary__id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 2px var(--sp-2);
  color: var(--clr-text-muted);
}
.editor-question-summary__preview {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Question body fields */
.editor-question-body {
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.editor-question-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-4);
}
.editor-question-row--meta {
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  align-items: end;
}
@media (max-width: 640px) {
  .editor-question-row,
  .editor-question-row--meta { grid-template-columns: 1fr 1fr; }
}
.editor-bi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4) var(--sp-6);
}
@media (max-width: 640px) {
  .editor-bi-grid { grid-template-columns: 1fr; }
}

/* Collapsible sub-sections within question */
.editor-subsection {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.editor-subsection summary {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clr-accent);
  cursor: pointer;
  list-style: none;
  background: var(--clr-bg);
}
.editor-subsection summary::-webkit-details-marker { display: none; }
.editor-subsection[open] summary {
  border-bottom: 1px solid var(--clr-border);
}
.editor-subsection__body {
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* Add domain / add question buttons */
.editor-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border: 2px dashed var(--clr-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--clr-text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  width: 100%;
  transition: border-color var(--t-base), color var(--t-base), background var(--t-base);
}
.editor-add-btn:hover {
  border-color: var(--clr-accent);
  color: var(--clr-accent);
  background: #eff6ff;
}
.editor-add-domain-btn {
  margin: var(--sp-5) var(--sp-6) var(--sp-6);
  width: calc(100% - var(--sp-12));
}

/* Print: hide editor */
@media print {
  #tab-editor { display: none !important; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a, a:visited { text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
  a[href^="#"]::after,
  a[href^="javascript"]::after { content: ""; }

  .site-header,
  .sidebar,
  .lang-toggle,
  .skip-link,
  .btn-primary,
  .btn-secondary,
  .status-radios { display: none !important; }

  .app-shell {
    display: block;
  }

  .app-main {
    padding: 0;
  }

  .question-card {
    border: 1px solid #ccc;
    page-break-inside: avoid;
    margin-bottom: 1rem;
  }

  h1, h2, h3 {
    page-break-after: avoid;
    color: #000 !important;
  }

  .dashboard-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .stat-card {
    border: 1px solid #ccc;
    flex: 1 1 140px;
    page-break-inside: avoid;
  }

  #site-footer {
    border-top: 1px solid #ccc;
    padding-top: 0.5rem;
  }

  body {
    font-size: 11pt;
    line-height: 1.5;
  }

  @page {
    margin: 20mm 15mm;
  }
}
