:root {
  --bg: #0b1120;
  --surface: #131d33;
  --surface-raised: #1c2a4a;
  --border: #26385d;
  --border-focus: #38bdf8;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.15);
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 16px;
  -webkit-font-smoothing: antialiased;
}

.shell {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 80px;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.brand h1 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}
.brand p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 2px;
}
.net {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--warn);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.net.is-online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}
.net .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* PROGRESS */
.progress-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.progress-track {
  height: 6px;
  background: var(--surface-raised);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.3s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.draft-label {
  color: var(--success);
  font-size: 11px;
}

/* PANELS */
.stage { position: relative; }
.panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.2s ease;
}
.panel.is-active { display: flex; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.lead {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}
.notes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 0;
}
.notes li {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 20px;
  position: relative;
}
.notes li::before {
  content: "•";
  position: absolute;
  left: 6px;
  color: var(--accent-hover);
  font-size: 16px;
  line-height: 1;
}

.question {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
}
.hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* OPTIONS LIST (radio / checkbox) */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.opt:hover {
  border-color: var(--border-focus);
  background: rgba(37, 99, 235, 0.08);
}
.opt input {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.opt-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.opt-title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
}
.opt--other input.text-input {
  margin-top: 4px;
}

/* CHIP CHOICES (Yes / No / Other) */
.statement {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.statement-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  cursor: pointer;
  user-select: none;
}
.chip input { display: none; }
.chip span {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.chip:hover span {
  border-color: var(--border-focus);
  color: var(--text);
}
.chip input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* BLOCKS */
.block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.block-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
}
.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

/* INPUTS */
.text-input, .text-area {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 0.15s ease;
}
.text-input:focus, .text-area:focus {
  outline: none;
  border-color: var(--border-focus);
}
.text-input::placeholder, .text-area::placeholder {
  color: var(--text-dim);
}
.text-area { resize: vertical; min-height: 80px; }

/* PHONE CALLOUT */
.block--phone {
  padding: 16px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  text-align: center;
}
.block--phone .block-title {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.5;
}
.hotline {
  display: inline-block;
  margin-top: 8px;
  font-size: 20px;
  font-weight: 700;
  color: #38bdf8;
  text-decoration: none;
  letter-spacing: 0.5px;
}
.hotline:hover { text-decoration: underline; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease;
  min-height: 44px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-ghost {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  border-color: var(--border-focus);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* CONTROLS (BOTTOM FIXED) */
.controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
  z-index: 10;
}
.controls .btn { flex: 1; }

.field-row {
  display: flex;
  gap: 12px;
}
.field-row--wrap {
  flex-direction: column;
}

/* REVIEW */
.review {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.review-item {
  padding: 10px 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.review-q {
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}
.review-a {
  color: #fff;
  font-weight: 600;
}

/* DONE */
.done-card {
  padding: 12px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.done-id { color: var(--text-muted); }
.done-id b { color: #38bdf8; font-family: monospace; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  z-index: 100;
  animation: fadeIn 0.15s ease;
}

@media (max-width: 480px) {
  body { padding: 8px; }
  .panel { padding: 16px; gap: 16px; }
  .question { font-size: 16px; }
  .opt-title { font-size: 14px; }
}
