/* ============================================================
   CONTROLUP ControlUp Stories — styles.css
   ============================================================
   TABLE OF CONTENTS
   1. BRAND TOKENS (CSS custom properties — edit here to retune)
   2. RESET & BASE
   3. LAYOUT PRIMITIVES
   4. TYPOGRAPHY SCALE
   5. COMPONENTS — Nav / Header
   6. COMPONENTS — Hero & Stat Chips
   7. COMPONENTS — Search & Filter Controls
   8. COMPONENTS — Story Cards (Gallery)
   9. COMPONENTS — Story Detail
   10. COMPONENTS — Pillar Pipeline
   11. COMPONENTS — Downloads
   12. COMPONENTS — File Viewer Modal
   13. COMPONENTS — ROI Calculator
   14. COMPONENTS — Add Story
   15. COMPONENTS — Badges & Tags
   16. COMPONENTS — Buttons
   17. COMPONENTS — Alerts & Callouts
   18. ANIMATIONS & TRANSITIONS
   19. SCROLLBAR
   20. PRINT STYLESHEET
   ============================================================ */

/* ============================================================
   1. BRAND TOKENS
   Retune anything here — all color, radius, shadow, and
   spacing decisions flow from these variables.
   ============================================================ */
:root {
  /* --- Core palette (ControlUp navy) --- */
  --bg-base:        #08111D;   /* deepest background — ControlUp navy */
  --bg-elevated:    #0C1928;   /* card / surface */
  --bg-raised:      #122236;   /* raised card / modal */
  --bg-overlay:     #1C3147;   /* hover states / subtle fills */
  --bg-glass:       rgba(12, 25, 40, 0.72);  /* glassmorphism */

  /* --- Brand accent: ControlUp Pink (primary; use sparingly, ~5–10%) --- */
  --brand-purple:   #E5005F;   /* primary CTA, links, key highlight */
  --brand-purple-h: #FF5D97;   /* hover (pink-soft) */
  --brand-purple-d: #B30049;   /* pressed / darker */
  --brand-purple-bg: rgba(229, 0, 95, 0.12); /* tinted fill */
  --brand-purple-glow: rgba(229, 0, 95, 0.32);

  /* --- ControlUp secondary brand (charts/gradients) --- */
  --cu-orange: #FF7B1A;
  --cu-gold:   #FFB400;
  --cu-purple: #AB1BC3;
  --cu-navy2:  #0C2A52;        /* header gradient partner */

  /* --- Accent / status colors (ControlUp semantics) --- */
  --green:   #1D9E75;   /* healthy / remediated / success */
  --green-bg: rgba(29, 158, 117, 0.12);
  --amber:   #FFB400;   /* warning / medium severity (ControlUp gold) */
  --amber-bg: rgba(255, 180, 0, 0.12);
  --red:     #F85149;   /* critical / high severity */
  --red-bg:  rgba(248, 81, 73, 0.12);
  --blue:    #5FB0FF;   /* info / detect (ControlUp light blue) */
  --blue-bg: rgba(95, 176, 255, 0.12);
  --cyan:    #FF7B1A;   /* secondary series (ControlUp orange) */
  --cyan-bg: rgba(255, 123, 26, 0.12);

  /* --- Text --- */
  --text-primary:   #EAF1F8;   /* headings, key data */
  --text-secondary: #9FB1C4;   /* body, secondary labels */
  --text-muted:     #6F8298;   /* tertiary, placeholders */
  --text-inverse:   #08111D;   /* text on light/accent bg */

  /* --- Borders & dividers (navy) --- */
  --border:         #22364B;
  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-strong:  #33485F;

  /* --- Shadows --- */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px var(--brand-purple-glow);

  /* --- Radius --- */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-pill: 999px;

  /* --- Spacing scale (4px base) --- */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* --- Typography --- */
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif,
               "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: "Geist Mono", ui-monospace, "Cascadia Code", "Fira Code",
               "SF Mono", "Consolas", "Liberation Mono", "Courier New", monospace;

  /* --- Transitions --- */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
  --transition: 180ms var(--ease-out);

  /* --- Layout --- */
  --content-max: 1280px;
  --content-pad: clamp(16px, 4vw, 48px);
  --nav-height:  64px;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-secondary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  /* Subtle grid background texture */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(229,0,95,0.18) 0%, transparent 70%);
}

a {
  color: var(--brand-purple);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--brand-purple-h); text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--brand-purple);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

img, svg { display: block; }

ul, ol { list-style: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}
button:focus-visible {
  outline: 2px solid var(--brand-purple);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  line-height: 1.2;
  font-weight: 700;
}

p { max-width: 72ch; }

/* ============================================================
   3. LAYOUT PRIMITIVES
   ============================================================ */
.page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding-top: var(--nav-height);
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-pad);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   4. TYPOGRAPHY SCALE
   ============================================================ */
.text-hero    { font-size: clamp(2rem,   5vw, 3.5rem);  font-weight: 800; letter-spacing: -0.03em; }
.text-h1      { font-size: clamp(1.6rem, 3vw, 2.5rem);  font-weight: 700; letter-spacing: -0.02em; }
.text-h2      { font-size: clamp(1.25rem,2vw, 1.875rem); font-weight: 700; letter-spacing: -0.015em; }
.text-h3      { font-size: clamp(1rem,   1.5vw, 1.25rem); font-weight: 600; }
.text-body    { font-size: 1rem;    line-height: 1.7; }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem;  letter-spacing: 0.02em; }
.text-mono    { font-family: var(--font-mono); font-size: 0.85rem; }
.text-label   { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

/* ============================================================
   5. COMPONENTS — Nav / Header
   ============================================================ */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-pad);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

