@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter/InterVariable.woff2') format('woff2-variations'), url('/assets/fonts/inter/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --color-primary: #1a6eb0;
  --color-primary-dark: #145781;
  --color-primary-darker: #0d3550;
  --color-primary-light: #eaf3fa;
  --color-primary-lighter: #f5f9fc;

  --color-accent: #e88024;
  --color-accent-dark: #c2691a;
  --color-accent-light: #fdece0;

  --color-ink: #14181c;
  --color-muted: #3f6580;
  --color-muted-light: #6f8fa3;
  --color-line: #d7e2ea;
  --color-line-soft: #e8eef2;
  --color-panel: #f3f7fa;
  --color-white: #ffffff;

  --color-bg-dark: #0c2439;
  --color-bg-dark-alt: #0f2e48;

  --color-error: #b3261e;
  --color-success: #1e8a5b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(12, 36, 57, 0.08);
  --shadow-md: 0 10px 28px rgba(12, 36, 57, 0.12);

  --dur: 0.22s;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--color-ink);
  background: var(--color-panel);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

/* ---- App shell: sidebar + main ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--color-bg-dark);
  color: var(--color-white);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo img { height: 26px; }
.sidebar-title {
  margin-top: 0.85rem;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--color-white);
  line-height: 1.35;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.toc { margin-top: 1.4rem; display: flex; flex-direction: column; gap: 0.15rem; flex: 1; overflow-y: auto; }
.toc-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.toc-item .toc-badge {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}
.toc-item .toc-badge svg { width: 11px; height: 11px; display: none; }
.toc-item.is-done { color: rgba(255,255,255,0.85); }
.toc-item.is-done .toc-badge { background: var(--color-accent); border-color: var(--color-accent); }
.toc-item.is-done .toc-badge span { display: none; }
.toc-item.is-done .toc-badge svg { display: block; }
.toc-item.is-active { color: var(--color-white); background: rgba(255,255,255,0.08); font-weight: 600; }
.toc-item.is-active .toc-badge { background: var(--color-white); border-color: var(--color-white); color: var(--color-bg-dark); }

.sidebar-foot { font-size: 0.72rem; color: rgba(255,255,255,0.4); padding-top: 1rem; }
.sidebar-foot a { color: rgba(255,255,255,0.65); text-decoration: underline; }

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.app-main-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .app-sidebar { width: 100%; height: auto; position: static; padding: 1.1rem 1.25rem; }
  .toc { display: none; }
  .app-main { height: auto; overflow: visible; }
  .app-main-scroll { overflow-y: visible; }
}

/* ---- Mobile progress (shown instead of sidebar TOC) ---- */
.mobile-progress { display: none; padding: 0.9rem 1.25rem 0; }
.mobile-progress-track { height: 4px; background: var(--color-line); border-radius: 99px; overflow: hidden; margin-top: 0.5rem; }
.mobile-progress-fill { height: 100%; background: var(--color-accent); transition: width 0.3s var(--ease); }
.mobile-progress-label { font-size: 0.76rem; color: var(--color-muted); }
@media (max-width: 860px) {
  .mobile-progress { display: block; }
}

/* ---- Step body ---- */
.survey-body {
  padding: clamp(1rem, 2.5vw, 1.5rem) clamp(1.5rem, 4vw, 3rem);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.wizard-step { display: none; animation: stepIn 0.25s var(--ease); flex: 1; }
.wizard-step.is-active { display: flex; flex-direction: column; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}
.step-title {
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  font-weight: 700;
  color: var(--color-ink);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}
.step-intro {
  color: var(--color-muted);
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
  max-width: 60ch;
}

/* ---- Welcome screen ---- */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem 0;
}
.welcome-mark {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.5rem;
}
.welcome-mark svg { width: 24px; height: 24px; }
.welcome-screen h1 {
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  font-weight: 800;
  color: var(--color-ink);
  margin-bottom: 0.85rem;
  letter-spacing: -0.015em;
  max-width: 22ch;
  line-height: 1.15;
}
.welcome-screen p {
  color: var(--color-muted);
  font-size: 0.92rem;
  max-width: 46ch;
  margin: 0 auto 1.75rem;
  line-height: 1.6;
}
.welcome-note {
  background: var(--color-panel);
  border: 1px solid var(--color-line-soft);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  font-size: 0.82rem;
  color: var(--color-muted);
  text-align: left;
  max-width: 46ch;
  margin-bottom: 1.75rem;
}
.welcome-note strong { color: var(--color-primary-dark); }

/* ---- Fields ---- */
.field { margin-bottom: 0.55rem; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 0.3rem;
}
.field .hint {
  display: block;
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--color-muted-light);
  margin-top: 0.2rem;
}
.field .req { color: var(--color-accent); }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="date"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.48rem 0.7rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.86rem;
  color: var(--color-ink);
  background: var(--color-white);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.field textarea { resize: vertical; min-height: 64px; }

.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
@media (max-width: 560px) { .field-grid { grid-template-columns: 1fr; } }

