/* ============================================================
   ReflexRanch — Master Stylesheet
   Relevant Reflex Consulting
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");
/* ── Custom Properties ──────────────────────────────────── */
:root {
  --brand-primary:   #1a1a2e;
  --brand-accent:    #e94560;
  --brand-teal:      #0f9b8e;
  --brand-light:     #f8f9fc;
  --brand-white:     #ffffff;

  --text-primary:    #1a1a2e;
  --text-secondary:  #5a6478;
  --text-muted:      #9aa3b4;
  --text-inverse:    #ffffff;

  --border-color:    #e5e9f0;
  --border-focus:    #e94560;

  --bg-page:         #f4f6fb;
  --bg-card:         #ffffff;
  --bg-sidebar:      #1a1a2e;
  --bg-sidebar-hover:#252545;

  --shadow-xs: 0 1px 2px rgba(26,26,46,0.06);
  --shadow-sm: 0 2px 8px rgba(26,26,46,0.08);
  --shadow-md: 0 4px 20px rgba(26,26,46,0.10);
  --shadow-lg: 0 8px 40px rgba(26,26,46,0.14);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --transition: all 0.2s ease;
  --transition-slow: all 0.35s cubic-bezier(0.4,0,0.2,1);

  --nav-h: 64px;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-accent); text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.85; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--font-body); }
input, textarea, select, button { outline: none; }
ul { list-style: none; }

/* ── Typography ─────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
h4 { font-size: 1.1rem; }
p  { line-height: 1.7; color: var(--text-secondary); }
small { font-size: 0.8rem; color: var(--text-muted); }

/* ── Portal Nav ─────────────────────────────────────────── */
.portal-nav {
  position: sticky; top: 0; z-index: 900;
  background: var(--brand-white);
  border-bottom: 1px solid var(--border-color);
  height: var(--nav-h);
  box-shadow: var(--shadow-xs);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 1.5rem;
  height: 100%; padding: 0 1.5rem;
}
.nav-brand {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.2rem;
  color: var(--brand-primary);
  text-decoration: none;
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px;
  background: var(--brand-accent);
  color: white;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800;
}
.brand-text { letter-spacing: 0.05em; }

.nav-links {
  display: flex; align-items: center; gap: 0.25rem;
  margin-left: 1rem;
}
.nav-links a {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}
.nav-links a svg { width: 16px; height: 16px; opacity: 0.7; }
.nav-links a:hover, .nav-links a.active {
  background: var(--bg-page);
  color: var(--brand-primary);
}
.nav-links a.active { color: var(--brand-accent); font-weight: 600; }

.nav-user {
  display: flex; align-items: center; gap: 0.75rem;
  margin-left: auto;
}
.user-menu-wrap { position: relative; }
.user-avatar {
  width: 36px; height: 36px;
  background: var(--brand-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 0.9rem; font-weight: 700;
  transition: var(--transition);
}
.user-avatar:hover { background: var(--brand-accent); }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 200px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: none;
  z-index: 1000;
  animation: dropIn 0.15s ease;
}
.user-dropdown.open { display: block; }
.dropdown-header {
  padding: 0.85rem 1rem;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-color);
}
.dropdown-header strong { display: block; font-size: 0.9rem; color: var(--text-primary); }
.dropdown-header small  { font-size: 0.75rem; color: var(--text-muted); }
.user-dropdown a {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}
.user-dropdown a:last-child { border-bottom: none; }
.user-dropdown a:hover { background: var(--bg-page); color: var(--brand-primary); }
.user-dropdown .logout-link:hover { color: var(--brand-accent); }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; padding: 4px; margin-left: auto;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text-primary); border-radius: 2px;
  transition: var(--transition);
}

