/* ---------- Brand tokens (from assets/colors.json + calasystems.com) ---------- */
:root {
  --orange: #e46127;
  --orange-2: #e58247;
  --orange-soft: #fbe9df;
  --tan: #e1c2a4;
  --sand: #f6ece1;
  --cream: #fffef6;
  --breen: #042d2c;
  --breen-2: #112c2c;
  --ink: #042d2c;
  --muted: #5f6b6a;
  --line: rgba(4, 45, 44, 0.14);
  --line-strong: rgba(4, 45, 44, 0.32);
  --danger: #c2410c;
  --ok: #1f7a4d;
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 52px;
  --shadow: 0 10px 30px rgba(4, 45, 44, 0.08);
  --font: Metropolis, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@font-face { font-family: Metropolis; src: url(/fonts/Metropolis-Regular.otf) format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Metropolis; src: url(/fonts/Metropolis-Medium.otf) format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: Metropolis; src: url(/fonts/Metropolis-SemiBold.otf) format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: Metropolis; src: url(/fonts/Metropolis-Bold.otf) format("opentype"); font-weight: 700; font-display: swap; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video { max-width: 100%; display: block; }
.noscript { padding: 24px; text-align: center; }
[hidden] { display: none !important; }

/* ---------- App frame: full-height column, sticky footer ---------- */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
@media (min-width: 700px) {
  body { background: linear-gradient(180deg, var(--sand) 0%, var(--cream) 60%); }
  .app {
    max-width: 560px;
    margin: 24px auto;
    min-height: calc(100dvh - 48px);
    background: var(--cream);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }
}

.top {
  padding: calc(12px + env(safe-area-inset-top)) 20px 0;
  background: var(--cream);
  position: sticky; top: 0; z-index: 5;
}
.top-row { display: flex; align-items: center; justify-content: space-between; min-height: 40px; }
.logo { height: 22px; width: auto; }
.save-state { font-size: 13px; color: var(--muted); min-height: 1em; }
.save-state.err { color: var(--danger); }
.progress-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-bottom: 4px; }
.progress { flex: 1; height: 8px; background: rgba(4, 45, 44, 0.1); border-radius: 8px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--orange); border-radius: 8px; transition: width .35s ease; }
.pct { font-size: 13px; font-weight: 600; color: var(--breen); min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }

.main {
  flex: 1;
  padding: 20px 20px 24px;
}
.main.enter { animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .main.enter { animation: none; } .progress > i { transition: none; } }

.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--orange); margin: 0 0 8px; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.01em; }
.help { margin: 0 0 20px; color: var(--muted); font-size: 16px; }
p { margin: 0 0 14px; }

