:root {
  --vp-primary: #007681;        /* Valterra teal (wordmark) */
  --vp-primary-dark: #005962;
  --vp-accent: #7e99a3;         /* Valterra slate (wave mark / "PLATINUM") */
  --vp-accent-dark: #5f7c87;
  --vp-tint: #e6f2f3;           /* light teal selection tint */
  --vp-bg: #f4f7f8;
  --vp-card: #ffffff;
  --vp-border: #e0e7e9;
  --vp-border-strong: #cdd8db;
  --vp-text: #1f2d31;
  --vp-muted: #5e6f74;
  --vp-error: #b3261e;
  --vp-error-bg: #fdf3f2;

  /* Spacing / shape / depth tokens for a consistent feel across breakpoints */
  --radius: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(16,40,44,.06);
  --shadow-md: 0 8px 24px rgba(0,118,129,.07);
  --shadow-lg: 0 16px 44px rgba(0,118,129,.12);
  --ring: 0 0 0 3px rgba(0,118,129,.28);

  /* Offset used when scrolling an element into view under the sticky progress bar */
  --sticky-offset: 84px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (min-width: 768px) { html { font-size: 16px; } }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--vp-bg);
  color: var(--vp-text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
  padding-top: clamp(1.25rem, 3vw, 2.25rem);
  padding-bottom: 1rem;
}

a { color: var(--vp-primary); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* ---------- Header ---------- */
.site-header {
  background: #fff;
  border-top: 4px solid var(--vp-primary);
  border-bottom: 1px solid var(--vp-border);
  box-shadow: var(--shadow-sm);
}
.site-header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  padding: .8rem 0;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: .85rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.brand-logo { height: 38px; width: auto; display: block; }
.brand-divider { width: 1px; height: 26px; background: var(--vp-border-strong); }
.brand-tag {
  color: var(--vp-accent-dark);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* Language switcher */
.lang-switch {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem;
  background: var(--vp-bg);
  padding: .2rem;
  border-radius: var(--radius-pill);
}
.lang-option {
  display: inline-block;
  padding: .35rem .6rem;
  border-radius: var(--radius-pill);
  font-size: .8rem;
  font-weight: 600;
  color: var(--vp-muted);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.lang-option:hover { color: var(--vp-primary-dark); background: #fff; }
.lang-option.is-active { color: #fff; background: var(--vp-primary); box-shadow: var(--shadow-sm); }

/* ---------- Footer ---------- */
.site-footer {
  flex-shrink: 0;
  margin-top: 3rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--vp-border);
  color: var(--vp-muted);
  font-size: .85rem;
}
.site-footer .container { display: flex; flex-wrap: wrap; gap: .25rem 1rem; justify-content: space-between; }
.footer-managed a { color: var(--vp-primary); font-weight: 600; }

/* ---------- Layout helpers ---------- */
.survey-container { max-width: 760px; margin: 0 auto; }
.survey-hero { max-width: 720px; margin: clamp(.5rem, 2vw, 1.5rem) auto; text-align: center; }
.survey-eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--vp-accent-dark);
  font-weight: 700;
  font-size: .8rem;
}
.survey-hero h1 {
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--vp-primary);
  margin: .35rem 0 1rem;
}
.lead { color: var(--vp-muted); font-size: clamp(1rem, 2.4vw, 1.15rem); }

/* ---------- Cards ---------- */
.survey-card {
  background: var(--vp-card);
  border: 1px solid var(--vp-border);
  border-radius: var(--radius-lg);
  padding: clamp(1.15rem, 3vw, 1.9rem);
  box-shadow: var(--shadow-md);
  text-align: left;
  margin: 1.5rem 0;
}
.survey-card h2 { font-size: 1.2rem; color: var(--vp-primary); margin-top: 0; }
.survey-card ul { padding-left: 1.15rem; }
.survey-card li { margin-bottom: .35rem; }
.survey-note { color: var(--vp-muted); font-size: .9rem; }

/* ---------- Buttons ---------- */
.btn {
  border-radius: 10px;
  font-weight: 600;
  touch-action: manipulation;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn-lg { padding: .7rem 1.5rem; font-size: 1.05rem; }
.btn-primary { background: var(--vp-primary); border-color: var(--vp-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--vp-primary-dark); border-color: var(--vp-primary-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-link { color: var(--vp-primary); font-weight: 600; }
.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus {
  box-shadow: var(--ring);
}

/* ---------- Type choice tiles (Permanent / Contractor) ---------- */
.survey-card fieldset { border: 0; padding: 0; margin: 0; }
.choice-tile {
  display: block;
  border: 2px solid var(--vp-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, background .15s, box-shadow .15s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.choice-tile:hover { border-color: var(--vp-accent); box-shadow: var(--shadow-sm); }
.choice-tile:has(input:checked) { border-color: var(--vp-primary); background: var(--vp-tint); }
.choice-tile:focus-within { box-shadow: var(--ring); }
.choice-tile input { margin-right: .6rem; accent-color: var(--vp-primary); }
.choice-title { font-weight: 700; }
.choice-sub { display: block; color: var(--vp-muted); font-size: .9rem; margin-left: 1.6rem; }

/* Side-by-side choice tiles once there's room (tablet and up) */
@media (min-width: 620px) {
  .survey-card fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  .choice-tile { margin-bottom: 0; height: 100%; }
  /* The grouped demographic filters stay stacked; only the type-choice tiles use the 2-col grid. */
  .survey-card fieldset.filter-group { display: block; }
  .survey-card fieldset.filter-group .filter-group-title { grid-column: 1 / -1; }
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.25rem; }
.form-label { font-weight: 600; margin-bottom: .35rem; display: inline-block; }
.required { color: var(--vp-error); }
.field-error { display: block; color: var(--vp-error); font-size: .85rem; margin-top: .35rem; font-weight: 600; }
.has-error .form-select, .has-error textarea, .has-error .form-control { border-color: var(--vp-error); }
.form-select, .form-control { min-height: 48px; border-radius: 10px; border-color: var(--vp-border-strong); }
.form-select:disabled { background-color: var(--vp-tint); color: var(--vp-muted); cursor: not-allowed; }
textarea.form-control { min-height: 104px; }

/* ---------- Grouped demographic filters (linked dropdowns) ---------- */
.filter-group { margin: 0 0 1.5rem; padding: 0; }
.filter-group + .filter-group { border-top: 1px solid var(--vp-border); padding-top: 1.25rem; }
.filter-group-title {
  font-weight: 700;
  color: var(--vp-primary);
  font-size: 1.05rem;
  margin: 0 0 .85rem;
  padding: 0;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}
.form-actions .btn-primary { flex: 0 0 auto; }

/* ---------- Progress (sticky) ---------- */
.progress-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(244,247,248,.9);
  backdrop-filter: saturate(140%) blur(6px);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--vp-border);
  padding: .6rem 0 .65rem;
  margin: 0 0 1.25rem;
}
.progress-track { height: 8px; border-radius: var(--radius-pill); background: var(--vp-border); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--vp-primary), var(--vp-accent-dark)); border-radius: var(--radius-pill); transition: width .3s ease; }
.progress-text { display: inline-block; margin-top: .4rem; font-size: .85rem; font-weight: 600; color: var(--vp-muted); }

/* ---------- Questions ---------- */
.dimension-block {
  background: var(--vp-card);
  border: 1px solid var(--vp-border);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 3vw, 1.6rem);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  scroll-margin-top: var(--sticky-offset);
}
.dimension-title {
  font-size: .82rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--vp-accent-dark);
  font-weight: 800;
  border-bottom: 1px solid var(--vp-border);
  padding-bottom: .6rem;
  margin: 0 0 1.25rem;
}
.question { padding: 1.1rem 0; border-bottom: 1px dashed var(--vp-border); scroll-margin-top: var(--sticky-offset); }
.question:first-of-type { padding-top: .25rem; }
.question:last-child { border-bottom: none; padding-bottom: .25rem; }
.question.has-error { background: var(--vp-error-bg); border-radius: 12px; padding: 1rem .85rem; border-bottom-style: solid; border-bottom-color: transparent; }
.question-text { font-weight: 600; margin-bottom: .9rem; font-size: 1.02rem; }
.question-number { color: var(--vp-muted); margin-right: .35rem; }

