/* =============================================================================
   PRIMERA PLASTICS  ×  IBB INNOVATIONS
   Business Central → Power Platform  |  Interactive Demo
   design.css — the shared design system (tokens, reset, type, components)
   Direction: "Engineered precision" — molten polymer + CNC tolerances + Swiss
   =============================================================================
   View builders: every view scopes its own classes (.v-<id>__*).
   Only the tokens + the .u-* / component layer below are shared.
   ========================================================================== */

/* ----------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* — Core palette — Primera Plastics brand: navy · teal · lime — */
  --ink:        #0B2533;   /* deep navy (dark surface + body text) */
  --ink-2:      #103040;   /* raised navy surface */
  --ink-3:      #163A4D;   /* hover / inset navy */
  --porcelain:  #F5F7F6;   /* cool off-white (light surface) */
  --paper:      #FFFFFF;   /* pure paper */
  --molten:     #0A7E8A;   /* PRIMARY accent = Primera teal */
  --molten-deep:#075E66;   /* teal pressed */
  --molten-soft:rgba(10,126,138,.12);
  --lime:       #A8AD00;   /* Primera signature lime (CTA / spark) */
  --lime-deep:  #8C9000;   /* lime pressed */
  --lime-soft:  rgba(168,173,0,.16);
  --blue:       #00557D;   /* Primera deep blue (data) */
  --blue-deep:  #0A2A3B;
  --blue-soft:  rgba(0,85,125,.12);
  --steel:      #5B6470;   /* muted text */
  --steel-2:    #8A929C;   /* muted text on dark */
  --line:       rgba(11,37,51,.10);  /* hairline on light */
  --line-2:     rgba(245,247,247,.12); /* hairline on dark */
  --good:       #18A957;
  --good-soft:  rgba(24,169,87,.14);
  --warn:       #E0A100;
  --warn-soft:  rgba(224,161,0,.14);

  /* — Product accents (Microsoft surfaces only) — */
  --powerapps:  #742774;   /* Power Apps plum */
  --automate:   #0066FF;   /* Power Automate blue */
  --automate-2: #0B53CE;
  --dataverse:  #B4009E;   /* Dataverse/Dynamics magenta */
  --bc-teal:    #00808F;   /* Business Central teal */
  --bc-teal-2:  #2A6E7F;

  /* — Spacing scale (1.5 ratio-ish, intentional) — */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;
  --s10: 144px;

  /* — Radii — */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* — Elevation (warm, low, layered — never default gray box-shadow) — */
  --sh-1: 0 1px 2px rgba(14,17,22,.06), 0 1px 1px rgba(14,17,22,.04);
  --sh-2: 0 6px 16px rgba(14,17,22,.08), 0 2px 4px rgba(14,17,22,.05);
  --sh-3: 0 18px 48px rgba(14,17,22,.16), 0 6px 14px rgba(14,17,22,.08);
  --sh-4: 0 40px 90px rgba(14,17,22,.28), 0 12px 28px rgba(14,17,22,.16);
  --sh-molten: 0 10px 30px rgba(7,94,102,.34), 0 2px 8px rgba(7,94,102,.24);
  --sh-inset: inset 0 1px 0 rgba(255,255,255,.06);

  /* — Motion — */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);   /* ease-out-expo */
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --d-fast: 150ms;
  --d-norm: 280ms;
  --d-slow: 420ms;

  /* — Type — */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", "Cascadia Code", ui-monospace, "Consolas", monospace;

  --text-hero: clamp(2.8rem, 6vw, 5.5rem);
  --text-h1:   clamp(2.2rem, 4vw, 3.4rem);
  --text-h2:   clamp(1.6rem, 2.6vw, 2.3rem);
  --text-h3:   clamp(1.2rem, 1.6vw, 1.5rem);
  --text-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --text-sm:   0.875rem;
  --text-xs:   0.75rem;

  /* — Layout — */
  --rail-w: 280px;
  --stage-max: 1440px;
}

/* ----------------------------------------------------------------------------
   2. RESET
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--ink);
  background: var(--porcelain);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01","cv01","cv11";
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.04; letter-spacing: -0.02em; }
::selection { background: var(--molten); color: #fff; }

/* ----------------------------------------------------------------------------
   3. FOCUS — visible, designed, molten ring
   -------------------------------------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--molten);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* ----------------------------------------------------------------------------
   4. TEXTURE — faint grain + hairline grid utilities
   -------------------------------------------------------------------------- */
