/* ==========================================================================
   OmniAsync Form — theme
   Palette:  #0A0A0A ink · #6B6B6B slate · #A6A6A6 mist · #FFFFFF paper
             #EDEDED hairline · #16A34A confirm-green · #DC2626 alert-red
   Type:     'Inter' for everything — display weight 800 for headlines,
             italic 400 for the accent word, 500/600 for UI chrome.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500&display=swap');

:root {
  --ink: #0a0a0a;
  --slate: #6b6b6b;
  --mist: #a6a6a6;
  --paper: #ffffff;
  --hairline: #ebebeb;
  --panel: #fafafa;
  --confirm: #16a34a;
  --confirm-bg: #eefaf1;
  --alert: #dc2626;
  --alert-bg: #fdeeee;
  --radius: 14px;
  --radius-sm: 8px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--ink); color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- Material icons sizing ---- */
.material-icons-round {
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
}

/* ---- shared bits ---- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 18px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); display: inline-block; }

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  font-weight: 600;
  font-size: 14px;
  transition: transform .18s var(--ease), opacity .18s var(--ease);
}
.btn-pill:hover { transform: translateY(-1px); opacity: .88; }
.btn-pill:active { transform: translateY(0); }
.btn-pill:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-pill.ghost { background: transparent; color: var(--ink); }
.btn-pill.danger { background: var(--alert); border-color: var(--alert); }
.btn-pill.small { padding: 8px 16px; font-size: 13px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--slate);
  transition: all .16s var(--ease);
}
.btn-icon:hover { border-color: var(--ink); color: var(--ink); }

.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
  margin-bottom: 8px;
}
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field textarea,
.field select {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  transition: border-color .16s var(--ease);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--ink);
}
.field textarea { resize: vertical; min-height: 90px; }

/* ==========================================================================
   Error page
   ========================================================================== */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.error-card { text-align: center; max-width: 420px; }
.error-card h1 { font-size: 40px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 12px; }
.error-card em { font-style: italic; font-weight: 500; color: var(--mist); }
.error-card p { color: var(--slate); margin-bottom: 24px; }

/* ==========================================================================
   Admin — auth
   ========================================================================== */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, #f7f7f7, transparent);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 40px 36px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-brand .mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.auth-brand .name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.auth-card h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-card .sub { color: var(--slate); font-size: 14px; margin-bottom: 28px; }
.alert {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--alert-bg); color: var(--alert); font-size: 13px; font-weight: 500;
  margin-bottom: 20px;
}

/* ==========================================================================
   Admin — shell / nav
   ========================================================================== */
.admin-shell { min-height: 100vh; background: var(--paper); }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px; border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; background: rgba(255,255,255,.9); backdrop-filter: blur(8px);
  z-index: 20;
}
.admin-topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.admin-topbar .brand .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.admin-topbar .who { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--slate); }
.admin-main { max-width: 1080px; margin: 0 auto; padding: 40px 32px 80px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.page-head h1 { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.page-head .sub { color: var(--slate); font-size: 14px; margin-top: 6px; }

/* ---- forms grid on dashboard ---- */
.forms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.form-card {
  border: 1px solid var(--hairline); border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 14px; transition: border-color .16s var(--ease);
}
.form-card:hover { border-color: var(--mist); }
.form-card .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.form-card h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.form-card .desc { color: var(--slate); font-size: 13px; line-height: 1.5; }
.status-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.status-pill.live { background: var(--confirm-bg); color: var(--confirm); }
.status-pill.paused { background: var(--panel); color: var(--mist); }
.form-card .stats { display: flex; gap: 18px; font-size: 13px; color: var(--slate); }
.form-card .stats strong { color: var(--ink); }
.form-card .actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }

.empty-state {
  text-align: center; padding: 80px 24px; border: 1px dashed var(--hairline); border-radius: var(--radius);
  color: var(--slate);
}
.empty-state .material-icons-round { font-size: 40px; color: var(--mist); margin-bottom: 12px; }

/* ==========================================================================
   Admin — form builder
   ========================================================================== */
.builder-layout { display: grid; grid-template-columns: 1fr 320px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .builder-layout { grid-template-columns: 1fr; } }

.panel { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 26px; }
.panel + .panel { margin-top: 16px; }
.panel h2 { font-size: 15px; font-weight: 700; margin-bottom: 18px; }

.question-card {
  border: 1px solid var(--hairline); border-radius: var(--radius); padding: 18px 20px;
  margin-bottom: 12px; background: var(--paper);
}
.question-card .qhead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.question-card .qhead .type-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--slate); background: var(--panel); padding: 5px 10px; border-radius: 999px;
}
.question-card .qhead .type-badge .material-icons-round { font-size: 15px; }
.question-card .qhead .drag { color: var(--mist); cursor: grab; }
.question-card .qhead .spacer { flex: 1; }
.question-card .qrow { display: flex; gap: 10px; }
.question-card .qrow > * { flex: 1; }
.question-toggle { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--slate); margin-top: 10px; }
.mcq-options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.mcq-options input { padding: 9px 12px !important; font-size: 14px !important; }
.mcq-option-row { display: flex; gap: 8px; align-items: center; }