/* Logo / wordmark */
/* DROP-IN LOGO: place your SVG at site/assets/logo.svg.
   When it exists, the JS swaps .wordmark for <img class="logo-img">.
   The comment below marks the region to update if you have an actual brand asset. */
.wordmark {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  text-decoration: none;
  flex-shrink: 0;
}
.wordmark-brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-purple);
  letter-spacing: -0.02em;
}
.wordmark-lab {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.logo-img {
  height: 36px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-overlay);
  text-decoration: none;
}
.nav-link.active {
  color: var(--brand-purple);
  background: var(--brand-purple-bg);
}
.nav-link svg { flex-shrink: 0; }

.nav-cta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--brand-purple);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.nav-cta:hover {
  background: var(--brand-purple-h);
  box-shadow: var(--shadow-glow);
  color: #fff;
  text-decoration: none;
}

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.nav-icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background: var(--bg-elevated);
}

/* ============================================================
   6. COMPONENTS — Hero & Stat Chips
   ============================================================ */
.hero {
  padding: var(--sp-16) var(--content-pad) var(--sp-12);
  max-width: var(--content-max);
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
  background: var(--brand-purple-bg);
  border: 1px solid var(--brand-purple);
  color: var(--brand-purple);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--sp-6);
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.75rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-bottom: var(--sp-5);
  line-height: 1.05;
}
.hero-title .brand-accent { color: var(--brand-purple); }

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  margin: 0 auto var(--sp-10);
  max-width: 56ch;
}

.stat-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-8);
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
}
.stat-chip-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-chip-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: left;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
}

/* ============================================================
   7. COMPONENTS — Search & Filter Controls
   ============================================================ */
.library-layout {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-pad) var(--sp-16);
  display: grid;
  /* 220px -> 172px: at a typical laptop window width the old fixed sidebar
     left only ~1150px for the grid, which (with a 320px card minimum) never
     fit more than 2 columns even though there was visibly spare room. */
  grid-template-columns: 172px 1fr;
  gap: var(--sp-5);
  align-items: start;
}

.facet-sidebar {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  position: sticky;
  top: var(--sp-5);
}
.facet-group { margin-bottom: var(--sp-5); }
.facet-group:last-child { margin-bottom: 0; }
.facet-group h4 {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 var(--sp-2);
}
.facet-opt {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.facet-opt:hover { color: var(--text-primary); }
.facet-opt input[type="checkbox"] {
  accent-color: var(--brand-purple);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.facet-opt span:first-of-type { flex: 1; }
.facet-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.facet-main { min-width: 0; }

.search-row {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-icon {
  position: absolute;
  left: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4) var(--sp-3) 44px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:hover { border-color: var(--border); }
.search-input:focus {
  outline: none;
  border-color: var(--brand-purple);
  box-shadow: 0 0 0 3px var(--brand-purple-bg);
}

.results-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
}

/* ============================================================
   8. COMPONENTS — Story Cards (Gallery)
   ============================================================ */
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(266px, 1fr));
  gap: var(--sp-5);
}

.story-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  color: inherit;
}
.story-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border);
  text-decoration: none;
  color: inherit;
}
.story-card:focus-visible {
  outline: 2px solid var(--brand-purple);
  outline-offset: 2px;
}

.card-accent-stripe {
  height: 4px;
  width: 100%;
  flex-shrink: 0;
}

.card-body {
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  flex: 1;
}

.card-icon-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.card-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-number {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

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

.card-tagline {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--sp-20) var(--sp-4);
  color: var(--text-muted);
}
.empty-state svg { margin: 0 auto var(--sp-4); opacity: 0.3; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: var(--sp-2); }

/* ============================================================
   9. COMPONENTS — Story Detail
   ============================================================ */
.story-detail { max-width: var(--content-max); margin: 0 auto; }

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  margin: var(--sp-8) var(--content-pad) 0;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}
.back-btn:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--border);
}

/* Story header band */
.story-header {
  position: relative;
  overflow: hidden;
  margin: var(--sp-5) var(--content-pad) 0;
  border-radius: var(--radius-xl);
  padding: var(--sp-10) var(--sp-8);
  border: 1px solid transparent;
}
.story-header-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.story-header-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-6);
  flex-wrap: wrap;
}
.story-header-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
}
.story-header-text { flex: 1; min-width: 240px; }
.story-header-text h1 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  color: #fff;
  margin-bottom: var(--sp-2);
  letter-spacing: -0.02em;
}
.story-header-tagline {
  color: rgba(255,255,255,0.8);
  font-size: 1rem;
  margin-bottom: var(--sp-4);
  max-width: 60ch;
}
.story-header-badges { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* Asset detail page — a minimised version of the story header/band */
.asset-detail-header { padding: var(--sp-8) var(--sp-8); }
.asset-detail-header .story-header-icon { width: 56px; height: 56px; }
.asset-detail-header .story-header-text h1 { font-size: clamp(1.25rem, 2.4vw, 1.75rem); }

/* Story body */
.story-body {
  padding: var(--sp-8) var(--content-pad) var(--sp-16);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-8);
}

.story-section { display: flex; flex-direction: column; gap: var(--sp-4); }
.story-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--sp-3);
}

.narrative-text {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 72ch;
}

/* Talk track callout */
.talk-track {
  display: flex;
  gap: var(--sp-4);
  background: var(--bg-raised);
  border-left: 4px solid var(--brand-purple);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: var(--sp-5) var(--sp-6);
  align-items: flex-start;
}
.talk-track-icon { flex-shrink: 0; color: var(--brand-purple); margin-top: 2px; }
.talk-track-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-purple);
  margin-bottom: var(--sp-2);
}
.talk-track-text {
  font-size: 1rem;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.65;
}

/* Phase 1 setup callout — recommends enabling a story's metrics collector
   before the demo. Visible in both SE and Customer mode. */
