/* ============================================================
   Swift Poll - single stylesheet
   Mobile-first, dependency-free, brand colours from the logo
   (blue -> green gradient). BEM-ish naming under `sp-` prefix.
   ============================================================ */

:root {
  /* Brand */
  --sp-blue:     #2563eb;
  --sp-blue-600: #1d4ed8;
  --sp-green:    #16a34a;
  --sp-green-600:#15803d;

  /* Surfaces */
  --sp-bg:       #f6f8fc;
  --sp-bg-2:     #eef2f8;
  --sp-surface:  #ffffff;
  --sp-border:   #e5e9f2;
  --sp-border-2: #dce2ee;

  /* Text */
  --sp-text:       #0f172a;
  --sp-text-muted: #64748b;
  --sp-text-soft:  #94a3b8;

  /* Feedback */
  --sp-danger: #dc2626;
  --sp-ok:     #16a34a;

  /* Radii + spacing + shadows */
  --sp-radius-sm: 8px;
  --sp-radius:    14px;
  --sp-radius-lg: 20px;
  --sp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --sp-shadow:    0 8px 24px rgba(15, 23, 42, 0.08);
  --sp-shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.12);

  /* Gradients */
  --sp-grad: linear-gradient(135deg, var(--sp-blue) 0%, var(--sp-green) 100%);
  --sp-grad-soft: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(22, 163, 74, 0.08) 100%);

  /* Type */
  --sp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* ----------------------- Reset / base ----------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sp-font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--sp-text);
  background: var(--sp-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: var(--sp-blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

.sp-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.is-hidden { display: none !important; }

/* Background decoration */
.sp-body::before {
  content: "";
  position: fixed; inset: 0 0 auto 0; height: 280px;
  background: var(--sp-grad-soft);
  z-index: -1;
  pointer-events: none;
}

/* --------------------------- Header --------------------------- */
.sp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  max-width: 1120px; margin: 0 auto; width: 100%;
}
.sp-header__brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--sp-text); text-decoration: none;
}
.sp-header__brand:hover { text-decoration: none; }
.sp-header__logo {
  width: 36px; height: 36px; border-radius: 10px;
  box-shadow: var(--sp-shadow-sm);
  background: #fff;
}
.sp-header__name {
  font-weight: 700; font-size: 18px; letter-spacing: -0.01em;
  background: var(--sp-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.sp-header__nav { display: flex; gap: 10px; }
.sp-link {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--sp-text-muted);
  font-weight: 500;
}
.sp-link:hover { color: var(--sp-blue-600); background: var(--sp-bg-2); text-decoration: none; }

/* --------------------------- Main --------------------------- */
.sp-main {
  flex: 1;
  padding: 8px 18px 96px;
  max-width: 1120px; margin: 0 auto; width: 100%;
}
.sp-main--poll,
.sp-main--dashboard { padding-top: 6px; }

/* --------------------------- Hero --------------------------- */
.sp-hero { text-align: center; padding: 24px 4px 0; }
.sp-hero__logo {
  width: 72px; height: 72px; margin: 0 auto 16px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--sp-shadow);
}
.sp-hero__title {
  font-size: 34px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.sp-hero__title [data-brand-name] {
  background: var(--sp-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.sp-hero__subtitle {
  color: var(--sp-text-muted);
  font-size: 16px; max-width: 560px; margin: 0 auto 20px;
}

/* --------------------------- Card --------------------------- */
.sp-card {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-lg);
  padding: 22px;
  box-shadow: var(--sp-shadow-sm);
}
.sp-card--hero { max-width: 560px; margin: 8px auto 24px; text-align: left; }
.sp-card--poll {
  max-width: 620px; margin: 18px auto 0;
  box-shadow: var(--sp-shadow);
  padding: 24px;
}
.sp-card--success { text-align: center; }
.sp-card__title {
  font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.sp-card__subtitle {
  margin: 0 0 18px; color: var(--sp-text-muted);
}

/* Steps on landing */
.sp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sp-steps li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border-radius: var(--sp-radius);
  background: var(--sp-bg-2);
}
.sp-steps__n {
  flex: 0 0 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  font-weight: 700; font-size: 13px;
  color: #fff; background: var(--sp-grad);
}

/* CTA row */
.sp-cta-row {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin-top: 16px;
}
.sp-fineprint {
  color: var(--sp-text-soft);
  font-size: 13px;
  margin: 14px 0 0;
  text-align: center;
}
.sp-fineprint--sm { font-size: 12px; margin-top: 10px; }

/* --------------------------- Buttons --------------------------- */
.sp-btn {
  -webkit-appearance: none; appearance: none;
  border: 1px solid transparent;
  padding: 13px 20px;
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  min-height: 46px;
}
.sp-btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}
.sp-btn:active:not(:disabled) { transform: translateY(1px); }
.sp-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.sp-btn--primary {
  background: var(--sp-grad);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}
.sp-btn--primary:hover:not(:disabled) { box-shadow: 0 10px 24px rgba(37, 99, 235, 0.3); }

.sp-btn--ghost {
  background: #fff;
  color: var(--sp-text);
  border-color: var(--sp-border-2);
}
.sp-btn--ghost:hover:not(:disabled) { border-color: var(--sp-blue); color: var(--sp-blue-600); }

.sp-btn--block { width: 100%; }
.sp-btn--sm { padding: 9px 14px; font-size: 14px; min-height: 38px; }
.sp-btn--xl {
  padding: 18px 36px;
  font-size: 17px;
  min-height: 58px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  min-width: 240px;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.28);
}
.sp-btn--xl:hover:not(:disabled) { box-shadow: 0 14px 34px rgba(37, 99, 235, 0.34); }
.sp-cta-row--solo { justify-content: center; margin-top: 22px; }
.sp-cta-row--solo .sp-btn--xl { flex: 0 1 auto; }
.sp-btn__arrow { transition: transform 0.2s ease; }
.sp-btn:hover .sp-btn__arrow { transform: translateX(2px); }