.type-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.type-picker button {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--hairline); background: var(--paper); font-size: 13px; font-weight: 500; text-align: left;
  transition: all .14s var(--ease);
}
.type-picker button:hover { border-color: var(--ink); background: var(--panel); }
.type-picker .material-icons-round { font-size: 18px; color: var(--slate); }

.builder-side { position: sticky; top: 90px; }
.save-status { font-size: 12px; color: var(--mist); margin-top: 10px; text-align: center; }

/* ==========================================================================
   Admin — responses
   ========================================================================== */
.table-wrap { border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
table.responses-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.responses-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--slate); font-weight: 700; padding: 14px 20px; border-bottom: 1px solid var(--hairline);
  background: var(--panel);
}
table.responses-table td { padding: 14px 20px; border-bottom: 1px solid var(--hairline); }
table.responses-table tr:last-child td { border-bottom: none; }
table.responses-table tr:hover td { background: var(--panel); }

.answer-block { margin-bottom: 26px; }
.answer-block .q { font-size: 13px; font-weight: 600; color: var(--slate); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.answer-block .a { font-size: 16px; line-height: 1.6; }
.answer-block .a ul { margin: 0; padding-left: 20px; }
.answer-block .a a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ==========================================================================
   Public — conversational form
   ========================================================================== */
.form-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.form-progress-track { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: var(--hairline); z-index: 30; }
.form-progress-bar { height: 100%; background: var(--ink); width: 0%; transition: width .5s var(--ease); }

.form-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 32px 0; font-size: 13px; color: var(--slate);
}
.form-topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
.form-topbar .brand .mark {
  width: 24px; height: 24px; border-radius: 6px; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-weight: 800; font-size: 11px;
}

.stage {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px;
}
.stage-inner { width: 100%; max-width: 620px; }

.step {
  opacity: 0; transform: translateY(18px);
  animation: stepIn .55s var(--ease) forwards;
}
@keyframes stepIn { to { opacity: 1; transform: translateY(0); } }
.step.step-out { animation: stepOut .32s var(--ease) forwards; }
@keyframes stepOut { to { opacity: 0; transform: translateY(-14px); } }

.step .greet {
  font-size: 14px; font-weight: 600; color: var(--slate); margin-bottom: 14px; min-height: 20px;
}
.step .greet .material-icons-round { font-size: 16px; margin-right: 4px; color: var(--confirm); vertical-align: -3px; }
.step h2 {
  font-size: clamp(24px, 4vw, 34px); font-weight: 800; letter-spacing: -.02em; line-height: 1.25; margin-bottom: 8px;
}
.step h2 em { font-style: italic; font-weight: 500; color: var(--mist); }
.step .helper { color: var(--slate); font-size: 14px; margin-bottom: 26px; }
.step .required-mark { color: var(--alert); margin-left: 4px; }