/* Visually-hidden native inputs (kept focusable for keyboard / screen readers) */
.likert-option input,
.enps-option input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Likert (5-point) */
.likert { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.likert-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .55rem;
  border: 1px solid var(--vp-border);
  border-radius: var(--radius);
  padding: .85rem .4rem;
  cursor: pointer;
  font-size: .8rem;
  line-height: 1.25;
  color: var(--vp-muted);
  background: #fff;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s, transform .05s;
}
.likert-dot {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid var(--vp-border-strong);
  font-weight: 700;
  color: var(--vp-muted);
  background: #fff;
  transition: inherit;
}
.likert-option:hover { border-color: var(--vp-accent); box-shadow: var(--shadow-sm); }
.likert-option:active { transform: translateY(1px); }
.likert-option:has(input:checked) {
  border-color: var(--vp-primary);
  background: var(--vp-tint);
  color: var(--vp-text);
  font-weight: 600;
}
.likert-option:has(input:checked) .likert-dot { border-color: var(--vp-primary); background: var(--vp-primary); color: #fff; }
.likert-option:focus-within { box-shadow: var(--ring); border-color: var(--vp-primary); }

/* eNPS (0-10) */
.enps { display: grid; grid-template-columns: repeat(11, 1fr); gap: .35rem; }
.enps-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--vp-border);
  border-radius: 10px;
  font-weight: 600;
  color: var(--vp-muted);
  background: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s, transform .05s;
}
.enps-option:hover { border-color: var(--vp-accent); box-shadow: var(--shadow-sm); }
.enps-option:active { transform: translateY(1px); }
.enps-option:has(input:checked) { border-color: var(--vp-primary); background: var(--vp-primary); color: #fff; font-weight: 700; }
.enps-option:focus-within { box-shadow: var(--ring); border-color: var(--vp-primary); }
.enps-scale { display: flex; justify-content: space-between; color: var(--vp-muted); font-size: .8rem; margin-top: .5rem; }

/* ---------- Message pages (Thank you / Closed / Invalid) ---------- */
.survey-message { text-align: center; padding-top: 2rem; }
.message-icon {
  width: 76px; height: 76px; margin: 0 auto 1.1rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--vp-primary); color: #fff; font-size: 2.1rem;
  box-shadow: var(--shadow-md);
}
.message-icon-muted { background: var(--vp-tint); color: var(--vp-primary-dark); box-shadow: none; }
.handoff { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--vp-border); }
.handoff-note { color: var(--vp-muted); margin-bottom: .9rem; }

/* ===========================================================
   Responsive tuning
   =========================================================== */

/* Tablet: a touch more breathing room, comfortable scale options */
@media (min-width: 576px) and (max-width: 991.98px) {
  .survey-container { max-width: 680px; }
  .likert-option { padding: .9rem .5rem; }
  .enps-option { min-height: 50px; }
}

/* Large desktop: a slightly wider, airier reading column */
@media (min-width: 992px) {
  .survey-container { max-width: 800px; }
  .dimension-block { padding: 1.75rem 2rem; }
}

/* Phones */
@media (max-width: 575.98px) {
  .survey-card { margin: 1.15rem 0; }

  .dimension-title { font-size: .78rem; }
  .question { padding: .95rem 0; }
  .question-text { font-size: 1rem; }

  /* Likert becomes a vertical, full-width list with large tap targets */
  .likert { grid-template-columns: 1fr; gap: .45rem; }
  .likert-option {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    gap: .8rem;
    min-height: 52px;
    padding: .6rem .8rem;
    font-size: .98rem;
  }
  .likert-dot { width: 32px; height: 32px; }

  /* eNPS: two tidy rows (0-5 / 6-10) that stay tappable */
  .enps { grid-template-columns: repeat(6, 1fr); gap: .35rem; }
  .enps-option { min-height: 46px; }

  /* Stacked, full-width actions; primary on top for thumb reach */
  .form-actions { flex-direction: column-reverse; align-items: stretch; gap: .5rem; }
  .form-actions .btn-primary,
  .form-actions .btn-link { width: 100%; text-align: center; }
  .survey-card .btn-lg { width: 100%; }

  .brand-logo { height: 30px; }
  .brand-tag { font-size: .68rem; letter-spacing: .1em; }
  .lang-option { padding: .3rem .5rem; font-size: .76rem; }
}

