/* Site Surveys - phone-first, Sign Central brand (brand/kit/brand-tokens.css). */
:root {
  --sc-green: #0e4423;
  --sc-green-deep: #082d17;
  --sc-lime: #70bc1f;
  --sc-lime-dark: #5ab025;
  --sc-lime-deep: #3f8f1a;
  --sc-lime-bright: #8ad42f;
  --sc-paper: #fbfaf6;
  --sc-tint: #eef7e4;
  --sc-ink: #1e2621;
  --sc-muted: #52605a;
  --sc-border: rgba(30, 38, 33, 0.14);
  --sc-amber: #b35c00;
  --sc-amber-bg: #fff3e0;
  --sc-red: #b3261e;
  --sc-red-bg: #fdecea;
  --sc-font: "Poppins", "Inter", -apple-system, "Segoe UI", Arial, sans-serif;
  --radius: 14px;
  --bar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sc-font);
  background: var(--sc-paper);
  color: var(--sc-ink);
  font-size: 16px;
  line-height: 1.45;
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { color: var(--sc-green); letter-spacing: -0.015em; margin: 0; }
h1 { font-size: 1.35rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 600; }
a { color: var(--sc-green); }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--sc-lime); outline-offset: 2px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(8, 45, 23, 0.96);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: #fff;
  height: var(--bar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 0 8px;
}
.top .back {
  background: none; border: 0; color: #d9ead1; width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 26px; line-height: 1;
}
.top .back:hover { background: rgba(255,255,255,0.08); color: #fff; }
.top .logo { height: 34px; width: auto; display: block; }
.top .title { flex: 1; font-weight: 600; font-size: 1rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .status { font-size: 0.8rem; color: #a9c9a0; white-space: nowrap; }

.screen { max-width: 560px; margin: 0 auto; padding: 16px 14px 120px; }
.screen.tight { padding-bottom: 32px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; border-radius: 999px; border: 0; font-weight: 600; text-decoration: none;
  min-height: 48px; font-size: 1rem;
}
.btn-primary { background: var(--sc-lime); color: #0b2e18; }
.btn-primary:hover { background: var(--sc-lime-bright); }
.btn-primary:disabled { background: #c9d9bb; color: #56704a; cursor: default; }
.btn-secondary { background: var(--sc-green); color: #fff; }
.btn-secondary:hover { background: var(--sc-green-deep); }
.btn-quiet { background: #fff; color: var(--sc-green); border: 1.5px solid var(--sc-border); }
.btn-quiet:hover { border-color: var(--sc-green); }
.btn-danger { background: var(--sc-red-bg); color: var(--sc-red); }
.btn-block { width: 100%; }
.btn-big { min-height: 64px; font-size: 1.15rem; font-weight: 700; }
.btn-sm { min-height: 40px; padding: 8px 16px; font-size: 0.9rem; }

/* PIN screen */
.pin-wrap { min-height: calc(100vh - var(--bar-h)); display: flex; flex-direction: column; justify-content: center; }
.pin-wrap h1 { text-align: center; margin-bottom: 4px; }
.pin-wrap p { text-align: center; color: var(--sc-muted); margin: 0 0 24px; }
.pin-input {
  width: 100%; font-size: 2rem; letter-spacing: 0.35em; text-align: center; padding: 14px;
  border: 2px solid var(--sc-border); border-radius: var(--radius); background: #fff;
}
.pin-input:focus { border-color: var(--sc-lime); outline: 0; }

/* home */
.home-actions { display: grid; gap: 12px; margin-bottom: 22px; }
.who { font-size: 0.95rem; color: var(--sc-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.who input { flex: 1; min-width: 140px; padding: 10px 12px; border: 1.5px solid var(--sc-border); border-radius: 10px; background: #fff; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 0 10px; }
.section-head h2 { font-size: 0.95rem; color: var(--sc-muted); font-weight: 600; }
.section-head .link { font-size: 0.9rem; }

.list { display: grid; gap: 8px; }
.row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  background: #fff; border: 1.5px solid var(--sc-border); border-radius: var(--radius);
  padding: 12px 14px; text-align: left; width: 100%; color: inherit; text-decoration: none;
}
.row:hover { border-color: var(--sc-green); }
.row .meta { min-width: 0; overflow: hidden; }
.row .meta .name { display: block; font-weight: 600; color: var(--sc-green); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta .sub { display: block; color: var(--sc-muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { color: var(--sc-muted); padding: 24px 8px; text-align: center; }

/* the rego plate: the one bit of personality. NZ plate: white, black text, rounded border. */
.plate {
  display: inline-block; font-weight: 700; font-size: 1.05rem; letter-spacing: 0.08em;
  background: #fff; color: #111; border: 2px solid #111; border-radius: 6px;
  padding: 3px 8px; min-width: 88px; text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1.5px #fff, inset 0 0 0 2.5px #111;
}
.plate.none { color: var(--sc-muted); border-style: dashed; box-shadow: none; font-weight: 500; letter-spacing: 0; font-size: 0.85rem; }
.plate.big { font-size: 1.5rem; padding: 6px 14px; }

/* status chips */
.chip { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.chip.draft { background: #f0efe9; color: var(--sc-muted); }
.chip.sent { background: var(--sc-amber-bg); color: var(--sc-amber); }
.chip.filed { background: var(--sc-tint); color: var(--sc-lime-deep); }
.chip.error { background: var(--sc-red-bg); color: var(--sc-red); }

/* survey form */
.card { background: #fff; border: 1.5px solid var(--sc-border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h2 { margin-bottom: 8px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 0.85rem; color: var(--sc-muted); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 12px; border: 1.5px solid var(--sc-border); border-radius: 10px; background: #fff;
  font-size: 17px; /* 16px+ stops iOS zooming into the field */
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--sc-lime); outline: 0; box-shadow: 0 0 0 3px rgba(112,188,31,0.25); }
.field textarea { min-height: 84px; resize: vertical; }
.field input.rego { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field .hint { font-size: 0.8rem; color: var(--sc-muted); margin-top: 4px; }
.price-wrap { position: relative; }
.price-wrap input { padding-left: 28px; }
.price-wrap::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--sc-muted); font-weight: 600; }

/* repairer picker: one-tap Kawans button + a type-ahead for everyone else */
.field-label { display: block; font-size: 0.85rem; color: var(--sc-muted); margin-bottom: 8px; }
.quick-rep { width: 100%; background: #fff; color: var(--sc-green); border: 2px solid var(--sc-green); min-height: 56px; font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.quick-rep:hover { background: var(--sc-tint); }
.quick-rep.on { background: var(--sc-green); color: #fff; }
.quick-rep.on::before { content: "\2713  "; }
.rep-card { position: relative; }
.rep-field { position: relative; margin-bottom: 0; }
.rep-field input { padding-right: 44px; }
.rep-field .tick { display: none; position: absolute; right: 14px; bottom: 12px; color: var(--sc-lime-deep); font-weight: 700; font-size: 1.2rem; }
.rep-field.selected input { border-color: var(--sc-lime); background: var(--sc-tint); font-weight: 600; }
.rep-field.selected .tick { display: block; }
.typeahead { position: absolute; left: 14px; right: 14px; z-index: 15; background: #fff; border: 1.5px solid var(--sc-border); border-radius: 12px; box-shadow: 0 12px 30px rgba(8,45,23,0.18); overflow: hidden; margin-top: 4px; }
.typeahead .opt { display: block; width: 100%; text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--sc-border); padding: 13px 14px; font-size: 1rem; }
.typeahead .opt:last-child { border-bottom: 0; }
.typeahead .opt:hover { background: var(--sc-tint); }
.typeahead .opt.add { color: var(--sc-green); font-weight: 600; }

/* photos */
.photo-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #eee; border: 1.5px solid var(--sc-border);
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .del {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.tile .tag { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,0.6); color: #fff; font-size: 0.7rem; padding: 2px 7px; border-radius: 999px; }
.tile.uploading::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,0.55); }
.tile .spin { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; color: var(--sc-green); font-weight: 600; }
.tile.cam {
  border: 2px dashed var(--sc-lime-dark); background: var(--sc-tint); color: var(--sc-green);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 600; font-size: 0.9rem;
}
.tile.cam svg { width: 34px; height: 34px; }
.tile.cam:hover { background: #e2f1d3; }
.scan-tile {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--sc-green); color: #fff; border: 0; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.scan-tile:hover { background: var(--sc-green-deep); }
.scan-tile svg { width: 40px; height: 40px; flex: none; }
.scan-tile .t { font-weight: 700; font-size: 1.05rem; }
.scan-tile .s { font-size: 0.85rem; color: #d9ead1; }
.scan-tile:disabled { opacity: 0.6; }
.scan-result { background: var(--sc-tint); border-radius: 10px; padding: 10px 12px; font-size: 0.9rem; margin-bottom: 12px; }
.scan-result .kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.scan-result .k { color: var(--sc-muted); }

/* notices */
.notice { border-radius: 10px; padding: 10px 12px; font-size: 0.92rem; margin-bottom: 12px; }
.notice.ok { background: var(--sc-tint); color: var(--sc-green); }
.notice.warn { background: var(--sc-amber-bg); color: var(--sc-amber); }
.notice.bad { background: var(--sc-red-bg); color: var(--sc-red); }
.notice code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85em; word-break: break-all; }

/* result after sending */
.result h2 { margin-bottom: 10px; }
.result .kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 0.95rem; }
.result .k { color: var(--sc-muted); }
.result .path { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; word-break: break-all; }

/* sticky bottom bar */
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(251,250,246,0.96); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--sc-border);
  padding: 10px 14px calc(10px + var(--safe-b));
}
.bottom .inner { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.bottom .save-state { flex: 1; font-size: 0.85rem; color: var(--sc-muted); }
.bottom .save-state.bad { color: var(--sc-red); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%);
  background: var(--sc-green); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; z-index: 50;
  max-width: 92vw; text-align: center; box-shadow: 0 10px 30px rgba(8,45,23,0.25);
}
.toast.bad { background: var(--sc-red); }

/* busy overlay */
.busy { position: fixed; inset: 0; background: rgba(251,250,246,0.7); z-index: 60; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; color: var(--sc-green); font-weight: 600; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--sc-tint); border-top-color: var(--sc-lime); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* repairers screen */
.rep-form { display: grid; gap: 8px; }