.choice-group { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.choice-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--color-ink);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.choice-pill input { position: absolute; opacity: 0; pointer-events: none; }
.choice-pill:hover { border-color: var(--color-primary); }
.choice-pill:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-white);
  font-weight: 600;
}

/* ---- Matrix tables (cash / non-cash grids) ---- */
.matrix-wrap { overflow-x: auto; border: 1px solid var(--color-line-soft); border-radius: var(--radius-md); flex: 1; }
.matrix-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.matrix-table th, .matrix-table td { padding: 0.32rem 0.5rem; border-bottom: 1px solid var(--color-line-soft); }
.matrix-table thead th {
  background: var(--color-panel);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: left;
  position: sticky;
  top: 0;
}
.matrix-table thead th:first-child { width: 34%; }
.matrix-table thead th:not(:first-child) { text-align: center; }
.matrix-table tbody th {
  text-align: left;
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--color-ink);
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}
.matrix-table tbody tr:last-child td, .matrix-table tbody tr:last-child th { border-bottom: none; }
.matrix-table td { text-align: center; }
.matrix-table input[type="number"] {
  width: 100%;
  max-width: 92px;
  text-align: right;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.78rem;
}
.matrix-table input[type="number"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.matrix-hint { font-size: 0.76rem; color: var(--color-muted); margin-bottom: 0.6rem; }

@media (max-width: 640px) {
  .matrix-cards { display: flex; flex-direction: column; gap: 0.75rem; }
  .matrix-card {
    border: 1px solid var(--color-line-soft);
    border-radius: var(--radius-md);
    padding: 0.85rem;
  }
  .matrix-card h4 { font-size: 0.85rem; font-weight: 700; color: var(--color-ink); margin-bottom: 0.6rem; }
  .matrix-card .role-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }
  .matrix-card .role-row:last-child { margin-bottom: 0; }
  .matrix-card .role-row label { font-size: 0.76rem; color: var(--color-muted); flex-shrink: 0; }
  .matrix-card .role-row input { width: 120px; text-align: right; padding: 0.4rem 0.5rem; border: 1px solid var(--color-line); border-radius: var(--radius-sm); font: inherit; font-size: 0.8rem; }
  .matrix-wrap { display: none; }
}
@media (min-width: 641px) {
  .matrix-cards { display: none; }
}

/* ---- Totals summary (auto-calculated) ---- */
.totals-table { width: 100%; border-collapse: collapse; margin-top: 0.4rem; }
.totals-table th, .totals-table td { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--color-line-soft); }
.totals-table thead th {
  background: var(--color-bg-dark);
  color: var(--color-white);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
}
.totals-table thead th:not(:first-child) { text-align: right; }
.totals-table tbody th { text-align: left; font-weight: 500; font-size: 0.82rem; color: var(--color-muted); }
.totals-table tbody td { text-align: right; font-weight: 700; font-size: 0.86rem; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.totals-table tbody tr.grand-total th, .totals-table tbody tr.grand-total td {
  border-top: 2px solid var(--color-primary);
  color: var(--color-primary-dark);
  font-size: 0.92rem;
}
.totals-currency-note { font-size: 0.76rem; color: var(--color-muted); margin-top: 0.6rem; }

/* ---- Nav buttons ---- */
.survey-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem clamp(1.5rem, 4vw, 3rem) 0.75rem;
  border-top: 1px solid var(--color-line-soft);
  flex-shrink: 0;
}
.survey-nav.is-centered { justify-content: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.84rem;
  border: none;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.btn-primary { background: var(--color-primary); color: var(--color-white); }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-accent { background: var(--color-accent); color: var(--color-white); }
.btn-accent:hover { background: var(--color-accent-dark); }
.btn-ghost { background: transparent; color: var(--color-muted); }
.btn-ghost:hover { color: var(--color-ink); }
.btn-lg { padding: 0.8rem 2rem; font-size: 0.88rem; }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn svg { width: 16px; height: 16px; }

/* ---- Alerts ---- */
.alert {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  margin-bottom: 1rem;
}
.alert-error { background: #fbebe9; color: var(--color-error); border: 1px solid #f0c7c2; }
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 0.1rem; }

/* ---- Consent ---- */
.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: var(--color-ink);
  cursor: pointer;
}
.consent-label input { margin-top: 0.2rem; flex-shrink: 0; width: 15px; height: 15px; }

.g-recaptcha-wrap { margin: 1rem 0; }

/* ---- Thank you screen ---- */
.thankyou-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 1rem 0; }
.thankyou-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #e7f6ef;
  color: var(--color-success);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
}
.thankyou-icon svg { width: 26px; height: 26px; }
.thankyou-screen h1 { font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 800; margin-bottom: 0.6rem; }
.thankyou-screen p { color: var(--color-muted); max-width: 44ch; margin: 0 auto; font-size: 0.88rem; }

/* ---- Admin screens reuse .field/.btn from above ---- */
