:root {
  --primary: #0B3954;
  --primary-hover: #0E4A6B;
  --accent: #F46036;
  --accent-hover: #E04F26;
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --text: #0F1B2D;
  --muted: #5C6B82;
  --border: #E5E7EB;
  --border-strong: #CBD5E1;
  --success: #10B981;
  --error: #EF4444;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.06), 0 4px 12px rgba(15, 27, 45, 0.04);
  --shadow-lg: 0 4px 6px rgba(15, 27, 45, 0.05), 0 12px 32px rgba(15, 27, 45, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.brand-mark {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.progress-wrap {
  margin-top: 10px;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  text-align: right;
}

.app {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 120px;
}

/* Welcome */
.welcome {
  text-align: center;
  padding: 32px 4px;
}

.welcome h1 {
  font-size: 30px;
  margin: 0 0 12px;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.welcome p {
  color: var(--muted);
  font-size: 17px;
  max-width: 460px;
  margin: 0 auto;
}

.welcome .estimate {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 24px;
}

/* Section card */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 22px;
  margin: 0 0 4px;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.section-description {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 15px;
}

/* Fields */
.field {
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--text);
}

.field-required {
  color: var(--accent);
  margin-left: 2px;
}

.field-help {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px; /* prevents iOS zoom on focus */
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235C6B82' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 57, 84, 0.12);
}

.field.invalid input,
.field.invalid textarea,
.field.invalid select {
  border-color: var(--error);
}

.field-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 6px;
}

/* Options (radio / checkbox / yes-no) */
.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  background: var(--surface);
  -webkit-tap-highlight-color: transparent;
}

.option:hover {
  border-color: var(--primary);
}

.option input {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.option.selected {
  border-color: var(--primary);
  background: rgba(11, 57, 84, 0.04);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.option-label {
  font-size: 15px;
  flex: 1;
}

.yesno {
  display: flex;
  flex-direction: row;
  gap: 10px;
}

.yesno .option {
  flex: 1;
  text-align: center;
  justify-content: center;
}

/* Buttons + nav */
.nav {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

button {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.005em;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
  flex: 1;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover { border-color: var(--primary); }

.btn-accent {
  background: var(--accent);
  color: white;
  flex: 1;
}

.btn-accent:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  padding: 8px 12px;
  font-weight: 500;
}

.btn-ghost:hover { color: var(--text); }

/* Footer / save status */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.save-status {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: color 0.2s;
}

.save-status.saved { color: var(--success); }

/* Thank you */
.thank-you {
  text-align: center;
  padding: 60px 20px;
}

.thank-you-mark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
}

.thank-you h1 {
  font-size: 28px;
  margin: 0 0 12px;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.thank-you p {
  color: var(--muted);
  font-size: 16px;
  max-width: 420px;
  margin: 0 auto;
}

@media (max-width: 480px) {
  .section { padding: 20px 16px; }
  .section-title { font-size: 20px; }
  .welcome h1 { font-size: 26px; }
  .welcome p { font-size: 16px; }
}
