/* 70067 Bolt-Up - built for phones, gloves and sunlight: big targets, high contrast. */
:root {
  --bg: #eef1f4;
  --card: #ffffff;
  --ink: #111820;
  --ink-2: #4a5663;
  --line: #d3d9e0;
  --brand: #1f3b4d;
  --brand-ink: #ffffff;
  --accent: #0b6bcb;
  --red: #c62828;
  --red-bg: #fdecec;
  --yellow: #b7791f;
  --yellow-bg: #fff6dc;
  --green: #1e7b34;
  --green-bg: #e6f4ea;
  --radius: 14px;
  --tap: 52px;
  font-size: 17px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151b; --card: #1a232c; --ink: #eef2f6; --ink-2: #a9b6c3; --line: #2e3a46;
    --red-bg: #3a1717; --yellow-bg: #3a2e12; --green-bg: #123020; --accent: #5aa9ff;
  }
  .brand img { filter: invert(1) brightness(1.2); }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.35; }
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); }
.brand img { height: 34px; display: block; }
.top-title { font-weight: 800; font-size: 1.05rem; flex: 1; line-height: 1.1; }
.top-title { min-width: 0; }
.top-title small { display: block; font-weight: 500; font-size: .75rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-btn { text-decoration: none; font-weight: 700; padding: 10px 14px; border-radius: 10px; background: var(--bg); color: var(--ink); }

.net { background: #333; color: #fff; padding: 8px 16px; font-size: .9rem; text-align: center; }
.net.warn { background: var(--yellow); }

main { max-width: 720px; margin: 0 auto; padding: 12px 12px 120px; }
.loading { padding: 40px; text-align: center; color: var(--ink-2); }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 0 0 12px; border: 1px solid var(--line); }
.card h2 { font-size: 1.05rem; margin: 0 0 10px; }
.card h3 { font-size: .95rem; margin: 14px 0 6px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }

/* joint header */
.joint { border-left: 10px solid var(--red); }
.joint.done { border-left-color: var(--yellow); }
.joint .bu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.joint .bu { font-size: 2.2rem; font-weight: 900; letter-spacing: .02em; }
.chip { display: inline-block; padding: 5px 11px; border-radius: 999px; font-weight: 800; font-size: .85rem; white-space: nowrap; }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.yellow { background: var(--yellow-bg); color: var(--yellow); }
.chip.green { background: var(--green-bg); color: var(--green); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin-top: 8px; }
.kv dt { color: var(--ink-2); font-size: .85rem; padding-top: 2px; }
.kv dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.targets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.targets div { background: var(--bg); border-radius: 10px; padding: 8px; text-align: center; }
.targets b { display: block; font-size: 1.35rem; }
.targets span { font-size: .8rem; color: var(--ink-2); }
.targets .full { background: var(--brand); color: var(--brand-ink); }
.targets .full span { color: #cfe0ec; }

/* siblings / next */
.sibs { display: flex; flex-wrap: wrap; gap: 8px; }
.sib { min-height: 44px; min-width: 84px; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--line);
  background: var(--card); font-weight: 800; text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.sib.done { background: var(--green-bg); border-color: transparent; color: var(--green); }
.sib.here { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.pick-sibs { margin: 6px 0 12px; }

/* manual entry: pick the drawing from the log */
.pick { display: grid; gap: 8px; }
.pick:not(:empty) { margin: -4px 0 12px; }
.pick-btn { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: var(--tap);
  padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 800; text-align: left; cursor: pointer; }
.pick-btn span small { display: block; font-weight: 600; font-size: .8rem; color: var(--ink-2); }
.pick-btn > small { font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.dwg { overflow-wrap: anywhere; }

.muted { color: var(--ink-2); }
.small { font-size: .85rem; }

/* form */
.field { margin: 12px 0; }
.field > label, .label { display: block; font-weight: 750; margin-bottom: 6px; }
.req::after { content: " *"; color: var(--red); }
input[type=text], input[type=number], input[type=date], input[type=search], input[type=password], select, textarea {
  width: 100%; min-height: var(--tap); padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.invalid { border-color: var(--red) !important; background: var(--red-bg) !important; }
.help { font-size: .85rem; color: var(--ink-2); margin-top: 4px; }
.warn-text { color: var(--red); font-weight: 700; font-size: .9rem; margin-top: 6px; }

.check { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.check:first-of-type { border-top: 0; }
.check .q { font-size: .95rem; }
.check.no .q { color: var(--red); font-weight: 700; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { min-width: 50px; min-height: 46px; border: 0; background: var(--card); font-weight: 900; font-size: 1rem; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--line); }
.seg button[aria-pressed=true].yes { background: var(--green); color: #fff; }
.seg button[aria-pressed=true].no { background: var(--red); color: #fff; }
.seg button[aria-pressed=true].na { background: #6b7785; color: #fff; }
.seg button[aria-pressed=true].opt { background: var(--brand); color: #fff; }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; }
.tq-seg .seg button:first-child { flex: 2; padding: 0 8px; }
.typed-tool { display: grid; gap: 6px; }
.typed-tool label { font-weight: 750; margin-top: 4px; }
.field .link-btn { display: block; padding-left: 0; text-align: left; justify-self: start; }

.sig-wrap { position: relative; border: 2px dashed var(--line); border-radius: 12px; background: #fff; touch-action: none; }
.sig-wrap canvas { display: block; width: 100%; height: 190px; border-radius: 12px; }
.sig-wrap .ph { position: absolute; left: 14px; bottom: 44px; right: 14px; border-bottom: 2px solid #c9d1d9; pointer-events: none; }
.sig-wrap .ph span { position: absolute; left: 0; top: 6px; color: #8a96a3; font-size: .85rem; }
.sig-wrap.signed .ph span { display: none; }
.sig-actions { display: flex; justify-content: flex-end; margin-top: 6px; }

.toggle { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.toggle input { width: 26px; height: 26px; accent-color: var(--red); }
.toggle.on { border-color: var(--red); background: var(--red-bg); font-weight: 700; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 58px; border: 0; border-radius: 14px;
  font-weight: 850; font-size: 1.1rem; cursor: pointer; text-decoration: none; padding: 12px 16px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.go { background: var(--green); color: #fff; }
.btn.ghost { background: var(--card); color: var(--ink); border: 2px solid var(--line); }
.btn.danger { background: var(--card); color: var(--red); border: 2px solid var(--red); }
.btn.small { min-height: 44px; font-size: .95rem; width: auto; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: grid; gap: 10px; margin-top: 12px; }
.btn-row.two { grid-template-columns: 1fr 1fr; }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 8px 4px; cursor: pointer; }

.banner { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; font-weight: 650; }
.banner.red { background: var(--red-bg); color: var(--red); }
.banner.yellow { background: var(--yellow-bg); color: var(--yellow); }
.banner.green { background: var(--green-bg); color: var(--green); }
.banner.blue { background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--ink); }
.banner ul { margin: 6px 0 0 18px; padding: 0; font-weight: 500; }

.done-hero { text-align: center; padding: 26px 16px; }
.done-hero .tick { font-size: 3.2rem; line-height: 1; color: var(--green); }
.done-hero h2 { font-size: 1.5rem; margin: 8px 0 4px; }

.hist { border-top: 1px solid var(--line); padding: 10px 0; }
.hist.old { opacity: .75; }
details summary { cursor: pointer; font-weight: 750; padding: 8px 0; min-height: 40px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.card > .list-row:first-child { border-top: 0; padding: 0; }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--card); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .modal-back { align-items: center; } .modal { border-radius: 18px; } }

/* scan a tag: live camera view */
.scan-btn { cursor: pointer; border: 0; background: var(--brand) !important; color: var(--brand-ink) !important; font: inherit; font-weight: 700; }
.scan-big { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 64px; border: 0; border-radius: 14px;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 850; font-size: 1.15rem; cursor: pointer; margin: 4px 0 12px; }
.scanner { position: fixed; inset: 0; z-index: 60; background: #000; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 50%; top: 50%; width: min(72vw, 72vh); aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 4px solid #fff; border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); pointer-events: none; }
.scan-hint { position: absolute; left: 16px; right: 16px; top: max(18px, env(safe-area-inset-top)); color: #fff; font-weight: 750;
  font-size: 1.05rem; text-align: center; text-shadow: 0 1px 3px #000; }
.scan-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); }
.scan-ctl { min-height: 52px; padding: 0 20px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .92); color: #111;
  font: inherit; font-weight: 800; display: inline-flex; align-items: center; cursor: pointer; }
.scan-ctl.on { background: #ffd54a; }
.scan-ctl.close { background: #c62828; color: #fff; }
.scan-ctl input { display: none; }