/* --------------------------- Form --------------------------- */
.sp-form { display: grid; gap: 14px; }
.sp-field { display: grid; gap: 6px; }
.sp-field__label {
  font-weight: 600; font-size: 14px; color: var(--sp-text);
}
.sp-req { color: var(--sp-danger); }
.sp-opt { color: var(--sp-text-soft); font-weight: 500; }
.sp-input {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  background: #fff;
  border: 1px solid var(--sp-border-2);
  border-radius: var(--sp-radius);
  color: var(--sp-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sp-input:focus {
  outline: none;
  border-color: var(--sp-blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}
.sp-form__actions { margin-top: 4px; }
.sp-error {
  color: var(--sp-danger);
  font-size: 14px;
  margin: 0;
  min-height: 1em;
}

/* --------------------------- Poll question --------------------------- */
.sp-progress {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 18px;
}
.sp-progress__label {
  font-size: 13px; font-weight: 600;
  color: var(--sp-text-muted);
  letter-spacing: 0.02em; text-transform: uppercase;
}
.sp-progress__track {
  height: 8px;
  background: var(--sp-bg-2);
  border-radius: 999px;
  overflow: hidden;
}
.sp-progress__bar {
  height: 100%;
  background: var(--sp-grad);
  transition: width 0.3s ease;
  border-radius: 999px;
}

.sp-q-title {
  font-size: 20px; line-height: 1.35; font-weight: 700;
  margin: 0 0 18px;
  color: var(--sp-text);
  letter-spacing: -0.01em;
}

.sp-options { border: 0; padding: 0; margin: 0; }
.sp-options__list { display: grid; gap: 10px; }

.sp-option {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--sp-border-2);
  border-radius: var(--sp-radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  min-height: 52px;
}
.sp-option:hover { border-color: var(--sp-blue); }
.sp-option input { position: absolute; opacity: 0; pointer-events: none; }
.sp-option__radio {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--sp-border-2);
  background: #fff;
  display: inline-grid; place-items: center;
  flex: 0 0 22px;
  transition: border-color 0.15s ease;
}
.sp-option__radio::after {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--sp-grad);
  transform: scale(0);
  transition: transform 0.15s ease;
}
.sp-option__text { font-weight: 500; }
.sp-option--selected {
  border-color: var(--sp-blue);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(22, 163, 74, 0.06));
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.10);
}
.sp-option--selected .sp-option__radio { border-color: var(--sp-blue); }
.sp-option--selected .sp-option__radio::after { transform: scale(1); }
.sp-option input:focus-visible + .sp-option__radio {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.sp-nav {
  display: flex; gap: 10px; justify-content: space-between;
  margin-top: 20px;
}
.sp-nav .sp-btn { flex: 1; }

/* Success screen */
.sp-check {
  width: 72px; height: 72px; margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--sp-grad);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 14px 30px rgba(22, 163, 74, 0.28);
}

