/* ============================================
   AubeForms — Identité visuelle « L'Aube Étoilée »
   Thème par défaut : aube (coral dawn)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Dawn palette */
  --aube: #ec7266;          /* coral dawn — primary */
  --aube-soft: #f5a896;
  --aube-glow: #fbbf77;     /* sunrise peach */
  --aube-deep: #c84e3f;

  --nuit: #1e1b4b;          /* deep twilight */
  --nuit-soft: #4338ca;
  --etoile: #f4c06d;        /* star gold */
  --lavande: #a78bfa;

  --cream: #fdf8f1;         /* dawn cream bg */
  --surface: #ffffff;
  --surface-2: #fefbf4;
  --border: #eadfd0;
  --border-soft: #f3ead9;

  --text: #2a2338;
  --text-light: #786d82;
  --text-faint: #a59a9a;

  --success: #5a9d68;
  --danger: #c94a45;

  --primary: var(--aube);
  --primary-dark: var(--aube-deep);
  --primary-light: rgba(236, 114, 102, 0.1);
  --accent: var(--aube-glow);

  --gradient-aube: linear-gradient(135deg, #ec7266 0%, #fbbf77 100%);
  --gradient-nuit: linear-gradient(135deg, #1e1b4b 0%, #4338ca 50%, #a78bfa 100%);

  --shadow-sm: 0 1px 2px rgba(42, 35, 56, 0.06);
  --shadow: 0 4px 12px rgba(42, 35, 56, 0.08), 0 1px 3px rgba(42, 35, 56, 0.04);
  --shadow-lg: 0 12px 40px rgba(42, 35, 56, 0.12), 0 4px 12px rgba(42, 35, 56, 0.06);
  --shadow-xl: 0 24px 60px rgba(42, 35, 56, 0.16);
  --radius: 14px;
  --radius-lg: 20px;
  --radius-sm: 8px;
}

/* Thèmes par formulaire */
[data-theme="aube"]    { --theme: #ec7266; --theme-accent: #fbbf77; --theme-grad: linear-gradient(135deg, #ec7266, #fbbf77); }
[data-theme="nuit"]    { --theme: #4338ca; --theme-accent: #a78bfa; --theme-grad: linear-gradient(135deg, #1e1b4b, #4338ca, #a78bfa); }
[data-theme="lavande"] { --theme: #8b5cf6; --theme-accent: #c4b5fd; --theme-grad: linear-gradient(135deg, #7c3aed, #c4b5fd); }
[data-theme="foret"]   { --theme: #059669; --theme-accent: #6ee7b7; --theme-grad: linear-gradient(135deg, #065f46, #10b981); }
[data-theme="ocean"]   { --theme: #0284c7; --theme-accent: #7dd3fc; --theme-grad: linear-gradient(135deg, #0c4a6e, #0ea5e9, #7dd3fc); }
[data-theme="sobre"]   { --theme: #404040; --theme-accent: #d4d4d4; --theme-grad: linear-gradient(135deg, #262626, #525252); }

/* Mode sombre */
[data-mode="dark"] {
  --cream: #14131c;
  --surface: #1c1a27;
  --surface-2: #23212f;
  --border: #2e2c3c;
  --border-soft: #262433;
  --text: #e9e4f0;
  --text-light: #9b91a9;
  --text-faint: #6a6378;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--aube); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Stars background decoration */
.starfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.starfield::before, .starfield::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, var(--etoile), transparent 50%),
    radial-gradient(1px 1px at 60% 70%, var(--lavande), transparent 50%),
    radial-gradient(1.2px 1.2px at 80% 15%, var(--aube-glow), transparent 50%),
    radial-gradient(0.8px 0.8px at 30% 80%, var(--etoile), transparent 50%),
    radial-gradient(1px 1px at 90% 50%, var(--lavande), transparent 50%),
    radial-gradient(1.5px 1.5px at 10% 60%, var(--aube-glow), transparent 50%);
  opacity: 0.35;
  animation: twinkle 8s ease-in-out infinite;
}
.starfield::after {
  animation-delay: 4s;
  transform: translate(40px, -20px);
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.5; }
}

/* ============ Typography ============ */
h1, h2, h3, .display {
  font-family: 'Fraunces', 'Georgia', serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.serif { font-family: 'Fraunces', 'Georgia', serif; }

/* ============ Brand ============ */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px;
  position: relative;
  background: var(--gradient-aube);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(236, 114, 102, 0.35);
}
.brand-mark::before {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  background: white;
  border-radius: 50%;
  bottom: -12px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
}
.brand-mark::after {
  content: '✦';
  position: absolute;
  top: 4px; right: 6px;
  color: white;
  font-size: 10px;
  opacity: 0.9;
}
.brand small { font-size: 12px; color: var(--text-light); font-weight: 400; font-family: 'Inter', sans-serif; letter-spacing: 0.02em; }

/* ============ Topbar ============ */
.topbar {
  display: flex;
  align-items: center;
  padding: 18px 32px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(1.8) blur(16px);
  -webkit-backdrop-filter: saturate(1.8) blur(16px);
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0;
  z-index: 30;
  gap: 16px;
}
[data-mode="dark"] .topbar { background: rgba(28, 26, 39, 0.8); }
.topbar .spacer { flex: 1; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--gradient-aube);
  color: white;
  box-shadow: 0 4px 14px rgba(236, 114, 102, 0.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(236, 114, 102, 0.45); transform: translateY(-1px); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--aube); color: var(--aube); }
.btn-ghost { background: transparent; color: var(--text-light); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #a33a35; }
.btn-dark { background: var(--nuit); color: white; }
.btn-dark:hover { background: var(--nuit-soft); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Avatar */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient-aube);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.user-menu {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 6px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  font-size: 13px;
}
.user-menu button { padding: 6px 10px; border-radius: 8px; font-size: 12px; color: var(--text-light); }
.user-menu button:hover { background: var(--surface-2); color: var(--danger); }

/* Mode toggle */
.mode-toggle {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}
.mode-toggle:hover { background: var(--surface-2); }

/* ============ Dashboard ============ */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px 80px;
  position: relative;
  z-index: 1;
}
.hero {
  margin-bottom: 48px;
  text-align: center;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.hero-eyebrow::before {
  content: '✦';
  color: var(--aube);
}
.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 500;
  line-height: 1.1;
  margin-bottom: 14px;
}
.hero h1 .accent {
  background: var(--gradient-aube);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: italic;
}
.hero .subtitle {
  color: var(--text-light);
  font-size: 17px;
  max-width: 520px;
  margin: 0 auto;
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.stat-bubble {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.stat-bubble:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-bubble .ic {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--primary-light);
  color: var(--aube);
}
.stat-bubble .val { font-family: 'Fraunces', serif; font-size: 26px; font-weight: 600; line-height: 1; }
.stat-bubble .lbl { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* Section heading */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 40px 0 20px;
}
.section-heading h2 {
  font-size: 24px;
  font-weight: 500;
}
.section-heading .hint { color: var(--text-light); font-size: 13px; }

/* Templates gallery */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}
.template-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  text-align: left;
}
.template-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--aube); }
.template-card .cover {
  height: 110px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.template-card.aube    .cover { background: linear-gradient(135deg, #ec7266, #fbbf77); }
.template-card.nuit    .cover { background: linear-gradient(135deg, #1e1b4b, #4338ca, #a78bfa); }
.template-card.lavande .cover { background: linear-gradient(135deg, #7c3aed, #c4b5fd); }
.template-card.foret   .cover { background: linear-gradient(135deg, #065f46, #10b981); }
.template-card.ocean   .cover { background: linear-gradient(135deg, #0c4a6e, #0ea5e9); }
.template-card.sobre   .cover { background: linear-gradient(135deg, #262626, #525252); }
.template-card.blank   .cover { background: var(--surface-2); }
.template-card.blank   .cover::after { content: '+'; color: var(--text-light); font-size: 40px; font-weight: 300; }
.template-card .cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.6), transparent 50%),
    radial-gradient(1.5px 1.5px at 70% 20%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(2px 2px at 85% 60%, rgba(255,255,255,0.6), transparent 50%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.4), transparent 50%);
  pointer-events: none;
}
.template-card.blank .cover::before { display: none; }
.template-card .body { padding: 16px; flex: 1; }
.template-card h3 {
  font-family: 'Fraunces', serif;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}
.template-card .meta { font-size: 12px; color: var(--text-light); }

/* Forms grid */
.forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.form-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.form-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.form-card .header {
  height: 96px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  cursor: pointer;
}
.form-card[data-theme="aube"]    .header { background: linear-gradient(135deg, #ec7266, #fbbf77); }
.form-card[data-theme="nuit"]    .header { background: linear-gradient(135deg, #1e1b4b, #4338ca, #a78bfa); }
.form-card[data-theme="lavande"] .header { background: linear-gradient(135deg, #7c3aed, #c4b5fd); }
.form-card[data-theme="foret"]   .header { background: linear-gradient(135deg, #065f46, #10b981); }
.form-card[data-theme="ocean"]   .header { background: linear-gradient(135deg, #0c4a6e, #0ea5e9); }
.form-card[data-theme="sobre"]   .header { background: linear-gradient(135deg, #262626, #525252); }
.form-card .header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 15% 25%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 75% 20%, rgba(255,255,255,0.5), transparent),
    radial-gradient(2.5px 2.5px at 90% 70%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 30% 85%, rgba(255,255,255,0.4), transparent);
  pointer-events: none;
}
.form-card .badges {
  display: flex;
  gap: 6px;
  position: absolute;
  top: 10px; right: 10px;
  z-index: 1;
}
.form-card .pill {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 100px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.form-card .pill.published { background: rgba(255, 255, 255, 0.25); }
.form-card .body { padding: 16px; flex: 1; cursor: pointer; }
.form-card h3 {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.form-card .meta {
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  gap: 10px;
  align-items: center;
}
.form-card .meta .dot { width: 3px; height: 3px; background: var(--text-faint); border-radius: 50%; }
.form-card .actions {
  display: flex;
  padding: 8px;
  border-top: 1px solid var(--border-soft);
  gap: 2px;
}
.form-card .actions button {
  flex: 1;
  padding: 8px;
  font-size: 12px;
  color: var(--text-light);
  border-radius: 8px;
  transition: all 0.15s;
}
.form-card .actions button:hover { background: var(--primary-light); color: var(--aube); }
.form-card .actions button.danger:hover { background: rgba(201, 74, 69, 0.08); color: var(--danger); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state .icon {
  font-size: 52px;
  margin-bottom: 16px;
  background: var(--gradient-aube);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============ Login ============ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.auth-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(236, 114, 102, 0.15), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(251, 191, 119, 0.15), transparent 50%),
    radial-gradient(circle at 60% 30%, rgba(167, 139, 250, 0.1), transparent 50%);
  pointer-events: none;
}
.auth-card {
  position: relative;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-xl);
}
[data-mode="dark"] .auth-card { background: rgba(28, 26, 39, 0.85); border-color: rgba(255, 255, 255, 0.05); }
.auth-card h2 {
  font-family: 'Fraunces', serif;
  margin: 28px 0 6px;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.auth-card .subtitle { color: var(--text-light); margin-bottom: 28px; font-size: 14px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card label {
  display: block;
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.auth-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s;
}
.auth-card input:focus { outline: none; border-color: var(--aube); box-shadow: 0 0 0 4px var(--primary-light); }
.auth-card .btn { width: 100%; justify-content: center; padding: 13px; font-size: 15px; margin-top: 8px; }
.auth-card .switch { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-light); }
.auth-card .switch a { font-weight: 500; }
.auth-card .error {
  background: rgba(201, 74, 69, 0.08);
  color: var(--danger);
  padding: 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid rgba(201, 74, 69, 0.2);
}

/* ============ Editor (three-panel) ============ */
.editor-shell {
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  min-height: calc(100vh - 72px);
}
.editor-shell.preview-collapsed { grid-template-columns: 240px 1fr 0; }
.editor-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  padding: 20px 14px;
  overflow-y: auto;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
}
.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 8px 10px 10px;
}
.type-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  margin-bottom: 2px;
  transition: all 0.15s;
}
.type-btn:hover { background: var(--surface-2); color: var(--aube); }
.type-btn .t-ic {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--aube);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.editor-canvas {
  padding: 32px 24px 80px;
  overflow-y: auto;
}
.editor-canvas-inner { max-width: 720px; margin: 0 auto; }

.editor-right {
  background: var(--surface);
  border-left: 1px solid var(--border-soft);
  padding: 20px;
  overflow-y: auto;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
}
.editor-right h4 {
  font-family: 'Fraunces', serif;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
}
.editor-right .empty-right {
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  padding: 40px 0;
}

/* Form header card */
.form-header-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
}
.form-header-card .cover {
  height: 90px;
  position: relative;
  background: var(--theme-grad, var(--gradient-aube));
}
.form-header-card .cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 15% 30%, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 75% 20%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 90% 60%, rgba(255,255,255,0.5), transparent);
}
.form-header-card .content { padding: 22px 28px 26px; }
.form-header-card input.title {
  width: 100%;
  font-family: 'Fraunces', serif;
  font-size: 32px;
  font-weight: 500;
  border: none;
  padding: 4px 0;
  font-family: 'Fraunces', serif;
  background: transparent;
  color: var(--text);
  letter-spacing: -0.01em;
}
.form-header-card input.title:focus { outline: none; border-bottom: 1px dashed var(--aube); }
.form-header-card textarea.description {
  width: 100%;
  border: none;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  padding: 6px 0;
  background: transparent;
  color: var(--text-light);
  min-height: 32px;
}
.form-header-card textarea.description:focus { outline: none; border-bottom: 1px dashed var(--border); }

/* Question card */
.question-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 10px;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all 0.15s;
  cursor: pointer;
}
.question-card::before {
  content: '';
  position: absolute;
  left: -1px; top: 12px; bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background 0.2s;
}
.question-card.active::before { background: var(--gradient-aube); }
.question-card.active { box-shadow: var(--shadow); }
.question-card.section-card {
  background: linear-gradient(135deg, var(--primary-light), transparent);
  border-color: rgba(236, 114, 102, 0.2);
}

.q-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.q-index {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.question-card.active .q-index { background: var(--gradient-aube); color: white; }
.q-title {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
}
.q-title:focus { outline: none; background: var(--surface-2); }
.q-badge {
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 11px;
  color: var(--text-light);
  background: var(--surface-2);
  white-space: nowrap;
}
.q-badge.quiz { background: rgba(244, 192, 109, 0.15); color: #b98a2a; }

.q-body { padding-left: 36px; margin-top: 8px; }
.q-preview {
  color: var(--text-faint);
  font-size: 14px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px dashed var(--border);
  font-style: italic;
}

/* Options */
.option-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}
.option-row .marker {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0;
  position: relative;
}
.option-row .marker.radio::before {
  content: '';
  width: 18px; height: 18px;
  border: 2px solid var(--text-faint);
  border-radius: 50%;
  display: block;
}
.option-row .marker.check::before {
  content: '';
  width: 18px; height: 18px;
  border: 2px solid var(--text-faint);
  border-radius: 6px;
  display: block;
}
.option-row .marker.num {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
}
.option-row input.option-text {
  flex: 1;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  transition: all 0.15s;
}
.option-row input.option-text:hover { background: var(--surface-2); }
.option-row input.option-text:focus {
  outline: none;
  border-color: var(--aube);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.option-row input.option-text::placeholder { color: var(--text-faint); font-style: italic; }
.option-row .correct-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--success);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 100px;
  background: rgba(90, 157, 104, 0.1);
}
.option-row .correct-badge.inactive { color: var(--text-faint); background: transparent; border: 1px dashed var(--border); }
.option-row .remove-opt {
  color: var(--text-faint);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
}
.option-row .remove-opt:hover { background: rgba(201, 74, 69, 0.1); color: var(--danger); }
.add-option-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-light);
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 6px;
}
.add-option-btn:hover { color: var(--aube); background: var(--primary-light); }

/* Q footer */
.q-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.q-footer .toggle-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-light); }
.q-footer .icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  color: var(--text-light);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.q-footer .icon-btn:hover { background: var(--surface-2); color: var(--aube); }
.q-footer .icon-btn.danger:hover { background: rgba(201, 74, 69, 0.1); color: var(--danger); }
.q-footer .divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* Switch */
.switch-toggle {
  position: relative;
  width: 38px;
  height: 22px;
  display: inline-block;
  flex-shrink: 0;
}
.switch-toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1cada;
  border-radius: 22px;
  transition: 0.25s;
}
.slider::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
input:checked + .slider { background: var(--gradient-aube); }
input:checked + .slider::before { transform: translateX(16px); }

/* Toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 72px;
  z-index: 20;
}
.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-light);
}
.save-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.save-status.saving::before { background: var(--accent); animation: pulse 1s infinite; }
.save-status.error::before { background: var(--danger); }
@keyframes pulse { 50% { opacity: 0.4; } }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 10px 24px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 72px;
  z-index: 20;
}
.tab {
  padding: 10px 18px 14px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  font-size: 14px;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active {
  border-bottom-color: var(--aube);
  color: var(--aube);
  font-weight: 500;
}

/* Settings panel */
.settings-wrap {
  max-width: 780px;
  margin: 32px auto;
  padding: 0 16px;
}
.settings-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  margin-bottom: 18px;
}
.settings-card h3 {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
}
.settings-card .card-hint { color: var(--text-light); font-size: 13px; margin-bottom: 18px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
  gap: 16px;
}
.setting-row:last-child { border-bottom: none; }
.setting-row .label-group { flex: 1; min-width: 0; }
.setting-row .label-group .lbl { font-weight: 500; font-size: 14px; }
.setting-row .label-group .desc { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* Theme picker */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 6px;
}
.theme-swatch {
  aspect-ratio: 1;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  border: 3px solid transparent;
  transition: all 0.15s;
  overflow: hidden;
}
.theme-swatch[data-t="aube"]    { background: linear-gradient(135deg, #ec7266, #fbbf77); }
.theme-swatch[data-t="nuit"]    { background: linear-gradient(135deg, #1e1b4b, #4338ca, #a78bfa); }
.theme-swatch[data-t="lavande"] { background: linear-gradient(135deg, #7c3aed, #c4b5fd); }
.theme-swatch[data-t="foret"]   { background: linear-gradient(135deg, #065f46, #10b981); }
.theme-swatch[data-t="ocean"]   { background: linear-gradient(135deg, #0c4a6e, #0ea5e9); }
.theme-swatch[data-t="sobre"]   { background: linear-gradient(135deg, #262626, #525252); }
.theme-swatch.active { border-color: var(--text); transform: scale(1.05); }
.theme-swatch::after {
  content: attr(data-t);
  position: absolute;
  bottom: 4px; left: 0; right: 0;
  text-align: center;
  font-size: 9px;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Input inside settings */
.settings-card input[type="text"], .settings-card input[type="datetime-local"],
.settings-card textarea, .settings-card select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
.settings-card input:focus, .settings-card textarea:focus, .settings-card select:focus {
  outline: none; border-color: var(--aube); box-shadow: 0 0 0 3px var(--primary-light);
}

/* ============ Public form ============ */
body.public-body {
  background: var(--cream);
  position: relative;
}
body.public-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 10%, color-mix(in srgb, var(--theme) 18%, transparent), transparent 50%),
    radial-gradient(circle at 90% 90%, color-mix(in srgb, var(--theme-accent) 18%, transparent), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.public-wrap {
  min-height: 100vh;
  padding: 24px 16px 60px;
  position: relative;
  z-index: 1;
}
.public-inner { max-width: 680px; margin: 0 auto; }

.progress-wrap {
  position: sticky;
  top: 0;
  padding: 12px 0;
  background: var(--cream);
  margin-bottom: 16px;
  z-index: 5;
}
.progress-bar {
  height: 5px;
  background: var(--border-soft);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--theme-grad, var(--gradient-aube));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 100px;
}
.progress-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 8px;
  text-align: center;
}

.public-header {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 0;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.public-header .cover {
  height: 120px;
  position: relative;
  background: var(--theme-grad, var(--gradient-aube));
}
.public-header .cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 15% 30%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 45% 20%, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 75% 50%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 60% 80%, rgba(255,255,255,0.5), transparent),
    radial-gradient(2.5px 2.5px at 90% 25%, rgba(255,255,255,0.7), transparent);
}
.public-header .content { padding: 28px 32px 28px; }
.public-header h1 {
  font-family: 'Fraunces', serif;
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
}
.public-header .desc {
  color: var(--text-light);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.public-header .required-note {
  color: var(--danger);
  font-size: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.quiz-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(244, 192, 109, 0.15);
  color: #b98a2a;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 10px;
}

.public-q {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  animation: qIn 0.3s ease;
}
@keyframes qIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.public-q h3 {
  font-family: 'Fraunces', serif;
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}
.public-q .required { color: var(--danger); margin-left: 2px; }
.public-q .q-desc {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 14px;
  white-space: pre-wrap;
}

.public-q input[type="text"], .public-q input[type="email"],
.public-q input[type="number"], .public-q input[type="tel"],
.public-q input[type="url"], .public-q input[type="date"],
.public-q input[type="time"], .public-q textarea, .public-q select {
  width: 100%;
  padding: 12px 0 10px;
  border: none;
  border-bottom: 2px solid var(--border);
  font-size: 15px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
  transition: border-color 0.15s;
}
.public-q input:focus, .public-q textarea:focus, .public-q select:focus {
  outline: none;
  border-bottom-color: var(--theme, var(--aube));
}
.public-q textarea { min-height: 70px; resize: vertical; padding-top: 8px; }
.public-q select { padding: 12px 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }

.public-q .radio-option, .public-q .check-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 10px;
  border: 1.5px solid var(--border-soft);
  margin-bottom: 6px;
  transition: all 0.15s;
  font-size: 14px;
}
.public-q .radio-option:hover, .public-q .check-option:hover {
  border-color: var(--theme, var(--aube));
  background: var(--surface-2);
}
.public-q .radio-option:has(input:checked),
.public-q .check-option:has(input:checked) {
  border-color: var(--theme, var(--aube));
  background: color-mix(in srgb, var(--theme, var(--aube)) 8%, transparent);
}
.public-q .radio-option input, .public-q .check-option input {
  width: 18px; height: 18px;
  accent-color: var(--theme, var(--aube));
}
.public-q .radio-option.correct, .public-q .check-option.correct {
  border-color: var(--success);
  background: rgba(90, 157, 104, 0.1);
}
.public-q .radio-option.wrong, .public-q .check-option.wrong {
  border-color: var(--danger);
  background: rgba(201, 74, 69, 0.08);
}

.linear-scale {
  display: flex;
  justify-content: space-between;
  margin: 16px 0;
  gap: 4px;
  flex-wrap: wrap;
}
.linear-scale label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  flex: 1;
  min-width: 40px;
  padding: 8px 4px;
  border-radius: 10px;
  transition: all 0.15s;
}
.linear-scale label:hover { background: var(--surface-2); }
.linear-scale label:has(input:checked) {
  background: color-mix(in srgb, var(--theme, var(--aube)) 15%, transparent);
  color: var(--theme, var(--aube));
  font-weight: 600;
}
.linear-scale input { accent-color: var(--theme, var(--aube)); }
.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

/* Star rating */
.star-rating {
  display: inline-flex;
  gap: 6px;
  font-size: 36px;
  color: var(--border);
  cursor: pointer;
}
.star-rating .star {
  transition: color 0.12s, transform 0.12s;
  user-select: none;
}
.star-rating .star.filled {
  color: var(--etoile);
  transform: scale(1.08);
}

/* Sections */
.public-section {
  background: var(--surface);
  padding: 22px 28px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  border-left: 4px solid var(--theme, var(--aube));
  box-shadow: var(--shadow-sm);
}
.public-section h2 {
  font-family: 'Fraunces', serif;
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 500;
}
.public-section p { margin: 0; color: var(--text-light); font-size: 14px; white-space: pre-wrap; }

.submit-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  gap: 12px;
}
.submit-bar .btn-primary {
  background: var(--theme-grad, var(--gradient-aube));
  box-shadow: 0 4px 16px color-mix(in srgb, var(--theme, var(--aube)) 40%, transparent);
}

.public-footer {
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 32px;
}
.public-footer a { color: var(--text-light); }

/* One-by-one mode */
.onebyone-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
}
.onebyone-q {
  max-width: 600px;
  width: 100%;
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.onebyone-q .q-num {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 14px;
}
.onebyone-q .q-num::before { content: '→'; color: var(--theme, var(--aube)); }
.onebyone-q h2 {
  font-family: 'Fraunces', serif;
  font-size: 32px;
  font-weight: 500;
  margin-bottom: 10px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.onebyone-q .q-desc { color: var(--text-light); margin-bottom: 24px; }
.onebyone-q .input-zone { margin-bottom: 28px; }
.onebyone-q .input-zone input[type="text"], .onebyone-q .input-zone input[type="email"],
.onebyone-q .input-zone input[type="number"], .onebyone-q .input-zone input[type="tel"],
.onebyone-q .input-zone input[type="url"], .onebyone-q .input-zone textarea,
.onebyone-q .input-zone input[type="date"], .onebyone-q .input-zone input[type="time"] {
  width: 100%;
  font-size: 22px;
  padding: 12px 0;
  border: none;
  border-bottom: 2px solid var(--border);
  background: transparent;
  font-family: inherit;
  color: var(--text);
}
.onebyone-q .input-zone input:focus, .onebyone-q .input-zone textarea:focus {
  outline: none;
  border-bottom-color: var(--theme, var(--aube));
}
.onebyone-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}
.onebyone-hint {
  font-size: 12px;
  color: var(--text-faint);
}

/* Confettis */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 14px;
  top: -20px;
  opacity: 0.9;
  animation: confetti-fall linear forwards;
  transform-origin: center;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0.2; }
}

/* Confirmation */
.confirmation-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.confirmation-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: var(--theme-grad, var(--gradient-aube));
}
.confirmation-card .check {
  font-size: 72px;
  background: var(--theme-grad, var(--gradient-aube));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 12px;
  animation: checkPop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes checkPop { from { transform: scale(0) rotate(-180deg); } to { transform: scale(1) rotate(0); } }
.confirmation-card h2 {
  font-family: 'Fraunces', serif;
  margin: 0 0 14px;
  font-size: 28px;
  font-weight: 500;
}
.confirmation-card p { color: var(--text-light); font-size: 15px; line-height: 1.6; }
.confirmation-card .score-display {
  font-family: 'Fraunces', serif;
  font-size: 48px;
  font-weight: 600;
  margin: 18px 0 8px;
  background: var(--theme-grad, var(--gradient-aube));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.confirmation-card .actions { margin-top: 28px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============ Responses ============ */
.responses-wrap {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 20px;
}
.responses-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}
.stat-card .val {
  font-family: 'Fraunces', serif;
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}
.stat-card .lbl { color: var(--text-light); font-size: 12px; margin-top: 6px; }

.response-table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: auto;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}
.response-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.response-table th, .response-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.response-table th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-light);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
}
.response-table tr:hover { background: var(--surface-2); }
.response-table td.actions button { color: var(--danger); font-size: 16px; padding: 4px 6px; border-radius: 6px; }
.response-table td.actions button:hover { background: rgba(201, 74, 69, 0.1); }

.question-summary {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 12px;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}
.question-summary h4 {
  font-family: 'Fraunces', serif;
  margin: 0 0 14px;
  font-weight: 600;
  font-size: 16px;
}
.answer-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.answer-bar-label { flex: 0 0 140px; font-size: 13px; }
.answer-bar-bg {
  flex: 1;
  height: 26px;
  background: var(--surface-2);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.answer-bar-fill {
  height: 100%;
  background: var(--gradient-aube);
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.answer-bar-count { flex: 0 0 60px; font-size: 12px; color: var(--text-light); text-align: right; }

.text-answers-list { max-height: 260px; overflow-y: auto; }
.text-answer-item {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
  border-left: 3px solid var(--aube-glow);
}

/* ============ Modal ============ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(20, 19, 28, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal h3 { font-family: 'Fraunces', serif; margin: 0 0 8px; font-size: 20px; font-weight: 600; }
.modal p { color: var(--text-light); margin-bottom: 20px; font-size: 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal .share-link { display: flex; gap: 8px; margin-bottom: 12px; }
.modal .share-link input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--text);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--nuit);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Mobile floating action button */
.mobile-fab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-aube);
  color: white;
  font-size: 28px;
  box-shadow: 0 8px 24px rgba(236, 114, 102, 0.4);
  z-index: 40;
  transition: transform 0.2s;
  align-items: center;
  justify-content: center;
}
.mobile-fab:hover { transform: scale(1.08); }
.mobile-fab:active { transform: scale(0.96); }

/* Bottom sheet for type picker on mobile */
.type-sheet-bg {
  position: fixed;
  inset: 0;
  background: rgba(20,19,28,0.5);
  z-index: 90;
  display: none;
  animation: fadeIn 0.2s;
}
.type-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
  animation: sheetUp 0.25s cubic-bezier(0.4,0,0.2,1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.type-sheet h4 {
  font-family: 'Fraunces', serif;
  margin: 0 0 14px;
  font-size: 18px;
}
.type-sheet .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.type-sheet .opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
}
.type-sheet .opt:hover { border-color: var(--aube); background: var(--surface-2); }
.type-sheet .opt .ic {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--aube);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .editor-shell { grid-template-columns: 1fr; }
  .editor-sidebar, .editor-right { display: none; }
  .mobile-fab { display: flex; }
  .editor-canvas { padding: 20px 14px 100px; }
}
@media (max-width: 640px) {
  .dashboard { padding: 32px 16px; }
  .templates-grid, .forms-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .topbar { padding: 14px 18px; }
}
