:root {
  --bg-cream: #F7F3EE;
  --surface: #FFFFFF;
  --surface-soft: #FBF9F6;
  --sage: #6D8658;
  --sage-dark: #586E46;
  --sage-tint: #E4ECE0;
  --sage-border: #C5D3BC;
  --red: #BB3223;
  --red-tint: #FDF0EE;
  --red-border: #E8B5AF;
  --amber: #A66B08;
  --amber-tint: #FEF7E7;
  --amber-border: #EBD29A;
  --ink: #2F332F;
  --muted: #6E736E;
  --border: #E2DBD2;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 28px rgba(47, 51, 47, 0.07);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

/* Global helper – must always win over alert/field-group display rules */
.is-hidden {
  display: none !important;
}

/* Sticky Wizard HUD */
.wizard-hud {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 243, 238, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(226, 219, 210, 0.85);
}

.progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: rgba(226, 219, 210, 0.9);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sage) 0%, #839E6D 100%);
  transition: width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.wizard-hud-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-logo {
  height: 22px;
  width: auto;
  display: block;
}

.hud-motivation {
  color: var(--sage-dark);
  font-weight: 600;
  text-align: center;
  flex: 1;
}

.hud-counter {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 26px 16px 56px;
}

.container-wide {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.wizard-shell {
  min-height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 26px 26px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.brand-logo {
  display: block;
  max-width: 220px;
  height: auto;
  margin-bottom: 18px;
}

h1 {
  margin: 0 0 6px;
  font-size: 1.75rem;
  line-height: 1.22;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0 0 12px;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--sage-dark);
}

.intro-text {
  margin: 0 0 16px;
  color: var(--ink);
}

.meta-pill {
  display: inline-block;
  background: var(--bg-cream);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.875rem;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

/* Wizard Step Transitions */
.js-wizard .wizard-step:not(.is-active) {
  display: none;
}

.js-wizard .wizard-step.is-active {
  animation: stepIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes stepIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}

.shake {
  animation: gentleShake 0.34s ease;
}

.section-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--sage-tint);
  color: var(--sage-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--sage-tint);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage-dark);
}

.section-heading::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 18px;
  border-radius: 3px;
  background: var(--sage);
}

.section-note {
  margin: 0 0 18px;
  padding: 13px 15px;
  background: var(--surface-soft);
  border-left: 3px solid var(--sage);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.94rem;
  color: var(--ink);
}

.section-note p {
  margin: 0 0 8px;
}

.section-note p:last-child {
  margin-bottom: 0;
}

.field-group {
  margin-bottom: 18px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 1.14rem;
  line-height: 1.4;
  margin-bottom: 12px;
  color: var(--ink);
}

.optional-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-cream);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
  vertical-align: middle;
}

.q-num {
  display: inline-block;
  min-width: 28px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--sage-dark);
  background: var(--sage-tint);
  border-radius: 6px;
  padding: 2px 8px;
  margin-right: 6px;
  text-align: center;
  vertical-align: middle;
}

.req-star {
  color: var(--red);
  font-weight: 700;
  margin-left: 3px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
textarea,
select {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: #FFFFFF;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(109, 134, 88, 0.18);
}

textarea {
  min-height: 112px;
  resize: vertical;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.input-with-unit {
  position: relative;
}

.input-with-unit input {
  padding-right: 48px;
}

.unit-tag {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  pointer-events: none;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.08s ease;
  user-select: none;
  flex: 1 1 auto;
}

.choice-card:hover {
  border-color: var(--sage);
  background: #F4F7F1;
}

.choice-card:has(input:checked) {
  background: var(--sage-tint);
  border-color: var(--sage);
}

.choice-card input[type="radio"],
.choice-card input[type="checkbox"] {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--sage);
  cursor: pointer;
}

.choice-card span {
  font-size: 0.98rem;
  line-height: 1.45;
}

.nogo-list {
  margin: 0 0 16px;
  padding: 14px 16px 14px 32px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.nogo-list li {
  margin-bottom: 5px;
  font-size: 0.92rem;
}

.nogo-list li:last-child {
  margin-bottom: 0;
}

.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.94rem;
  border: 1px solid transparent;
}

.alert-error,
.alert-nogo {
  background: var(--red-tint);
  border-color: var(--red-border);
  color: #7D1E13;
}

.alert-warning,
.alert-review {
  background: var(--amber-tint);
  border-color: var(--amber-border);
  color: #6B4504;
}

.alert-ok {
  background: var(--sage-tint);
  border-color: var(--sage-border);
  color: #36472A;
}

.alert ul {
  margin: 6px 0 0 18px;
  padding: 0;
}

.inline-hint {
  margin-top: 14px;
  margin-bottom: 0;
}

.step-error {
  margin-top: 14px;
  margin-bottom: 0;
}

.wizard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.wizard-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--sage);
  color: #FFFFFF;
}

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

.btn-secondary {
  background: #FFFFFF;
  color: var(--ink);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--sage);
  background: var(--surface-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding: 12px 14px;
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--bg-cream);
}

.btn-danger {
  background: var(--red);
  color: #FFFFFF;
}

.btn-danger:hover {
  background: #982619;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.88rem;
}

.btn-block {
  width: 100%;
}

.form-footer-note {
  text-align: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.bmi-preview {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-cream);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sage-dark);
}

/* Confetti & Success Celebration */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.success-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sage-tint);
  border: 2px solid var(--sage);
  color: var(--sage-dark);
  margin-bottom: 14px;
  animation: popIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .wizard-hud-inner {
    padding: 8px 12px;
  }
  .hud-motivation {
    display: none;
  }
  .brand-header,
  .card {
    padding: 22px 18px;
  }
  h1 {
    font-size: 1.48rem;
  }
  .field-label {
    font-size: 1.06rem;
  }
}

/* Admin & Thankyou helpers */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-brand img {
  height: 36px;
  width: auto;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 720px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}

.stat-card.active {
  border-color: var(--sage);
  box-shadow: 0 0 0 2px rgba(109, 134, 88, 0.2);
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-ok {
  background: var(--sage-tint);
  color: #36472A;
  border: 1px solid var(--sage-border);
}

.badge-review {
  background: var(--amber-tint);
  color: #6B4504;
  border: 1px solid var(--amber-border);
}

.badge-nogo {
  background: var(--red-tint);
  color: #7D1E13;
  border: 1px solid var(--red-border);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-soft);
}

tr:hover td {
  background: var(--surface-soft);
}

.detail-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-grid:last-child {
  border-bottom: none;
}

.detail-q {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-a {
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-bar input {
  flex: 1;
}

.ref-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  background: var(--bg-cream);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

@media print {
  body {
    background: #FFFFFF;
  }
  .no-print {
    display: none !important;
  }
  .card {
    box-shadow: none;
    border-color: #CCCCCC;
  }
}