.u-grain::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: .035;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.u-grain--dark::before { opacity: .06; mix-blend-mode: soft-light; }

.u-grid-lines {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
}
.u-grid-lines--dark {
  background-image:
    linear-gradient(var(--line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ----------------------------------------------------------------------------
   5. SECTION WRAPPERS — light & dark rhythm
   -------------------------------------------------------------------------- */
.section { position: relative; padding: var(--s9) var(--s8); }
.section--tight { padding: var(--s7) var(--s8); }
.section--light { background: var(--porcelain); color: var(--ink); }
.section--paper { background: var(--paper); color: var(--ink); }
.section--dark  { background: var(--ink); color: var(--porcelain); }
.section--ink2  { background: var(--ink-2); color: var(--porcelain); }
.section__inner { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; }

.on-dark { color: var(--porcelain); }
.on-dark .muted { color: var(--steel-2); }

/* ----------------------------------------------------------------------------
   6. KICKER — the engineered label
   -------------------------------------------------------------------------- */
.kicker {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--molten);
  font-weight: 500;
}
.kicker::before {
  content: "";
  width: 22px; height: 1px; background: var(--molten);
  display: inline-block;
}
.kicker--blue { color: var(--blue); }
.kicker--blue::before { background: var(--blue); }
.kicker--steel { color: var(--steel); }
.kicker--steel::before { background: var(--steel); }
.on-dark .kicker--steel { color: var(--steel-2); }

/* ----------------------------------------------------------------------------
   7. TYPOGRAPHY HELPERS
   -------------------------------------------------------------------------- */
.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.t-hero { font-size: var(--text-hero); }
.t-h1 { font-size: var(--text-h1); }
.t-h2 { font-size: var(--text-h2); }
.t-h3 { font-size: var(--text-h3); }
.t-lead { font-size: clamp(1.1rem, 1.4vw, 1.375rem); line-height: 1.5; color: var(--steel); max-width: 60ch; }
.on-dark .t-lead { color: var(--steel-2); }
.muted { color: var(--steel); }
.mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }
.text-molten { color: var(--molten); }
.text-blue { color: var(--blue); }
.text-good { color: var(--good); }

/* ----------------------------------------------------------------------------
   8. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  --_bg: var(--ink);
  --_fg: var(--porcelain);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 13px 22px;
  border-radius: var(--r-pill);
  background: var(--_bg);
  color: var(--_fg);
  font-weight: 560;
  font-size: var(--text-sm);
  letter-spacing: -0.01em;
  line-height: 1;
  box-shadow: var(--sh-1);
  transition: transform var(--d-fast) var(--ease),
              box-shadow var(--d-fast) var(--ease),
              background var(--d-fast) var(--ease);
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0) scale(.985); transition-duration: 90ms; }

.btn--molten {
  --_bg: var(--molten); --_fg: #fff;
  background: linear-gradient(180deg, var(--molten), var(--molten-deep));
  box-shadow: var(--sh-molten);
}
.btn--molten:hover { box-shadow: 0 14px 36px rgba(7,94,102,.42), 0 3px 10px rgba(7,94,102,.28); }
.btn--molten:active { background: var(--molten-deep); }

.btn--blue {
  --_bg: var(--blue); --_fg: #fff;
  background: linear-gradient(180deg, var(--blue), var(--blue-deep));
  box-shadow: 0 8px 22px rgba(0,85,125,.30);
}

.btn--ghost {
  --_bg: transparent; --_fg: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn--ghost:hover { background: rgba(14,17,22,.04); box-shadow: none; }
.on-dark .btn--ghost { --_fg: var(--porcelain); border-color: var(--line-2); }
.on-dark .btn--ghost:hover { background: rgba(247,245,242,.06); }

.btn--sm { padding: 9px 16px; font-size: var(--text-xs); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ----------------------------------------------------------------------------
   9. CHIPS / BADGES
   -------------------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  font-weight: 540;
  letter-spacing: 0.01em;
  background: rgba(14,17,22,.05);
  color: var(--steel);
  border: 1px solid var(--line);
}
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip--molten { background: var(--molten-soft); color: var(--molten-deep); border-color: rgba(7,94,102,.22); }
.chip--blue   { background: var(--blue-soft);   color: var(--blue-deep);   border-color: rgba(0,85,125,.22); }
.chip--good   { background: var(--good-soft);   color: var(--good);        border-color: rgba(24,169,87,.24); }
.chip--warn   { background: var(--warn-soft);   color: #9A6E00;            border-color: rgba(224,161,0,.30); }
.chip--mono   { font-family: var(--font-mono); letter-spacing: 0; }
.on-dark .chip { background: rgba(247,245,242,.07); color: var(--steel-2); border-color: var(--line-2); }

/* status badges (BC list, runs, etc.) */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-xs); font-weight: 600;
  padding: 3px 9px; border-radius: var(--r-xs);
  letter-spacing: 0.01em;
}
.badge--planned  { background: var(--blue-soft);  color: var(--blue-deep); }
.badge--released { background: var(--good-soft);  color: var(--good); }
.badge--finished { background: rgba(14,17,22,.07); color: var(--steel); }
.badge--firm     { background: var(--molten-soft); color: var(--molten-deep); }