/* Very small phones: keep the language pills on one scrollable row */
@media (max-width: 380px) {
  .site-header-inner { gap: .4rem; }
  .lang-switch { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
}

/* Respect device safe areas (notches / rounded corners) when viewport-fit=cover is set */
@supports (padding: max(0px)) {
  .container {
    padding-left: max(.75rem, env(safe-area-inset-left));
    padding-right: max(.75rem, env(safe-area-inset-right));
  }
}

/* Honour reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ======================= Admin reporting area ======================= */
.admin-nav { display: flex; align-items: center; gap: .35rem .9rem; flex-wrap: wrap; margin-left: auto; }
.admin-nav-link {
  text-decoration: none; color: var(--vp-muted); font-weight: 600; font-size: .9rem;
  padding: .4rem .7rem; border-radius: var(--radius-pill); min-height: 38px; display: inline-flex; align-items: center;
}
.admin-nav-link:hover { background: var(--vp-tint); color: var(--vp-primary-dark); }
.admin-nav-link.is-active { background: var(--vp-primary); color: #fff; }
.admin-user { color: var(--vp-muted); font-size: .85rem; padding-left: .4rem; border-left: 1px solid var(--vp-border-strong); }
.admin-logout-form { margin: 0; }
.admin-logout {
  border: 1px solid var(--vp-border-strong); background: #fff; color: var(--vp-text);
  border-radius: var(--radius-pill); padding: .4rem .8rem; font-weight: 600; font-size: .85rem; cursor: pointer; min-height: 38px;
}
.admin-logout:hover { border-color: var(--vp-primary); color: var(--vp-primary-dark); }

.admin-page { max-width: 1100px; margin: 0 auto; }
.admin-h1 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 0 0 .25rem; }
.admin-h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
.admin-lead { color: var(--vp-muted); margin: 0 0 1.4rem; }

/* KPI cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.6rem; }
.stat-card {
  background: var(--vp-card); border: 1px solid var(--vp-border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .25rem;
}
.stat-card.stat-enps { border-color: var(--vp-primary); box-shadow: var(--shadow-md); }
.stat-label { color: var(--vp-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--vp-text); line-height: 1.1; }
.stat-sub { color: var(--vp-muted); font-size: .8rem; }

/* Landing link cards */
.admin-link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.admin-link-card {
  display: block; text-decoration: none; color: inherit; background: var(--vp-card);
  border: 1px solid var(--vp-border); border-radius: var(--radius-lg); padding: 1.3rem; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
.admin-link-card:hover { border-color: var(--vp-primary); box-shadow: var(--shadow-md); }
.admin-link-card h2 { margin: 0 0 .35rem; font-size: 1.2rem; color: var(--vp-primary-dark); }
.admin-link-card p { margin: 0 0 .7rem; color: var(--vp-muted); }
.admin-link-go { font-weight: 600; color: var(--vp-primary); }

.admin-empty {
  background: var(--vp-card); border: 1px dashed var(--vp-border-strong); border-radius: var(--radius);
  padding: 1.5rem; text-align: center; color: var(--vp-muted);
}

/* Login */
.admin-login { display: flex; justify-content: center; padding-top: 1.5rem; }
.admin-login-card { max-width: 420px; width: 100%; }
.admin-login-card h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
.admin-login-sub { color: var(--vp-muted); margin: 0 0 1.2rem; }
.admin-field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.admin-field label { font-weight: 600; font-size: .9rem; }
.admin-field input {
  border: 1px solid var(--vp-border-strong); border-radius: 10px; padding: .65rem .8rem; font-size: 1rem; min-height: 46px;
}
.admin-field input:focus-visible { border-color: var(--vp-primary); }
.admin-field-check { flex-direction: row; align-items: center; }
.admin-field-check label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; }
.admin-field-check input { min-height: 0; width: auto; }
.table-link { color: var(--vp-primary); font-weight: 600; text-decoration: none; }
.table-link:hover { text-decoration: underline; }
.role-scope { font-size: .8rem; margin-top: .25rem; }
.admin-scope { border: 1px solid var(--vp-border-strong); border-radius: 10px; padding: .8rem 1rem; margin: 0; }
.admin-scope legend { font-weight: 600; padding: 0 .4rem; }
.admin-scope-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .4rem .9rem; margin-top: .6rem; }
.admin-scope-opt { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; }
.admin-scope-opt input { min-height: 0; width: auto; }
.admin-login-btn { width: 100%; }
.admin-alert {
  background: var(--vp-error-bg); color: var(--vp-error); border: 1px solid #f2c9c6;
  border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem; font-size: .9rem;
}

