/* Site Capture: the plan is the screen. Pins and arrows in survey-paint pink, laser lines in green,
   controls in Stone & Art plum. System fonts so the app opens with no signal. */
:root {
  color-scheme: light dark;
  --paper: #f5f6f4;
  --plan-bg: #e9ebe8;
  --ink: #1d2125;
  --muted: #565c63;
  --line: #cfd4d8;
  --plum: #541840;
  --plum-ink: #ffffff;
  --mark: #d4006f;
  --laser: #0b8a58;
  --bad: #b3261e;
  --halo: #ffffff;
  --tap: 48px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15181b;
    --plan-bg: #0e1012;
    --ink: #e9ecee;
    --muted: #a2a9b0;
    --line: #343a40;
    --plum: #c99bbb;
    --plum-ink: #15181b;
    --mark: #ff4fa6;
    --laser: #2fd38f;
    --bad: #ff8a80;
    --halo: #15181b;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* class display rules must never beat the hidden attribute */
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 19px; margin: 0 0 4px; }
p { margin: 0 0 12px; }
.hint, .msg { color: var(--muted); font-size: 15px; }
.msg:empty { display: none; }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }

button, select, input {
  font: inherit;
  color: inherit;
  min-height: var(--tap);
  border-radius: 10px;
}
button {
  border: 1px solid var(--line);
  background: transparent;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
}
button.primary { background: var(--plum); color: var(--plum-ink); border-color: var(--plum); }
button.ghost { border-color: transparent; }
select, input { border: 1px solid var(--line); background: var(--paper); padding: 0 12px; width: 100%; }
label { display: grid; gap: 4px; margin: 0 0 12px; font-size: 15px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; color: var(--ink); }
label.check input { width: 22px; min-height: 22px; }

/* list pages */
.page { max-width: 560px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 32px; }
.page > button.primary { width: 100%; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.top h1 { margin: 0; }
.outbox { display: grid; gap: 8px; padding: 12px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.outbox p { margin: 0; font-weight: 600; }
progress { width: 100%; height: 8px; accent-color: var(--plum); }
.list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.list .empty { color: var(--muted); }
button.job { width: 100%; text-align: left; display: grid; gap: 2px; padding: 12px 14px; }
button.job span { font-weight: 400; font-size: 14px; color: var(--muted); }
details { border-top: 1px solid var(--line); padding: 12px 0; }
details > button { width: 100%; }
summary { font-weight: 700; min-height: var(--tap); display: flex; align-items: center; cursor: pointer; }

/* the visit screen */
#job:not([hidden]) {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  height: 100vh;
  height: 100dvh;
}
.bar { display: flex; gap: 6px; align-items: center; padding: max(6px, env(safe-area-inset-top)) 8px 6px; border-bottom: 1px solid var(--line); }
.bar select { flex: 1 1 0; min-width: 0; }
.bar button { flex: none; padding: 0 10px; }
#back { font-size: 26px; }
#send.busy { opacity: 0.6; }
#sendCount { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 99px; background: var(--plum); color: var(--plum-ink); }
.banner { width: 100%; border-radius: 0; border: 0; background: var(--mark); color: #fff; }
#planArea { position: relative; overflow: hidden; background: var(--plan-bg); }
#planWrap { position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
#planWrap .empty { padding: 24px; color: var(--muted); }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage img, .stage svg { position: absolute; left: 0; top: 0; pointer-events: none; }
#northMark {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--paper); padding: 0;
}
#northMark span { display: block; font-weight: 800; transform: translateY(-1px); }
#northMark::before {
  content: ""; position: absolute; left: 50%; top: -9px; margin-left: -6px;
  border: 6px solid transparent; border-bottom: 9px solid var(--ink); border-top: 0;
}

/* plan marks */
.pin { fill: var(--mark); stroke: var(--halo); }
.pin-text { fill: #fff; text-anchor: middle; font-weight: 700; font-family: system-ui, sans-serif; }
.pin-arrow, .draft-arrow { stroke: var(--mark); stroke-linecap: round; }
.head { fill: var(--mark); stroke: none; }
.draft { fill: none; stroke: var(--mark); }
.draft-arrow { stroke-dasharray: 4 3; }
.m-line { stroke: var(--laser); stroke-linecap: round; }
.m-end { fill: var(--laser); }
.m-text { fill: var(--laser); stroke: var(--halo); paint-order: stroke; text-anchor: middle; font-weight: 700; font-family: system-ui, sans-serif; font-variant-numeric: tabular-nums; }

/* sheet for the current step */
.sheet { border-top: 3px solid var(--plum); padding: 12px 16px; max-height: 52dvh; overflow: auto; display: grid; gap: 10px; background: var(--paper); }
.sheet[hidden] { display: none; }
.sheet h2, .sheet p { margin: 0; }
.sheet .row { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.sheet .grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sheet .list { margin: 0; }
.live { font-variant-numeric: tabular-nums; font-weight: 600; }
.reading { display: flex; align-items: baseline; gap: 8px; }
.reading .big { font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 72px; letter-spacing: 0.02em; }
.reading span { font-size: 28px; font-weight: 700; color: var(--muted); }
.dial-wrap { display: grid; justify-items: center; gap: 6px; }
.dial {
  position: relative; width: 176px; height: 176px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--plan-bg); touch-action: none; cursor: grab;
}
.dial::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px; border-radius: 50%; background: var(--mark); }
.needle { position: absolute; left: calc(50% - 2px); top: 22px; width: 4px; height: calc(50% - 22px); background: var(--mark); border-radius: 2px; transform-origin: 50% 100%; }
.needle::before { content: ""; position: absolute; left: -7px; top: -12px; border: 9px solid transparent; border-bottom: 13px solid var(--mark); border-top: 0; }
.side { position: absolute; font-size: 13px; color: var(--muted); }
.side.t { top: 2px; left: 50%; transform: translateX(-50%); }
.side.b { bottom: 2px; left: 50%; transform: translateX(-50%); }
.side.l { left: 4px; top: 50%; transform: translateY(-50%); }
.side.r { right: 4px; top: 50%; transform: translateY(-50%); }
.facing { font-size: 15px; color: var(--muted); text-align: center; }

/* bottom dock */
.dock { border-top: 1px solid var(--line); padding: 6px 8px max(8px, env(safe-area-inset-bottom)); display: grid; gap: 6px; }
.drawer-btn { border: 0; text-align: left; padding: 0 4px; color: var(--muted); font-weight: 600; }
#drawer { max-height: 36dvh; overflow: auto; margin: 0; }
button.item { width: 100%; text-align: left; font-weight: 500; }
button.item.done { color: var(--laser); border-color: var(--laser); }
.actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.actions button { padding: 0 2px; font-size: 15px; }
.actions button[data-mode="photo"] { background: var(--plum); color: var(--plum-ink); border-color: var(--plum); }

#toast {
  position: fixed; left: 12px; right: 12px; bottom: 132px; padding: 12px 14px; border-radius: 10px;
  background: var(--ink); color: var(--paper); font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
#toast.show { opacity: 1; }
#toast.bad { background: var(--bad); color: #fff; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