/* ----------------------------------------------------------------------------
   10. SURFACES / CARDS
   -------------------------------------------------------------------------- */
.surface {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
}
.surface--flat { box-shadow: none; }
.surface--dark { background: var(--ink-2); border-color: var(--line-2); box-shadow: var(--sh-3); color: var(--porcelain); }
.card-pad { padding: var(--s6); }

.hairline { height: 1px; background: var(--line); border: none; }
.on-dark .hairline { background: var(--line-2); }
.vrule { width: 1px; background: var(--line); align-self: stretch; }

/* ----------------------------------------------------------------------------
   11. CODE / JSON BLOCK
   -------------------------------------------------------------------------- */
.code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.65;
  background: var(--ink);
  color: #D7DCE3;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  padding: var(--s5);
  overflow: auto;
  box-shadow: var(--sh-3);
  position: relative;
}
.code__bar {
  display: flex; align-items: center; gap: var(--s2);
  padding: 10px var(--s4);
  background: var(--ink-2);
  border-bottom: 1px solid var(--line-2);
  border-radius: var(--r-md) var(--r-md) 0 0;
  margin: calc(-1 * var(--s5)) calc(-1 * var(--s5)) var(--s4);
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--steel-2); letter-spacing: 0.04em;
}
.code__dot { width: 11px; height: 11px; border-radius: 50%; }
.code .tok-key { color: #7FB2FF; }       /* blue keys */
.code .tok-str { color: #9FE0E8; }       /* molten-tinted strings */
.code .tok-num { color: #A6E3A1; }
.code .tok-bool{ color: #C9A6FF; }
.code .tok-punc{ color: #6B7585; }
.code .tok-comment { color: #5B6470; font-style: italic; }
.code .tok-method { color: #0A7E8A; font-weight: 600; }

/* endpoint pill */
.endpoint {
  font-family: var(--font-mono); font-size: var(--text-xs);
  background: rgba(14,17,22,.05); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 12px;
  color: var(--ink); display: inline-flex; gap: 8px; align-items: center;
  overflow: auto; max-width: 100%;
}
.endpoint .verb { color: var(--good); font-weight: 700; }
.endpoint .verb--post { color: var(--molten-deep); }

/* ----------------------------------------------------------------------------
   12. DEVICE FRAME HELPERS (Power Apps phone/tablet)
   -------------------------------------------------------------------------- */
.device {
  position: relative;
  background: #0A0C10;
  border-radius: 38px;
  padding: 12px;
  box-shadow: var(--sh-4), inset 0 0 0 2px rgba(255,255,255,.04);
}
.device--phone { width: 340px; }
.device--tablet { width: 560px; border-radius: 28px; padding: 14px; }
.device__screen {
  position: relative;
  background: var(--paper);
  border-radius: 28px;
  overflow: hidden;
  aspect-ratio: 9 / 19;
}
.device--tablet .device__screen { aspect-ratio: 4 / 3; border-radius: 16px; }
.device__notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 132px; height: 26px; background: #0A0C10;
  border-radius: 0 0 16px 16px; z-index: 5;
}

/* ----------------------------------------------------------------------------
   13. REVEAL / MOTION PRIMITIVES (views call onEnter to toggle .is-in)
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--d-slow) var(--ease), transform var(--d-slow) var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }
.reveal--d1 { transition-delay: 60ms; }
.reveal--d2 { transition-delay: 120ms; }
.reveal--d3 { transition-delay: 180ms; }
.reveal--d4 { transition-delay: 240ms; }
.reveal--d5 { transition-delay: 300ms; }
.reveal--d6 { transition-delay: 360ms; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-ring { 0%{ box-shadow:0 0 0 0 rgba(10,126,138,.45);} 100%{ box-shadow:0 0 0 14px rgba(10,126,138,0);} }
@keyframes dash-flow { to { stroke-dashoffset: -24; } }
.u-spin { animation: spin .8s linear infinite; }

/* ----------------------------------------------------------------------------
   14. LAYOUT UTILITIES
   -------------------------------------------------------------------------- */
.u-flex { display: flex; }
.u-col { display: flex; flex-direction: column; }
.u-center { align-items: center; }
.u-between { justify-content: space-between; }
.u-wrap { flex-wrap: wrap; }
.u-gap1 { gap: var(--s1); } .u-gap2 { gap: var(--s2); } .u-gap3 { gap: var(--s3); }
.u-gap4 { gap: var(--s4); } .u-gap5 { gap: var(--s5); } .u-gap6 { gap: var(--s6); }
.u-grid { display: grid; }
.u-mt2{margin-top:var(--s2);} .u-mt3{margin-top:var(--s3);} .u-mt4{margin-top:var(--s4);}
.u-mt5{margin-top:var(--s5);} .u-mt6{margin-top:var(--s6);} .u-mt7{margin-top:var(--s7);}
.u-mb4{margin-bottom:var(--s4);} .u-mb5{margin-bottom:var(--s5);} .u-mb6{margin-bottom:var(--s6);}
.u-fill { flex: 1; } .u-none { flex: none; }
.u-rel { position: relative; }
.u-hidden { display: none !important; }

/* numeric tabular alignment for data */
.tnum { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* ============================================================================
   15. APP SHELL  (rendered by app.js)
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
  background: var(--porcelain);
}

/* — Left rail — */
.rail {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  background: var(--ink);
  color: var(--porcelain);
  border-right: 1px solid var(--line-2);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.rail::before { /* grain */
  content:""; position:absolute; inset:0; pointer-events:none; opacity:.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.rail__brand {
  position: relative; z-index: 1;
  padding: var(--s6) var(--s5) var(--s5);
  border-bottom: 1px solid var(--line-2);
}
.rail__logo { display: flex; align-items: center; gap: var(--s3); }
.rail__logoimg { width: 196px; max-width: 100%; height: auto; display: block; }
.rail__mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(150deg, var(--molten), var(--molten-deep));
  display: grid; place-items: center;
  box-shadow: var(--sh-molten);
  flex: none;
}
.rail__name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.02em; }
.rail__sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--steel-2); margin-top: 14px; }

.rail__nav { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: var(--s4) var(--s3); }
.rail__item {
  position: relative;
  display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: var(--s3);
  width: 100%;
  padding: 11px var(--s3);
  border-radius: var(--r-md);
  text-align: left;
  color: var(--steel-2);
  transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}
.rail__item:hover { background: rgba(247,245,242,.05); color: var(--porcelain); }
.rail__item.is-active { background: var(--ink-2); color: var(--porcelain); box-shadow: var(--sh-inset); }
.rail__item.is-active::before {
  content:""; position:absolute; left:-3px; top:50%; transform:translateY(-50%);
  width:3px; height:22px; border-radius:3px; background: var(--molten);
}
.rail__num {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--steel); letter-spacing: 0.02em;
}
.rail__item.is-active .rail__num { color: var(--molten); }
.rail__label { font-size: var(--text-sm); font-weight: 520; letter-spacing: -0.01em; }
.rail__item.is-done .rail__num { color: var(--good); }

.rail__foot {
  position: relative; z-index: 1;
  padding: var(--s4) var(--s5) var(--s5);
  border-top: 1px solid var(--line-2);
}
.rail__progress {
  height: 4px; border-radius: 999px; background: rgba(247,245,242,.10);
  overflow: hidden; margin-bottom: var(--s3);
}
.rail__progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--molten), var(--lime));
  border-radius: 999px;
  transition: width var(--d-slow) var(--ease);
}
.rail__credit { font-size: 11px; color: var(--steel); letter-spacing: 0.01em; }
.rail__credit strong { color: var(--steel-2); font-weight: 600; }