/* --------------------------- Dashboard --------------------------- */
.sp-dash-hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 16px 0 8px;
}
.sp-dash-hero__title {
  margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em;
  background: var(--sp-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sp-dash-hero__sub { margin: 2px 0 0; color: var(--sp-text-muted); font-size: 14px; }
.sp-dash-hero__actions { display: flex; gap: 8px; }

.sp-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 12px 0 18px;
}
.sp-stat-card {
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-lg);
  padding: 16px 18px;
  display: flex; align-items: baseline; justify-content: space-between;
  box-shadow: var(--sp-shadow-sm);
}
.sp-stat-card__label {
  color: var(--sp-text-muted);
  font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.sp-stat-card__value {
  font-size: 28px; font-weight: 800; letter-spacing: -0.02em;
  background: var(--sp-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.sp-loading {
  text-align: center; padding: 36px; color: var(--sp-text-muted);
}

.sp-empty {
  text-align: center; padding: 40px 16px;
  background: #fff; border: 1px dashed var(--sp-border-2);
  border-radius: var(--sp-radius-lg);
}
.sp-empty h2 { margin: 0 0 6px; font-size: 20px; }
.sp-empty p { color: var(--sp-text-muted); margin: 0 0 16px; }

.sp-section { margin-top: 28px; }
.sp-section__title {
  font-size: 18px; font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

/* Aggregated results grid */
.sp-agg-grid {
  display: grid; grid-template-columns: 1fr; gap: 14px;
}

.sp-agg-card {
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-lg);
  padding: 18px;
  box-shadow: var(--sp-shadow-sm);
}
.sp-agg-card__head {
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 14px;
}
.sp-agg-card__badge {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 26px; padding: 0 8px;
  border-radius: 999px;
  background: var(--sp-grad);
  color: #fff; font-weight: 700; font-size: 12px;
  letter-spacing: 0.02em;
}
.sp-agg-card__title {
  margin: 0; font-size: 15px; line-height: 1.4; font-weight: 600;
  color: var(--sp-text);
}
.sp-bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sp-bar__head {
  display: flex; justify-content: space-between; gap: 12px;
  margin-bottom: 6px;
  font-size: 14px;
}
.sp-bar__label { font-weight: 600; }
.sp-bar__val { color: var(--sp-text-muted); font-variant-numeric: tabular-nums; }
.sp-bar__pct { color: var(--sp-text-soft); font-size: 12px; }
.sp-bar__track {
  height: 10px;
  background: var(--sp-bg-2);
  border-radius: 999px;
  overflow: hidden;
}
.sp-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--sp-grad);
  transition: width 0.4s ease;
  min-width: 2px;
}
.sp-bar__fill--yes      { background: linear-gradient(135deg, #16a34a, #22c55e); }
.sp-bar__fill--not_sure { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.sp-bar__fill--no       { background: linear-gradient(135deg, #dc2626, #ef4444); }

.sp-agg-card__foot {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--sp-border);
  color: var(--sp-text-muted); font-size: 13px;
}

/* User-wise responses */
.sp-users__desktop { display: none; }
.sp-users__mobile  { display: grid; gap: 10px; }
.sp-user-card {
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-lg);
  padding: 14px 16px;
  box-shadow: var(--sp-shadow-sm);
}
.sp-user-card__head {
  display: flex; justify-content: space-between; gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.sp-user-card__name {
  margin: 0; font-size: 15px; font-weight: 700;
}
.sp-user-card__meta {
  margin: 2px 0 0; color: var(--sp-text-muted); font-size: 12px;
}
.sp-user-card__time {
  color: var(--sp-text-soft); font-size: 12px; white-space: nowrap;
}
.sp-user-card__answers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sp-user-card__answers li {
  display: flex; gap: 8px; font-size: 14px;
  padding: 6px 10px;
  background: var(--sp-bg-2);
  border-radius: 10px;
}
.sp-user-card__q { color: var(--sp-text-muted); font-weight: 600; flex: 0 0 32px; }
.sp-user-card__a { font-weight: 600; }

.sp-table-wrap { overflow-x: auto; border-radius: var(--sp-radius-lg); border: 1px solid var(--sp-border); background: #fff; }
.sp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.sp-table th, .sp-table td {
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--sp-border);
  white-space: nowrap;
}
.sp-table thead th {
  font-weight: 700;
  background: var(--sp-bg-2);
  color: var(--sp-text);
  position: sticky; top: 0;
}
.sp-table tbody tr:last-child td { border-bottom: 0; }
.sp-table tbody tr:hover td { background: var(--sp-bg); }
.sp-muted { color: var(--sp-text-muted); }

/* --------------------------- Footer --------------------------- */
.sp-footer {
  margin-top: auto;
  padding: 20px 18px 24px;
  color: var(--sp-text-soft); font-size: 13px;
  text-align: center;
}
.sp-footer__dot { margin: 0 6px; }
.sp-credit { white-space: nowrap; }
.sp-credit__heart {
  display: inline-block;
  color: #ef4444;
  transform: translateY(1px);
  animation: sp-heartbeat 1.8s ease-in-out infinite;
}
.sp-credit__link {
  color: var(--sp-text-muted);
  font-weight: 600;
  border-bottom: 1px dashed var(--sp-border-2);
  padding-bottom: 1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.sp-credit__link:hover {
  color: var(--sp-blue-600);
  border-bottom-color: var(--sp-blue);
  text-decoration: none;
}
@keyframes sp-heartbeat {
  0%, 100% { transform: translateY(1px) scale(1); }
  15%      { transform: translateY(1px) scale(1.18); }
  30%      { transform: translateY(1px) scale(1); }
  45%      { transform: translateY(1px) scale(1.12); }
}

/* --------------------------- Toasts --------------------------- */
.sp-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px);
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px; font-weight: 600;
  box-shadow: var(--sp-shadow-lg);
  opacity: 0; transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 50;
  max-width: calc(100% - 32px);
}
.sp-toast--show { opacity: 1; transform: translate(-50%, 0); }
.sp-toast--error { background: var(--sp-danger); }
.sp-toast--ok { background: var(--sp-green-600); }

/* Dashboard gate (passcode denied fallback) */
.sp-gate {
  min-height: 60vh; display: grid; place-items: center;
  font-weight: 700; color: var(--sp-danger);
}

/* ============================================================
   Responsive: tablet / desktop breakpoints
   ============================================================ */
@media (min-width: 600px) {
  .sp-hero__title { font-size: 44px; }
  .sp-hero__logo  { width: 84px; height: 84px; }
  .sp-stats       { grid-template-columns: repeat(3, 1fr); }
  .sp-stats .sp-stat-card:not(:first-child) { display: none; } /* placeholder for future stats */
  .sp-agg-grid    { grid-template-columns: repeat(2, 1fr); }
  .sp-nav .sp-btn { flex: 0 1 auto; min-width: 140px; }
}

@media (min-width: 900px) {
  .sp-main          { padding: 16px 24px 96px; }
  .sp-hero          { padding-top: 40px; }
  .sp-hero__title   { font-size: 52px; }
  .sp-agg-grid      { grid-template-columns: repeat(3, 1fr); }
  .sp-users__desktop { display: block; }
  .sp-users__mobile  { display: none; }
}

/* ============================================================
   Select (styled to match sp-input)
   ============================================================ */
.sp-select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}
.sp-select:focus {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%232563eb' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

/* ============================================================
   Dashboard filter bar
   ============================================================ */
.sp-filter-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-lg);
  padding: 14px 16px;
  margin: 10px 0 14px;
  box-shadow: var(--sp-shadow-sm);
}
.sp-filter-bar__label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sp-text-muted);
}
.sp-filter-bar__select { max-width: 100%; }
.sp-filter-bar__hint {
  color: var(--sp-text-soft); font-size: 13px;
}