.phase1-callout {
  display: flex;
  gap: var(--sp-4);
  background: var(--green-bg);
  border-left: 4px solid var(--green);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: var(--sp-5) var(--sp-6);
  align-items: flex-start;
  margin-bottom: var(--sp-6);
}
.phase1-callout-icon { flex-shrink: 0; color: var(--green); margin-top: 2px; }
.phase1-callout-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: var(--sp-2);
}
.phase1-callout-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 68ch;
  margin-bottom: var(--sp-4);
}
.phase1-callout-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.phase1-callout-btn { border-color: var(--green); color: var(--green); }
.phase1-callout-btn:hover { background: var(--green); color: #fff; }
.phase1-callout-filename {
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  opacity: 0.75;
  margin-left: .25em;
}

/* ============================================================
   10. COMPONENTS — Pillar Pipeline
   ============================================================ */
.pillar-pipeline {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  /* smooth scroll on mobile */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  /* Auto-number visible pillars. Hidden (display:none) steps — e.g. the
     SE-only Simulate pillar in customer mode — don't increment, so Detect
     becomes 1 in customer view and 2 in SE view automatically. */
  counter-reset: pillar;
}

.pillar-step {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  position: relative;
  counter-increment: pillar;
}

/* Arrow connector between pillars */
.pillar-step:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 16px solid var(--bg-elevated);
  z-index: 2;
  pointer-events: none;
}
/* layered border arrow */
.pillar-step:not(:last-child)::before {
  content: '';
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-left: 17px solid var(--border-subtle);
  z-index: 1;
  pointer-events: none;
}

.pillar-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: var(--sp-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: border-color var(--transition), background var(--transition);
}
.pillar-step:first-child .pillar-card { border-radius: var(--radius-xl) 0 0 var(--radius-xl); }
.pillar-step:last-child  .pillar-card { border-radius: 0 var(--radius-xl) var(--radius-xl) 0; }

.pillar-card:hover { background: var(--bg-raised); }

.pillar-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
}

.pillar-number {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  color: #fff;
}
/* Number is rendered from the counter so it reflects visible position, not
   a hardcoded digit. */
.pillar-number::before { content: counter(pillar); }

.pillar-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

/* Pillar color coding */
.pillar-simulate .pillar-number { background: var(--amber); }
.pillar-simulate .pillar-header { border-bottom-color: rgba(245,158,11,0.2); }

.pillar-detect .pillar-number  { background: var(--blue); }
.pillar-detect .pillar-header  { border-bottom-color: rgba(59,130,246,0.2); }

.pillar-alert .pillar-number   { background: var(--red); }
.pillar-alert .pillar-header   { border-bottom-color: rgba(239,68,68,0.2); }

.pillar-remediate .pillar-number { background: var(--green); }
.pillar-remediate .pillar-header  { border-bottom-color: rgba(34,197,94,0.2); }

/* ── Package band (story page): name + fix description + POC counts/badge ── */
.pkg-band {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.pkg-band-main { min-width: 280px; flex: 1; }
.pkg-band-name { color: var(--text-secondary); font-weight: 600; }
.pkg-band-desc { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; margin: 0; max-width: 70ch; }
.pkg-band-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); flex-shrink: 0; }

/* POC linkage badges (reused on cards too) */
.badge-poc {
  background: rgba(124,58,237,0.14);
  color: #a78bfa;
  border: 1px solid rgba(124,58,237,0.35);
  text-decoration: none;
}
a.badge-poc:hover { background: rgba(124,58,237,0.24); }
.badge-poc-none {
  background: var(--bg-overlay);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* Group labels bracketing Simulate (SE) vs the Package trio, aligned to the
   pillar columns via matching flex weights (Simulate = 1 of 4). */
.pillar-grouprow { display: flex; gap: 0; margin-bottom: var(--sp-2); }
.pillar-grouplabel {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 2px;
}
.pillar-grouplabel-se  { flex: 1; min-width: 220px; color: var(--amber); }
.pillar-grouplabel-pkg { flex: 3; color: var(--text-secondary); padding-left: var(--sp-2); }

/* Pillar content rows */
.pillar-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.pillar-row-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pillar-row-value {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Safety chip */
.safety-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--green-bg);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: var(--radius-md);
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  margin-top: var(--sp-1);
}

/* Detect realtime chips */
.realtime-chips {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.realtime-chip {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.realtime-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
  margin-top: 5px;
}

/* Filters callout — must stand out */
.filters-callout {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-top: var(--sp-2);
}
.filters-callout-icon { color: var(--amber); flex-shrink: 0; margin-top: 1px; }
.filters-callout-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: var(--sp-1);
}
.filters-callout-text {
  font-size: 0.8125rem;
  color: rgba(245,158,11,0.9);
  line-height: 1.5;
}

/* Remediate options */
.remediate-options {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.remediate-option {
  background: var(--bg-raised);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.remediate-option-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.remediate-option-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.remediate-option-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.remediate-option-requires {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.remediate-option-setup {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-overlay);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-mono);
  border: 1px solid var(--border-subtle);
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  line-height: 1.6;
}

/* Console click-path — collapsed by default so the plain-English description
   leads; this is reference detail for whoever is actually configuring it. */
.remediate-setup-details {
  margin-top: var(--sp-1);
}

.remediate-setup-details summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand-purple);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--brand-purple-bg);
  border: 1px solid rgba(229,0,95,0.25);
  user-select: none;
}

.remediate-setup-details summary::-webkit-details-marker {
  display: none;
}

.remediate-setup-details summary::before {
  content: '›';
  display: inline-block;
  font-weight: 700;
  transition: transform 0.15s ease;
}

.remediate-setup-details[open] summary::before {
  transform: rotate(90deg);
}

