:root {
  --brand: #197231;
  --brand-dark: #145a27;
  --brand-light: #e7f4ec;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #b00020;
  --bg: #ffffff;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: #f9fafb00;
  overflow-x: hidden;
  overflow-y: auto;
}

.container {
  max-width: 100%;
  margin: 32px auto;
  padding: 24px;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(0deg, var(--brand-light), #fff);
}

.card-header h1 {
  margin: 0;
  font-size: 24px;
  color: var(--brand-dark);
}

.progress {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  margin-top: 16px;
}

.progress-step {
  height: 6px;
  background: #e5efe9;
  border-radius: 999px;
}

.progress-step.active {
  background: var(--brand);
}

.card-body { padding: 14px; }

.step { display: none; }
.step.active { display: block; }

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-1 { grid-template-columns: 1fr; }
.grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

label { font-weight: 600; margin-bottom: 6px; display: block; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}

textarea { min-height: 140px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(25,114,49,0.1);
}

.muted { color: var(--muted); font-size: 14px; }

.actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #eef2f7; color: #111827; }
.btn-secondary:hover { background: #e4e9f0; }

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
}

.notice {
  background: #f0fff4;
  border: 1px solid #c6f6d5;
  color: #22543d;
  padding: 14px;
  border-radius: 10px;
}

.success {
  background: #e6fffa;
  border: 1px solid #b2f5ea;
  color: #234e52;
  padding: 14px;
  border-radius: 10px;
}

.failure {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  color: #9b2c2c;
  padding: 14px;
  border-radius: 10px;
}

.required::after { content: " *"; color: var(--danger); }

.footer-note { margin-top: 16px; color: var(--muted); font-size: 13px; }

/* New UI helpers for advanced form */
.badge { display:inline-block; padding:6px 10px; border-radius:999px; font-size:12px; font-weight:600; }
.badge.tier1 { background:#eef7ff; color:#0b5fad; }
.badge.tier2 { background:#fff7e6; color:#ad750b; }
.badge.tier3 { background:#e7f4ec; color:#145a27; }

.calc-box { border:1px solid var(--border); border-radius:12px; padding:12px; background:#fff; }
.calc-grid { display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
.summary { border-top:1px dashed var(--border); margin-top:14px; padding-top:12px; }
.summary-item { display:flex; justify-content:space-between; padding:6px 0; }

.upload-hint { font-size:12px; color: var(--muted); margin-top:4px; }
.upload-list { list-style:none; padding:0; margin:8px 0; }
.upload-list li { padding:6px 8px; border:1px dashed var(--border); border-radius:8px; margin-bottom:6px; }

.divider { height:1px; background: var(--border); margin:14px 0; }
.inline { display:flex; align-items:center; gap:8px; }
.right { text-align:right; }

/* Mobile responsive rules */
img, iframe, video { max-width: 100%; height: auto; }

@media (max-width: 768px) {
  .container { max-width: 100%; margin: 16px auto; padding: 16px; }
  .card-header h1 { font-size: 20px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: 1fr; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn { width: 100%; }
  .inline { flex-wrap: wrap; }
  label { font-size: 15px; line-height: 1.3; }
  input[type="text"], input[type="email"], input[type="tel"], input[type="number"], select, textarea { font-size: 16px; }
  .btn { padding: 14px 18px; font-size: 16px; }
}

@media (max-width: 640px) {
  .card-body { padding: 12px; }
  label { font-size: 14px; }
  .grid { gap: 12px; }
  .summary-item { padding: 4px 0; }
}