.step .input-wrap { margin-bottom: 22px; }
.step input[type=text],
.step input[type=email],
.step input[type=tel],
.step input[type=url],
.step textarea,
.step select {
  width: 100%;
  border: none; border-bottom: 2px solid var(--hairline);
  padding: 12px 2px; font-size: 22px; font-weight: 500; color: var(--ink);
  background: transparent; transition: border-color .18s var(--ease);
}
.step select { font-size: 18px; -webkit-appearance: none; appearance: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 4px center; }
.step textarea { font-size: 18px; min-height: 120px; resize: vertical; border: 2px solid var(--hairline); border-radius: var(--radius-sm); padding: 14px 16px; }
.step textarea:focus, .step input:focus, .step select:focus { outline: none; border-color: var(--ink); }

.bullets-list { display: flex; flex-direction: column; gap: 10px; }
.bullet-row { display: flex; align-items: center; gap: 10px; }
.bullet-row .material-icons-round { color: var(--mist); font-size: 18px; }
.bullet-row input {
  flex: 1; border: none; border-bottom: 1.5px solid var(--hairline); padding: 8px 2px; font-size: 16px;
  background: transparent;
}
.bullet-row input:focus { outline: none; border-color: var(--ink); }
.bullet-row .remove { color: var(--mist); }
.bullet-row .remove:hover { color: var(--alert); }
.add-bullet {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--slate);
  margin-top: 4px; align-self: flex-start;
}
.add-bullet:hover { color: var(--ink); }

.mcq-list { display: flex; flex-direction: column; gap: 10px; }
.mcq-choice {
  display: flex; align-items: center; gap: 12px; padding: 15px 18px;
  border: 1.5px solid var(--hairline); border-radius: var(--radius-sm); cursor: pointer;
  transition: all .14s var(--ease);
}
.mcq-choice:hover { border-color: var(--mist); }
.mcq-choice.selected { border-color: var(--ink); background: var(--panel); }
.mcq-choice .radio {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--hairline); flex-shrink: 0;
  display: grid; place-items: center; transition: border-color .14s var(--ease);
}
.mcq-choice.selected .radio { border-color: var(--ink); }
.mcq-choice .radio::after {
  content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--ink);
  transform: scale(0); transition: transform .14s var(--ease);
}
.mcq-choice.selected .radio::after { transform: scale(1); }
.mcq-choice span.label { font-size: 15px; font-weight: 500; }

.dropzone {
  border: 2px dashed var(--hairline); border-radius: var(--radius); padding: 36px 20px; text-align: center;
  transition: all .16s var(--ease); cursor: pointer;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--ink); background: var(--panel); }
.dropzone .material-icons-round { font-size: 30px; color: var(--mist); margin-bottom: 8px; }
.dropzone .dz-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.dropzone .dz-sub { font-size: 12px; color: var(--slate); }
.file-chip {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); margin-top: 12px; font-size: 13px;
}
.file-chip .material-icons-round { color: var(--confirm); }
.file-chip .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress { height: 4px; background: var(--hairline); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.upload-progress .bar { height: 100%; width: 0; background: var(--ink); transition: width .2s var(--ease); }

.step-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.step-error { color: var(--alert); font-size: 13px; margin-top: 10px; min-height: 16px; }
.hint-enter { font-size: 12px; color: var(--mist); }
.hint-enter kbd {
  border: 1px solid var(--hairline); border-radius: 4px; padding: 1px 6px; font-size: 11px; font-family: inherit;
}

.nav-arrows { position: fixed; right: 28px; bottom: 28px; display: flex; flex-direction: column; gap: 8px; z-index: 25; }

/* ---- Thank you screen ---- */
.thankyou { text-align: center; }
.thankyou .icon-wrap {
  width: 64px; height: 64px; border-radius: 50%; background: var(--confirm-bg); color: var(--confirm);
  display: grid; place-items: center; margin: 0 auto 20px; animation: pop .5s var(--ease);
}
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.thankyou .icon-wrap .material-icons-round { font-size: 32px; }
.thankyou p.msg { font-size: 15px; color: var(--slate); max-width: 420px; margin: 0 auto; }

/* ---- Name intro screen ---- */
.welcome-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--hairline); font-size: 13px; color: var(--slate); margin-bottom: 22px;
}

@media (max-width: 560px) {
  .stage { padding: 24px 20px; }
  .form-topbar { padding: 20px 20px 0; }
  .nav-arrows { right: 16px; bottom: 16px; }
}