/* Filter cells (shared by the drawer) */
.filter-cell { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.filter-cell label { font-weight: 600; font-size: .82rem; color: var(--vp-muted); }
.filter-cell select {
  border: 1px solid var(--vp-border-strong); border-radius: 10px; padding: .55rem .7rem; font-size: .95rem;
  min-height: 44px; background: #fff; max-width: 100%; width: 100%;
}
.filter-cell select:disabled { background: var(--vp-bg); color: var(--vp-muted); cursor: not-allowed; }
.btn-clear { color: var(--vp-muted); text-decoration: none; font-weight: 600; font-size: .9rem; }
.btn-clear:hover { color: var(--vp-primary-dark); text-decoration: underline; }

/* Dashboard toolbar: filter toggle + active-filter chips */
.dash-toolbar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.6rem;
}
.filter-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  background: #fff; color: var(--vp-primary-dark); border: 1px solid var(--vp-primary);
  padding: .5rem .9rem; min-height: 44px;
}
.filter-toggle:hover, .filter-toggle:focus { background: var(--vp-tint); color: var(--vp-primary-dark); }
.filter-toggle-ico { font-size: 1.05rem; line-height: 1; }
.filter-badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 .35rem;
  border-radius: var(--radius-pill); background: var(--vp-primary); color: #fff;
  font-size: .75rem; font-weight: 700;
}
.dash-chips { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dash-chip {
  display: inline-flex; align-items: center; background: var(--vp-tint); color: var(--vp-primary-dark);
  border-radius: var(--radius-pill); padding: .25rem .7rem; font-size: .85rem; font-weight: 600;
}
.dash-chips-empty { font-size: .9rem; }

/* Slide-out filter drawer */
.filter-scrim {
  position: fixed; inset: 0; background: rgba(15, 32, 39, .45); z-index: 1090;
  opacity: 0; transition: opacity .25s ease;
}
.filter-scrim.is-open { opacity: 1; }
.filter-drawer {
  position: fixed; top: 0; left: 0; height: 100dvh; width: min(340px, 88vw); z-index: 1100;
  background: var(--vp-card); box-shadow: 2px 0 24px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column; padding: 1.1rem 1.2rem 1.4rem;
  transform: translateX(-100%); transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-left: max(1.2rem, env(safe-area-inset-left));
}
.filter-drawer.is-open { transform: translateX(0); }
.filter-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.filter-drawer-title { font-size: 1.15rem; margin: 0; color: var(--vp-primary-dark); }
.filter-close {
  border: none; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer;
  color: var(--vp-muted); width: 40px; height: 40px; border-radius: 10px;
}
.filter-close:hover, .filter-close:focus { background: var(--vp-bg); color: var(--vp-primary-dark); }
.filter-form { display: flex; flex-direction: column; gap: 1rem; }
.filter-form .filter-actions { display: flex; align-items: center; gap: .8rem; margin-top: .4rem; }
.filter-form .filter-actions .btn-primary { flex: 1 1 auto; min-height: 44px; }

/* "Working" overlay while the dashboard reloads */
.dash-overlay {
  position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .6); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
}
.dash-overlay.is-active { opacity: 1; visibility: visible; }
.dash-overlay-card {
  display: flex; align-items: center; gap: .8rem; background: var(--vp-card);
  border: 1px solid var(--vp-border); border-radius: var(--radius); box-shadow: var(--shadow-md, 0 10px 30px rgba(0,0,0,.15));
  padding: 1rem 1.4rem; font-weight: 600; color: var(--vp-primary-dark);
}
.dash-spinner {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  border: 3px solid var(--vp-tint); border-top-color: var(--vp-primary);
  animation: dash-spin .7s linear infinite;
}
@keyframes dash-spin { to { transform: rotate(360deg); } }
body.drawer-open { overflow: hidden; }

/* "Present my results" launch button loading state */
.present-launch { display: inline-flex; align-items: center; gap: .5rem; }
.present-launch.is-loading { cursor: progress; opacity: .9; pointer-events: none; }
.present-launch.is-loading::before {
  content: ""; width: 15px; height: 15px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff;
  animation: dash-spin .7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .filter-drawer, .filter-scrim, .dash-overlay { transition: none; }
  .dash-spinner { animation-duration: 1.4s; }
}

/* Drilldown tree (progress) */
.tree { background: var(--vp-card); border: 1px solid var(--vp-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.tree-head, .tree-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px 80px 200px; align-items: center; gap: .5rem;
  padding: .6rem 1rem;
}
.tree-head { background: var(--vp-tint); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--vp-muted); font-weight: 700; }
.tree-col-num { text-align: right; font-variant-numeric: tabular-nums; }
.tree-strong { font-weight: 700; }
.tree-node { border-top: 1px solid var(--vp-border); }
.tree-node > summary { cursor: pointer; list-style: none; }
.tree-node > summary::-webkit-details-marker { display: none; }
.tree-twisty { display: inline-block; width: 0; height: 0; margin-right: .55rem; vertical-align: middle;
  border-left: 6px solid var(--vp-accent-dark); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
  transition: transform .15s; }