.remediate-setup-details[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.remediate-setup-details .remediate-option-setup {
  margin-top: 0;
}

/* Native vs Workflow license badges */
.badge-native {
  background: var(--green-bg);
  color: var(--green);
  border-color: rgba(34,197,94,0.25);
}
.badge-workflow-license {
  background: var(--brand-purple-bg);
  color: var(--brand-purple);
  border-color: rgba(229,0,95,0.25);
}

/* Divider between manual and automated */
.remediate-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-1) 0;
}
.remediate-divider::before,
.remediate-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}
.remediate-divider-text {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* "Automate it — recommended" priority label above the automated options */
.remediate-priority-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: var(--sp-1);
}

/* ============================================================
   11. COMPONENTS — Downloads
   ============================================================ */
.downloads-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
}

.downloads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.download-item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}
.download-item:hover {
  border-color: var(--border);
  background: var(--bg-overlay);
}

.download-item-main {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.download-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.download-item-info {
  flex: 1;
  min-width: 0;
}
.download-item-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.download-item-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-height: 1.3;
  margin-top: 1px;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: auto;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  flex: 1;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}
.download-btn:hover {
  background: var(--brand-purple-bg);
  border-color: var(--brand-purple);
  color: var(--brand-purple);
  text-decoration: none;
}
.download-btn:focus-visible {
  outline: 2px solid var(--brand-purple);
  outline-offset: 2px;
}

/* Download kind colors */
.kind-simulate  { background: rgba(245,158,11,0.12); color: var(--amber); }
.kind-remediate { background: var(--green-bg); color: var(--green); }
.kind-alert     { background: var(--red-bg); color: var(--red); }
.kind-workflow  { background: var(--brand-purple-bg); color: var(--brand-purple); }
.kind-dashboard { background: var(--cyan-bg); color: var(--cyan); }
.kind-collect   { background: var(--blue-bg); color: var(--blue); }
/* CUSM plugin template — vivid violet-pink to stand apart from all other kinds */
.kind-cusm      { background: rgba(171,27,195,0.16); color: #AB1BC3; }

/* CUSM download item — subtle highlight on the whole row */
.download-item-cusm {
  border-color: rgba(168,85,247,0.25);
}
.download-item-cusm:hover {
  border-color: rgba(168,85,247,0.5);
  background: rgba(168,85,247,0.06);
}

/* Helptext shown under cusm download label */
.download-item-cusm-hint {
  font-size: 0.7rem;
  color: #AB1BC3;
  opacity: 0.85;
  line-height: 1.4;
  margin-top: 2px;
}

/* CU-Popup note inside Remediate pillar */
.cusm-pillar-note {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.3);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.75rem;
  color: #C44FD6;
  line-height: 1.5;
}
.cusm-pillar-note svg { flex-shrink: 0; margin-top: 1px; color: #AB1BC3; }
.cusm-pillar-note strong { color: #D98FE6; }

/* Bundle CTA */
.bundle-cta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--brand-purple-bg);
  border: 1px solid var(--brand-purple);
  border-radius: var(--radius-lg);
  color: var(--brand-purple);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition);
}
.bundle-cta:hover {
  background: var(--brand-purple);
  color: #fff;
  text-decoration: none;
}

/* ============================================================
   12. COMPONENTS — File Viewer Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8,13,30,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: fadeIn 150ms var(--ease-out);
}

.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 200ms var(--ease-out);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--sp-4);
  flex-shrink: 0;
}
.modal-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-header-actions {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
}

.modal-body {
  flex: 1;
  overflow: auto;
  padding: var(--sp-5) var(--sp-6);
}

.modal-loading {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.modal-error {
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.modal-error code {
  display: block;
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--amber);
  white-space: pre-wrap;
  word-break: break-all;
}

.code-viewer {
  background: var(--bg-base);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  overflow-x: auto;
  white-space: pre;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.65;
  tab-size: 2;
  border: 1px solid var(--border-subtle);
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--brand-purple);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

/* ============================================================
   13. COMPONENTS — ROI Calculator
   ============================================================ */
.roi-page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-12) var(--content-pad) var(--sp-16);
}

.roi-page-header {
  text-align: center;
  margin-bottom: var(--sp-10);
}
.roi-page-header h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-3);
}
.roi-page-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 52ch;
  margin: 0 auto;
}

.roi-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-8);
  align-items: start;
}
@media (max-width: 800px) {
  .roi-layout { grid-template-columns: 1fr; }
}

.roi-inputs {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.roi-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.roi-input-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.roi-input-label-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}
.roi-input-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-purple);
  min-width: 80px;
  text-align: right;
}

.roi-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-overlay);
  outline: none;
  cursor: pointer;
  accent-color: var(--brand-purple);
  transition: opacity var(--transition);
}
.roi-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--brand-purple);
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--brand-purple-bg);
  transition: box-shadow var(--transition);
}
.roi-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px var(--brand-purple-bg);
}
.roi-slider:focus-visible { outline: 2px solid var(--brand-purple); outline-offset: 4px; }

.roi-number-input {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.roi-number-input:focus {
  outline: none;
  border-color: var(--brand-purple);
  box-shadow: 0 0 0 3px var(--brand-purple-bg);
}

/* Currency toggle */
.currency-toggle {
  display: flex;
  gap: var(--sp-1);
  background: var(--bg-base);
  border-radius: var(--radius-md);
  padding: var(--sp-1);
  border: 1px solid var(--border-subtle);
}
.currency-btn {
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
}
.currency-btn.active {
  background: var(--brand-purple);
  color: #fff;
}
.currency-btn:hover:not(.active) {
  background: var(--bg-overlay);
  color: var(--text-primary);
}

/* Story scope select */
.scope-select-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.scope-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.scope-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
}
.scope-chip:hover {
  border-color: var(--brand-purple);
  color: var(--text-primary);
}
.scope-chip.active {
  background: var(--brand-purple-bg);
  border-color: var(--brand-purple);
  color: var(--brand-purple);
}
.scope-chip input { display: none; }