/* — Main column — */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s4) var(--s7);
  background: rgba(247,245,242,.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__crumb { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.topbar__kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--molten); }
.topbar__title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; gap: var(--s3); flex: none; }
.topbar__count { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--steel); letter-spacing: 0.04em; }

.iconbtn {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--paper); color: var(--steel);
  transition: all var(--d-fast) var(--ease);
}
.iconbtn:hover { color: var(--ink); border-color: rgba(14,17,22,.22); transform: translateY(-1px); box-shadow: var(--sh-1); }
.iconbtn.is-on { background: var(--ink); color: var(--porcelain); border-color: var(--ink); }

/* — Stage (where views mount) — */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
}
.stage__view {
  position: relative;
  min-height: calc(100vh - 71px);
}
/* crossfade/slide transition driven by app.js classes */
.stage__view.is-leaving {
  animation: view-out var(--d-norm) var(--ease) forwards;
}
.stage__view.is-entering {
  animation: view-in var(--d-slow) var(--ease) forwards;
}
@keyframes view-in  { from { opacity:0; transform: translateY(14px); } to { opacity:1; transform:none; } }
@keyframes view-out { from { opacity:1; transform: none; } to { opacity:0; transform: translateY(-10px); } }

/* — Floating prev/next dock — */
.dock {
  position: fixed; right: var(--s7); bottom: var(--s6); z-index: 40;
  display: flex; align-items: center; gap: var(--s2);
  padding: 7px;
  background: rgba(14,17,22,.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-4);
}
.dock__btn {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  color: var(--porcelain);
  transition: background var(--d-fast) var(--ease), transform var(--d-fast) var(--ease);
}
.dock__btn:hover { background: rgba(247,245,242,.10); transform: translateY(-1px); }
.dock__btn:active { transform: scale(.92); }
.dock__btn[disabled] { opacity: .3; pointer-events: none; }
.dock__pos { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--steel-2); padding: 0 var(--s2); letter-spacing: 0.04em; min-width: 52px; text-align: center; }
.dock__next { background: var(--lime); color: var(--ink); }
.dock__next:hover { background: var(--lime-deep); }