details[open] > summary .tree-twisty { transform: rotate(90deg); }
.tree-l1 > summary { font-weight: 700; }
.tree-l2 > summary .tree-col-name { padding-left: 1.4rem; font-weight: 600; }
.tree-l2 > summary { background: #fcfdfd; }
.tree-leaf .tree-col-name { padding-left: 3rem; color: var(--vp-muted); }
.tree-leaf { border-top: 1px solid var(--vp-border); background: #fafcfc; font-size: .92rem; }
.tree-row:hover { background: var(--vp-tint); }
.tree-col-bar { display: flex; align-items: center; gap: .5rem; }
.bar { display: flex; flex: 1; height: 8px; background: var(--vp-border); border-radius: 999px; overflow: hidden; min-width: 60px; }
.bar-fill { display: block; height: 100%; background: var(--vp-primary); }
.bar-pct { font-size: .78rem; color: var(--vp-muted); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* Progress tracker toolbar + stacked bars */
.tree-toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.tree-search {
  flex: 1 1 240px; min-height: 42px; border: 1px solid var(--vp-border-strong); border-radius: 10px;
  padding: .5rem .8rem; font-size: .95rem; background: var(--vp-card);
}
.tree-search:focus-visible { border-color: var(--vp-primary); outline: none; }
.tree-toolbar-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.btn-tree {
  background: var(--vp-card); border: 1px solid var(--vp-border-strong); border-radius: 999px;
  padding: .45rem .9rem; font-size: .82rem; font-weight: 600; color: var(--vp-muted);
  cursor: pointer; text-decoration: none; line-height: 1;
}
.btn-tree:hover { border-color: var(--vp-primary); color: var(--vp-primary-dark); }
.tree-count { font-size: .78rem; font-weight: 500; }
.bar-fill-inprog { background: var(--vp-accent); opacity: .45; }
.tree-legend { font-size: .78rem; margin: .6rem 0 0; }
.dot-done { background: var(--vp-primary); }
.dot-inprog { background: var(--vp-accent); opacity: .6; }
.tree-no-results { margin-top: .8rem; }

/* Completion tracker: name + completion bar only (percentage-only tracker). */
.tree-completion .tree-head, .tree-completion .tree-row { grid-template-columns: minmax(0, 1fr) 260px; }
.tree-completion .bar { min-width: 120px; }

/* Result tables */
.result-section { margin-bottom: 1.8rem; }
.result-table {
  width: 100%; border-collapse: collapse; background: var(--vp-card);
  border: 1px solid var(--vp-border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.result-table th, .result-table td { padding: .6rem .85rem; text-align: left; border-top: 1px solid var(--vp-border); }
.result-table thead th { background: var(--vp-tint); border-top: 0; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--vp-muted); }
.result-table td.num, .result-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.result-table td.muted, .muted { color: var(--vp-muted); }
.result-table tbody tr:hover { background: var(--vp-tint); }
.fav-pill { display: inline-block; min-width: 56px; text-align: center; padding: .15rem .5rem; border-radius: 999px; font-weight: 600; font-size: .85rem; }
.fav-high { background: #e3f3ec; color: #1c7a4f; }
.fav-mid { background: #fdf3e3; color: #9a6b15; }
.fav-low { background: var(--vp-error-bg); color: var(--vp-error); }

/* Results dashboard: shared bits */
:root {
  --lk1: #c0453b;   /* strongly disagree */
  --lk2: #e08a4e;   /* disagree */
  --lk3: #d3dadd;   /* neutral */
  --lk4: #7cb894;   /* agree */
  --lk5: #1c7a4f;   /* strongly agree */
}
.stat-scale, .dim-scale { font-size: .9rem; font-weight: 600; color: var(--vp-muted); margin-left: .1rem; }
.admin-notice {
  background: var(--vp-tint); border: 1px solid var(--vp-border-strong); border-radius: var(--radius);
  padding: 1.1rem 1.3rem; color: var(--vp-text); margin-bottom: 1.6rem;
}
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 .3rem 0 .6rem; vertical-align: baseline; }
.dot:first-child { margin-left: 0; }
.dot.lk1 { background: var(--lk1); } .dot.lk2 { background: var(--lk2); } .dot.lk3 { background: var(--lk3); }
.dot.lk4 { background: var(--lk4); } .dot.lk5 { background: var(--lk5); }
.dot-prom { background: var(--lk5); } .dot-pass { background: var(--lk3); } .dot-detr { background: var(--lk1); }

/* eNPS stacked bar */
.enps-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--vp-border); margin: .3rem 0 .1rem; }
.enps-seg { display: block; height: 100%; }
.enps-prom { background: var(--lk5); }
.enps-pass { background: var(--lk3); }
.enps-detr { background: var(--lk1); }

/* Likert distribution bars */
.likert-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--vp-border); }
.likert-bar-sm { height: 10px; min-width: 140px; }
.likert-seg { display: block; height: 100%; }
.likert-seg.lk1 { background: var(--lk1); }
.likert-seg.lk2 { background: var(--lk2); }
.likert-seg.lk3 { background: var(--lk3); }
.likert-seg.lk4 { background: var(--lk4); }
.likert-seg.lk5 { background: var(--lk5); }
.likert-legend { font-size: .78rem; margin: .7rem 0 0; }
.legend-item { display: inline-block; margin-right: .4rem; white-space: nowrap; }

/* Insights strip */
.insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: .9rem; margin-bottom: 1.8rem; }
.insight-card {
  background: var(--vp-card); border: 1px solid var(--vp-border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1rem 1.1rem;
}
.insight-good { border-top: 4px solid var(--lk5); }
.insight-bad { border-top: 4px solid var(--lk1); }
.insight-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--vp-muted); margin: 0 0 .7rem; }
.insight-item + .insight-item { margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--vp-border); }
.insight-text { font-size: .92rem; margin-bottom: .35rem; }
.insight-dim { display: inline-block; margin-left: .3rem; font-size: .74rem; font-weight: 600; color: var(--vp-accent-dark); text-transform: uppercase; letter-spacing: .04em; }
.insight-bar-row { display: flex; align-items: center; gap: .6rem; }
.insight-val { font-weight: 700; font-size: .88rem; min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.mini-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--vp-border); overflow: hidden; }
.mini-fill { display: block; height: 100%; border-radius: 999px; }
.mini-good { background: var(--lk5); }
.mini-bad { background: var(--lk1); }

