:root {
  --teal: #0f766e; --teal-dark: #115e59; --teal-soft: #ccfbf1;
  --ink: #1f2933; --muted: #616e7c; --line: #e4e7eb; --bg: #f5f7f8;
  --good: #15803d; --good-soft: #dcfce7; --bad: #b42318; --bad-soft: #fee4e2;
  --warn: #b45309; --warn-soft: #fef3c7; --yellow: #f5b70a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
main { max-width: 640px; margin: 0 auto; padding: 12px 12px calc(40px + env(safe-area-inset-bottom)); }
body.admin main { max-width: 960px; }
h1 { font-size: 26px; margin: 0 0 6px; line-height: 1.2; }
h2 { font-size: 18px; margin: 0 0 12px; }
a { color: var(--teal); }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); background: var(--teal); color: #fff; }
.brand { color: #fff; font-weight: 700; text-decoration: none; }
.nav { display: flex; gap: 16px; align-items: center; margin: 0; }
.nav a, .top .linkbtn { color: #fff; text-decoration: none; font-size: 15px; opacity: .92; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--teal); cursor: pointer; text-decoration: underline; }

.card { background: #fff; border-radius: var(--radius); padding: 18px; margin: 12px 0; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card.narrow { max-width: 440px; margin: 40px auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.error { color: var(--bad); font-weight: 600; }
.flash { background: var(--warn-soft); color: #7c2d12; padding: 12px 14px; border-radius: 10px; margin: 12px 0; }
.error-box { background: var(--bad-soft); color: #7a271a; padding: 14px 16px; border-radius: 12px; margin: 12px 0; }
.error-box ul { margin: 6px 0 0; padding-left: 20px; }
.ok-box { background: var(--good-soft); color: #14532d; padding: 14px 16px; border-radius: 12px; font-weight: 600; }

.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 15px; font-weight: 600; margin-bottom: 6px; }
input[type=password], input[type=text], input:not([type]), textarea { width: 100%; font: inherit; padding: 12px 14px; border: 1.5px solid #cbd2d9; border-radius: 10px; background: #fff; }
input:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 22px; border-radius: 12px; border: 0; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.block { display: flex; width: 100%; margin-top: 10px; }
.btn.primary { background: var(--teal); color: #fff; }
.btn.primary:active { background: var(--teal-dark); }
.btn.ghost { background: #fff; color: var(--teal); border: 1.5px solid var(--teal); }
.btn.danger { background: #fff; color: var(--bad); border: 1.5px solid var(--bad); }

.progress { height: 6px; background: #d9e2ec; border-radius: 3px; overflow: hidden; margin: 6px 0 14px; }
.progress div { height: 100%; background: var(--teal); }
.stephead { padding: 0 4px; }
.stepnum { font-size: 14px; font-weight: 700; color: var(--teal); text-transform: uppercase; letter-spacing: .04em; }

.where-text { font-size: 18px; font-weight: 600; margin: 10px 0 0; }
.note { margin: 10px 0 0; padding: 10px 12px; background: var(--warn-soft); border-radius: 10px; }
.doorcode { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--teal-soft); }
.doorcode b { font-size: 30px; letter-spacing: .12em; }
.plan-wrap summary { cursor: pointer; font-weight: 700; color: var(--teal); }
.plan { width: 100%; max-height: 380px; margin-top: 10px; }
.plan .room { fill: #f8fafc; stroke: #334e68; stroke-width: 2.5; }
.plan .room-pool { fill: #bae6fd; stroke: #0369a1; }
.plan .room-patio { fill: #f1f5f9; stroke: #9fb3c8; stroke-dasharray: 6 4; }
.plan .room-garage { fill: #eef2f5; stroke: #9fb3c8; }
.plan .room.done { fill: #dcfce7; }
.plan .room.current { fill: var(--yellow); stroke: #92400e; stroke-width: 4; }
.plan .room-daybed.current, .plan .room-daybed { stroke-width: 3; }
.plan text { font-size: 15px; font-weight: 700; fill: #243b53; text-anchor: middle; pointer-events: none; }
.plan text.t-primarybath { font-size: 12px; }

.ref img { width: 100%; border-radius: 10px; display: block; }
.caption { margin: 10px 0 0; padding: 10px 12px; background: var(--warn-soft); border-radius: 10px; font-weight: 600; }

.item { padding: 14px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; padding-top: 0; }
.q { margin: 0 0 10px; font-weight: 600; }
.star { color: var(--bad); font-weight: 800; }
.important { margin: -4px 0 12px; padding: 10px 12px; border-left: 4px solid var(--bad); background: var(--warn-soft); border-radius: 8px; font-weight: 600; color: #7c2d12; }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.yn label { position: relative; }
.yn input { position: absolute; opacity: 0; inset: 0; }
.yn span { display: flex; align-items: center; justify-content: center; min-height: 52px; border-radius: 12px; border: 2px solid #cbd2d9; font-weight: 700; background: #fff; }
.yn .good input:checked + span { background: var(--good); border-color: var(--good); color: #fff; }
.yn .bad input:checked + span { background: var(--bad); border-color: var(--bad); color: #fff; }
.yn input:focus-visible + span { box-shadow: 0 0 0 3px var(--teal-soft); }
.ifbad { display: none; margin-top: 8px; padding: 4px 12px 12px; background: var(--bad-soft); border-radius: 12px; }
.item.is-bad .ifbad { display: block; }

.photo-field { padding: 12px; border: 1.5px dashed #9fb3c8; border-radius: 12px; margin-bottom: 12px; background: #fff; }
.photo-field.has { border-style: solid; border-color: var(--good); }
.photo-label { font-weight: 700; margin-bottom: 8px; }
.photo-intro { margin: -4px 0 14px; padding: 10px 12px; background: var(--teal-soft); color: var(--teal-dark); border-radius: 10px; }
.req, .opt { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }
.req { background: var(--warn-soft); color: var(--warn); }
.opt { background: #eef2f5; color: var(--muted); }
.photo-field.has .req { background: var(--good-soft); color: var(--good); }
.thumb-wrap { position: relative; margin-bottom: 10px; }
.thumb-wrap .thumb { margin-bottom: 0; }
.upload-status { position: absolute; inset: 0; border-radius: 10px; background: rgba(15, 23, 42, .62); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; text-align: center; font-weight: 700; }
.upload-status[hidden] { display: none; }
.upload-status.error { background: rgba(180, 35, 24, .88); }
.upload-bar { width: 80%; height: 8px; border-radius: 4px; background: rgba(255,255,255,.3); overflow: hidden; }
.upload-bar div { height: 100%; width: 0; background: #fff; transition: width .2s; }
.spinner { width: 34px; height: 34px; border: 4px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.big { width: 52px; height: 52px; border-color: var(--teal-soft); border-top-color: var(--teal); }
@keyframes spin { to { transform: rotate(360deg); } }
.photo-field.busy { border-color: var(--teal); border-style: solid; }
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.overlay[hidden] { display: none; }
.overlay-box { background: #fff; border-radius: 16px; padding: 28px 24px; max-width: 320px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; font-weight: 700; }
.overlay-box .upload-bar { display: none; }
.thumb { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; margin-bottom: 10px; }
.thumb.empty { height: 90px; display: flex; align-items: center; justify-content: center; background: #f0f4f8; color: var(--muted); font-size: 15px; }
.camera { width: 100%; background: var(--teal-soft); color: var(--teal-dark); position: relative; overflow: hidden; }
.camera input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 16px; position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.saving { text-align: center; font-weight: 700; color: var(--teal); }

.steplist { display: grid; gap: 8px; margin-top: 12px; }
.steprow { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.steprow .n { width: 28px; height: 28px; border-radius: 50%; background: #eef2f5; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.steprow .t { flex: 1; font-weight: 600; }
.pill { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.bigcheck { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%; background: var(--good); color: #fff; font-size: 40px; display: flex; align-items: center; justify-content: center; }

.reports { display: grid; gap: 8px; }
.report { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; }
.answers { list-style: none; padding: 0; margin: 0; }
.answers li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.answers li:first-child { border-top: 0; }
.ans { flex: none; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; }
.ans.yes { background: var(--good); } .ans.no { background: var(--bad); } .ans.none { background: #cbd2d9; }
.failnote { color: var(--bad); font-weight: 600; margin-top: 2px; }
.comment { background: #f0f4f8; padding: 10px 12px; border-radius: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; display: block; }
.gallery figcaption { font-size: 14px; color: var(--muted); margin-top: 4px; }
.refrow img { width: 100%; max-width: 420px; border-radius: 10px; display: block; margin-bottom: 10px; }
.refrow form { margin-top: 8px; }