/* ── Portal Main & Layout ───────────────────────────────── */
.portal-body { display: flex; flex-direction: column; min-height: 100vh; }
.portal-main { flex: 1; }
.page-container {
  max-width: 1280px; margin: 0 auto;
  padding: 2rem 1.5rem;
}
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  margin-bottom: 2rem;
}
.page-header-left h2 { margin-bottom: 0.25rem; }
.page-header-left p  { font-size: 0.9rem; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-page);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Stat Cards (Dashboard) ─────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-xs);
  display: flex; align-items: flex-start; gap: 1rem;
  transition: var(--transition-slow);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.accent   { background: #fff1f3; color: var(--brand-accent); }
.stat-icon.teal     { background: #e8f7f6; color: var(--brand-teal); }
.stat-icon.blue     { background: #eef2ff; color: #4f6ef7; }
.stat-icon.purple   { background: #f3e8ff; color: #9333ea; }
.stat-icon.orange   { background: #fff7ed; color: #f97316; }
.stat-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; line-height: 1; margin-bottom: 0.2rem; }
.stat-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.stat-delta { font-size: 0.78rem; margin-top: 0.25rem; }
.stat-delta.up   { color: var(--brand-teal); }
.stat-delta.down { color: var(--brand-accent); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 600;
  border: 2px solid transparent;
  transition: var(--transition);
  cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand-accent); color: white; border-color: var(--brand-accent); }
.btn-primary:hover { background: #c73750; border-color: #c73750; color: white; opacity: 1; }
.btn-secondary { background: transparent; color: var(--brand-primary); border-color: var(--border-color); }
.btn-secondary:hover { border-color: var(--brand-primary); background: var(--bg-page); }
.btn-teal { background: var(--brand-teal); color: white; border-color: var(--brand-teal); }
.btn-teal:hover { background: #0d8578; color: white; opacity: 1; }
.btn-dark { background: var(--brand-primary); color: white; border-color: var(--brand-primary); }
.btn-dark:hover { background: #252545; color: white; opacity: 1; }
.btn-danger { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #dc2626; color: white; border-color: #dc2626; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; margin-bottom: 0.45rem;
  font-size: 0.875rem; font-weight: 600; color: var(--text-primary);
}
.form-label .required { color: var(--brand-accent); margin-left: 2px; }
.form-control {
  width: 100%; padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.9rem;
  color: var(--text-primary);
  background: white;
  transition: var(--transition);
}
.form-control:focus { border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(233,69,96,0.1); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239aa3b4' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.5rem; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.78rem; color: var(--brand-accent); margin-top: 0.3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-check { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.form-check input[type="checkbox"], .form-check input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brand-accent); cursor: pointer; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-color); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  background: var(--bg-page);
  padding: 0.75rem 1rem;
  text-align: left; font-weight: 600; font-size: 0.78rem;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}
tbody tr { border-bottom: 1px solid var(--border-color); transition: var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-page); }
tbody td { padding: 0.85rem 1rem; color: var(--text-secondary); vertical-align: middle; }
tbody td strong { color: var(--text-primary); }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-green  { background: #dcfce7; color: #16a34a; }
.badge-yellow { background: #fef9c3; color: #ca8a04; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-dark   { background: #e2e8f0; color: #334155; }
.badge-blue   { background: #dbeafe; color: #2563eb; }
.badge-teal   { background: #ccfbf1; color: #0f766e; }
.badge-purple { background: #f3e8ff; color: #7c3aed; }
.badge-orange { background: #ffedd5; color: #c2410c; }

/* ── Flash Messages ─────────────────────────────────────── */
.flash-container { max-width: 1280px; margin: 1rem auto 0; padding: 0 1.5rem; }
.flash {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  animation: slideInDown 0.25s ease;
}
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.flash-warning { background: #fef9c3; color: #92400e; border: 1px solid #fde68a; }
.flash-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.flash-close {
  background: none; border: none; font-size: 1.2rem;
  cursor: pointer; opacity: 0.6; color: inherit; margin-left: 1rem;
}
.flash-close:hover { opacity: 1; }

/* ── Auth Pages ─────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--brand-primary);
  background-image: radial-gradient(ellipse at 20% 50%, rgba(233,69,96,0.15) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 20%, rgba(15,155,142,0.12) 0%, transparent 50%);
  padding: 2rem 1rem;
}
.auth-box {
  width: 100%; max-width: 440px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.auth-box-header {
  padding: 2.5rem 2.5rem 1.5rem;
  text-align: center;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-color);
}
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-bottom: 1rem; }
.auth-logo .brand-mark { width: 42px; height: 42px; font-size: 1.2rem; }
.auth-logo .brand-text { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; color: var(--brand-primary); }
.auth-box-header h2 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.auth-box-header p  { font-size: 0.85rem; }
.auth-box-body { padding: 2rem 2.5rem; }
.auth-box-footer {
  padding: 1.25rem 2.5rem;
  text-align: center;
  background: var(--bg-page);
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem; color: var(--text-muted);
}
.auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.5rem 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }
.auth-divider span { font-size: 0.78rem; color: var(--text-muted); }

/* ── Survey Cards (Client Dashboard) ───────────────────── */
.surveys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.survey-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-xs);
  transition: var(--transition-slow);
  cursor: pointer;
  position: relative;
}
.survey-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--brand-accent); }
.survey-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.75rem; }
.survey-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.25rem; line-height: 1.3; }
.survey-card p  { font-size: 0.82rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.survey-card-meta {
  display: flex; gap: 1rem; margin-top: 1rem; padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem; color: var(--text-muted);
}
.survey-card-meta span { display: flex; align-items: center; gap: 0.3rem; }
.survey-card-meta svg { width: 12px; height: 12px; }
.survey-card-actions {
  display: flex; gap: 0.5rem; margin-top: 1rem;
  opacity: 0; transition: var(--transition);
}
.survey-card:hover .survey-card-actions { opacity: 1; }
.survey-card-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; margin-top: 5px;
}
.survey-card-status-dot.active   { background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.survey-card-status-dot.draft    { background: #94a3b8; }
.survey-card-status-dot.paused   { background: #eab308; }
.survey-card-status-dot.closed   { background: var(--brand-accent); }
.survey-card-status-dot.archived { background: #64748b; }

/* ── Pricing Page ───────────────────────────────────────── */
.pricing-page { padding: 5rem 1.5rem; background: white; }
.pricing-header { text-align: center; margin-bottom: 3rem; }
.pricing-header h1 { margin-bottom: 0.75rem; }
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  max-width: 1100px; margin: 0 auto;
}
.pricing-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  position: relative; transition: var(--transition-slow);
}
.pricing-card.featured {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 4px rgba(233,69,96,0.1);
  transform: scale(1.02);
}
.pricing-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--brand-accent); color: white;
  padding: 0.25rem 1rem; border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.pricing-name { font-family: var(--font-display); font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.pricing-price { font-family: var(--font-display); font-size: 2.4rem; font-weight: 800; line-height: 1; margin-bottom: 0.25rem; }
.pricing-price span { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.pricing-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.pricing-features { list-style: none; margin-bottom: 2rem; }
.pricing-features li {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.45rem 0; font-size: 0.88rem; border-bottom: 1px solid var(--border-color);
}
.pricing-features li:last-child { border-bottom: none; }
.pricing-features li::before { content: '✓'; color: var(--brand-teal); font-weight: 700; flex-shrink: 0; }
.pricing-features li.dim { color: var(--text-muted); }
.pricing-features li.dim::before { content: '—'; color: var(--border-color); }

/* ── Builder ─────────────────────────────────────────────── */
.builder-layout {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}
.builder-sidebar-left {
  background: var(--brand-white);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.builder-sidebar-right {
  background: var(--brand-white);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
}
.builder-canvas {
  background: var(--bg-page);
  overflow-y: auto;
  padding: 2rem;
}
.builder-topbar {
  height: 52px;
  background: white;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem; gap: 0.75rem;
  grid-column: 1 / -1;
}
.builder-topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; flex: 1; }
.builder-sidebar-title {
  padding: 1rem; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}
.question-type-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.5rem; padding: 0.75rem;
}
.q-type-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  padding: 0.6rem 0.4rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: white; cursor: pointer;
  font-size: 0.7rem; font-weight: 600; color: var(--text-secondary);
  text-align: center; line-height: 1.2;
  transition: var(--transition);
}
.q-type-btn:hover { border-color: var(--brand-accent); color: var(--brand-accent); background: #fff1f3; }
.q-type-btn svg { width: 20px; height: 20px; opacity: 0.7; }
.q-type-btn:hover svg { opacity: 1; }
.q-type-section { padding: 0.5rem 0.75rem 0; }
.q-type-section-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.4rem; }

/* Question blocks in canvas */
.canvas-page {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.canvas-page-header {
  background: var(--bg-page);
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 0.75rem;
}
.canvas-page-header h4 { font-size: 0.85rem; font-weight: 700; flex: 1; }

.question-block {
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 0.75rem;
  background: white;
  cursor: grab;
  transition: var(--transition);
  position: relative;
}
.question-block:hover { border-color: var(--border-color); box-shadow: var(--shadow-sm); }
.question-block.selected { border-color: var(--brand-accent); box-shadow: 0 0 0 4px rgba(233,69,96,0.08); }
.question-block.dragging { opacity: 0.5; cursor: grabbing; }
.question-num {
  position: absolute; top: -1px; left: -1px;
  background: var(--brand-accent); color: white;
  font-size: 0.7rem; font-weight: 700;
  padding: 2px 7px; border-radius: 0 0 var(--radius-sm) 0;
}
.question-type-tag {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  background: var(--bg-page); padding: 2px 7px; border-radius: var(--radius-full);
  margin-bottom: 0.5rem; display: inline-block;
}
.question-title-display { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.question-block-actions {
  position: absolute; right: 0.75rem; top: 0.75rem;
  display: flex; gap: 0.35rem;
  opacity: 0; transition: var(--transition);
}
.question-block:hover .question-block-actions,
.question-block.selected .question-block-actions { opacity: 1; }

/* Right panel – properties */
.prop-section { padding: 1rem; border-bottom: 1px solid var(--border-color); }
.prop-section:last-child { border-bottom: none; }
.prop-section-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.75rem; }
.prop-toggle {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.6rem;
}
.prop-toggle span { font-size: 0.85rem; color: var(--text-secondary); }

/* Toggle switch */
.toggle-switch { position: relative; width: 38px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer; transition: var(--transition);
}
.toggle-track::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; left: 3px; top: 3px;
  background: white; border-radius: 50%;
  transition: var(--transition);
}
.toggle-switch input:checked + .toggle-track { background: var(--brand-accent); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(18px); }

/* ── Public Survey Renderer ─────────────────────────────── */
.survey-page-body {
  min-height: 100vh; background: var(--bg-page);
  display: flex; flex-direction: column;
  font-family: var(--font-body);
}
.survey-header {
  background: white;
  border-bottom: 3px solid var(--brand-accent);
  padding: 1.25rem 1.5rem;
}
.survey-header-inner { max-width: 760px; margin: 0 auto; }
.survey-progress-wrap { margin-top: 0.75rem; }
.survey-progress-bar {
  height: 4px; background: var(--border-color);
  border-radius: var(--radius-full); overflow: hidden;
}
.survey-progress-fill {
  height: 100%; background: var(--brand-accent);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}
.survey-progress-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }

.survey-body { flex: 1; display: flex; flex-direction: column; }
.survey-form { max-width: 760px; margin: 2rem auto; padding: 0 1rem; width: 100%; }
.survey-question-block {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-xs);
  animation: fadeUp 0.3s ease;
}
.sq-title {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 0.5rem; line-height: 1.4;
}
.sq-title .required-star { color: var(--brand-accent); margin-left: 2px; }
.sq-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.25rem; }

/* Choice options */
.choice-list { display: flex; flex-direction: column; gap: 0.6rem; }
.choice-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer; transition: var(--transition);
  font-size: 0.9rem;
}
.choice-item:hover { border-color: var(--brand-accent); background: #fff1f3; }
.choice-item.selected { border-color: var(--brand-accent); background: #fff1f3; color: var(--brand-primary); font-weight: 600; }
.choice-item input[type="radio"],
.choice-item input[type="checkbox"] { accent-color: var(--brand-accent); width: 16px; height: 16px; }

/* Rating */
.rating-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.rating-btn {
  width: 48px; height: 48px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: white; font-weight: 700; font-size: 1rem;
  color: var(--text-secondary); cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.rating-btn:hover, .rating-btn.selected { border-color: var(--brand-accent); background: var(--brand-accent); color: white; }
.rating-labels { display: flex; justify-content: space-between; margin-top: 0.4rem; }
.rating-labels span { font-size: 0.72rem; color: var(--text-muted); }

/* Stars */
.star-row { display: flex; gap: 0.35rem; }
.star-btn {
  font-size: 2rem; background: none; border: none;
  color: var(--border-color); cursor: pointer; transition: var(--transition);
  line-height: 1;
}
.star-btn.lit, .star-btn:hover { color: #f59e0b; }
.star-row:hover .star-btn { color: #f59e0b; }
.star-row .star-btn:hover ~ .star-btn { color: var(--border-color); }

/* NPS */
.nps-row { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.nps-btn {
  min-width: 44px; height: 44px; padding: 0 0.5rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: white; font-weight: 700;
  cursor: pointer; transition: var(--transition);
}
.nps-btn.selected { background: var(--brand-accent); border-color: var(--brand-accent); color: white; }
.nps-labels { display: flex; justify-content: space-between; margin-top: 0.4rem; }
.nps-labels span { font-size: 0.72rem; color: var(--text-muted); }

/* Slider */
.slider-wrap { padding: 1rem 0; }
.slider-input { width: 100%; accent-color: var(--brand-accent); }
.slider-val { text-align: center; font-size: 1.5rem; font-weight: 700; color: var(--brand-accent); margin-bottom: 0.5rem; }

/* Matrix */
.matrix-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.matrix-table th { padding: 0.5rem; text-align: center; font-weight: 600; color: var(--text-muted); font-size: 0.78rem; }
.matrix-table td { padding: 0.5rem; text-align: center; border-top: 1px solid var(--border-color); }
.matrix-table tr:last-child td { border-bottom: none; }
.matrix-table td:first-child { text-align: left; font-weight: 500; }
.matrix-table input[type="radio"],
.matrix-table input[type="checkbox"] { accent-color: var(--brand-accent); width: 16px; height: 16px; }

/* Ranking */
.rank-list { display: flex; flex-direction: column; gap: 0.5rem; }
.rank-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border-color); border-radius: var(--radius-md);
  background: white; cursor: grab;
}
.rank-item .rank-handle { color: var(--text-muted); cursor: grab; }
.rank-item .rank-num {
  width: 26px; height: 26px; background: var(--brand-accent);
  color: white; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}

/* Emoji scale */
.emoji-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.emoji-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--border-color); border-radius: var(--radius-md);
  background: white; cursor: pointer; transition: var(--transition);
  font-size: 0.75rem; color: var(--text-muted);
}
.emoji-btn span.emoji-icon { font-size: 2rem; }
.emoji-btn:hover, .emoji-btn.selected { border-color: var(--brand-accent); background: #fff1f3; }

/* Survey nav buttons */
.survey-nav {
  max-width: 760px; margin: 0 auto 2rem;
  padding: 0 1rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}

/* Survey footer */
.survey-footer {
  text-align: center; padding: 1.5rem;
  font-size: 0.75rem; color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  background: white;
}
.survey-footer a { color: var(--text-muted); }
.powered-logo { font-family: var(--font-display); font-weight: 800; color: var(--brand-primary); }

/* ── Portal Footer ──────────────────────────────────────── */
.portal-footer {
  background: var(--brand-primary); color: white;
  margin-top: auto;
}
.footer-inner {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem; padding: 3rem 1.5rem 2rem;
}
.footer-brand .nav-brand { color: white; margin-bottom: 0.75rem; }
.footer-brand p { font-size: 0.85rem; color: rgba(255,255,255,0.5); line-height: 1.6; }
.footer-brand a { color: rgba(255,255,255,0.7); }
.footer-links h4 { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.4); margin-bottom: 1rem; }
.footer-links a { display: block; font-size: 0.85rem; color: rgba(255,255,255,0.65); margin-bottom: 0.5rem; }
.footer-links a:hover { color: white; opacity: 1; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 1.25rem 1.5rem; text-align: center;
}
.footer-bottom p { font-size: 0.8rem; color: rgba(255,255,255,0.4); }

/* ── Landing Page ───────────────────────────────────────── */
.landing-hero {
  background: var(--brand-primary);
  background-image: radial-gradient(ellipse at 15% 60%, rgba(233,69,96,0.2) 0%, transparent 55%),
                    radial-gradient(ellipse at 85% 20%, rgba(15,155,142,0.15) 0%, transparent 50%);
  color: white; padding: 7rem 1.5rem 5rem;
  text-align: center;
}
.landing-hero h1 { color: white; margin-bottom: 1.25rem; }
.landing-hero p { font-size: 1.1rem; color: rgba(255,255,255,0.7); max-width: 580px; margin: 0 auto 2.5rem; }
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-badge {
  display: inline-block; background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8); padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full); font-size: 0.78rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.2); margin-bottom: 1.5rem;
}
.features-section { padding: 5rem 1.5rem; }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem; max-width: 1100px; margin: 3rem auto 0;
}
.feature-card {
  padding: 2rem; border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: white; transition: var(--transition-slow);
}
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.feature-icon {
  width: 48px; height: 48px; margin-bottom: 1.25rem;
  background: var(--bg-page); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.feature-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.section-header { text-align: center; margin-bottom: 1rem; }
.section-header h2 { margin-bottom: 0.5rem; }

/* ── Dashboard layout ───────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}
.usage-bar-wrap { margin-top: 0.5rem; }
.usage-bar {
  height: 6px; background: var(--border-color);
  border-radius: var(--radius-full); overflow: hidden; margin-bottom: 0.3rem;
}
.usage-bar-fill {
  height: 100%; background: var(--brand-teal);
  border-radius: var(--radius-full); transition: width 0.6s ease;
}
.usage-bar-fill.warning { background: #f59e0b; }
.usage-bar-fill.danger  { background: var(--brand-accent); }
.usage-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-muted); }

/* ── Modals ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,26,46,0.6);
  backdrop-filter: blur(3px);
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: white; border-radius: var(--radius-xl);
  width: 100%; max-width: 560px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  padding: 1.5rem; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.4rem; color: var(--text-muted); cursor: pointer; }
.modal-body  { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); display: flex; gap: 0.75rem; justify-content: flex-end; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

/* ── Empty States ───────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text-secondary); }
.empty-state p  { font-size: 0.88rem; max-width: 320px; margin: 0 auto 1.5rem; }

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex; gap: 0.35rem; justify-content: center;
  margin-top: 1.5rem; flex-wrap: wrap;
}
.page-link {
  min-width: 36px; height: 36px; padding: 0 0.5rem;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border-color); border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition); text-decoration: none;
}
.page-link:hover, .page-link.active {
  border-color: var(--brand-accent);
  background: var(--brand-accent); color: white;
}
.page-link.disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border-color); margin-bottom: 1.5rem; }
.tab-btn {
  padding: 0.75rem 1.25rem;
  border: none; background: none;
  font-family: var(--font-body); font-size: 0.88rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--brand-accent); border-bottom-color: var(--brand-accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Dropdown filter ────────────────────────────────────── */
.filter-bar { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: center; }
.filter-bar .form-control { width: auto; flex: 0 1 180px; }
.search-box { position: relative; flex: 1; max-width: 320px; }
.search-box svg { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.search-box input { padding-left: 2.25rem; }

/* ── Loader ─────────────────────────────────────────────── */
.loader-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(255,255,255,0.8); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 42px; height: 42px;
  border: 3px solid var(--border-color);
  border-top-color: var(--brand-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }

/* ── Charts placeholder ─────────────────────────────────── */
.chart-box {
  background: var(--bg-page);
  border-radius: var(--radius-md);
  padding: 1rem;
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Tooltip ────────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--brand-primary); color: white;
  padding: 0.35rem 0.65rem; border-radius: var(--radius-sm);
  font-size: 0.72rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: var(--transition);
  z-index: 100;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Animations ─────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes slideInDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .builder-layout { grid-template-columns: 240px 1fr; }
  .builder-sidebar-right { display: none; }
  .builder-sidebar-right.open { display: flex; flex-direction: column; position: fixed; right: 0; top: var(--nav-h); bottom: 0; width: 300px; z-index: 800; box-shadow: var(--shadow-lg); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-links, .nav-user .user-plan { display: none; }
  .nav-toggle { display: flex; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: white; border-bottom: 1px solid var(--border-color);
    padding: 1rem; z-index: 800; gap: 0.25rem;
  }
  .builder-layout { grid-template-columns: 1fr; }
  .builder-sidebar-left { display: none; position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 800; box-shadow: var(--shadow-lg); }
  .builder-sidebar-left.open { display: flex; }
  .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .surveys-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-card.featured { transform: none; }
  .form-row { grid-template-columns: 1fr; }
  .page-container { padding: 1.25rem 1rem; }
  .auth-box-body, .auth-box-header { padding-left: 1.5rem; padding-right: 1.5rem; }
  .auth-box-footer { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .rating-btn { width: 40px; height: 40px; font-size: 0.9rem; }
  .nps-btn { min-width: 36px; height: 36px; font-size: 0.85rem; }
}

/* ── Print ──────────────────────────────────────────────── */
@media print {
  .portal-nav, .portal-footer, .btn, .survey-nav { display: none !important; }
  .survey-question-block { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}

/* ── Statement / Section Break — no card style ────────────── */
.sq-display-only {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0.5rem 0 !important;
}