/* Dimension cards */
.dim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.dim-card {
  background: var(--vp-card); border: 1px solid var(--vp-border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: .95rem 1.05rem; display: flex; flex-direction: column; gap: .55rem;
}
.dim-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.dim-name { font-weight: 700; font-size: .95rem; }
.dim-avg { font-weight: 700; font-size: 1.05rem; color: var(--vp-primary-dark); white-space: nowrap; }
.dim-fav-track { height: 10px; border-radius: 999px; background: var(--vp-border); overflow: hidden; }
.dim-fav-fill { display: block; height: 100%; border-radius: 999px; }
.dim-fav-fill.fav-high { background: var(--lk5); }
.dim-fav-fill.fav-mid { background: var(--lk2); }
.dim-fav-fill.fav-low { background: var(--lk1); }
.dim-meta { font-size: .82rem; display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.dim-suppressed { font-size: .85rem; margin: 0; }

/* Heatmap */
.heatmap-wrap { overflow-x: auto; }
.heatmap-table th.heat-col { font-size: .7rem; }
.heatmap-table td.heat-cell {
  text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .88rem;
  min-width: 64px; white-space: nowrap;
}
.heat-high { background: #e3f3ec; color: #14603c; }
.heat-mid { background: #fdf3e3; color: #8a5f12; }
.heat-low { background: #fbe9e7; color: #a03227; }
.heat-none { color: var(--vp-muted); }
.heat-suppressed { background: #eef1f2; color: var(--vp-muted); font-weight: 600; }
.heat-drill { font-weight: 600; text-decoration: none; }
.heat-drill:hover { text-decoration: underline; }
.heat-mean { display: block; font-weight: 700; line-height: 1.15; }
.heat-fav { display: block; font-weight: 500; font-size: .72rem; opacity: .8; line-height: 1.1; }

/* Permanent vs contractor comparison */
.cmp-card {
  background: var(--vp-card); border: 1px solid var(--vp-border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1rem 1.2rem;
}
.cmp-row { display: grid; grid-template-columns: 180px 1fr; gap: .4rem 1.2rem; align-items: center; padding: .65rem 0; }
.cmp-row + .cmp-row { border-top: 1px dashed var(--vp-border); }
.cmp-dim { font-weight: 700; font-size: .92rem; }
.cmp-bars { display: flex; flex-direction: column; gap: .35rem; }
.cmp-bar-row { display: flex; align-items: center; gap: .6rem; }
.cmp-label { min-width: 82px; font-size: .78rem; color: var(--vp-muted); font-weight: 600; }
.cmp-val { min-width: 52px; text-align: right; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }
.cmp-fav { min-width: 52px; text-align: right; font-size: .78rem; font-variant-numeric: tabular-nums; }
.cmp-perm { background: var(--vp-primary); }
.cmp-contr { background: var(--vp-accent); }

/* Grouped question table */
.question-table td:first-child { max-width: 420px; }
.question-table .dist-col { width: 180px; }
.dim-subhead td {
  background: var(--vp-tint); font-weight: 700; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--vp-primary-dark); padding-top: .45rem; padding-bottom: .45rem;
}
.result-table tbody tr.dim-subhead:hover { background: var(--vp-tint); }

@media (max-width: 760px) {
  .tree-head { display: none; }
  .tree-row { grid-template-columns: repeat(3, 1fr); row-gap: .35rem; }
  .tree-col-name { grid-column: 1 / -1; }
  .tree-col-num { text-align: left; }
  .tree-col-num::before {
    content: attr(data-label); display: block; font-size: .66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--vp-muted);
  }
  .tree-col-bar { grid-column: 1 / -1; }
  .tree-completion .tree-row { grid-template-columns: 1fr; }
  .tree-toolbar-actions { width: 100%; }
  .result-table { display: block; overflow-x: auto; white-space: nowrap; }
  .heatmap-wrap .result-table, .heatmap-wrap .heatmap-table { display: table; white-space: normal; }
  .question-table td:first-child { max-width: none; min-width: 220px; }
  .dim-grid { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .cmp-row { grid-template-columns: 1fr; }
}

/* User management */
.admin-page-narrow { max-width: 560px; }
.admin-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.admin-page-head .admin-lead { margin-bottom: 1.2rem; }
.admin-success {
  background: #e3f3ec; color: #1c7a4f; border: 1px solid #bfe3d1;
  border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem; font-size: .9rem;
}
.admin-hint { color: var(--vp-muted); font-size: .8rem; }
.admin-form { display: block; }
.admin-form .admin-field select {
  border: 1px solid var(--vp-border-strong); border-radius: 10px; padding: .6rem .7rem; font-size: 1rem; min-height: 46px; background: #fff;
}
.admin-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; margin-top: .5rem; }
.role-badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-weight: 600; font-size: .8rem; }
.role-admin { background: var(--vp-tint); color: var(--vp-primary-dark); }
.role-viewer { background: #eef1f2; color: var(--vp-muted); }

/* Survey links */
.admin-h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
.link-row { display: flex; gap: .6rem; align-items: center; max-width: 760px; }
.link-input {
  flex: 1 1 auto; min-width: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .9rem; padding: .55rem .7rem; border: 1px solid var(--vp-border-strong); border-radius: 10px;
  background: #fff; color: var(--vp-text);
}
.link-copy {
  flex: 0 0 auto; min-height: 42px; padding: 0 1rem; border: 1px solid var(--vp-primary);
  background: var(--vp-primary); color: #fff; border-radius: 10px; font-weight: 600; cursor: pointer;
}
.link-copy:hover { background: var(--vp-primary-dark); border-color: var(--vp-primary-dark); }
.link-copy.is-copied { background: #1c7a4f; border-color: #1c7a4f; }
.link-table td { vertical-align: middle; }
.link-table .link-input { width: 100%; }
.link-col-action { width: 1%; white-space: nowrap; }
.link-col-qr { width: 1%; white-space: nowrap; text-align: center; }
.link-block { max-width: 760px; }
.link-block .link-qr-wrap { margin-top: .8rem; }
.link-qr-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: .45rem; }
.link-qr {
  display: block; width: 96px; height: 96px; padding: 6px; background: #fff;
  border: 1px solid var(--vp-border-strong); border-radius: 10px; image-rendering: pixelated;
}
.link-block .link-qr { width: 112px; height: 112px; }
.link-qr-download {
  display: inline-block; font-size: .8rem; font-weight: 600; color: var(--vp-primary-dark);
  text-decoration: none; padding: .25rem .55rem; border: 1px solid var(--vp-border-strong);
  border-radius: 8px; background: #fff; white-space: nowrap;
}
.link-qr-download:hover { background: var(--vp-tint); border-color: var(--vp-primary); }
@media (max-width: 768px) {
  .link-block .link-qr-wrap { align-items: flex-start; }
}
.complex-note {
  background: var(--vp-tint); border: 1px solid var(--vp-border); border-radius: 10px;
  padding: .6rem .8rem; font-weight: 600; color: var(--vp-primary-dark); margin: 0 0 1rem;
}
.field-hint { display: block; margin-top: .3rem; font-size: .82rem; color: var(--vp-muted); }

/* ---- AI Presentation Mode (preview) ---- */
.present-shell { margin: 1.2rem 0 2.4rem; }
.present-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.present-eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; color: var(--vp-primary); }
.present-title { font-size: 1.6rem; margin: .2rem 0 .3rem; }
.present-scope { color: var(--vp-muted); margin: 0; }
.present-chip { display: inline-block; padding: .3rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.present-chip--ai { background: var(--vp-tint); color: var(--vp-primary-dark); }
.present-chip--fallback { background: #fff4e5; color: #9a6300; border: 1px solid #f2d9ad; }

.present-body { display: grid; grid-template-columns: 220px 1fr; gap: 1.4rem; align-items: start; }
.present-rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.present-rail li { border-radius: 10px; }
.present-rail a, .present-rail .rail-disabled {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .55rem .75rem; border-radius: 10px; text-decoration: none; color: var(--vp-text);
  border: 1px solid transparent; font-size: .92rem;
}
.present-rail a:hover { background: var(--vp-tint); }
.present-rail li.is-current a { background: var(--vp-primary); color: #fff; font-weight: 600; }
.present-rail .rail-disabled { color: var(--vp-muted); cursor: default; }
.present-rail .rail-note { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; opacity: .7; }

.present-stage {
  background: #fff; border: 1px solid var(--vp-border); border-radius: 16px;
  padding: 1.6rem 1.8rem; min-height: 420px;
  box-shadow: 0 12px 34px rgba(0, 60, 66, .06);
}
.scene-headline { font-size: 1.5rem; margin: 0 0 1.1rem; color: var(--vp-primary-dark); }
.scene-stats { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.3rem; }
.scene-stat {
  flex: 0 0 auto; min-width: 130px; background: var(--vp-tint); border-radius: 14px;
  padding: .9rem 1.1rem; display: flex; flex-direction: column; gap: .1rem;
}
.scene-stat-value { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--vp-primary-dark); }
.scene-stat-label { font-size: .82rem; font-weight: 600; color: var(--vp-text); }
.scene-stat-sub { font-size: .74rem; color: var(--vp-muted); }
.scene-stat.tone-good .scene-stat-value { color: #1c7a4f; }
.scene-stat.tone-mid .scene-stat-value { color: #9a6300; }
.scene-stat.tone-low .scene-stat-value { color: #b5313b; }

.scene-narration p { font-size: 1.05rem; line-height: 1.6; margin: 0 0 .8rem; max-width: 62ch; }

.scene-chart-preview { margin: 1.4rem 0 .6rem; }
.scene-chart-preview h3 { font-size: 1rem; margin: 0 0 .7rem; }
.chart-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.chart-bars li { display: grid; grid-template-columns: 180px 1fr 52px; align-items: center; gap: .6rem; }
.chart-bar-label { font-size: .86rem; }
.chart-bar-track { background: #eef1f2; border-radius: 999px; height: 14px; overflow: hidden; }
.chart-bar-fill { display: block; height: 100%; background: var(--vp-primary); border-radius: 999px; }
.chart-bar-value { font-size: .86rem; font-weight: 700; text-align: right; color: var(--vp-primary-dark); }
.scene-chart-note { font-size: .78rem; color: var(--vp-muted); margin-top: .7rem; }

.scene-commands { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1.4rem; }
.scene-commands-label { font-size: .82rem; font-weight: 600; color: var(--vp-muted); }
.scene-command-chip {
  border: 1px dashed var(--vp-border-strong); border-radius: 999px; padding: .3rem .7rem;
  font-size: .82rem; color: var(--vp-text); background: #fff;
}
.scene-source-note { font-size: .76rem; color: var(--vp-muted); margin-top: 1rem; font-style: italic; }
.present-empty { color: var(--vp-muted); }

@media (max-width: 760px) {
  .present-body { grid-template-columns: 1fr; }
  .present-rail ol { flex-direction: row; flex-wrap: wrap; }
  .present-stage { padding: 1.2rem 1.1rem; }
  .chart-bars li { grid-template-columns: 110px 1fr 46px; }
}

/* ---- AI Presentation Mode (interactive player) ---- */
.present-player {
  display: flex; flex-direction: column; gap: .8rem;
  min-height: calc(100vh - 200px); margin: 1rem 0 2rem;
}
.present-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.present-topbar-info { display: flex; flex-direction: column; }
.present-topbar-actions { display: flex; align-items: center; gap: .6rem; }

/* Scene rail: numbered, labelled chips (scrollable on small screens) */
.present-rail-nav {
  display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .2rem;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.rail-chip {
  display: inline-flex; align-items: center; gap: .45rem; flex: 0 0 auto;
  border: 1px solid var(--vp-border-strong); background: #fff; color: var(--vp-text);
  border-radius: 999px; padding: .3rem .8rem .3rem .35rem; font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s; white-space: nowrap;
}
.rail-chip:hover { background: var(--vp-tint); border-color: var(--vp-primary); }
.rail-chip-num {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: #eef1f2; color: var(--vp-muted); font-size: .74rem; font-weight: 700;
}
.rail-chip.is-done .rail-chip-num { background: var(--vp-tint); color: var(--vp-primary-dark); }
.rail-chip.is-current { background: var(--vp-primary); border-color: var(--vp-primary); color: #fff; }
.rail-chip.is-current .rail-chip-num { background: rgba(255, 255, 255, .25); color: #fff; }

.present-stage {
  position: relative;
  flex: 1 1 auto; background: #fff; border: 1px solid var(--vp-border); border-radius: 18px;
  padding: 1.8rem 2rem; display: flex; align-items: safe center; justify-content: center;
  box-shadow: 0 18px 44px rgba(0, 60, 66, .08); overflow: auto;
}

/* Start splash: covers the stage while the first narration clip buffers; the Start click doubles
   as the user gesture browsers need before audio may play. */
.present-splash {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .55rem; text-align: center; padding: 2rem;
  background: linear-gradient(165deg, #f7fbfb 0%, #e3f0f1 60%, #d7e9ea 100%);
  border-radius: 18px; transition: opacity .4s ease;
}
.present-splash.is-hidden { opacity: 0; pointer-events: none; }
.present-splash-title { margin: 0; font-size: 1.7rem; color: var(--vp-primary-dark); }
.present-splash-scope { margin: 0 0 1rem; color: var(--vp-muted); }
.present-start {
  border: 0; background: var(--vp-primary); color: #fff; font-size: 1.05rem; font-weight: 700;
  border-radius: 999px; padding: .9rem 1.9rem; cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 118, 129, .35); transition: background .15s, transform .15s;
}
.present-start:hover { background: var(--vp-primary-dark); transform: translateY(-1px); }
.present-splash-status { margin: .2rem 0 0; font-size: .85rem; color: var(--vp-muted); min-height: 1.2em; }
.present-scene { width: 100%; max-width: 900px; }
.scene-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: .3rem; }
.scene-counter {
  font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--vp-muted);
}
.scene-counter:empty { display: none; }
.present-scene.anim-in { animation: presentIn .6s ease both; }
@keyframes presentIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.present-scene .scene-chart { height: 320px; margin: 1rem 0 .4rem; position: relative; }
.present-scene .scene-chart canvas { max-height: 320px; }

/* Structured scene cards (recommendations, verbatim quotes) */
.scene-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .9rem; margin: .4rem 0 1rem; }
.scene-cards:empty { display: none; }
.scene-card {
  background: var(--vp-bg); border: 1px solid var(--vp-border); border-left: 4px solid var(--vp-primary);
  border-radius: 12px; padding: .9rem 1rem;
}
.scene-card.tone-good { border-left-color: #1c7a4f; }
.scene-card.tone-mid { border-left-color: #d99a06; }
.scene-card.tone-low { border-left-color: #b5313b; }
.scene-card-eyebrow {
  display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--vp-muted); margin-bottom: .25rem;
}
.scene-card-title { font-size: .98rem; margin: 0 0 .35rem; color: var(--vp-primary-dark); line-height: 1.35; }
.scene-card-body { font-size: .88rem; line-height: 1.5; margin: 0 0 .5rem; color: var(--vp-text); }
.scene-card-points { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .3rem; }
.scene-card-points li { font-size: .88rem; line-height: 1.45; }
.scene-card--quote { border-left-color: var(--vp-accent-dark, #9a8b5c); background: #fbfaf6; }
.scene-card--quote .scene-card-points { list-style: none; padding-left: 0; gap: .55rem; }
.scene-card--quote .scene-card-points li { font-style: italic; color: #4c5a5c; }

.present-subtitles {
  min-height: 2.6rem; text-align: center; font-size: 1.15rem; font-weight: 600; color: var(--vp-primary-dark);
  padding: .4rem 1rem; background: var(--vp-tint); border-radius: 12px;
}
.present-subtitles:empty { visibility: hidden; }

/* One compact control bar: transport + progress + ask + settings */
.present-controlbar {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--vp-border); border-radius: 14px; padding: .55rem .7rem;
}
.present-transport { display: flex; align-items: center; gap: .4rem; }
.tbtn {
  min-width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--vp-border-strong);
  background: #fff; color: var(--vp-text); font-size: 1rem; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; padding: 0 .6rem;
}
.tbtn:hover { background: var(--vp-tint); }
.tbtn.is-on { background: var(--vp-tint); border-color: var(--vp-primary); }
.tbtn-play { background: var(--vp-primary); color: #fff; border-color: var(--vp-primary); }
.tbtn-play:hover { background: var(--vp-primary-dark); }
.present-progress { flex: 1 1 90px; height: 8px; background: #eef1f2; border-radius: 999px; overflow: hidden; min-width: 70px; }
.present-progress-fill { display: block; height: 100%; width: 0; background: var(--vp-primary); border-radius: 999px; }
.present-noscript { color: var(--vp-muted); }

/* Settings popover (speed, subtitles, voice, motion, bookmark, restart) */
.present-menu-wrap { position: relative; margin-left: auto; }
.present-menu {
  position: absolute; right: 0; bottom: calc(100% + .5rem); z-index: 40;
  min-width: 235px; background: #fff; border: 1px solid var(--vp-border); border-radius: 12px;
  box-shadow: 0 14px 38px rgba(0, 60, 66, .18); padding: .45rem; display: flex; flex-direction: column; gap: .15rem;
}
.present-menu-row {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; width: 100%;
  border: 0; background: none; text-align: left; cursor: pointer;
  padding: .55rem .65rem; border-radius: 8px; font-size: .9rem; font-weight: 600; color: var(--vp-text);
}
.present-menu-row:hover { background: var(--vp-tint); }
.present-menu-row select { border: 1px solid var(--vp-border-strong); border-radius: 8px; padding: .25rem .4rem; font-size: .86rem; }
.present-menu-sep { height: 1px; background: var(--vp-border); margin: .3rem .2rem; }
/* Toggle rows show their state as an On/Off pill */
.menu-toggle::after {
  content: "Off"; font-size: .72rem; font-weight: 700; color: var(--vp-muted);
  border: 1px solid var(--vp-border-strong); border-radius: 999px; padding: .1rem .55rem;
}
.menu-toggle.is-on::after { content: "On"; background: var(--vp-primary); border-color: var(--vp-primary); color: #fff; }
.present-menu-row.is-on { color: var(--vp-primary-dark); }

/* Suggested command chips inside the player (clickable, feed the conversation engine) */
.present-scene .scene-commands { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1rem; }
.present-scene .scene-commands:empty { display: none; }
.present-scene .scene-command-chip {
  border: 1px solid var(--vp-border-strong); border-radius: 999px; padding: .4rem .85rem;
  font-size: .84rem; font-weight: 600; color: var(--vp-primary-dark); background: #fff; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.present-scene .scene-command-chip:hover,
.present-scene .scene-command-chip:focus-visible { background: var(--vp-tint); border-color: var(--vp-primary); }
/* "ask" chips call the AI: subtle tint + sparkle so they read as questions, not navigation */
.present-scene .scene-command-chip--ask { background: var(--vp-tint); border-style: dashed; }
.present-scene .scene-command-chip--ask::before { content: "\2726\00a0"; color: var(--vp-primary); }
.present-scene .scene-command-chip--ask:hover,
.present-scene .scene-command-chip--ask:focus-visible { background: #fff; }

.present-ask { display: flex; gap: .5rem; align-items: center; flex: 2 1 240px; min-width: 200px; }
.present-ask-input {
  flex: 1 1 auto; min-width: 0; padding: .6rem .8rem; border: 1px solid var(--vp-border-strong);
  border-radius: 12px; font-size: .95rem; background: #fff; color: var(--vp-text);
}
.present-ask-input:focus { outline: 2px solid var(--vp-primary); outline-offset: 1px; }
#btn-mic.is-on { background: #b5313b; color: #fff; border-color: #b5313b; }
.present-reply {
  font-size: .95rem; color: var(--vp-primary-dark); background: var(--vp-tint);
  border-radius: 12px; padding: .5rem .9rem;
}
.present-reply:empty { display: none; }

@media (max-width: 760px) {
  .present-stage { padding: 1.2rem 1.1rem; }
  .present-scene .scene-chart { height: 260px; }
  /* Stack the bar: transport + progress + settings on top, ask box full width below */
  .present-controlbar { row-gap: .55rem; }
  .present-ask { order: 5; flex-basis: 100%; }
  .present-menu { right: -4px; }
}

@media (prefers-reduced-motion: reduce) {
  .present-scene.anim-in { animation: none; }
}
