@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&family=Inter:wght@400;500;600;700;800&family=Manrope:wght@700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --deep-teal: #336e6b;
  --core-teal: #3c8783;
  --signal-teal: #4a9a95;
  --mint-teal: #72bdb5;
  --charcoal: #181918;
  --ink: #121413;
  --text: #2b312f;
  --muted: #67716e;
  --muted-2: #909a96;
  --line: #e4eae8;
  --line-strong: #cfd8d5;
  --white: #ffffff;
  --soft: #f5f7f6;
  --soft-2: #eef3f2;
  --soft-3: #f9fbfa;
  --success: #2e7b54;
  --success-soft: #eef8f1;
  --danger: #a44a4a;
  --danger-soft: #fff4f3;
  --warning: #8a6420;
  --warning-soft: #fff8e8;
  --shadow: 0 28px 80px rgba(18, 20, 19, .08);
  --shadow-sm: 0 12px 36px rgba(18, 20, 19, .06);
  --shadow-xs: 0 6px 18px rgba(18, 20, 19, .045);
  --radius-xl: 28px;
  --radius-lg: 24px;
  --radius: 18px;
  --radius-sm: 12px;
  --display-font: "Manrope", "Adobe Clean", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body-font: "Inter", "Adobe Clean", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --arabic-font: "Cairo", "Inter", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--white);
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, textarea, select { font: inherit; }
a { color: var(--deep-teal); text-decoration: none; }
a:hover { color: #244f4d; }
img { max-width: 100%; display: block; }
button, a { -webkit-tap-highlight-color: transparent; }
:lang(ar), [dir="rtl"] { font-family: var(--arabic-font); }
::selection { background: rgba(114, 189, 181, .28); color: var(--ink); }

.page-loader {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 9999;
  height: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .16s ease;
  background: rgba(60,135,131,.12);
}
.page-loader span {
  display: block;
  width: 34%;
  height: 100%;
  transform: translateX(-110%);
  background: linear-gradient(90deg, var(--deep-teal), var(--signal-teal), var(--mint-teal));
}
.page-loader.is-active { opacity: 1; }
.page-loader.is-active span { animation: loader-line .8s ease-in-out infinite; }
@keyframes loader-line { to { transform: translateX(410%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.eyebrow {
  color: var(--core-teal);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.required-mark { color: var(--core-teal); font-weight: 800; margin-left: 3px; }

.button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--charcoal);
  color: var(--white);
  font-size: .96rem;
  font-weight: 700;
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.button:hover { color: var(--white); background: #0f1110; transform: translateY(-1px); box-shadow: 0 12px 24px rgba(18,20,19,.12); }
.button:active { transform: translateY(0); }
.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
.link-button:focus-visible {
  outline: 3px solid rgba(74,154,149,.22);
  outline-offset: 2px;
}
.button-teal { background: var(--deep-teal); }
.button-teal:hover { background: #2a625f; }
.button-light { background: var(--white); color: var(--ink); border-color: var(--line-strong); }
.button-light:hover { color: var(--ink); background: var(--soft); box-shadow: none; }
.button-danger { background: var(--danger); }
.button-danger:hover { background: #883c3c; }
.button-sm { min-height: 38px; padding: 8px 13px; font-size: .85rem; }
.button[disabled] { opacity: .58; cursor: wait; transform: none; box-shadow: none; }

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.icon-button:hover { background: var(--soft); }

.alert {
  border: 1px solid var(--line);
  border-left: 3px solid var(--core-teal);
  background: #f2f7f6;
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 18px;
}
.alert-success { border-left-color: var(--success); background: var(--success-soft); }
.alert-error { border-left-color: var(--danger); background: var(--danger-soft); }
.alert-warning { border-left-color: var(--warning); background: var(--warning-soft); }

.field { margin-bottom: 24px; }
.field label, .field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}
.field-hint { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.field-error { color: var(--danger); font-size: .88rem; margin-top: 8px; font-weight: 600; }
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea,
select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 13px 15px;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
textarea { min-height: 140px; resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: #b2bfbb; background: var(--white); }
input:focus, textarea:focus, select:focus {
  border-color: var(--deep-teal);
  box-shadow: 0 0 0 4px rgba(60,135,131,.08);
  background: var(--white);
  outline: 0;
}
.has-error input, .has-error textarea, .has-error select { border-color: var(--danger); background: #fffdfd; }

.choice-list { display: grid; gap: 10px; }
.choice-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  background: var(--white);
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.choice-item:hover { border-color: #b6c8c4; background: var(--soft-3); box-shadow: var(--shadow-xs); transform: translateY(-1px); }
.choice-item input { width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--deep-teal); }
.choice-item span { line-height: 1.4; }
.consent-row { background: var(--soft); }

.empty-state { padding: 52px 24px; text-align: center; color: var(--muted); }
.empty-state-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--core-teal);
  display: grid;
  place-items: center;
}
.empty-state h3 { margin: 0 0 6px; color: var(--ink); font-family: var(--display-font); font-size: 1.1rem; letter-spacing: -.03em; }
.empty-state p { margin: 0 auto; max-width: 44ch; }

/* Public experience */
.public-body {
  min-height: 100vh;
  background: linear-gradient(180deg, #fbfcfb 0, #f3f6f5 100%);
}
.form-stage {
  width: min(1220px, calc(100% - 32px));
  margin: 24px auto 0;
  min-height: calc(100vh - 80px);
  display: grid;
  grid-template-columns: minmax(320px, .86fr) minmax(0, 1.14fr);
  border: 1px solid var(--line);
  border-radius: 32px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow);
}
.form-brand-panel {
  background: linear-gradient(180deg, #1a1b1a 0, #202221 100%);
  color: var(--white);
  padding: clamp(28px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.form-brand-logo img { width: 220px; }
.form-brand-panel .eyebrow { margin-top: 40px; color: var(--mint-teal); }
.form-brand-panel h1 {
  margin: 14px 0 14px;
  font-family: var(--display-font);
  font-size: clamp(2.6rem, 4.7vw, 4.9rem);
  line-height: .94;
  letter-spacing: -.06em;
  color: var(--white);
  max-width: 10ch;
}
.form-brand-panel .lead { margin: 0; font-size: 1.03rem; line-height: 1.8; color: #c7cfcd; max-width: 40ch; }
.intro-note {
  margin-top: 26px;
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  color: #c3cbca;
  font-size: .92rem;
}
.brand-points {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}
.brand-point {
  padding: 15px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}
.brand-point strong {
  display: block;
  margin-bottom: 4px;
  color: var(--white);
  font-size: .95rem;
  letter-spacing: -.01em;
}
.brand-point span { color: #c4cecc; font-size: .88rem; line-height: 1.65; display: block; }
.brand-tagline-wrap { margin-top: auto; padding-top: 30px; }
.dot-accent { display: flex; gap: 7px; margin-bottom: 12px; }
.dot-accent span { width: 5px; height: 5px; border-radius: 50%; background: var(--signal-teal); }
.dot-accent span:nth-child(2) { opacity: .75; }
.dot-accent span:nth-child(3) { opacity: .45; }
.brand-tagline { color: #9eabaa; font-size: .86rem; }

.form-workspace {
  padding: clamp(24px, 4vw, 42px);
  background: var(--white);
}
.workspace-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}
.workspace-topbar h2 {
  margin: 10px 0 0;
  font-family: var(--display-font);
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  line-height: .98;
  letter-spacing: -.05em;
  color: var(--ink);
}
.workspace-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.workspace-pill {
  min-height: 32px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}
.public-form-card,
.form-workspace {
  position: relative;
}
.form-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.form-card-head h2 {
  margin: 0;
  font-family: var(--display-font);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--ink);
}
.form-card-head span { color: var(--muted); font-size: .82rem; }
.form-actions {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.privacy-note { color: var(--muted); font-size: .84rem; max-width: 32ch; line-height: 1.7; }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.public-footer {
  width: min(1220px, calc(100% - 32px));
  margin: 14px auto 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: .8rem;
}

.success-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto;
}
.success-stage {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 32px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow);
}
.success-stage-brand {
  background: linear-gradient(180deg, #1b1c1c 0, #202222 100%);
  color: var(--white);
  padding: clamp(28px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.success-stage-brand img { width: 220px; margin-bottom: 40px; }
.success-stage-brand .eyebrow { color: var(--mint-teal); }
.success-stage-brand h1 {
  margin: 14px 0 14px;
  font-family: var(--display-font);
  font-size: clamp(2.4rem, 4vw, 4rem);
  line-height: .96;
  letter-spacing: -.05em;
  color: var(--white);
}
.success-stage-brand p { color: #c5cecc; line-height: 1.8; max-width: 36ch; }
.success-card {
  padding: clamp(28px, 4vw, 48px);
  background: var(--white);
}
.success-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #edf5f4;
  border: 1px solid #d8e6e3;
  color: var(--deep-teal);
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 20px;
}
.success-card h2 {
  margin: 10px 0 12px;
  font-family: var(--display-font);
  font-size: clamp(2rem, 3vw, 2.8rem);
  line-height: .98;
  letter-spacing: -.05em;
  color: var(--ink);
}
.response-reference {
  margin: 28px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: .9rem;
}
.response-reference strong { color: var(--ink); letter-spacing: .04em; }
.success-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Login */
.login-body {
  min-height: 100vh;
  background: linear-gradient(180deg, #f8faf9 0, #f2f5f4 100%);
  padding: 28px 16px;
}
.login-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: minmax(320px, .95fr) minmax(360px, 1.05fr);
  border: 1px solid var(--line);
  border-radius: 32px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow);
}
.login-brand-panel {
  position: relative;
  background: linear-gradient(180deg, #171919 0, #212322 100%);
  color: var(--white);
  padding: clamp(28px, 4vw, 48px);
  display: flex;
  flex-direction: column;
}
.login-brand-panel::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(114,189,181,.18), rgba(114,189,181,0));
}
.login-brand-panel img { width: 220px; position: relative; z-index: 1; }
.login-brand-copy { position: relative; z-index: 1; margin: auto 0; }
.login-brand-copy .eyebrow { color: var(--mint-teal); }
.login-brand-copy h1 {
  margin: 12px 0 14px;
  font-family: var(--display-font);
  font-size: clamp(2.7rem, 4vw, 4.6rem);
  line-height: .94;
  letter-spacing: -.06em;
  color: var(--white);
  max-width: 10ch;
}
.login-brand-copy p { color: #c4cfcd; max-width: 34ch; line-height: 1.8; }
.login-panel {
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vw, 48px);
  background: var(--white);
}
.login-card {
  width: min(440px, 100%);
}
.login-card .eyebrow { margin-bottom: 10px; }
.login-card h2 {
  margin: 0 0 8px;
  font-family: var(--display-font);
  font-size: 2.35rem;
  line-height: .98;
  letter-spacing: -.045em;
  color: var(--ink);
}
.login-card > p { margin: 0 0 30px; color: var(--muted); max-width: 36ch; }
.login-card .button { width: 100%; }

/* Admin */
.admin-body { background: linear-gradient(180deg, #f9fbfa 0, #f2f5f4 100%); min-height: 100vh; }
.admin-shell { width: min(1320px, calc(100% - 32px)); margin: 22px auto 34px; }
.admin-frame-header {
  position: sticky;
  top: 14px;
  z-index: 40;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.admin-frame-header-inner {
  padding: 18px 22px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.admin-brand img { width: 170px; }
.admin-frame-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}
.admin-frame-meta h1 {
  margin: 8px 0 0;
  font-family: var(--display-font);
  font-size: clamp(1.85rem, 3vw, 2.6rem);
  line-height: .98;
  letter-spacing: -.05em;
  color: var(--ink);
}
.admin-meta-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.admin-user-pill {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-size: .85rem;
  font-weight: 700;
}
.admin-nav-row { padding: 0 22px 18px; }
.admin-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-nav a {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: .9rem;
  transition: all .16s ease;
}
.admin-nav a:hover { border-color: var(--line-strong); background: var(--soft); color: var(--ink); }
.admin-nav a.is-active { background: var(--charcoal); border-color: var(--charcoal); color: var(--white); }
.nav-icon { width: 18px; display: inline-grid; place-items: center; font-size: .9rem; }
.admin-main { min-width: 0; }
.admin-content { min-width: 0; }

.dashboard-hero {
  margin-bottom: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(135deg, #ffffff 0, #f4f7f6 100%);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.dashboard-hero h2 {
  margin: 10px 0 10px;
  font-family: var(--display-font);
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: .98;
  letter-spacing: -.055em;
  color: var(--ink);
}
.dashboard-hero p { max-width: 54ch; margin: 0; }
.dashboard-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  min-height: 146px;
  box-shadow: var(--shadow-xs);
}
.metric-label { color: var(--muted); font-size: .82rem; font-weight: 700; }
.metric-value {
  margin: 18px 0 10px;
  font-family: var(--display-font);
  font-size: 2.55rem;
  line-height: .95;
  letter-spacing: -.055em;
  font-weight: 800;
  color: var(--ink);
}
.metric-note { color: var(--muted); font-size: .8rem; }

.admin-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 18px;
  align-items: stretch;
}
.question-management-grid { grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); }
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow-xs);
}
.panel-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h2 {
  margin: 0;
  font-family: var(--display-font);
  font-size: 1.26rem;
  line-height: 1;
  letter-spacing: -.035em;
  color: var(--ink);
}
.panel-body { padding: 22px; }

.trend-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 240px;
  padding-top: 12px;
}
.trend-col { height: 212px; display: flex; flex-direction: column; justify-content: flex-end; }
.trend-bar-wrap { flex: 1; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); }
.trend-bar {
  width: min(30px, 68%);
  min-height: 4px;
  height: var(--bar-height, 4%);
  background: linear-gradient(180deg, var(--signal-teal), var(--deep-teal));
  border-radius: 10px 10px 0 0;
}
.trend-count { text-align: center; font-size: .77rem; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.trend-label { text-align: center; font-size: .73rem; color: var(--muted); padding-top: 8px; }

.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.data-table th {
  text-align: left;
  color: var(--muted);
  font-size: .73rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 15px 14px;
  border-bottom: 1px solid #e8eeec;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--soft-3); }
.response-id { font-weight: 800; font-size: .84rem; letter-spacing: .04em; color: var(--ink); }
.table-person strong { display: block; color: var(--ink); font-weight: 750; }
.table-person span { display: block; color: var(--muted); margin-top: 2px; font-size: .82rem; }
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 750;
  border: 1px solid transparent;
  white-space: nowrap;
}
.status-new { background: #eef8f7; color: #286762; border-color: #cfe7e4; }
.status-reviewed { background: #f2f4f4; color: #556260; border-color: #dde3e2; }
.status-progress { background: #fff7e9; color: #7a5d24; border-color: #ecddbd; }
.status-completed { background: #edf7f0; color: #356948; border-color: #cde2d4; }
.status-archived { background: #f1f1f1; color: #6b6b6b; border-color: #dedede; }
.status-neutral { background: var(--soft); color: var(--muted); border-color: var(--line); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}
.toolbar .filter-field { min-width: 150px; flex: 0 1 190px; }
.toolbar .filter-field.search { flex: 1 1 280px; }
.toolbar label {
  display: block;
  color: var(--muted);
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.toolbar input, .toolbar select { min-height: 44px; padding: 10px 12px; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .83rem;
}
.pagination-links { display: flex; gap: 7px; flex-wrap: wrap; }
.pagination a, .pagination span.page-current {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: inline-grid;
  place-items: center;
  background: var(--white);
}
.pagination span.page-current { background: var(--charcoal); color: var(--white); border-color: var(--charcoal); }

.response-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.response-meta-card { position: sticky; top: 130px; }
.response-summary { display: grid; gap: 0; }
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
  border-bottom: 1px solid #e8eeec;
  font-size: .88rem;
}
.summary-row:last-child { border-bottom: 0; }
.summary-row span { color: var(--muted); }
.summary-row strong { text-align: right; color: var(--ink); overflow-wrap: anywhere; }
.answer-list { display: grid; gap: 0; }
.answer-item { padding: 22px 0; border-bottom: 1px solid var(--line); }
.answer-item:first-child { padding-top: 0; }
.answer-item:last-child { border-bottom: 0; padding-bottom: 0; }
.answer-question {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.answer-value { color: var(--ink); font-size: 1rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.response-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.response-nav .button { min-width: 110px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .field { margin: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { padding: 24px; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.form-section-title {
  margin: 0 0 18px;
  font-family: var(--display-font);
  font-size: 1.18rem;
  letter-spacing: -.03em;
  color: var(--ink);
}
.checkbox-inline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-inline input { width: 18px; height: 18px; accent-color: var(--deep-teal); }

.question-list { display: grid; gap: 10px; }
.question-row {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: var(--white);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.question-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.question-order { color: var(--muted); text-align: center; font-size: .8rem; }
.question-main strong { display: block; color: var(--ink); line-height: 1.35; }
.question-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 5px; color: var(--muted); font-size: .78rem; }
.question-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.mini-form { display: inline; }
.link-button {
  border: 0;
  background: none;
  color: var(--deep-teal);
  cursor: pointer;
  padding: 6px 8px;
  font: inherit;
  font-size: .83rem;
  font-weight: 700;
  border-radius: 999px;
}
.link-button:hover { background: #edf6f5; }
.link-danger { color: var(--danger); }
.kicker-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.kicker-row p { margin: 0; color: var(--muted); }

/* Setup */
.setup-body { background: linear-gradient(180deg, #f8fbfa 0, #f2f5f4 100%); min-height: 100vh; padding: 34px 20px; }
.setup-wrap { width: min(820px, 100%); margin: 0 auto; }
.setup-brand { width: 220px; margin-bottom: 26px; }
.setup-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow-sm);
  padding: clamp(24px, 5vw, 42px);
}
.setup-card h1 { margin-top: 0; font-family: var(--display-font); letter-spacing: -.05em; color: var(--ink); }
.code-inline { padding: 2px 7px; border-radius: 7px; background: #eef2f1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid-2, .question-management-grid { grid-template-columns: 1fr; }
  .response-layout { grid-template-columns: 1fr; }
  .response-meta-card { position: static; }
}

@media (max-width: 980px) {
  .form-stage,
  .success-stage,
  .login-shell { grid-template-columns: 1fr; }
  .form-brand-panel h1,
  .success-stage-brand h1,
  .login-brand-copy h1 { max-width: 12ch; }
  .dashboard-hero { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 760px) {
  .form-stage,
  .success-stage,
  .login-shell,
  .admin-shell {
    width: min(100% - 16px, 100%);
  }
  .form-stage,
  .success-stage,
  .login-shell { border-radius: 24px; }
  .form-brand-panel,
  .form-workspace,
  .success-stage-brand,
  .success-card,
  .login-brand-panel,
  .login-panel { padding: 22px 18px; }
  .workspace-topbar { flex-direction: column; align-items: flex-start; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .button { width: 100%; }
  .public-footer { width: min(100% - 16px, 100%); flex-direction: column; align-items: flex-start; margin-bottom: 20px; }

  .admin-frame-header { position: static; border-radius: 22px; }
  .admin-frame-header-inner { padding: 18px 16px 12px; flex-direction: column; align-items: flex-start; }
  .admin-frame-meta { flex-direction: column; align-items: flex-start; }
  .admin-meta-actions { width: 100%; justify-content: flex-start; }
  .admin-nav-row { padding: 0 16px 16px; }
  .admin-nav { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }

  .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 124px; padding: 18px; border-radius: 18px; }
  .metric-value { font-size: 2.08rem; margin-top: 14px; }
  .panel, .dashboard-hero { border-radius: 20px; }
  .panel-head { padding: 18px 16px; }
  .panel-body { padding: 18px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .question-row { grid-template-columns: 34px minmax(0,1fr); }
  .question-actions { grid-column: 2; justify-content: flex-start; }

  .responsive-table .data-table,
  .responsive-table .data-table tbody,
  .responsive-table .data-table tr,
  .responsive-table .data-table td { display: block; width: 100%; }
  .responsive-table .data-table thead { display: none; }
  .responsive-table .data-table tr { border-bottom: 1px solid var(--line); padding: 10px 13px; }
  .responsive-table .data-table tr:last-child { border-bottom: 0; }
  .responsive-table .data-table td {
    border: 0;
    padding: 7px 0;
    display: grid;
    grid-template-columns: 108px minmax(0,1fr);
    gap: 10px;
    align-items: start;
  }
  .responsive-table .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding-top: 2px;
  }
  .responsive-table .data-table td[data-label=""] { display: block; }
  .responsive-table .data-table td[data-label=""]::before { display: none; }
  .pagination { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 520px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .admin-frame-meta h1 { font-size: 1.9rem; }
  .workspace-topbar h2, .success-card h2 { font-size: 2rem; }
  .form-brand-panel h1, .success-stage-brand h1, .login-brand-copy h1 { font-size: 2.6rem; }
  .toolbar { display: grid; grid-template-columns: 1fr; }
  .toolbar .filter-field { min-width: 0; width: 100%; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .button { flex: 1; }
  .response-reference { flex-direction: column; gap: 4px; }
}


/* ===== V5: public form first ===== */
.public-form-only {
  background: #f6f8f7;
}
.public-shell {
  width: min(960px, calc(100% - 28px));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.public-topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 2px;
}
.public-logo img { width: 210px; height: auto; }
.main-site-link {
  color: var(--ink);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}
.main-site-link:hover { color: var(--deep-teal); }
.public-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 18px 0 52px;
}
.form-card {
  width: min(780px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(16, 22, 20, .07);
  padding: clamp(24px, 5vw, 52px);
}
.form-heading {
  max-width: 650px;
  margin-bottom: 34px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.form-heading h1 {
  margin: 0 0 12px;
  color: var(--ink);
  font-family: var(--display-font);
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: -.055em;
}
.form-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}
.form-heading .form-intro-copy {
  margin-top: 10px;
  color: #7b8582;
  font-size: .92rem;
}
.form-fields { display: grid; gap: 0; }
.form-card .field { margin-bottom: 25px; }
.form-card .field label,
.form-card .field-label {
  font-size: .94rem;
  margin-bottom: 9px;
}
.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="tel"],
.form-card input[type="number"],
.form-card input[type="date"],
.form-card textarea,
.form-card select {
  min-height: 54px;
  border-radius: 12px;
  background: #fff;
}
.form-card textarea { min-height: 138px; }
.form-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 25px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}
.required-note { color: var(--muted); font-size: .8rem; }
.submit-button { min-width: 150px; }
.public-footer-simple {
  min-height: 72px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #7b8582;
  font-size: .78rem;
  padding: 18px 2px 24px;
}
.footer-links { display: flex; align-items: center; column-gap: 12px; row-gap: 8px; flex-wrap: wrap; }
.footer-links a { color: #5e6865; }
.footer-links a:hover { color: var(--ink); }
.footer-sep { color: #b7bfbd; }
.flux-credit { display: inline-flex; align-items: baseline; gap: 7px; white-space: nowrap; line-height: 1.2; }
.flux-wordmark {
  font-family: "Space Grotesk", var(--body-font);
  font-weight: 700;
  letter-spacing: .025em;
  color: var(--ink);
  font-size: .88rem;
  line-height: 1;
}
.flux-dotcom {
  font-family: "Space Grotesk", var(--body-font);
  font-weight: 600;
  letter-spacing: .015em;
  color: #6f7876;
  line-height: 1;
}

/* ===== Notifications ===== */
.notification-center { position: relative; }
.notification-bell {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.notification-bell:hover { background: var(--soft); border-color: #b9c6c2; transform: translateY(-1px); }
.notification-bell svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.notification-count {
  position: absolute;
  right: -4px;
  top: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--deep-teal);
  color: #fff;
  border: 2px solid #fff;
  display: grid;
  place-items: center;
  font-size: .62rem;
  line-height: 1;
  font-weight: 800;
}
.notification-count.is-empty { display: none; }
.notification-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: min(390px, calc(100vw - 30px));
  max-height: min(620px, calc(100vh - 120px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(18, 20, 19, .16);
  z-index: 100;
}
.notification-popover-head {
  min-height: 66px;
  padding: 15px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.notification-popover-head strong { display: block; color: var(--ink); font-size: .96rem; }
.notification-popover-head span { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.notification-text-button {
  border: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: transparent;
  color: var(--deep-teal);
  cursor: pointer;
  font-size: .76rem;
  font-weight: 700;
}
.notification-text-button:hover { background: #edf5f4; }
.notification-list { max-height: 390px; overflow-y: auto; }
.notification-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  border-bottom: 1px solid #edf0ef;
  background: #fff;
}
.notification-item.is-unread { background: #f2f8f7; }
.notification-item-main {
  min-width: 0;
  padding: 14px 9px 14px 15px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
  color: var(--text);
}
.notification-item-main:hover { color: var(--text); }
.notification-dot {
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: transparent;
}
.notification-item.is-unread .notification-dot { background: var(--core-teal); }
.notification-copy { min-width: 0; }
.notification-copy strong { display: block; color: var(--ink); font-size: .84rem; margin-bottom: 3px; }
.notification-copy > span { display: block; color: #5f6966; font-size: .8rem; line-height: 1.48; }
.notification-copy small { display: block; color: #98a19f; font-size: .7rem; margin-top: 6px; }
.notification-delete {
  width: 36px;
  border: 0;
  border-left: 1px solid transparent;
  background: transparent;
  color: #a1aaa7;
  cursor: pointer;
  font-size: 1.15rem;
}
.notification-delete:hover { color: var(--danger); background: #fff8f8; border-left-color: #f0e6e6; }
.notification-empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: .84rem; }
.notification-popover-foot {
  padding: 12px 14px 13px;
  border-top: 1px solid var(--line);
  background: #fafbfb;
}
.push-enable-button {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 9px 11px;
  cursor: pointer;
  text-align: left;
  font-size: .8rem;
  font-weight: 700;
}
.push-enable-button:hover { border-color: #aabbb7; }
.push-enable-button.is-enabled { border-color: #bbd8d3; background: #f0f8f6; }
.push-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #b0b9b6; flex: 0 0 auto; }
.push-enable-button.is-enabled .push-status-dot { background: var(--success); }
.notification-popover-foot p { margin: 7px 2px 0; color: #89928f; font-size: .68rem; line-height: 1.45; }

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  width: min(360px, calc(100vw - 28px));
  display: grid;
  gap: 9px;
  pointer-events: none;
}
.admin-toast {
  pointer-events: auto;
  display: block;
  transform: translateY(12px);
  opacity: 0;
  padding: 14px 16px;
  border: 1px solid #d7e4e1;
  border-radius: 16px;
  background: rgba(255,255,255,.97);
  color: var(--text);
  box-shadow: 0 18px 50px rgba(18,20,19,.14);
  transition: opacity .2s ease, transform .2s ease;
}
.admin-toast.is-visible { opacity: 1; transform: translateY(0); }
.admin-toast strong { display: block; color: var(--ink); font-size: .86rem; margin-bottom: 3px; }
.admin-toast span { display: block; color: var(--muted); font-size: .78rem; line-height: 1.45; }

/* ===== New response visibility ===== */
.data-table tbody tr.is-new-response { background: #f2f8f7; }
.data-table tbody tr.is-new-response:hover { background: #edf6f4; }
.response-id-wrap { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.new-response-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--core-teal); flex: 0 0 auto; }
.new-response-label {
  padding: 3px 6px;
  border-radius: 999px;
  background: #dff0ed;
  color: #286762;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .public-shell { width: min(100% - 18px, 960px); }
  .public-topbar { min-height: 82px; padding: 17px 2px; }
  .public-logo img { width: 184px; }
  .main-site-link { font-size: .72rem; }
  .public-main { padding-top: 5px; padding-bottom: 32px; }
  .form-card { border-radius: 18px; padding: 24px 18px; }
  .form-heading { margin-bottom: 28px; padding-bottom: 22px; }
  .form-heading h1 { font-size: 2.15rem; }
  .form-submit-row { flex-direction: column-reverse; align-items: stretch; }
  .submit-button { width: 100%; }
  .required-note { text-align: center; }
  .public-footer-simple { flex-direction: column; align-items: flex-start; gap: 7px; padding-bottom: 24px; }
  .footer-links { gap: 7px; }

  .admin-meta-actions { gap: 7px; }
  .admin-user-pill { display: none; }
  .admin-site-link { display: none; }
  .notification-popover { position: fixed; left: 9px; right: 9px; top: 82px; width: auto; max-height: calc(100vh - 100px); }
  .notification-list { max-height: calc(100vh - 300px); }
  .toast-stack { left: 10px; right: 10px; bottom: 12px; width: auto; }
}

@media (max-width: 480px) {
  .public-topbar { align-items: center; }
  .public-logo img { width: 165px; }
  .main-site-link { font-size: .68rem; }
  .form-heading h1 { font-size: 1.95rem; }
  .form-card { padding: 22px 15px; }
}


/* Consent checkbox: keep the native control visually separated from its copy. */
.consent-row {
  gap: 0 !important;
  align-items: flex-start;
}
.consent-row > input[type="checkbox"] {
  margin: 2px 14px 0 0 !important;
  margin-inline-end: 14px !important;
  flex: 0 0 18px;
}
.consent-row > span {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.5;
}