/* ROI results */
.roi-results {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  position: sticky;
  top: calc(var(--nav-height) + var(--sp-5));
}

.roi-headline-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.roi-headline-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--brand-purple-glow) 0%, transparent 70%);
  pointer-events: none;
}

.roi-headline-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.roi-headline-value {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: var(--sp-1);
}
.roi-headline-value .currency { font-size: 0.5em; vertical-align: super; }
.roi-headline-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.roi-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.roi-metric {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  text-align: center;
}
.roi-metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-1);
}
.roi-metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Visual bar */
.roi-bar-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-6);
}
.roi-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.roi-bar-track {
  background: var(--bg-overlay);
  border-radius: var(--radius-pill);
  height: 12px;
  overflow: hidden;
}
.roi-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--brand-purple), var(--brand-purple-h));
  transition: width 400ms var(--ease-out);
  min-width: 4px;
}

/* Assumptions box */
.roi-assumptions {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-6);
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.roi-assumptions strong { color: var(--text-secondary); }
.roi-assumptions .formula {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================================
   14. COMPONENTS — Add Story
   ============================================================ */
.add-page {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--sp-12) var(--content-pad) var(--sp-16);
}

.add-page-header {
  margin-bottom: var(--sp-8);
}
.add-page-header h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-3);
}
.add-page-header p {
  color: var(--text-secondary);
  max-width: 56ch;
}

.steps-list {
  counter-reset: steps;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin: var(--sp-6) 0;
}
.step-item {
  counter-increment: steps;
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
}
.step-item::before {
  content: counter(steps);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-purple);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-content {
  padding-top: 6px;
  flex: 1;
}
.step-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}
.step-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.step-desc code {
  background: var(--bg-overlay);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--brand-purple);
}

/* Story form */
.story-form {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.form-group.full-width { grid-column: 1 / -1; }

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}
.form-sublabel {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -var(--sp-1);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-purple);
  box-shadow: 0 0 0 3px var(--brand-purple-bg);
}
.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

/* JSON preview */
.json-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.json-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.json-preview-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.json-preview-actions { display: flex; gap: var(--sp-2); }
.json-output {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-height: 500px;
  overflow: auto;
  white-space: pre;
  tab-size: 2;
}

/* ============================================================
   15. COMPONENTS — Badges & Tags
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 3px var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  line-height: 1;
}

/* Difficulty */
.badge-easy     { color: var(--green); border-color: rgba(34,197,94,0.3);  background: var(--green-bg); }
.badge-medium   { color: var(--amber); border-color: rgba(245,158,11,0.3); background: var(--amber-bg); }
.badge-advanced { color: var(--red);   border-color: rgba(239,68,68,0.3);  background: var(--red-bg);  }

/* Severity */
.badge-high     { color: var(--red);   border-color: rgba(239,68,68,0.3);  background: var(--red-bg);   }
.badge-medium-sev{ color: var(--amber); border-color: rgba(245,158,11,0.3); background: var(--amber-bg); }
.badge-low      { color: var(--green); border-color: rgba(34,197,94,0.3);  background: var(--green-bg); }

/* Category */
.badge-category {
  color: var(--text-secondary);
  border-color: var(--border-subtle);
  background: var(--bg-overlay);
  font-size: 0.6875rem;
}

/* Time */
.badge-time {
  color: var(--text-muted);
  border-color: var(--border-subtle);
  background: transparent;
  font-size: 0.6875rem;
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0;
}

/* Alert type */
.badge-threshold {
  color: var(--amber);
  border-color: rgba(245,158,11,0.3);
  background: var(--amber-bg);
}
.badge-event {
  color: var(--blue);
  border-color: rgba(59,130,246,0.3);
  background: var(--blue-bg);
}

/* CU-Popup / CUSM badge — vivid violet-pink, matches kind-cusm */
.badge-cusm-popup {
  color: #AB1BC3;
  border-color: rgba(168,85,247,0.35);
  background: rgba(168,85,247,0.12);
  text-transform: none;
  font-size: 0.6875rem;
  letter-spacing: 0;
  font-weight: 600;
}

/* ============================================================
   16. COMPONENTS — Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--brand-purple);
  outline-offset: 3px;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--brand-purple);
  color: #fff;
  border-color: var(--brand-purple);
}
.btn-primary:hover {
  background: var(--brand-purple-h);
  border-color: var(--brand-purple-h);
  box-shadow: var(--shadow-glow);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--sp-2) var(--sp-3);
  font-size: 0.8125rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Print button */
.print-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.print-btn:hover {
  background: var(--bg-overlay);
  color: var(--text-primary);
  border-color: var(--border);
}

/* ============================================================
   17. COMPONENTS — Alerts & Callouts
   ============================================================ */
.info-callout {
  display: flex;
  gap: var(--sp-3);
  background: var(--blue-bg);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.info-callout-icon { color: var(--blue); flex-shrink: 0; margin-top: 1px; }

/* Notification / toast */
.toast {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-5);
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  white-space: nowrap;
  animation: slideUp 200ms var(--ease-out), fadeOut 300ms 2500ms var(--ease-in) forwards;
}

/* ============================================================
   18. ANIMATIONS & TRANSITIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; pointer-events: none; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.fade-in  { animation: fadeIn  200ms var(--ease-out); }
.slide-up { animation: slideUp 250ms var(--ease-out); }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   19. SCROLLBAR
   ============================================================ */

/* ============================================================
   19b. COMPONENTS — Success Packages Page
   ============================================================ */
.packages-page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding-bottom: var(--sp-16);
}

.packages-header {
  padding: var(--sp-12) var(--content-pad) 0;
}

.packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--sp-5);
  padding: 0 var(--content-pad) var(--sp-5);
}

.packages-footer {
  padding: 0 var(--content-pad);
}

/* Package card */
.pkg-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.pkg-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border);
}

.pkg-card-stripe {
  height: 4px;
  width: 100%;
  flex-shrink: 0;
}

.pkg-card-body {
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  flex: 1;
}

.pkg-card-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.pkg-icon-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pkg-meta { flex: 1; min-width: 0; }

.pkg-number {
  display: block;
  margin-bottom: var(--sp-1);
}

.pkg-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
}

.pkg-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  max-width: unset;  /* override global p max-width */
}

.pkg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.pkg-stats {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.pkg-stat {
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.pkg-stat strong {
  color: var(--text-primary);
  font-weight: 700;
}

.pkg-stat-sep {
  color: var(--text-muted);
  font-size: 0.75rem;
}

@media (max-width: 640px) {
  .packages-grid { grid-template-columns: 1fr; }
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb {
  background: var(--bg-overlay);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ============================================================
   20. PRINT STYLESHEET
   ============================================================ */
@media print {
  :root {
    --bg-base:      #fff;
    --bg-elevated:  #f7f7f8;
    --bg-raised:    #eff0f4;
    --text-primary: #0a0a14;
    --text-secondary: #3a3f55;
    --text-muted:   #7a7f96;
    --border-subtle: #d0d4e4;
    --brand-purple: #B30049;
  }

  body {
    background: #fff;
    color: #0a0a14;
    font-size: 11pt;
    line-height: 1.55;
    background-image: none;
  }

  /* Hide non-print elements */
  .site-nav,
  .back-btn,
  .hero-actions,
  .library-layout,
  .nav-links,
  .download-btn,
  .bundle-cta,
  .btn,
  .print-btn,
  .modal-overlay,
  .toast,
  .add-page,
  .roi-page,
  #page-gallery,
  .story-header .story-header-badges {
    display: none !important;
  }

  .main-content { padding-top: 0; }

  /* Print header */
  .print-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12pt;
    border-bottom: 2pt solid #B30049;
    margin-bottom: 16pt;
  }
  .print-brand {
    font-size: 16pt;
    font-weight: 800;
    color: #B30049;
  }
  .print-lab { font-size: 11pt; color: #7a7f96; }

  /* Story detail layout for print */
  .story-detail { max-width: 100%; }
  .story-header {
    margin: 0 0 16pt;
    padding: 12pt 16pt;
    background: #eff0f4 !important;
    border-radius: 6pt;
  }
  .story-header-bg { display: none; }
  .story-header h1 { color: #0a0a14 !important; font-size: 18pt; }
  .story-header-tagline { color: #3a3f55 !important; }

  .story-body {
    padding: 0;
    gap: 14pt;
  }

  .pillar-pipeline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6pt;
    overflow: visible;
  }

  .pillar-step::before,
  .pillar-step::after { display: none; }

  .pillar-card {
    background: #f7f7f8;
    border: 1pt solid #d0d4e4;
    border-radius: 4pt;
    break-inside: avoid;
  }
  .pillar-step:first-child .pillar-card,
  .pillar-step:last-child  .pillar-card { border-radius: 4pt; }

  .pillar-card,
  .story-header,
  .talk-track,
  .downloads-section { break-inside: avoid; }

  .downloads-section {
    margin-top: 10pt;
    border: 1pt solid #d0d4e4;
  }
  .download-item {
    background: #eff0f4;
    border: 1pt solid #d0d4e4;
    page-break-inside: avoid;
  }

  /* Show ROI line */
  .roi-print-line { display: block !important; }

  a[href]::after { content: none; }
}

/* Elements only visible in print */
.print-header { display: none; }
.roi-print-line { display: none; }

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 900px) {
  .pillar-pipeline {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
  }
  .pillar-step:not(:last-child)::after,
  .pillar-step:not(:last-child)::before { display: none; }
  .pillar-step:first-child .pillar-card,
  .pillar-step:last-child .pillar-card,
  .pillar-card { border-radius: var(--radius-xl); }

  .library-layout { grid-template-columns: 1fr; }
  .facet-sidebar {
    position: static;
    display: flex;
    gap: var(--sp-6);
    overflow-x: auto;
  }
  .facet-group { margin-bottom: 0; flex-shrink: 0; min-width: 160px; }
}

@media (max-width: 640px) {
  .story-grid { grid-template-columns: 1fr; }
  .hero { padding: var(--sp-10) var(--sp-4) var(--sp-8); }
  .story-header { margin: var(--sp-3) var(--sp-4) 0; padding: var(--sp-6) var(--sp-5); }
  .story-body { padding: var(--sp-5) var(--sp-4) var(--sp-12); }
  .roi-metrics-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .downloads-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

/* ───────────────────────────────────────────────────────────────
   Package builder — multi-select stories → one importable bundle
   ─────────────────────────────────────────────────────────────── */
.story-card { position: relative; }
.card-select {
  position: absolute; top: 12px; right: 12px; z-index: 6;
  width: 26px; height: 26px; border-radius: 8px;
  border: 1.5px solid var(--border-strong);
  background: rgba(8, 17, 29, 0.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  color: transparent; cursor: pointer; transition: all .15s ease;
}
.card-select:hover { border-color: var(--brand-purple); background: var(--brand-purple-bg); }
.card-select:focus-visible { outline: 2px solid var(--brand-purple); outline-offset: 2px; }
.story-card.selected { box-shadow: 0 0 0 2px var(--brand-purple), var(--shadow-lg); }
.story-card.selected .card-select {
  background: var(--brand-purple); border-color: var(--brand-purple); color: #fff;
}

.pkg-bar {
  position: fixed; left: 50%; bottom: 22px; z-index: 300;
  transform: translateX(-50%) translateY(160%);
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill); padding: 10px 12px 10px 22px;
  box-shadow: var(--shadow-lg); transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.pkg-bar.show { transform: translateX(-50%) translateY(0); }
.pkg-bar-count { font-size: .9rem; color: var(--text-secondary); white-space: nowrap; }
.pkg-bar-count b { color: var(--brand-purple); font-size: 1.05rem; }
.pkg-bar .btn { padding: 9px 16px; }
.pkg-bar-clear {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font: inherit; font-size: .85rem; padding: 6px 10px; border-radius: var(--radius-md);
}
.pkg-bar-clear:hover { color: var(--text-primary); background: var(--bg-overlay); }
@media (max-width: 560px){ .pkg-bar{ left:12px; right:12px; transform:translateY(160%); width:auto; } .pkg-bar.show{ transform:translateY(0);} }

/* ============================================================
   VIEW MODE  —  SE / Customer toggle + .se-only gating
   ============================================================ */

/* Right-hand nav cluster: mode toggle + CTA */
.nav-right { display: flex; align-items: center; gap: var(--sp-3); }

/* Segmented SE / Customer toggle -- hidden entirely unless the account has
   demo_mode granted (Admin > Users). Locked accounts see only their
   role-derived view, with no way to manually switch. */
.mode-toggle {
  display: inline-flex;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 2px;
}
html[data-can-toggle-mode="false"] .mode-toggle { display: none !important; }
.mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .01em;
  padding: .3rem .7rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mode-btn:hover { color: var(--text-primary); }
.mode-btn.active {
  background: var(--brand-purple);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.mode-btn:focus-visible { outline: 2px solid var(--brand-purple-h); outline-offset: 2px; }

/* Customize-for-customer export block */
.customize-export {
  margin-top: var(--sp-3); padding: var(--sp-4);
  border: 1px dashed var(--border); border-radius: var(--radius-md);
  background: var(--bg-raised);
}
.customize-head { display: flex; gap: var(--sp-3); align-items: flex-start; margin-bottom: var(--sp-3); }
.customize-title { font-weight: 700; font-size: .9rem; }
.customize-sub { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.customize-form { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-end; }
.customize-field { display: flex; flex-direction: column; gap: 4px; font-size: .72rem; color: var(--text-muted); flex: 1; min-width: 150px; }
.customize-field input {
  padding: 8px 10px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: var(--bg-overlay); color: var(--text-primary); font: inherit; font-size: .85rem;
}
.customize-status { font-size: .78rem; color: var(--text-secondary); margin-top: var(--sp-2); min-height: 1em; }

/* The gate: anything .se-only disappears in customer mode */
html[data-mode="customer"] .se-only { display: none !important; }

/* Admin-only: gated on profiles.is_admin (via auth.js) -- a real access-control
   condition, not a cosmetic one like the rest of this block. app.js sets
   data-is-admin="true" on <html> once the profile is hydrated. BUT it must still
   disappear while previewing Customer mode (data-mode="customer"): the whole
   point of that toggle is to show an SE what a real customer sees, and a real
   customer account is never an admin -- leaving this visible defeats the
   preview (and is a real risk if an SE is screen-sharing a "customer view"
   demo). The customer-mode rule is listed after, so it wins the cascade. */
.admin-only { display: none !important; }
html[data-is-admin="true"] .admin-only { display: flex !important; }
html[data-mode="customer"] .admin-only { display: none !important; }

/* Bundle CTA is audience-specific: SE demo bundle (.se-only, shown by default)
   vs customer bundle (.cust-bundle, shown only in customer mode). */
.cust-bundle { display: none; }
html[data-mode="customer"] .cust-bundle { display: flex; }

/* SE-only inline demo/setup note appended beside customer-safe copy */
.se-note { opacity: .82; font-style: italic; }
.se-note strong { font-style: normal; color: var(--brand-purple-h, #b794f6); }

/* Inverse: .cust-only shows only in customer mode (used for the adaptive
   "Four/Three Pillars" heading word). */
.cust-only { display: none; }
html[data-mode="customer"] .cust-only { display: inline; }

/* Mode-aware help banner lines */
.doc-modechip-cust { display: none; }
html[data-mode="customer"] .doc-modechip-se   { display: none; }
html[data-mode="customer"] .doc-modechip-cust { display: inline; }

/* ============================================================
   MODE-BLOCKED placeholder (customer hitting an SE route)
   ============================================================ */
.mode-blocked {
  max-width: 44ch;
  margin: 12vh auto;
  text-align: center;
  padding: var(--sp-8);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.mode-blocked-icon { color: var(--brand-purple); margin-bottom: var(--sp-3); }
.mode-blocked h2 { color: var(--text-primary); margin: 0 0 var(--sp-2); }
.mode-blocked p  { color: var(--text-secondary); margin: 0 0 var(--sp-6); }
.mode-blocked-actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

/* Ghost button (used by mode-blocked + docs) */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* ============================================================
   HELP / DOCUMENTATION page
   ============================================================ */
.doc-page { max-width: 80ch; margin: 0 auto; padding: var(--sp-8) var(--content-pad) var(--sp-16); }
.doc-header h1 { color: var(--text-primary); font-size: 1.9rem; margin: 0 0 var(--sp-2); letter-spacing: -.02em; }
.doc-sub { color: var(--text-secondary); font-size: .95rem; line-height: 1.6; margin: 0 0 var(--sp-4); }
.doc-modechip {
  display: inline-block;
  font-size: .75rem;
  color: var(--text-secondary);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: .25rem .8rem;
}

.doc-toc {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin: var(--sp-6) 0 var(--sp-8);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}
.doc-toc a {
  font-size: .8rem; font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: .25rem .75rem; text-decoration: none;
}
.doc-toc a:hover { color: var(--text-primary); border-color: var(--brand-purple); }

.doc-section { margin: 0 0 var(--sp-10); scroll-margin-top: 90px; }
.doc-section h2 { color: var(--text-primary); font-size: 1.25rem; margin: 0 0 var(--sp-3); }
.doc-section p, .doc-section li { color: var(--text-secondary); line-height: 1.65; }
.doc-section a { color: var(--brand-purple); }
.doc-section a:hover { color: var(--brand-purple-h); }
.doc-section code {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: .85em; color: var(--text-primary);
  background: var(--bg-overlay); padding: .1em .4em; border-radius: var(--radius-sm);
}

.doc-steps, .doc-list { padding-left: 1.25rem; }
.doc-steps li, .doc-list li { margin: .35rem 0; }
.doc-note { font-size: .85rem; color: var(--text-muted); display: flex; align-items: center; gap: .4rem; margin-top: var(--sp-3); }

.doc-pre {
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-4);
  overflow-x: auto; margin: var(--sp-3) 0;
}
.doc-pre code { background: none; padding: 0; color: var(--green); }

.doc-table-wrap { overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin: var(--sp-2) 0; }
.doc-table th, .doc-table td {
  text-align: left; padding: .5rem .7rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary); vertical-align: top;
}
.doc-table th { color: var(--text-primary); font-weight: 700; }
.doc-table td.se-mark { color: var(--brand-purple-h); }

.doc-section details {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: .6rem .9rem; margin: .5rem 0; background: var(--bg-elevated);
}
.doc-section summary { cursor: pointer; font-weight: 600; color: var(--text-primary); }
.doc-section details p { margin: .5rem 0 0; }

.doc-se-flag {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: var(--brand-purple-h);
  background: var(--brand-purple-bg);
  border: 1px solid var(--brand-purple-d);
  border-radius: var(--radius-pill);
  padding: .2rem .65rem; margin-bottom: var(--sp-3);
}

/* ─── Access gate (client-side only, see index.html inline script) ─── */
.gate-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  background: rgba(8, 17, 29, 0.92);
  backdrop-filter: blur(6px);
}
.gate-overlay[hidden] { display: none; } /* class display:flex above beats the UA [hidden] rule without this */
.gate-card {
  width: 100%; max-width: 420px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6, 32px) var(--sp-5, 28px);
}
.gate-brand { display: flex; align-items: baseline; gap: 6px; margin-bottom: 18px; font-weight: 800; font-size: 15px; }
.gate-brand .wordmark-lab { color: var(--brand-purple); font-weight: 600; }
.gate-title { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 0 0 6px; }
.gate-sub { font-size: 13.5px; color: var(--text-secondary); margin: 0 0 20px; }
.gate-field { margin-bottom: 14px; }
.gate-field label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 5px;
}
.gate-field input {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 14px;
  color: var(--text-primary); background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.gate-field input:focus {
  outline: none; border-color: var(--brand-purple);
  box-shadow: 0 0 0 3px var(--brand-purple-bg);
}
.gate-hint { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.gate-error {
  font-size: 12.5px; color: var(--red); background: var(--red-bg);
  border: 1px solid var(--red); border-radius: var(--radius-sm);
  padding: 8px 10px; margin: 0 0 14px;
}
.gate-submit {
  width: 100%; padding: 11px 16px; font: inherit; font-size: 14.5px; font-weight: 700;
  color: #fff; background: var(--brand-purple); border: none; border-radius: var(--radius-md);
  cursor: pointer;
}
.gate-submit:hover { background: var(--brand-purple-h); }
.gate-switch {
  margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--text-secondary);
}
.gate-link {
  background: none; border: none; padding: 0; font: inherit; font-weight: 600;
  color: var(--brand-purple); cursor: pointer; text-decoration: underline;
}
.gate-link:hover { color: var(--brand-purple-h); }
.gate-field select {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 14px;
  color: var(--text-primary); background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.gate-field select:focus {
  outline: none; border-color: var(--brand-purple);
  box-shadow: 0 0 0 3px var(--brand-purple-bg);
}
.gate-divider {
  display: flex; align-items: center; gap: 10px; margin: 16px 0;
  font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
}
.gate-divider::before, .gate-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.gate-secondary-btn {
  width: 100%; padding: 10px 16px; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--text-primary); background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.gate-secondary-btn:hover { border-color: var(--brand-purple); color: var(--brand-purple); }
.gate-secondary-btn:last-child { margin-bottom: 0; }

/* ── "See it live" interactive-demo card (story detail) ─────────────────── */
.demo-card {
  --_accent: var(--demo-accent, var(--brand-purple));
  display: flex; align-items: center; gap: 1rem;
  margin: 1.25rem 0; padding: 1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--_accent);
  border-radius: var(--radius-md);
  text-decoration: none; color: inherit;
  transition: var(--transition, all .15s ease);
}
.demo-card:hover {
  border-color: var(--_accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.demo-card-icon {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 10px;
  color: var(--_accent);
  background: color-mix(in srgb, var(--_accent) 12%, transparent);
}
.demo-card-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.demo-card-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--_accent);
}
.demo-card-title { font-size: .95rem; font-weight: 700; color: var(--text-primary); }
.demo-card-blurb { font-size: .8rem; color: var(--text-secondary); line-height: 1.35; }
.demo-card-cta {
  flex: 0 0 auto; margin-left: auto; white-space: nowrap;
  font-size: .8rem; font-weight: 700; color: var(--_accent);
  padding: .4rem .7rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--_accent) 35%, transparent);
}
@media (max-width: 560px) {
  .demo-card { flex-wrap: wrap; }
  .demo-card-cta { margin-left: 0; }
}
