/* ProdForm Enhanced — style.css */
/* Light mode only. Miro-like clean SaaS. */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #ede9fe;
  --bg: #f6f5f3;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-subtle: #f3f4f6;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --info: #3b82f6;
  --info-light: #eff6ff;
  --sidebar-width: 220px;
  --header-h: 52px;
  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Utilities ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s;
  white-space: nowrap; user-select: none; font-family: var(--font);
  line-height: 1.4;
}
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border-subtle); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; padding: 5px 8px; }
.btn-ghost:hover { background: var(--border-subtle); color: var(--text); text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 9px 20px; font-size: 14px; }
.btn-icon { padding: 5px; min-width: 28px; min-height: 28px; }

/* ─── Form Controls ─────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--text); }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  padding: 7px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text); background: var(--surface); font-family: var(--font);
  transition: border-color .15s, box-shadow .15s; width: 100%; outline: none;
  line-height: 1.5;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.1);
}
.form-textarea { resize: vertical; min-height: 72px; }
.form-hint { font-size: 11px; color: var(--text-muted); }
.form-error { font-size: 11px; color: var(--danger); }

/* Password input wrapper */
.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 36px; }
.input-wrap .eye-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 2px; display: flex; align-items: center;
}
.input-wrap .eye-btn:hover { color: var(--text); }

/* ─── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 99px; font-size: 11px; font-weight: 500; white-space: nowrap;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-gray { background: #f3f4f6; color: var(--text-secondary); }
.badge-info { background: var(--info-light); color: #1e40af; }

/* ─── Toast ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--text); color: #fff; padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; max-width: 320px; box-shadow: var(--shadow-md);
  pointer-events: all; display: flex; align-items: center; gap: 8px;
  animation: slideInToast .2s ease;
}
.toast.toast-success { background: #065f46; }
.toast.toast-error { background: #991b1b; }
.toast.toast-warning { background: #92400e; }
@keyframes slideInToast { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-height: 90vh;
  display: flex; flex-direction: column; animation: slideUp .15s ease;
}
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-sm { max-width: 400px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }
.modal-header {
  padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-shrink: 0;
}

/* ─── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 16px; }

/* ─── Table ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead { position: sticky; top: 0; z-index: 2; }
thead th {
  background: var(--border-subtle); padding: 7px 12px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border-subtle); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--border-subtle); }
tbody td { padding: 8px 12px; font-size: 13px; vertical-align: middle; }
tbody td.actions { white-space: nowrap; text-align: right; }

/* ─── Auth Pages ─────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 400px; padding: 36px 32px;
}
.auth-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px;
}
.auth-logo .logo-icon {
  width: 32px; height: 32px; background: var(--primary); border-radius: 7px;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; font-weight: 700;
}
.auth-tagline { font-size: 12px; color: var(--text-secondary); margin-bottom: 28px; }
.auth-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.auth-subtitle { font-size: 12px; color: var(--text-secondary); margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-footer { margin-top: 20px; text-align: center; font-size: 12px; color: var(--text-secondary); }

/* ─── App Layout ─────────────────────────────────────────────── */
#app-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; overflow-y: auto; flex-shrink: 0;
}
.sidebar-logo {
  padding: 16px 16px 12px; display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.sidebar-logo .logo-icon {
  width: 28px; height: 28px; background: var(--primary); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-section { padding: 10px 8px 4px; }
.sidebar-section-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; padding: 0 8px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-secondary); cursor: pointer; transition: all .1s;
  user-select: none; border: none; background: none; width: 100%; font-family: var(--font);
  text-align: left;
}
.nav-item:hover { background: var(--border-subtle); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.nav-item .nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .7; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 99px;
}
.sidebar-footer { margin-top: auto; padding: 10px 8px; border-top: 1px solid var(--border-subtle); }
.sidebar-user { padding: 8px 10px; }
.sidebar-user-name { font-size: 12px; font-weight: 500; color: var(--text); }
.sidebar-user-email { font-size: 11px; color: var(--text-muted); }
.sidebar-user-role { display: inline-flex; margin-top: 4px; }

/* Main content */
.main-content {
  margin-left: var(--sidebar-width); flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.main-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: var(--header-h); display: flex; align-items: center;
  gap: 12px; position: sticky; top: 0; z-index: 90;
  flex-shrink: 0;
}
.main-header h1 { font-size: 15px; font-weight: 600; }
.main-body { padding: 24px; flex: 1; overflow-y: auto; }