/* — Presenter notes overlay — */
.presenter {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: end center;
  padding: var(--s6);
  background: rgba(14,17,22,.42);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--d-norm) var(--ease);
}
.presenter.is-open { opacity: 1; pointer-events: auto; }
.presenter__card {
  width: min(680px, 100%);
  background: var(--ink-2); color: var(--porcelain);
  border: 1px solid var(--line-2); border-radius: var(--r-xl);
  box-shadow: var(--sh-4);
  padding: var(--s6) var(--s7);
  transform: translateY(20px);
  transition: transform var(--d-slow) var(--ease);
}
.presenter.is-open .presenter__card { transform: none; }
.presenter__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s4); }
.presenter__title { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; }
.presenter__list { display: flex; flex-direction: column; gap: var(--s3); }
.presenter__bullet {
  display: grid; grid-template-columns: 22px 1fr; gap: var(--s3); align-items: start;
  font-size: 1.02rem; line-height: 1.5; color: #DDE1E7;
}
.presenter__bullet b { color: #fff; font-weight: 600; }
.presenter__num {
  font-family: var(--font-mono); font-size: 12px; color: var(--molten);
  border: 1px solid rgba(10,126,138,.3); border-radius: 6px;
  width: 22px; height: 22px; display: grid; place-items: center; margin-top: 2px;
}
.presenter__hint { margin-top: var(--s5); font-family: var(--font-mono); font-size: 11px; color: var(--steel); letter-spacing: 0.04em; }
kbd {
  font-family: var(--font-mono); font-size: 11px;
  background: rgba(247,245,242,.10); border: 1px solid var(--line-2);
  border-radius: 5px; padding: 2px 6px; color: var(--steel-2);
}

/* — empty / missing view fallback — */
.viewstub {
  display: grid; place-items: center; min-height: calc(100vh - 71px);
  padding: var(--s9);
  text-align: center;
}
.viewstub__inner { max-width: 520px; }
.viewstub__badge {
  font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--molten);
}

/* ----------------------------------------------------------------------------
   16. REDUCED MOTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------------------------
   17. RESPONSIVE — hold to ~1024 (presentation-first, no full mobile collapse)
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  :root { --rail-w: 240px; }
  .section { padding: var(--s8) var(--s6); }
  .topbar { padding: var(--s4) var(--s5); }
}
@media (max-width: 1024px) {
  .dock { right: var(--s5); bottom: var(--s5); }
}