.nav {
  position: sticky; bottom: 0;
  display: flex; gap: 12px; align-items: center;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,254,246,0) 0%, var(--cream) 30%);
}
.nav .btn-primary { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 22px;
  border-radius: var(--radius); border: 1.5px solid transparent;
  font-weight: 600; font-size: 17px; text-decoration: none;
  transition: transform .08s ease, background .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:not(:disabled):hover { background: #d4561f; }
.btn-secondary { background: transparent; color: var(--breen); border-color: var(--line-strong); }
.btn-ghost { background: transparent; color: var(--breen); padding: 0 12px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--orange); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Fields ---------- */
.fields { display: flex; flex-wrap: wrap; gap: 14px 12px; }
.field { flex: 1 1 100%; }
.field.w-half { flex-basis: calc(50% - 6px); }
.field.w-third { flex-basis: calc(33.333% - 8px); }
.label { display: block; font-size: 14px; font-weight: 600; color: var(--breen); margin-bottom: 6px; }
.input {
  width: 100%; min-height: var(--tap); padding: 12px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; outline: none; font-size: 17px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.input.invalid { border-color: var(--danger); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.4; }
.unit-wrap { position: relative; }
.unit-wrap .input { padding-right: 48px; }
.unit-wrap .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 500; pointer-events: none; }
.error { color: var(--danger); font-size: 14px; margin-top: 6px; }

/* stepper */
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 12px 0; }
.stepper button {
  width: 64px; height: 64px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: #fff; font-size: 30px; font-weight: 500; color: var(--breen); line-height: 1;
}
.stepper button:active { background: var(--sand); }
.stepper button:disabled { opacity: .3; }
.stepper output { font-size: 44px; font-weight: 600; min-width: 80px; text-align: center; font-variant-numeric: tabular-nums; }

/* choices */
.choices { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.choices.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 60px; padding: 14px 16px; text-align: left;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: #fff;
  font-weight: 500; transition: border-color .12s, background .12s;
}
.choices.grid .choice { justify-content: center; text-align: center; font-size: 20px; font-weight: 600; min-height: 68px; }
.choice::before {
  content: ""; width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: #fff; transition: all .12s;
}
.choices.grid .choice::before { display: none; }
.choice[aria-checked="true"] { border-color: var(--orange); background: var(--orange-soft); }
.choice[aria-checked="true"]::before { border-color: var(--orange); background: radial-gradient(var(--orange) 45%, #fff 50%); }
.yesno { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.yesno .choice { justify-content: center; font-size: 20px; font-weight: 600; min-height: 80px; }
.yesno .choice::before { display: none; }

/* media capture */
.media { display: flex; flex-direction: column; gap: 12px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tile {
  position: relative; border-radius: var(--radius); overflow: hidden; background: var(--sand);
  aspect-ratio: 4 / 3; border: 1.5px solid var(--line);
}
.tile.hero { aspect-ratio: 4 / 3; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; padding: 10px; text-align: center; }
.tile .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255,255,255,.55); }
.tile .bar > i { display: block; height: 100%; background: var(--orange); width: 0; transition: width .2s; }
.tile .status {
  position: absolute; left: 10px; bottom: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgba(4,45,44,.78); color: #fff; font-size: 12px; font-weight: 600;
}
.tile .status.ok { background: var(--ok); }
.tile .status.err { background: var(--danger); }
.tile .remove {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: rgba(4,45,44,.78); color: #fff; font-size: 20px; line-height: 1;
}
.capture {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 132px; padding: 18px; border-radius: var(--radius);
  border: 2px dashed var(--orange-2); background: #fff; color: var(--breen);
  font-weight: 600; text-align: center; flex-direction: column;
}
.capture svg { width: 40px; height: 40px; color: var(--orange); }
.capture small { font-weight: 400; color: var(--muted); font-size: 14px; }
.capture.compact { min-height: var(--tap); flex-direction: row; border-style: solid; border-width: 1.5px; border-color: var(--line-strong); }
.capture.compact svg { width: 22px; height: 22px; }
.capture input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.capture-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tips { margin: 14px 0 0; padding: 12px 14px; background: var(--sand); border-radius: var(--radius-sm); font-size: 14px; color: var(--breen-2); }

/* ---------- Welcome / done ---------- */
.hero-logo { height: 34px; margin: 8px 0 28px; }
.welcome h1 { font-size: 32px; }
.lede { font-size: 18px; color: var(--breen-2); }
.checklist { list-style: none; padding: 0; margin: 20px 0 8px; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm); }
.checklist svg { width: 22px; height: 22px; flex: 0 0 22px; color: var(--orange); margin-top: 1px; }
.fineprint { font-size: 13px; color: var(--muted); margin-top: 18px; }
.done { text-align: center; padding-top: 32px; }
.done .check { width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 50%; background: var(--orange-soft); display: grid; place-items: center; }
.done .check svg { width: 42px; height: 42px; color: var(--orange); }
.ref { font-family: ui-monospace, Menlo, monospace; font-size: 14px; color: var(--muted); }

/* ---------- Review ---------- */
.review-section { margin: 0 0 22px; }
.review-section h2 { font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--orange); margin: 0 0 8px; font-weight: 600; }
.review-card { background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.review-row { display: flex; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: flex-start; }
.review-row:first-child { border-top: 0; }
.review-row .k { flex: 0 0 38%; font-size: 13px; color: var(--muted); padding-top: 2px; }
.review-row .v { flex: 1; font-weight: 500; word-break: break-word; }
.review-row .v.missing { color: var(--danger); font-weight: 600; }
.review-row .edit { flex: 0 0 auto; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs .tile { width: 84px; aspect-ratio: 1; }
.banner { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--orange-soft); color: var(--breen); font-size: 15px; margin-bottom: 18px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px;
  background: var(--breen); color: #fff; font-size: 15px; z-index: 50; box-shadow: var(--shadow);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
