/* =====================================================================
   SPARK Questionnaire Builder — app.css
   Loaded on every page (public/partials/head.php). Organised by page
   area: base > navbar > dashboard > builder > public form.
===================================================================== */

:root {
  --spark-primary: #2779BD;
  --spark-primary-dark: #1B4F72;
  --spark-bg: #F4F6F9;
  --spark-border: #E3E7ED;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--spark-bg);
  color: #1a1f27;
}

.spark-auth-bg { background: linear-gradient(135deg, #eef3fb 0%, #f7f9fc 100%); }

/* =================================================================
   Login page (public/login.php)
================================================================= */
.spark-login-page {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  /* Vertical scroll is a safety fallback, not the default: on any
     normal desktop viewport the content fits and no scrollbar shows.
     It only kicks in on unusually short/zoomed windows — and being a
     normal top-anchored page scroll, it can never clip or overlap
     content the way "overflow: hidden" on a shrunk flex box can. */
  overflow-y: auto;
  overflow-x: hidden;
}

/* --- top nav --------------------------------------------------- */
.spark-login-topnav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem clamp(1.25rem, 3vw, 3rem);
  border-bottom: 1px solid var(--spark-border);
}
.spark-login-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.spark-login-brand img { height: 30px; width: auto; display: block; }
.spark-login-brand-sub { font-size: 0.72rem; color: #8a93a3; line-height: 1; margin-top: 2px; }

.spark-login-nav-links { display: flex; align-items: center; gap: 1.75rem; }
.spark-login-nav-links a {
  color: #333a44;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.spark-login-nav-links a:hover { color: var(--spark-primary); }
.spark-login-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--spark-border);
  color: #6b7280;
  background: #fff;
}

@media (max-width: 767.98px) {
  .spark-login-nav-links { display: none; }
  .spark-login-topnav { flex-wrap: wrap; row-gap: 0.5rem; }
  .spark-nav-btn-outline, .spark-nav-btn-solid { padding: 0.35rem 0.65rem; font-size: 0.78rem; }
}

/* --- hero grid --------------------------------------------------- */
.spark-login-hero {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 2rem;
  padding: clamp(0.85rem, 2vw, 1.5rem) clamp(1.25rem, 4vw, 3rem);
  align-items: stretch;
}

@media (max-width: 991.98px) {
  .spark-login-hero { grid-template-columns: 1fr; }
}

.spark-login-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.spark-login-left-top { flex: 0 0 auto; }

.spark-auth-pill {
  display: inline-block;
  background: #e4edfa;
  color: var(--spark-primary-dark);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.32em 0.85em;
  border-radius: 999px;
}

.spark-auth-headline {
  font-size: clamp(1.35rem, 2.1vw, 1.85rem);
  font-weight: 700;
  line-height: 1.22;
  color: #1a1f27;
}

.spark-auth-subtext { max-width: 520px; font-size: 0.86rem; }

/* Compact horizontal feature strip (icon + short label, description on hover) */
.spark-login-feature-strip {
  flex: 0 0 auto;
  display: flex;
  gap: clamp(0.5rem, 1.5vw, 1.25rem);
  flex-wrap: wrap;
  margin: 0.75rem 0 0;
}
.spark-login-feature-strip li {
  flex: 1 1 0;
  min-width: 88px;
  text-align: center;
  cursor: default;
}
.spark-login-feature-strip .spark-feature-icon { margin: 0 auto 0.35rem; width: 36px; height: 36px; font-size: 0.95rem; }
.spark-login-feature-strip .label { font-size: 0.7rem; font-weight: 600; color: #333a44; line-height: 1.2; }

.spark-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  font-size: 1.05rem;
}
.spark-feature-icon.blue   { background: #e4edfa; color: var(--spark-primary); }
.spark-feature-icon.green  { background: #e3f6ec; color: #1e9e5a; }
.spark-feature-icon.purple { background: #f0e9fb; color: #7c4fd1; }
.spark-feature-icon.orange { background: #fdeee0; color: #d4770a; }
.spark-feature-icon.cyan   { background: #e2f5f8; color: #1691a3; }

/* This wrapper takes up leftover vertical space and centers its
   contents (the preview mock-up + workflow row) inside it. It has a
   guaranteed min-height matching that content's natural size, so it
   can never be squeezed smaller than what's inside it — that's what
   previously caused the preview card to overlap its neighbours on
   short/zoomed windows. If there truly isn't room, the page scrolls
   (see .spark-login-page) instead of clipping or overlapping. */
.spark-login-center-wrap {
  flex: 1 1 auto;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0;
}

.spark-auth-trust {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #f2f6fc;
  border: 1px solid var(--spark-border);
  border-radius: 12px;
  padding: 0.65rem 1rem;
}
.spark-auth-trust-stat { margin-left: auto; text-align: right; white-space: nowrap; }
.spark-auth-trust-stat .num { font-weight: 700; color: var(--spark-primary-dark); font-size: 1.05rem; line-height: 1.1; }

/* --- decorative "questionnaire preview" mockup ------------------- */
.spark-preview-mock {
  background: #fff;
  border: 1px solid var(--spark-border);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(20, 30, 60, 0.07);
  padding: 0.9rem 1.05rem 1rem;
  width: 100%;
  max-width: 440px;
}
.spark-preview-mock-dots span {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
}
.spark-preview-mock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}
.spark-preview-mock-title { font-weight: 700; font-size: 0.82rem; }
.spark-preview-mock-progress { font-size: 0.7rem; color: #8a93a3; }
.spark-preview-mock-bar {
  height: 4px;
  background: var(--spark-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.8rem;
}
.spark-preview-mock-bar-fill { height: 100%; width: 60%; background: var(--spark-primary); }
.spark-preview-mock-q { font-size: 0.76rem; margin-bottom: 0.45rem; }
.spark-preview-mock-scale { display: flex; gap: 0.4rem; margin-bottom: 0.85rem; }
.spark-preview-mock-scale-opt {
  flex: 1;
  border: 1px solid var(--spark-border);
  border-radius: 8px;
  text-align: center;
  padding: 0.3rem 0.2rem;
  font-size: 0.66rem;
  color: #6b7280;
}
.spark-preview-mock-scale-opt.active { border-color: var(--spark-primary); background: #eef3fb; color: var(--spark-primary-dark); font-weight: 700; }
.spark-preview-mock-check { display: flex; align-items: center; gap: 0.45rem; font-size: 0.76rem; margin-bottom: 0.35rem; color: #333; }
.spark-preview-mock-check input { accent-color: var(--spark-primary); }

.spark-workflow-row {
  display: flex;
  gap: 1.1rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.spark-workflow-step { text-align: center; font-size: 0.7rem; color: #6b7280; }
.spark-workflow-step .spark-feature-icon { margin: 0 auto 0.3rem; width: 36px; height: 36px; }

/* --- sign-in card ------------------------------------------------- */
.spark-auth-form-panel {
  background: #fbfcfe;
  border: 1px solid var(--spark-border);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(20, 30, 60, 0.06);
  padding: 1.5rem 1.75rem;
  min-height: 100%;
  /* No overflow/scroll of its own on purpose: a scrollable box that's
     also vertically centered starts its scroll position mid-content,
     which is what previously chopped "Welcome Back!" off at the top
     on short windows. Any real overflow is instead handled by the
     single, top-anchored scrollbar on .spark-login-page. */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.spark-auth-card-logo { width: 210px; max-width: 70%; height: auto; margin: 0 auto; display: block; }

.spark-auth-input-group .input-group-text { border-radius: 8px 0 0 8px; background: #fff; }
.spark-auth-input-group .form-control { border-radius: 0 8px 8px 0; padding: 0.55rem 0.85rem; }
.spark-auth-input-group:focus-within .input-group-text,
.spark-auth-input-group:focus-within .form-control {
  border-color: var(--spark-primary);
  box-shadow: 0 0 0 3px rgba(39, 121, 189, 0.14);
}
.spark-auth-input-group .form-control:focus { box-shadow: none; }
.spark-auth-toggle-visibility {
  background: #fff;
  border-color: #d6dbe3;
  color: #8a93a3;
}

.spark-auth-submit { border-radius: 10px; padding: 0.6rem 1rem; font-weight: 600; }

.spark-auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0; }
.spark-auth-divider::before, .spark-auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--spark-border); }
.spark-auth-divider span { font-size: 0.75rem; color: #8a93a3; white-space: nowrap; }

.spark-auth-oauth-row { display: flex; gap: 0.6rem; }
.spark-auth-oauth-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid #d6dbe3;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  color: #333a44;
}
.spark-auth-oauth-btn:disabled,
.spark-auth-oauth-btn.disabled { opacity: 0.55; cursor: not-allowed; }

.spark-auth-sso-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid #d6dbe3;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  color: #333a44;
  margin-top: 0.6rem;
}
.spark-auth-sso-btn:disabled,
.spark-auth-sso-btn.disabled { opacity: 0.55; cursor: not-allowed; }

/* --- footer -------------------------------------------------------- */
.spark-login-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--spark-border);
  padding: 0.55rem clamp(1.25rem, 3vw, 3rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: #8a93a3;
}
.spark-login-footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.spark-login-footer-links a { color: #8a93a3; text-decoration: none; }
.spark-login-footer-links a:hover { color: var(--spark-primary); }

/* Below desktop, there simply isn't room to fit everything without
   scrolling — fall back to a normal, scrollable, stacked layout. */
@media (max-width: 991.98px) {
  .spark-login-page { height: auto; min-height: 100vh; }
  .spark-login-left { height: auto; }
  .spark-login-center-wrap { flex: 0 0 auto; min-height: 0; padding: 1.25rem 0; }
  .spark-auth-form-panel { min-height: 0; }
}

@media (max-width: 575px) {
  .spark-preview-mock { display: none; }
  .spark-workflow-row { display: none; }
}

@media (max-width: 420px) {
  .spark-auth-form-panel { padding: 2rem 1.25rem; }
}

/* =================================================================
   Registration page (public/register.php)
================================================================= */
.spark-register-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: #fff;
  padding: clamp(2rem, 5vh, 4rem) 1.25rem;
}

.spark-register-card { width: 100%; max-width: 820px; }

.spark-register-brand { display: inline-block; margin-bottom: 1.25rem; }
.spark-register-brand img { height: 30px; width: auto; display: block; }

.spark-register-title {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 700;
  color: #1a1f27;
  margin-bottom: 0.35rem;
}

.spark-register-subtitle { font-size: 0.92rem; margin-bottom: 1.75rem; }

.spark-register-section-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--spark-primary);
  margin-bottom: 0.85rem;
}

.spark-register-input {
  background: #eef1f6;
  border: 1px solid #eef1f6;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
}
.spark-register-input:focus {
  background: #fff;
  border-color: var(--spark-primary);
  box-shadow: 0 0 0 3px rgba(39, 121, 189, 0.14);
}
.spark-register-input::placeholder { color: #9aa3b2; }

.spark-register-submit {
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.98rem;
}

.spark-register-submitted { padding: 2rem 0; }
.spark-register-submitted-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #e3f6ec;
  color: #1e9e5a;
  font-size: 1.75rem;
}

@media (max-width: 575px) {
  .spark-register-card { max-width: 100%; }
}

.btn-icon {
  border: none;
  background: transparent;
  color: #6b7280;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
}
.btn-icon:hover { background: #eef1f5; color: #1a1f27; }

/* ---------------------------------------------------------------
   Navbar
--------------------------------------------------------------- */
.spark-navbar {
  background: #fff;
  border-bottom: 1px solid var(--spark-border);
  box-shadow: 0 1px 3px rgba(20, 30, 60, 0.03);
  padding: 0.7rem 0;
}

.spark-navbar-logo { height: 28px; width: auto; display: block; }
.spark-navbar-brand-sub {
  font-size: 0.85rem;
  color: #8a93a3;
  font-weight: 500;
  border-left: 1px solid var(--spark-border);
  padding-left: 0.75rem;
  margin-left: 0.1rem;
}

.spark-public-logo { width: 220px; max-width: 80%; height: auto; }

.spark-public-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  text-align: center;
}
.spark-public-tagline {
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b7280;
  border-left: 1px solid var(--spark-border);
  padding-left: 0.75rem;
  line-height: 1.3;
  max-width: 320px;
  text-align: left;
}

@media (max-width: 575px) {
  .spark-public-brand { flex-direction: column; gap: 0.4rem; }
  .spark-public-tagline {
    border-left: none;
    padding-left: 0;
    text-align: center;
    max-width: 100%;
  }
}

.spark-nav-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 0.62rem;
  padding: 0.25em 0.45em;
}

/* ---------------------------------------------------------------
   Registration review queue (public/registrations.php)
--------------------------------------------------------------- */
.spark-reg-tabs .nav-link {
  color: #6b7280;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
}
.spark-reg-tabs .nav-link.active {
  background: var(--spark-primary);
  color: #fff;
}

.spark-reg-card { border-radius: 12px; }

.spark-reg-detail-grid { margin-top: 0.25rem; }
.spark-reg-detail-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9aa3b2;
  margin-bottom: 0.15rem;
}
.spark-reg-detail-value { font-size: 0.88rem; color: #1a1f27; }

.spark-reg-reason {
  background: #fdeeee;
  border: 1px solid #f6d4d4;
  color: #8a2f2f;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
}

.spark-reg-select { min-width: 130px; }


.status-badge { font-weight: 600; font-size: 0.72rem; padding: 0.4em 0.7em; }

/* ---------------------------------------------------------------
   Dashboard
--------------------------------------------------------------- */
.spark-dash-welcome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, #eef3fb 0%, #f7f9fc 100%);
  border: 1px solid var(--spark-border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.spark-dash-new-btn { border-radius: 10px; font-weight: 600; white-space: nowrap; z-index: 1; }
.spark-dash-welcome-deco {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%) rotate(-8deg);
  font-size: 5rem;
  color: var(--spark-primary);
  opacity: 0.08;
  pointer-events: none;
}
@media (max-width: 767.98px) {
  .spark-dash-welcome-deco { display: none; }
}

.spark-stat-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: #fff;
  border: 1px solid var(--spark-border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  height: 100%;
  transition: box-shadow .12s ease, transform .12s ease;
}
.spark-stat-card:hover { box-shadow: 0 6px 18px rgba(20, 30, 60, 0.06); transform: translateY(-1px); }

.spark-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 10px;
  font-size: 1.15rem;
}
.spark-stat-icon.blue   { background: #e4edfa; color: var(--spark-primary); }
.spark-stat-icon.green  { background: #e3f6ec; color: #1e9e5a; }
.spark-stat-icon.orange { background: #fdeee0; color: #d4770a; }
.spark-stat-icon.purple { background: #f0e9fb; color: #7c4fd1; }

.spark-stat-value { font-size: 1.35rem; font-weight: 700; color: #1a1f27; line-height: 1.15; }
.spark-stat-label { font-size: 0.78rem; color: #6b7280; }

.spark-dash-toolbar .card-body { padding: 0.9rem 1.1rem; }

.spark-dash-empty {
  border: 1px dashed var(--spark-border);
  border-radius: 14px;
  padding: 3rem 1.5rem;
  background: #fbfcfe;
}
.spark-dash-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #eef3fb;
  color: var(--spark-primary);
  font-size: 1.5rem;
}

@media (max-width: 767.98px) {
  .spark-dash-welcome { flex-direction: column; align-items: stretch; }
  .spark-dash-new-btn { width: 100%; }
}

.questionnaire-card {
  border-radius: 12px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.questionnaire-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(20, 30, 60, 0.08) !important;
}
.card-title-text { cursor: pointer; }
.card-title-text:hover { color: var(--spark-primary); }
.card-desc-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------------------------------------------------------
   Builder layout
--------------------------------------------------------------- */
.builder-body { background: var(--spark-bg); }

.builder-navbar {
  background: #fff;
  border-bottom: 1px solid var(--spark-border);
  padding: 0.5rem 0;
}
.builder-title-input {
  max-width: 420px;
  box-shadow: none !important;
}
.builder-title-input:focus { background: #f4f6f9; border-radius: 6px; }

.builder-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 320px;
  gap: 1rem;
  padding: 1rem;
  align-items: start;
  min-height: calc(100vh - 60px);
}

@media (max-width: 991px) {
  .builder-layout { grid-template-columns: 1fr; }
}

.builder-palette, .builder-inspector {
  background: #fff;
  border: 1px solid var(--spark-border);
  border-radius: 12px;
  padding: 0.85rem;
  position: sticky;
  top: 76px;
}

.palette-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a93a3;
  margin-bottom: 0.5rem;
  padding: 0 0.25rem;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  font-size: 0.86rem;
  text-align: left;
  color: #333;
  margin-bottom: 2px;
}
.palette-item:hover { background: #eef3fb; border-color: #d9e6f7; color: var(--spark-primary-dark); }
.palette-item i { font-size: 1rem; width: 20px; text-align: center; color: var(--spark-primary); }

.builder-canvas { min-height: 200px; }

/* --- Data view (inline grid + Excel export, replaces the old Results modal) --- */
.builder-data-view {
  padding: 1rem;
  min-height: calc(100vh - 60px);
}

.builder-data-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.builder-data-grid-wrap {
  background: #fff;
  border: 1px solid var(--spark-border);
  border-radius: 12px;
  overflow: hidden;
}

.builder-data-table {
  margin-bottom: 0;
  font-size: 0.84rem;
  white-space: nowrap;
}

/* Report view */
.builder-report-wrap {
  max-width: 900px;
  margin: 0 auto;
}

.report-question-card {
  background: #fff;
  border: 1px solid var(--spark-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.report-question-number {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--spark-muted, #6b7280);
  margin-bottom: 0.25rem;
}

.report-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 0.75rem;
}

.report-stat-cell {
  background: #f8fafd;
  border: 1px solid var(--spark-border);
  border-radius: 10px;
  padding: 0.65rem 0.5rem;
  text-align: center;
}

.report-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--spark-primary);
  line-height: 1.2;
}

.report-stat-label {
  font-size: 0.72rem;
  color: #6b7280;
  margin-top: 0.15rem;
}

.report-freq-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.report-freq-row {
  display: grid;
  grid-template-columns: minmax(90px, 220px) 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.report-freq-label {
  font-size: 0.85rem;
  color: #333a44;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-freq-bar-track {
  background: #eef1f6;
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
}

.report-freq-bar {
  background: var(--spark-primary);
  height: 100%;
  border-radius: 6px;
}

.report-freq-count {
  font-size: 0.8rem;
  color: #6b7280;
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
}

.report-text-sample {
  font-size: 0.85rem;
  color: #333a44;
  padding-left: 1.1rem;
}
.report-text-sample li { margin-bottom: 0.25rem; }

@media print {
  .spark-sidebar, .builder-navbar, .builder-data-toolbar { display: none !important; }
  .builder-report-wrap { max-width: 100%; padding-top: 1rem; }
  .report-question-card { break-inside: avoid; box-shadow: none; }
}

.builder-data-table thead th {
  background: #f7f9fc;
  color: #333a44;
  font-weight: 700;
  position: sticky;
  top: 0;
  white-space: normal;
  min-width: 160px;
  vertical-align: top;
}
.builder-data-table td { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.builder-data-table tbody tr:hover { background: #f7f9fc; }

.builder-section {
  background: #fff;
  border: 1px solid var(--spark-border);
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.builder-section.dragging-section { opacity: 0.5; }

.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: #fafbfd;
  border-bottom: 1px solid var(--spark-border);
}
.section-title-input {
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 0.95rem;
  flex-grow: 1;
  padding: 0.2rem 0.3rem;
  border-radius: 6px;
}
.section-title-input:focus { outline: none; background: #eef1f5; }

.section-questions { padding: 0.75rem; min-height: 40px; }
.section-questions:empty::after {
  content: 'Drop questions here, or add one from the left panel.';
  display: block;
  text-align: center;
  color: #9aa3b2;
  font-size: 0.82rem;
  padding: 1rem;
  border: 1px dashed var(--spark-border);
  border-radius: 8px;
}

.question-card {
  border: 1px solid var(--spark-border);
  border-radius: 10px;
  margin-bottom: 0.6rem;
  background: #fff;
  cursor: pointer;
  transition: border-color .1s ease, box-shadow .1s ease;
}
.question-card:hover { border-color: #c7d6ee; }
.question-card.selected { border-color: var(--spark-primary); box-shadow: 0 0 0 3px rgba(39,121,189,0.12); }
.question-card.dragging { opacity: 0.4; }

.question-card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid #f0f2f6;
  font-size: 0.78rem;
  color: #6b7280;
}
.question-type-icon { color: var(--spark-primary); }
.required-dot { color: #dc3545; font-weight: 700; }
.drag-handle { cursor: grab; color: #b7bfcc; }
.drag-handle:active { cursor: grabbing; }

.question-card-body { padding: 0.65rem 0.85rem 0.8rem; }
.question-text-preview { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }
.question-options-preview { font-size: 0.8rem; color: #6b7280; }
.option-preview-row { display: flex; align-items: center; gap: 0.4rem; padding: 1px 0; }

.inspector-empty { color: #9aa3b2; }

/* ---------------------------------------------------------------
   Public form (preview.php / fill.php)
--------------------------------------------------------------- */
.public-fill-bg {
  min-height: 100vh;
  background: linear-gradient(180deg, #eef3fb 0%, var(--spark-bg) 320px);
}

#formRoot .card,
.public-fill-bg .card {
  border-radius: 16px;
}

.public-fill-bg .card-body { padding: 2.5rem !important; }

@media (max-width: 575px) {
  .public-fill-bg .card-body { padding: 1.5rem !important; }
}

.form-section { margin-bottom: 2rem; }
.form-section:last-of-type { margin-bottom: 1.5rem; }

.section-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.section-divider-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--spark-primary-dark);
  white-space: nowrap;
}
.section-divider::after {
  content: '';
  flex-grow: 1;
  height: 1px;
  background: var(--spark-border);
}

/* Two-column responsive grid — short fields sit side by side,
   long-answer / choice-based questions span the full width. */
.question-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 1.5rem;
  row-gap: 1.5rem;
  margin-top: 1rem;
}
.question-block-full { grid-column: 1 / -1; min-width: 0; }
.question-block-half { grid-column: span 1; min-width: 0; }

@media (max-width: 575px) {
  .question-grid { grid-template-columns: 1fr; }
  .question-block-half { grid-column: 1 / -1; }
}

.question-block .form-label {
  font-size: 0.88rem;
  color: #1a1f27;
  margin-bottom: 0.4rem;
}
.question-block .form-text { font-size: 0.78rem; }

.question-block .form-control,
.question-block .form-select {
  border: 1px solid #d6dbe3;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.92rem;
  background: #fbfcfe;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.question-block .form-control:focus,
.question-block .form-select:focus {
  border-color: var(--spark-primary);
  box-shadow: 0 0 0 3px rgba(39,121,189,0.14);
  background: #fff;
}
.question-block textarea.form-control { resize: vertical; min-height: 100px; }

.question-block .form-check {
  padding: 0.5rem 0.5rem 0.5rem 2rem;
  border: 1px solid #eceff3;
  border-radius: 8px;
  margin-bottom: 0.4rem;
  transition: border-color .12s ease, background .12s ease;
}
.question-block .form-check:hover { border-color: #c7d6ee; background: #f8fafd; }
.question-block .form-check-input:checked ~ .form-check-label { font-weight: 600; }
.question-block .form-check-input { margin-top: 0.3em; }
.question-block .form-check-label { width: 100%; cursor: pointer; }

#submitBtn {
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.rating-star { border-radius: 8px !important; padding: 0.4rem 0.7rem; }

.slider-field { padding: 0.25rem 0; }
.slider-field .form-range { margin-bottom: 0.35rem; }

.result-option-label { width: 140px; flex-shrink: 0; }

/* Time duration */
.duration-input .form-text { font-size: 0.7rem; margin-top: 0.1rem; }

/* Ranking */
.ranking-list { display: flex; flex-direction: column; gap: 0.4rem; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid #d6dbe3;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  background: #fbfcfe;
}
.rank-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--spark-primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.rank-label { flex-grow: 1; font-size: 0.9rem; }
.rank-controls { display: flex; gap: 0.15rem; }
.rank-controls .btn-icon { padding: 0.15rem 0.4rem; }
.rank-controls .btn-icon:disabled { opacity: 0.3; }

/* Matrix */
.matrix-table { font-size: 0.85rem; }
.matrix-table th, .matrix-table td { vertical-align: middle; }
.matrix-table thead th { border-bottom: 2px solid var(--spark-border); }

/* Semantic differential (bipolar scale rows) */
.semantic-diff-block { display: flex; flex-direction: column; gap: 1rem; }
.semantic-diff-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.semantic-diff-label {
  flex: 0 0 120px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #333a44;
}
.semantic-diff-points {
  flex: 1 1 auto;
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
}
.semantic-diff-point {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: #6b7280;
  cursor: pointer;
}
.semantic-diff-point input { margin: 0; }
@media (max-width: 575.98px) {
  .semantic-diff-row { flex-wrap: wrap; row-gap: 0.4rem; }
  .semantic-diff-label { flex: 0 1 auto; }
  .semantic-diff-points { flex: 1 1 100%; order: 3; gap: 0.15rem; justify-content: space-around; }
  .semantic-diff-point { font-size: 0.66rem; }
  .semantic-diff-point span:last-child { display: none; } /* hide the "1".."5" numeral labels to save width; the radio position still conveys it */
}

/* File upload */
.file-upload-block .form-control { padding: 0.5rem 0.75rem; }
.file-upload-status { min-height: 1.2rem; }

/* =================================================================
   Features page (public/features.php)
   Same "no hard scroll on typical desktops, graceful fallback on
   short windows" pattern as the login page: page-level overflow-y is
   auto (not hidden), and nothing is allowed to be crushed below its
   content's natural size.
================================================================= */
.spark-features-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow-y: auto;
  overflow-x: hidden;
}

.spark-login-nav-links a.active {
  color: var(--spark-primary);
  position: relative;
}
.spark-login-nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -14px;
  height: 2px;
  background: var(--spark-primary);
}

.spark-nav-btn-outline {
  border: 1px solid var(--spark-border);
  color: #333a44;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.spark-nav-btn-outline:hover { border-color: var(--spark-primary); color: var(--spark-primary); }
.spark-nav-btn-solid {
  background: var(--spark-primary);
  color: #fff;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.spark-nav-btn-solid:hover { background: var(--spark-primary-dark); color: #fff; }

.spark-features-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(0.75rem, 1.8vh, 1.5rem) clamp(1.25rem, 3vw, 2.5rem);
  background: linear-gradient(180deg, #f7f9fc 0%, #ffffff 220px);
}

.spark-features-hero { flex: 0 0 auto; text-align: center; margin-bottom: clamp(0.75rem, 1.6vh, 1.25rem); }
.spark-features-hero h1 {
  font-size: clamp(1.3rem, 2.4vw, 1.85rem);
  font-weight: 700;
  color: #1a1f27;
  margin-bottom: 0.35rem;
}
.spark-features-hero p { color: #6b7280; font-size: 0.88rem; margin-bottom: 0.6rem; }
.spark-features-divider { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.spark-features-divider span { display: block; height: 3px; border-radius: 2px; }
.spark-features-divider .dash { width: 24px; background: var(--spark-border); }
.spark-features-divider .dot { width: 40px; background: var(--spark-primary); }

.spark-features-grid {
  flex: 1 1 auto;
  min-height: 300px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 1fr;
  gap: 0.65rem;
  margin-bottom: clamp(0.75rem, 1.6vh, 1.25rem);
}

.spark-feature-card {
  background: #fff;
  border: 1px solid var(--spark-border);
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
  box-shadow: 0 1px 3px rgba(20, 30, 60, 0.03);
}
.spark-feature-card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
}
.spark-feature-card h3 {
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  line-height: 1.25;
}
.spark-feature-card ul { list-style: none; margin: 0; padding: 0; }
.spark-feature-card li {
  font-size: 0.68rem;
  color: #4b5563;
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  margin-bottom: 0.22rem;
  line-height: 1.25;
}
.spark-feature-card li i { font-size: 0.65rem; margin-top: 0.15rem; flex-shrink: 0; }

.spark-feature-icon.pink  { background: #fde4f0; color: #c2266f; }
.spark-feature-icon.teal  { background: #dff5f2; color: #0f8b7d; }
.spark-feature-icon.indigo { background: #e6e6fb; color: #4c4ed6; }

.spark-lifecycle-section {
  flex: 0 0 auto;
  background: #f7f9fc;
  border: 1px solid var(--spark-border);
  border-radius: 14px;
  padding: clamp(0.65rem, 1.4vh, 1rem) clamp(1rem, 2vw, 1.75rem);
  margin-bottom: clamp(0.6rem, 1.3vh, 1rem);
  text-align: center;
}
.spark-lifecycle-section h2 { font-size: 1.02rem; font-weight: 700; color: #1a1f27; margin-bottom: 0.15rem; }
.spark-lifecycle-section > p { font-size: 0.78rem; color: #6b7280; margin-bottom: 0.75rem; }

.spark-lifecycle-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
}
.spark-lifecycle-step { flex: 1 1 0; min-width: 0; padding: 0 0.25rem; position: relative; }
.spark-lifecycle-step .icon-wrap {
  position: relative;
  width: 46px;
  height: 46px;
  margin: 0 auto 0.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: #fff;
  border: 1px solid var(--spark-border);
}
.spark-lifecycle-step .step-num {
  position: absolute;
  top: -4px; right: -4px;
  width: 17px; height: 17px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spark-lifecycle-step .title { font-size: 0.74rem; font-weight: 700; color: #1a1f27; }
.spark-lifecycle-step .desc { font-size: 0.62rem; color: #8a93a3; line-height: 1.2; margin-top: 0.1rem; }
.spark-lifecycle-arrow { flex: 0 0 auto; color: #c7cdd8; font-size: 0.85rem; padding-top: 14px; }

.spark-trust-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  border: 1px solid var(--spark-border);
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
}
.spark-trust-item { display: flex; align-items: center; gap: 0.55rem; }
.spark-trust-item .icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.spark-trust-item .title { font-size: 0.76rem; font-weight: 700; color: #1a1f27; }
.spark-trust-item .desc { font-size: 0.66rem; color: #8a93a3; line-height: 1.2; }

@media (max-width: 991.98px) {
  .spark-features-page { height: auto; min-height: 100vh; }
  .spark-features-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: auto; }
  .spark-lifecycle-row { flex-wrap: wrap; row-gap: 1rem; }
  .spark-lifecycle-step { flex: 1 1 22%; }
  .spark-lifecycle-arrow { display: none; }
  .spark-trust-bar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575px) {
  .spark-features-grid { grid-template-columns: 1fr; }
  .spark-lifecycle-step { flex: 1 1 45%; }
  .spark-trust-bar { grid-template-columns: 1fr; }
}

/* =================================================================
   How It Works page (public/howitwork.php)
   Same safe no-hard-scroll pattern as login.php / features.php.
================================================================= */
.spark-how-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.spark-how-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(0.7rem, 1.6vh, 1.25rem) clamp(1.25rem, 3vw, 2.5rem);
  background: linear-gradient(180deg, #f2f6fd 0%, #ffffff 260px);
  position: relative;
  z-index: 1;
}

.spark-how-hero { flex: 0 0 auto; text-align: center; margin-bottom: clamp(0.6rem, 1.4vh, 1rem); position: relative; }
.spark-how-hero .eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #8a93a3;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.spark-how-hero h1 {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 800;
  color: #14213d;
  margin-bottom: 0.3rem;
  line-height: 1.1;
}
.spark-how-hero h1 span { color: var(--spark-primary); }
.spark-how-hero .sub { font-size: 0.92rem; font-weight: 700; color: #1a1f27; margin-bottom: 0.25rem; }
.spark-how-hero .desc { font-size: 0.76rem; color: #6b7280; max-width: 620px; margin: 0 auto; line-height: 1.35; }

.spark-how-annotation {
  position: absolute;
  top: 4px;
  font-family: 'Segoe Print', 'Bradley Hand', cursive;
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.5;
  width: 140px;
}
.spark-how-annotation.left { left: 0; text-align: left; transform: rotate(-3deg); }
.spark-how-annotation.right { right: 0; text-align: right; transform: rotate(2deg); }

@media (max-width: 1200px) {
  .spark-how-annotation { display: none; }
}

.spark-how-row { display: flex; align-items: stretch; justify-content: center; gap: 0; margin-bottom: clamp(0.5rem, 1.2vh, 0.85rem); }
.spark-how-row:last-of-type { margin-bottom: clamp(0.75rem, 1.6vh, 1.1rem); }
.spark-how-arrow { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 26px; color: #b9c0cc; font-size: 1.1rem; }

.spark-how-card {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 14px;
  padding: 0.9rem 0.85rem 0.75rem;
  position: relative;
  border: 1px solid transparent;
}
.spark-how-card .badge-num {
  position: absolute;
  top: -12px; left: 16px;
  width: 30px; height: 30px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.spark-how-card .card-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: #fff;
  margin-bottom: 0.5rem;
  margin-top: 0.3rem;
}
.spark-how-card h3 { font-size: 0.85rem; font-weight: 700; color: #1a1f27; margin-bottom: 0.15rem; }
.spark-how-card .card-desc { font-size: 0.68rem; color: #5b6472; margin-bottom: 0.5rem; }
.spark-how-card ul { list-style: none; margin: 0; padding: 0; }
.spark-how-card li {
  font-size: 0.65rem;
  color: #4b5563;
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  margin-bottom: 0.2rem;
  line-height: 1.25;
}
.spark-how-card li i { font-size: 0.62rem; margin-top: 0.15rem; flex-shrink: 0; }

.spark-how-card.blue   { background: linear-gradient(160deg,#eaf2fd,#f5f9fe); border-color: #dbe8fa; }
.spark-how-card.green  { background: linear-gradient(160deg,#e7f8ee,#f4fbf7); border-color: #d7f0e0; }
.spark-how-card.purple { background: linear-gradient(160deg,#f1ecfc,#f8f5fd); border-color: #e5dcf8; }
.spark-how-card.orange { background: linear-gradient(160deg,#fdf1e2,#fef8ef); border-color: #fbe4c6; }
.spark-how-card.pink   { background: linear-gradient(160deg,#fde9f2,#fdf4f8); border-color: #fad3e6; }
.spark-how-card.teal   { background: linear-gradient(160deg,#e2f6f3,#f2fbf9); border-color: #cdefe9; }
.spark-how-card.amber  { background: linear-gradient(160deg,#fdf0dd,#fef8ef); border-color: #fbe2b8; }
.spark-how-card.indigo { background: linear-gradient(160deg,#eae9fb,#f5f4fd); border-color: #dcdaf7; }

.spark-how-card.blue   .badge-num { background-color: #2779BD; }
.spark-how-card.green  .badge-num { background-color: #1e9e5a; }
.spark-how-card.purple .badge-num { background-color: #7c4fd1; }
.spark-how-card.orange .badge-num { background-color: #d4770a; }
.spark-how-card.pink   .badge-num { background-color: #c2266f; }
.spark-how-card.teal   .badge-num { background-color: #0f8b7d; }
.spark-how-card.amber  .badge-num { background-color: #d4970a; }
.spark-how-card.indigo .badge-num { background-color: #4c4ed6; }

.spark-how-card.blue   .card-icon i { color: #2779BD; }
.spark-how-card.green  .card-icon i { color: #1e9e5a; }
.spark-how-card.purple .card-icon i { color: #7c4fd1; }
.spark-how-card.orange .card-icon i { color: #d4770a; }
.spark-how-card.pink   .card-icon i { color: #c2266f; }
.spark-how-card.teal   .card-icon i { color: #0f8b7d; }
.spark-how-card.amber  .card-icon i { color: #d4970a; }
.spark-how-card.indigo .card-icon i { color: #4c4ed6; }

.spark-how-card.blue   li i { color: #2779BD; }
.spark-how-card.green  li i { color: #1e9e5a; }
.spark-how-card.purple li i { color: #7c4fd1; }
.spark-how-card.orange li i { color: #d4770a; }
.spark-how-card.pink   li i { color: #c2266f; }
.spark-how-card.teal   li i { color: #0f8b7d; }
.spark-how-card.amber  li i { color: #d4970a; }
.spark-how-card.indigo li i { color: #4c4ed6; }

.spark-how-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  border: 1px solid var(--spark-border);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  flex-wrap: wrap;
}
.spark-how-footer-items { flex: 1 1 auto; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.spark-how-trust-item { display: flex; align-items: flex-start; gap: 0.5rem; max-width: 210px; }
.spark-how-trust-item .icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.spark-how-trust-item .title { font-size: 0.72rem; font-weight: 700; color: #1a1f27; }
.spark-how-trust-item .desc { font-size: 0.62rem; color: #8a93a3; line-height: 1.2; }

.spark-how-cta { flex: 0 0 auto; text-align: center; }
.spark-how-cta-btn {
  background: var(--spark-primary);
  color: #fff;
  border-radius: 999px;
  padding: 0.55rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.spark-how-cta-btn:hover { background: var(--spark-primary-dark); color: #fff; }
.spark-how-cta-caption { font-size: 0.62rem; color: #9aa3b2; margin-top: 0.35rem; letter-spacing: 0.03em; }

@media (max-width: 991.98px) {
  .spark-how-page { height: auto; min-height: 100vh; }
  .spark-how-row { flex-direction: column; gap: 1.5rem; }
  .spark-how-arrow { display: none; }
  .spark-how-footer { flex-direction: column; align-items: stretch; }
}

/* =================================================================
   Contact page (public/contact.php)
================================================================= */
.spark-contact-page { min-height: 100vh; display: flex; flex-direction: column; background: #fff; }
.spark-contact-main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: clamp(1.5rem, 4vh, 3rem) 1.25rem;
}
.spark-contact-card { width: 100%; max-width: 620px; }

/* Honeypot: present in the DOM (so bots that don't render CSS still
   fill it) but invisible and unreachable for a real visitor tabbing
   or reading the page. */
.spark-contact-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* =================================================================
   Long-form content pages (Privacy Policy, Terms of Use, Help, About)
   Normal scrolling document pages — the "no scroll" pattern used on
   the marketing pages doesn't apply here; these are meant to be read.
================================================================= */
.spark-content-page { min-height: 100vh; display: flex; flex-direction: column; background: #fff; }

.spark-content-main {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: clamp(1.5rem, 4vh, 3rem) 1.25rem 4rem;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

.spark-content-toc {
  flex: 0 0 240px;
  position: sticky;
  top: 1.5rem;
  align-self: flex-start;
  font-size: 0.82rem;
}
.spark-content-toc-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aa3b2;
  margin-bottom: 0.6rem;
}
.spark-content-toc a {
  display: block;
  padding: 0.3rem 0;
  color: #5b6472;
  text-decoration: none;
  border-left: 2px solid var(--spark-border);
  padding-left: 0.8rem;
}
.spark-content-toc a:hover { color: var(--spark-primary); border-left-color: var(--spark-primary); }

.spark-content-body { flex: 1 1 0; min-width: 0; max-width: 760px; }
.spark-content-body h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  color: #14213d;
  margin-bottom: 0.4rem;
}
.spark-content-updated { font-size: 0.82rem; color: #9aa3b2; margin-bottom: 1.75rem; }
.spark-content-intro { font-size: 0.95rem; color: #4b5563; margin-bottom: 2rem; line-height: 1.6; }
.spark-content-body section { margin-bottom: 2rem; scroll-margin-top: 1.5rem; }
.spark-content-body h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1f27;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--spark-border);
}
.spark-content-body h3 { font-size: 0.98rem; font-weight: 700; color: #1a1f27; margin: 1.1rem 0 0.5rem; }
.spark-content-body p { font-size: 0.9rem; color: #333a44; line-height: 1.7; margin-bottom: 0.9rem; }
.spark-content-body ul, .spark-content-body ol { font-size: 0.9rem; color: #333a44; line-height: 1.7; margin-bottom: 0.9rem; padding-left: 1.4rem; }
.spark-content-body li { margin-bottom: 0.35rem; }
.spark-content-body strong { color: #1a1f27; }
.spark-content-body a { color: var(--spark-primary); }
.spark-content-notice {
  background: #fdf8e9;
  border: 1px solid #f3e6b8;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  font-size: 0.84rem;
  color: #6b5a1e;
  margin-bottom: 2rem;
  line-height: 1.6;
}
.spark-content-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 1.2rem; }
.spark-content-table th, .spark-content-table td {
  border: 1px solid var(--spark-border);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.spark-content-table th { background: #f7f9fc; font-weight: 700; color: #1a1f27; }

@media (max-width: 991.98px) {
  .spark-content-toc { display: none; }
  .spark-content-main { flex-direction: column; }
}

/* =================================================================
   Dashboard shell (public/index.php) — sidebar + top bar layout
================================================================= */
.spark-shell { display: flex; min-height: 100vh; background: var(--spark-bg); }

.spark-sidebar {
  flex: 0 0 250px;
  width: 250px;
  background: #0d1b3e;
  color: #cbd3e6;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.spark-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  padding: 0.4rem 0.5rem 1.25rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.spark-sidebar-brand-chip {
  background: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.spark-sidebar-brand img { height: 22px; width: auto; display: block; }
.spark-sidebar-brand span { font-size: 0.78rem; color: #8791ac; display: block; }

.spark-sidebar-nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.spark-sidebar-nav a,
.spark-sidebar-nav .spark-sidebar-soon {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: 9px;
  color: #b6bedb;
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 500;
}
.spark-sidebar-nav a i,
.spark-sidebar-nav .spark-sidebar-soon i { font-size: 0.95rem; width: 18px; text-align: center; }
.spark-sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.spark-sidebar-nav a.active { background: var(--spark-primary); color: #fff; }
.spark-sidebar-nav .spark-sidebar-soon { color: #5c6584; cursor: not-allowed; }
.spark-sidebar-badge { position: absolute; right: 0.75rem; font-size: 0.62rem; padding: 0.25em 0.5em; }
.spark-sidebar-nav a.position-relative { position: relative; }

.spark-sidebar-footer { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 1rem; margin-top: 1rem; }
.spark-sidebar-user { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.spark-sidebar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--spark-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.spark-sidebar-user .name { font-size: 0.84rem; font-weight: 600; color: #fff; line-height: 1.2; }
.spark-sidebar-user .role { font-size: 0.72rem; color: #8791ac; }

.spark-sidebar-help {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  color: #b6bedb;
}
.spark-sidebar-help p { color: #8791ac; }

.spark-shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.spark-shell-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #fff;
  border-bottom: 1px solid var(--spark-border);
  padding: 0.75rem 1.5rem;
  flex-wrap: wrap;
}

.spark-shell-content { flex: 1; padding: 1.5rem; }

.spark-shell-footer {
  text-align: center;
  font-size: 0.78rem;
  color: #9aa3b2;
  padding: 1rem;
  border-top: 1px solid var(--spark-border);
}

.spark-dash-table-card { border-radius: 12px; overflow: hidden; }
.spark-dash-table { font-size: 0.86rem; }
.spark-dash-table thead th {
  background: #f7f9fc;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--spark-border);
  padding: 0.75rem 1rem;
  white-space: nowrap;
}
.spark-dash-table td { padding: 0.75rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--spark-border); }
.spark-dash-table tbody tr:last-child td { border-bottom: none; }
.spark-dash-table tbody tr:hover { background: #fbfcfe; }
.spark-dash-table .card-title-text { cursor: pointer; }
.spark-dash-table .card-title-text:hover { color: var(--spark-primary); }
.spark-dash-desc-cell {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  .spark-sidebar { display: none; }
  .spark-shell-content { padding: 1rem; }
}

/* Template Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

.gallery-card {
  background: #fff;
  border: 1px solid var(--spark-border);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: box-shadow .12s ease, transform .12s ease;
}
.gallery-card:hover { box-shadow: 0 6px 18px rgba(20, 30, 60, 0.06); transform: translateY(-1px); }

.gallery-tabs {
  border-bottom-color: var(--spark-border);
}
.gallery-tabs .nav-link {
  color: #4a5568;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 0.25rem;
  margin-right: 1.5rem;
  background: transparent;
}
.gallery-tabs .nav-link:hover {
  color: var(--spark-primary);
  border-color: transparent;
}
.gallery-tabs .nav-link.active {
  color: var(--spark-primary);
  border-bottom-color: var(--spark-primary);
  background: transparent;
}
.gallery-tabs .nav-link .badge {
  color: #4a5568;
  font-weight: 600;
  font-size: 0.72rem;
}
.gallery-tabs .nav-link.active .badge {
  color: var(--spark-primary);
}

.ins-bulk-add-panel {
  background: #f8fafd;
  border: 1px solid var(--spark-border);
  border-radius: 8px;
  padding: 0.65rem;
}

.settings-logo-preview {
  max-height: 60px;
  max-width: 200px;
  border: 1px solid var(--spark-border);
  border-radius: 6px;
  padding: 4px;
  background: #fff;
  vertical-align: middle;
}

/* Respondent-facing form's top logo — alignment set per questionnaire
   via Settings > Logo position. Overrides .spark-public-brand's
   default centered justify-content (defined earlier in this file)
   when a non-center alignment is chosen. */
.spark-public-brand.align-left { justify-content: flex-start; }
.spark-public-brand.align-center { justify-content: center; }
.spark-public-brand.align-right { justify-content: flex-end; }



