/* Field capture tool. Used one-handed, outdoors, standing next to a stranger.
   Everything is sized for a thumb and legible in sun. */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --ink: #15181F;
  --paper: #FFFFFF;
  --surface: #F1F3F6;
  --line: #D6DAE2;
  --line-strong: #9BA3B2;
  --muted: #5A6271;
  --signal: #1B3BCC;
  --signal-ink: #FFFFFF;
  --good: #0F7B4F;
  --warn: #9A5B00;
  --bad: #B3261E;
  --tap: 52px;
  --gutter: clamp(16px, 5vw, 32px);
  --font: 'Archivo Variable', system-ui, -apple-system, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
input, textarea, select, button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell ---------- */
.shell { min-height: 100svh; display: flex; flex-direction: column; }

.bar {
  position: sticky; top: 0; z-index: 20;
  background: var(--ink); color: #fff;
  padding: 10px var(--gutter) 0;
}
.bar-top { display: flex; align-items: baseline; gap: 10px; }
.bar-step { font-weight: 800; font-stretch: 78%; font-size: 1.1rem; letter-spacing: -0.01em; }
.bar-of { margin-left: auto; font-size: 0.82rem; color: #A9B0BE; font-variant-numeric: tabular-nums; }
.bar-client { font-size: 0.82rem; color: #A9B0BE; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.rail { display: flex; gap: 3px; margin-top: 10px; padding-bottom: 10px; }
.rail span { flex: 1; height: 4px; border-radius: 2px; background: #3A4150; }
.rail span.done { background: #7E8CA8; }
.rail span.now { background: #fff; }

main { flex: 1; padding: 22px var(--gutter) 140px; max-width: 680px; width: 100%; margin-inline: auto; }

h1 { margin: 0 0 6px; font-size: clamp(1.7rem, 6vw, 2.3rem); font-weight: 800; font-stretch: 76%; line-height: 1.04; letter-spacing: -0.02em; }
.hint { margin: 0 0 24px; color: var(--muted); max-width: 46ch; }

/* ---------- Fields ---------- */
.field { margin-bottom: 22px; }
.field > label, .legend { display: block; font-weight: 650; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); font-size: 0.86rem; }
.help { margin: 0 0 8px; color: var(--muted); font-size: 0.88rem; max-width: 48ch; }
input[type=text], input[type=tel], input[type=url], textarea, select {
  width: 100%; min-height: var(--tap); padding: 12px 14px;
  border: 2px solid var(--line); border-radius: 10px; background: var(--paper);
}
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--signal); }
.field.bad input, .field.bad textarea, .field.bad .files { border-color: var(--bad); }
.err { margin: 6px 0 0; color: var(--bad); font-size: 0.88rem; font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* choice chips */
.choices { display: grid; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 12px 14px;
  border: 2px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer;
}
.choice input { position: absolute; opacity: 0; }
.choice .dot { width: 22px; height: 22px; flex: none; border: 2px solid var(--line-strong); border-radius: 50%; display: grid; place-items: center; }
.choice input:checked + .dot { border-color: var(--signal); }
.choice input:checked + .dot::after { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--signal); }
.choice:has(input:checked) { border-color: var(--signal); background: #EEF1FE; }
.choice input:focus-visible + .dot { outline: 3px solid var(--signal); outline-offset: 2px; }

/* hours */
.hours { display: grid; gap: 8px; }
.hrow { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); }
.hrow .day { font-weight: 650; }
.hrow .times { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.hrow.closed .times { display: none; }
.hrow input[type=time] { flex: 1; min-width: 0; min-height: 46px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 8px; background: var(--paper); }
.hrow .to { color: var(--muted); font-size: 0.9rem; }
.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 0.9rem; color: var(--muted); cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--signal); }
.copydown { margin-top: 2px; }

/* list */
.list { display: grid; gap: 8px; }
.list .li { display: flex; align-items: center; gap: 10px; }
.list .n { width: 26px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 650; }

/* files */
.files { border: 2px dashed var(--line-strong); border-radius: 12px; background: var(--paper); padding: 14px; }
.files.drag { border-color: var(--signal); background: #EEF1FE; }
.files-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-file {
  flex: 1 1 auto; min-height: var(--tap); padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); font-weight: 650; cursor: pointer;
}
.btn-file:hover { background: var(--surface); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; background: #2A2F3A; }
.thumb .tag { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 5px; background: rgb(0 0 0 / 0.66); color: #fff; font-size: 0.64rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgb(0 0 0 / 0.72); color: #fff; font-size: 17px; line-height: 1; cursor: pointer; }
.count { margin-top: 10px; font-size: 0.86rem; font-weight: 650; }
.count.ok { color: var(--good); }
.count.short { color: var(--warn); }

/* confirm */
.confirm { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; }
.confirm input { width: 26px; height: 26px; margin: 0; flex: none; accent-color: var(--signal); }
.confirm span { font-weight: 600; }

/* ---------- Review ---------- */
.review { display: grid; gap: 2px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.review .r { display: grid; grid-template-columns: 1fr; gap: 2px; background: var(--paper); padding: 12px 14px; }
.review .k { font-size: 0.8rem; color: var(--muted); }
.review .v { font-weight: 600; overflow-wrap: anywhere; }
.review .v.empty { color: var(--muted); font-weight: 400; font-style: italic; }
.rsec { margin: 26px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.rsec h2 { margin: 0; font-size: 1.05rem; font-weight: 800; font-stretch: 80%; }
.rsec button { background: none; border: 0; color: var(--signal); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; padding: 0 4px; }

/* ---------- Footer nav ---------- */
.nav {
  position: fixed; inset: auto 0 0; z-index: 30;
  display: flex; gap: 10px; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--line);
}
.nav .inner { display: flex; gap: 10px; width: 100%; max-width: 680px; margin-inline: auto; }
.btn {
  min-height: 56px; padding: 0 20px; flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid transparent; border-radius: 12px; font-weight: 700; cursor: pointer;
}
.btn-primary { background: var(--signal); color: var(--signal-ink); }
.btn-primary:disabled { background: var(--line-strong); cursor: default; }
.btn-back { flex: 0 0 auto; background: var(--paper); border-color: var(--line-strong); }
.saved { position: fixed; top: 10px; right: var(--gutter); z-index: 31; padding: 4px 10px; border-radius: 999px; background: #3A4150; color: #CBD2DE; font-size: 0.72rem; font-weight: 600; opacity: 0; transition: opacity .25s; pointer-events: none; }
.saved.show { opacity: 1; }

/* ---------- Submit ---------- */
.progress { margin-top: 18px; display: grid; gap: 10px; }
.pline { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 0.9rem; }
.pbar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: var(--signal); transition: width .2s; }
.pline.done .pbar i { background: var(--good); }
.notice { padding: 14px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; }
.notice.good { background: #E6F4EC; color: #0B5537; }
.notice.bad { background: #FBE9E7; color: #8C1D18; }
.done-actions { display: grid; gap: 10px; margin-top: 20px; }

@media (min-width: 620px) {
  main { padding-bottom: 120px; }
  .hrow { grid-template-columns: 150px 1fr auto; }
  .hrow .times { grid-column: 2; }
}