@media (min-width: 720px) {
  .sp-filter-bar {
    grid-template-columns: auto 240px 1fr;
    align-items: center;
    gap: 14px;
  }
  .sp-filter-bar__label { margin-bottom: 0; }
}

/* ============================================================
   Admin: Manage Questions
   ============================================================ */
.sp-admin { margin-top: 28px; }
.sp-admin__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.sp-admin__sub { margin: 2px 0 0; color: var(--sp-text-muted); font-size: 13px; }

.sp-admin__form { padding: 18px; margin-bottom: 20px; }
.sp-admin__form-title {
  margin: 0 0 14px; font-size: 16px; font-weight: 700;
}

.sp-input--area {
  resize: vertical;
  min-height: 58px;
  line-height: 1.4;
}

.sp-counter {
  font-size: 12px; font-weight: 500;
  color: var(--sp-text-soft);
  margin-left: auto;
}
.sp-field__label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.sp-field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}
@media (min-width: 600px) {
  .sp-field-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
}

.sp-admin__form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 14px; flex-wrap: wrap;
}

.sp-admin__list-head {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0 10px;
}
.sp-admin__list-title {
  margin: 0; font-size: 15px; font-weight: 700;
  color: var(--sp-text);
}
.sp-admin__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 22px; padding: 0 8px;
  border-radius: 999px;
  background: var(--sp-bg-2); color: var(--sp-text-muted);
  font-size: 12px; font-weight: 700;
}
.sp-admin__list { display: grid; gap: 10px; }
.sp-admin__list-empty { margin: 12px 2px; font-size: 14px; }