/* ─── Dashboard ─────────────────────────────────────────────── */
.dashboard-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat-label { font-size: 11px; color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.forms-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.form-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; transition: all .15s; position: relative;
}
.form-card:hover { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.06); transform: translateY(-1px); }
.form-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.form-card-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.form-card-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.form-card-footer { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.form-card-actions { display: flex; gap: 4px; margin-left: auto; }
.form-card-actions .btn-ghost { opacity: 0; transition: opacity .15s; }
.form-card:hover .form-card-actions .btn-ghost { opacity: 1; }

/* ─── Form Builder ───────────────────────────────────────────── */
.builder-wrap { display: flex; gap: 0; height: calc(100vh - var(--header-h)); overflow: hidden; }
.builder-main { flex: 1; overflow-y: auto; padding: 20px 24px; }
.builder-sidebar { width: 280px; border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; flex-shrink: 0; }
.builder-sidebar-inner { padding: 16px; }

.builder-form-meta {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.builder-form-meta h3 { font-size: 13px; font-weight: 600; margin-bottom: 12px; }

.question-list { display: flex; flex-direction: column; gap: 8px; }
.question-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; cursor: default; transition: border-color .15s;
  position: relative;
}
.question-item.dragging { opacity: .5; }
.question-item.drag-over { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.1); }
.question-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.question-drag-handle { color: var(--text-muted); cursor: grab; padding: 0 2px; font-size: 16px; user-select: none; }
.question-drag-handle:active { cursor: grabbing; }
.question-num { font-size: 11px; font-weight: 600; color: var(--text-muted); min-width: 18px; }
.question-text { font-size: 13px; font-weight: 500; flex: 1; }
.question-actions { display: flex; gap: 2px; margin-left: auto; }
.question-type-label { font-size: 10px; color: var(--text-muted); background: var(--border-subtle); padding: 2px 8px; border-radius: 99px; }
.question-options { margin-top: 8px; padding-left: 26px; display: flex; flex-direction: column; gap: 4px; }
.question-option { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.question-option-dot { width: 12px; height: 12px; border: 1.5px solid var(--border); border-radius: 50%; flex-shrink: 0; }
.question-option-check { width: 12px; height: 12px; border: 1.5px solid var(--border); border-radius: 2px; flex-shrink: 0; }

/* Question editor (inline) */
.question-editor {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.options-editor { display: flex; flex-direction: column; gap: 6px; }
.option-row { display: flex; align-items: center; gap: 6px; }
.option-row .form-input { flex: 1; }

.add-question-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; border: 1.5px dashed var(--border); border-radius: var(--radius);
  color: var(--text-secondary); cursor: pointer; transition: all .15s;
  font-size: 13px; background: transparent; font-family: var(--font);
  margin-top: 8px; width: 100%;
}
.add-question-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* question type picker */
.qtype-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.qtype-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s; background: var(--surface); text-align: center;
}
.qtype-item:hover { border-color: var(--primary); background: var(--primary-light); }
.qtype-item.selected { border-color: var(--primary); background: var(--primary-light); }
.qtype-icon { font-size: 18px; }
.qtype-name { font-size: 11px; font-weight: 500; color: var(--text-secondary); }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle-input { display: none; }
.toggle-track {
  width: 36px; height: 20px; background: var(--border); border-radius: 99px;
  cursor: pointer; transition: background .15s; position: relative; flex-shrink: 0;
}
.toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.toggle-input:checked + .toggle-track { background: var(--primary); }
.toggle-input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle-label { font-size: 12px; color: var(--text); cursor: pointer; }

/* Builder actions bar */
.builder-actions {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 10px 24px; display: flex; align-items: center; gap: 8px;
  position: sticky; bottom: 0;
}

/* ─── Responses View ─────────────────────────────────────────── */
.responses-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.responses-table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}