.sp-q-row {
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-lg);
  padding: 14px 16px;
  box-shadow: var(--sp-shadow-sm);
}
.sp-q-row__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  margin-bottom: 8px;
}
.sp-q-row__num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 26px; padding: 0 8px;
  border-radius: 999px;
  background: var(--sp-grad); color: #fff;
  font-weight: 700; font-size: 12px;
}
.sp-q-row__text {
  margin: 0; font-size: 15px; line-height: 1.4; font-weight: 600;
  color: var(--sp-text);
}
.sp-q-row__opts {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.sp-q-row__opt {
  font-size: 13px; color: var(--sp-text-muted);
  background: var(--sp-bg-2);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Danger button */
.sp-btn--danger {
  background: var(--sp-danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.22);
}
.sp-btn--danger:hover:not(:disabled) { box-shadow: 0 8px 18px rgba(220, 38, 38, 0.28); }

/* ============================================================
   Modal
   ============================================================ */
.sp-modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: grid; place-items: center;
  padding: 16px;
  animation: sp-modal-in 0.18s ease;
}
.sp-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.sp-modal__dialog {
  position: relative;
  background: #fff;
  border-radius: var(--sp-radius-lg);
  padding: 22px;
  max-width: 440px; width: 100%;
  box-shadow: var(--sp-shadow-lg);
}
.sp-modal__title { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.sp-modal__body  { margin: 0 0 16px; color: var(--sp-text-muted); font-size: 14px; }
.sp-modal__actions {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}
@keyframes sp-modal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   Question head - required / optional pill
   ============================================================ */
.sp-q-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 0 0 18px;
  flex-wrap: wrap;
}
.sp-q-required {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sp-q-required--yes { background: rgba(220, 38, 38, 0.08); color: var(--sp-danger); }
.sp-q-required--no  { background: var(--sp-bg-2);          color: var(--sp-text-muted); }

/* Text answer on poll page */
.sp-q-body { display: grid; gap: 10px; }
.sp-text-answer { display: grid; gap: 6px; }
.sp-text-answer__area { width: 100%; min-height: 120px; resize: vertical; }
.sp-text-answer__foot { display: flex; justify-content: flex-end; }

/* Skip button lives inside sp-nav; already flexes. Hide default uses .is-hidden */

/* ============================================================
   Pills (admin)
   ============================================================ */
.sp-pill {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sp-bg-2); color: var(--sp-text-muted);
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase;
}
.sp-pill--type { background: rgba(37, 99, 235, 0.1); color: var(--sp-blue-600); }
.sp-pill--req  { background: rgba(22, 163, 74, 0.12); color: var(--sp-green-600); }

.sp-q-row__meta { display: flex; gap: 6px; margin: 6px 0 8px; flex-wrap: wrap; }

/* ============================================================
   Toggle switch (Required)
   ============================================================ */
.sp-field--checkbox { align-self: end; }
.sp-switch {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  padding-top: 28px;
}
.sp-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.sp-switch__track {
  width: 40px; height: 22px;
  background: var(--sp-border-2);
  border-radius: 999px; position: relative;
  transition: background 0.2s ease;
  flex: 0 0 40px;
}
.sp-switch__track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}
.sp-switch input:checked + .sp-switch__track { background: var(--sp-green); }
.sp-switch input:checked + .sp-switch__track::after { transform: translateX(18px); }
.sp-switch__label { font-size: 14px; font-weight: 600; }

/* ============================================================
   MCQ option fields in the admin add-question form
   ============================================================ */
.sp-option-field__row { display: flex; gap: 8px; align-items: stretch; }
.sp-option-field__input { flex: 1; }
.sp-option-field__remove {
  padding: 0 14px; min-width: 40px;
  font-size: 18px; line-height: 1;
}
.sp-admin__options-actions {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 10px;
}
.sp-admin__options-actions .sp-muted { font-size: 12px; }

/* ============================================================
   User admin rows
   ============================================================ */
.sp-user-admin {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-lg);
  padding: 12px 14px;
  box-shadow: var(--sp-shadow-sm);
}
.sp-user-admin__main { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sp-user-admin__name { font-weight: 700; }
.sp-user-admin__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Delete button floating right on user card */
.sp-user-card__rhs { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* Header who-am-i */
.sp-header__who {
  font-size: 12px; color: var(--sp-text-muted); font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--sp-bg-2);
  margin-right: 6px;
  white-space: nowrap;
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