/* ─── Public Form Filler ─────────────────────────────────────── */
.fill-wrap {
  min-height: 100vh; background: var(--bg); display: flex; flex-direction: column;
}
.fill-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.fill-logo { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.fill-logo .logo-icon { width: 24px; height: 24px; background: var(--primary); border-radius: 5px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; }
.fill-body {
  flex: 1; display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 16px;
}
.fill-form {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); width: 100%; max-width: 600px; padding: 0; overflow: hidden;
}
.fill-form-header {
  padding: 24px 28px 20px; border-bottom: 4px solid var(--primary);
}
.fill-form-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.fill-form-desc { font-size: 13px; color: var(--text-secondary); }
.fill-form-body { padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; }
.fill-question { display: flex; flex-direction: column; gap: 8px; }
.fill-question-label { font-size: 14px; font-weight: 500; line-height: 1.5; }
.fill-question-required { color: var(--danger); margin-left: 3px; }
.fill-question-hint { font-size: 12px; color: var(--text-muted); }
.fill-form-footer {
  padding: 16px 28px; border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* Fill option items */
.fill-options { display: flex; flex-direction: column; gap: 6px; }
.fill-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
  transition: all .15s; user-select: none;
}
.fill-option:hover { border-color: var(--primary); background: var(--primary-light); }
.fill-option.selected { border-color: var(--primary); background: var(--primary-light); }
.fill-option input { accent-color: var(--primary); width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }

/* Scale / Rating */
.fill-scale { display: flex; gap: 6px; flex-wrap: wrap; }
.fill-scale-item {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 14px; font-weight: 500; transition: all .15s; user-select: none;
}
.fill-scale-item:hover { border-color: var(--primary); background: var(--primary-light); }
.fill-scale-item.selected { border-color: var(--primary); background: var(--primary); color: #fff; }

/* Rating stars */
.fill-stars { display: flex; gap: 4px; }
.fill-star { font-size: 24px; cursor: pointer; transition: transform .1s; user-select: none; color: var(--border); }
.fill-star:hover, .fill-star.active { color: var(--warning); transform: scale(1.1); }

/* Timer */
.quiz-timer {
  display: flex; align-items: center; gap: 6px;
  background: var(--warning-light); border: 1px solid #fde68a; border-radius: var(--radius-sm);
  padding: 4px 12px; font-size: 13px; font-weight: 600; color: #92400e;
}
.quiz-timer.danger { background: var(--danger-light); border-color: #fca5a5; color: #991b1b; }

/* Progress bar */
.fill-progress { height: 3px; background: var(--border); position: relative; }
.fill-progress-bar { height: 100%; background: var(--primary); transition: width .3s ease; }

/* Score result */
.quiz-result {
  text-align: center; padding: 36px 28px; display: flex; flex-direction: column;
  align-items: center; gap: 12px;
}
.quiz-score-circle {
  width: 100px; height: 100px; border-radius: 50%;
  border: 4px solid var(--primary); display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.quiz-score-num { font-size: 26px; font-weight: 700; color: var(--primary); }
.quiz-score-max { font-size: 12px; color: var(--text-muted); }
.quiz-result-title { font-size: 18px; font-weight: 700; }
.quiz-result-subtitle { font-size: 13px; color: var(--text-secondary); max-width: 340px; }

/* Poll results */
.poll-results { display: flex; flex-direction: column; gap: 10px; }
.poll-bar-row { display: flex; flex-direction: column; gap: 3px; }
.poll-bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }
.poll-bar-track { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.poll-bar-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width .5s ease; }

/* PIN screen */
.pin-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg); padding: 24px;
}
.pin-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 36px 32px; max-width: 360px; width: 100%; text-align: center;
}
.pin-card .lock-icon { font-size: 32px; margin-bottom: 12px; }
.pin-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.pin-card p { font-size: 12px; color: var(--text-secondary); margin-bottom: 20px; }

/* ─── Analytics ──────────────────────────────────────────────── */
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.answer-dist { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.dist-row { display: flex; align-items: center; gap: 8px; }
.dist-label { font-size: 12px; color: var(--text-secondary); flex: 1; min-width: 80px; }
.dist-bar-wrap { flex: 3; display: flex; align-items: center; gap: 6px; }
.dist-bar { flex: 1; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.dist-bar-inner { height: 100%; background: var(--primary); border-radius: 99px; }
.dist-count { font-size: 11px; color: var(--text-muted); min-width: 24px; text-align: right; }

/* ─── Share Modal ─────────────────────────────────────────────── */
.share-url-row { display: flex; gap: 6px; }
.share-url-row .form-input { font-size: 12px; font-family: var(--font-mono); }
.embed-code { font-family: var(--font-mono); font-size: 11px; background: var(--border-subtle); border: 1px solid var(--border); padding: 10px; border-radius: var(--radius-sm); overflow-x: auto; white-space: pre; }
#qrcode-wrap canvas { display: block; margin: 0 auto; }

/* ─── Superadmin ─────────────────────────────────────────────── */
.superadmin-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.superadmin-tab {
  padding: 8px 14px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  border-bottom: 2px solid transparent; cursor: pointer; transition: all .15s; user-select: none;
  background: none; border-top: none; border-left: none; border-right: none; font-family: var(--font);
  margin-bottom: -1px;
}
.superadmin-tab:hover { color: var(--text); }
.superadmin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { color: var(--border); }

/* ─── Spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .6s linear infinite;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap { display: flex; align-items: center; justify-content: center; padding: 48px 0; }

/* ─── Empty state ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.empty-desc { font-size: 12px; color: var(--text-secondary); max-width: 280px; margin: 0 auto 16px; }

/* ─── Confirm dialog ─────────────────────────────────────────── */
.confirm-modal-body { text-align: center; padding: 24px 20px 8px; }
.confirm-modal-icon { font-size: 32px; margin-bottom: 10px; }
.confirm-modal-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.confirm-modal-message { font-size: 13px; color: var(--text-secondary); }

/* ─── Tabs (inside pages) ────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-btn {
  padding: 8px 14px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  border-bottom: 2px solid transparent; cursor: pointer; transition: all .15s;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: var(--font); margin-bottom: -1px; user-select: none;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Dropdown ───────────────────────────────────────────────── */
.dropdown-wrap { position: relative; display: inline-flex; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); right: 0; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); z-index: 300; overflow: hidden;
  animation: slideDown .12s ease;
}
@keyframes slideDown { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }
.dropdown-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  font-size: 13px; color: var(--text); cursor: pointer; transition: background .1s;
  user-select: none; border: none; background: none; font-family: var(--font); width: 100%;
}
.dropdown-item:hover { background: var(--border-subtle); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-light); }
.dropdown-sep { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* ─── Pagination ─────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 12px; }
.page-btn {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px;
  cursor: pointer; background: var(--surface); color: var(--text-secondary); transition: all .1s;
  font-family: var(--font);
}
.page-btn:hover { background: var(--border-subtle); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    transform: translateX(-220px); width: 220px;
    transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: flex !important; }
  .forms-grid { grid-template-columns: 1fr; }
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
  .builder-wrap { flex-direction: column; }
  .builder-sidebar { width: 100%; border-left: none; border-top: 1px solid var(--border); }
  .fill-form { max-width: 100%; }
}
.mobile-menu-btn { display: none; }

/* ─── Misc ───────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.section-title { font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.text-link { color: var(--primary); cursor: pointer; }
.text-link:hover { text-decoration: underline; }

/* GSheet section in builder */
.gsheet-section { padding: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius-sm); margin-top: 10px; }
.gsheet-section h4 { font-size: 12px; font-weight: 600; color: #065f46; margin-bottom: 8px; }

/* Answer detail in quiz result */
.answer-detail-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; text-align: left; }
.answer-detail-item {
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: 12px;
}
.answer-detail-item.correct { border-color: #bbf7d0; background: #f0fdf4; }
.answer-detail-item.incorrect { border-color: #fca5a5; background: #fef2f2; }
.answer-detail-q { font-weight: 500; margin-bottom: 4px; color: var(--text); }
.answer-detail-your { color: var(--text-secondary); }
.answer-detail-correct { color: #065f46; }
.answer-detail-explanation { color: var(--text-muted); font-style: italic; margin-top: 3px; }

/* Notify toast for quiz */
.question-answer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 800;
  display: flex; align-items: center; justify-content: center;
}
.answer-feedback-card {
  background: var(--surface); border-radius: var(--radius-lg); padding: 32px 36px;
  text-align: center; max-width: 360px; width: 90%; box-shadow: var(--shadow-lg);
}
.answer-feedback-icon { font-size: 48px; margin-bottom: 10px; }
.answer-feedback-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.answer-feedback-explanation { font-size: 13px; color: var(--text-secondary); }
