/* Field App. The portal's look (Mike, 26 Nov 2026: "match the design of the portal"; docs/app-standards.md, House
 * style): navy #0d1a36 and orange #f7941d from the logo, a light grey page (#f4f7fa) with white cards, the same type.
 * No dark-mode block. Crew screens keep big tap targets for gloved hands in sunlight; the office side has the portal's
 * navy menu down the left on a wide screen. */
:root {
  color-scheme: only light;
  --navy: #0d1a36; --brand: #0d1a36; --orange: #f7941d; --soft: #fff5e8;
  --ink: #16202a; --muted: #64707d; --line: #e3e8ee; --bg: #f4f7fa; --card: #ffffff;
  --good: #1a7f37; --bad: #b42318; --warn: #9a6700;
  --r: 12px; --side: 248px;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
main { padding: 14px 16px calc(32px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
main.office { max-width: 1400px; padding: 22px 24px; }
main.narrow { max-width: 760px; }
h1 { font-size: 18px; margin: 0; text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
h2 { font-size: 14px; color: var(--ink); margin: 24px 0 10px; text-transform: uppercase; letter-spacing: .04em; border-left: 4px solid var(--orange); padding-left: 8px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
h4 { margin: 0 0 6px; font-size: 15px; }
p { line-height: 1.45; }
label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 14px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
input, select, textarea { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid #cfd6de; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy); outline-offset: 0; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--navy); }
textarea { resize: vertical; }
a { color: var(--navy); }
.muted { color: var(--muted); }
.small, small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.pre { white-space: pre-wrap; }
.warn { color: var(--bad); font-weight: 600; }
.req { color: var(--bad); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row > input, .row > select { flex: 1; }
.grow { flex: 1; }

/* top bar (crew, Field Support, inspector): white, like the portal's */
header.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: #fff; border-bottom: 1px solid var(--line); }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--soft); color: var(--navy); }
.chip.ok { color: var(--good); background: #eaf6ee; } .chip.wait { color: var(--warn); background: var(--soft); } .chip.busy { color: var(--navy); } .chip.bad { color: #fff; background: var(--bad); }

/* buttons: navy like the portal's, orange for the one action that matters on a screen */
.btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 12px 18px; border: 1px solid var(--navy); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; }
.btn:hover { filter: brightness(1.08); }
.btn.primary { background: var(--navy); color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.sm { padding: 6px 11px; min-height: 36px; font-size: 14px; font-weight: 500; }
.btn.block { display: flex; width: 100%; margin: 12px 0; }
.btn.camera { width: 100%; min-height: 72px; font-size: 18px; background: #fff; border: 2px dashed var(--orange); color: var(--navy); margin: 8px 0; }
.btn:disabled { opacity: .45; cursor: default; }
.x { border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; padding: 4px 8px; }

/* the crew's five big buttons: navy cards with the orange edge, Job finished in green */
.buttons { display: flex; flex-direction: column; gap: 12px; }
.big { font: inherit; font-size: 22px; font-weight: 700; min-height: 80px; border-radius: 14px; border: 0; border-left: 8px solid var(--orange); color: #fff; background: var(--navy); cursor: pointer; text-align: left; padding: 0 22px; box-shadow: 0 1px 2px rgba(16,32,48,.08); }
.big.b5 { background: var(--good); border-left-color: #0f5a26; }
.notes { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: 8px; padding: 10px 14px; margin: 0; }
.notes p { margin: 6px 0 0; }

.search { margin-bottom: 10px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.jobrow { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; font: inherit; color: var(--ink); text-align: left; padding: 14px; border: 1px solid var(--line); border-top: 3px solid var(--navy); border-radius: var(--r); background: #fff; cursor: pointer; margin-bottom: 8px; }
.jobrow:hover { border-color: var(--orange); }

.card { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 12px 0; background: #fff; box-shadow: 0 1px 2px rgba(16,32,48,.04); }
.card.done { opacity: .55; }
details.card summary { cursor: pointer; font-weight: 600; }
.lead { color: var(--muted); }
.q { margin: 12px 0; }
.q label { margin: 0 0 6px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { font: inherit; color: var(--ink); min-width: 52px; min-height: 48px; padding: 8px 14px; border-radius: 8px; border: 1px solid #cfd6de; background: #fff; cursor: pointer; text-align: left; }
.opt.wide { min-width: 120px; text-align: center; }
.opt.check { width: 100%; }
.opt.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.hint { color: var(--warn); font-weight: 600; min-height: 1em; }
.hint.ok { color: var(--good); }
ul.signed { padding-left: 0; list-style: none; }

.strip { display: flex; flex-direction: column; gap: 10px; }
.shot { position: relative; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; background: #fff; }
.shot img { width: 100%; max-height: 260px; object-fit: contain; border-radius: 8px; background: var(--bg); }
.shot .x { position: absolute; top: 4px; right: 4px; background: #fff; border-radius: 99px; }
.shot select, .shot .note { margin-top: 6px; }
.row.small { margin-top: 6px; }

.veil { position: fixed; inset: 0; background: rgba(13,26,54,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.veil.full { flex-direction: column; background: #000; padding: 0; }
.dialog { background: #fff; border-radius: 14px; padding: 18px; max-width: 420px; width: 100%; box-shadow: 0 8px 24px rgba(16,32,48,.18); }
.dialog.wide { max-width: 640px; max-height: 80vh; overflow: auto; }
.dialog .big { font-size: 19px; }
.dialog .ask { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.dialog .row { justify-content: flex-end; margin-top: 12px; }
.drawbar { display: flex; gap: 6px; padding: calc(8px + env(safe-area-inset-top)) 8px 8px; background: #fff; width: 100%; justify-content: center; flex-wrap: wrap; }
canvas.draw { max-width: 100%; max-height: calc(100vh - 80px); touch-action: none; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 60; max-width: 90vw; transition: opacity .5s; }
.toast.bad { background: var(--bad); }
.toast.go { opacity: 0; }

/* sign-in: the portal's card */
.signin-wrap { max-width: 460px; }
.signin { max-width: 420px; margin: 9vh auto; text-align: center; border-top: 5px solid var(--orange); }
.signin input { margin: 6px 0; text-align: center; }
.signin h1 { font-size: 24px; margin: 4px 0 6px; white-space: normal; }
.biglogo { display: block; width: 240px; max-width: 80%; height: auto; margin: 0 auto 6px; }

.tabs { display: flex; gap: 4px; margin: 4px 0 12px; }
.tabs button { flex: 1; font: inherit; color: var(--ink); padding: 10px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* office: the portal's navy menu down the left on a wide screen, a navy bar across the top on a phone */
.office-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.office-top .brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 15px; }
.office-top .brand img { height: 26px; width: auto; background: #fff; border-radius: 6px; padding: 3px 6px; }
.office-top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.office-top nav button { font: inherit; font-size: 14.5px; border: 0; background: none; color: #e6eef5; padding: 8px 12px; border-radius: 9px; cursor: pointer; text-align: left; }
.office-top nav button:hover { background: rgba(255,255,255,.08); }
.office-top nav button.on { background: var(--orange); color: var(--navy); font-weight: 600; }
.office-top .me { font: inherit; font-size: 13px; color: #9fb6c9; background: none; border: 0; cursor: pointer; padding: 6px 4px; text-align: left; }
.office-top .me:hover { color: #fff; }
.bell { position: relative; font-size: 20px; border: 0; background: none; cursor: pointer; color: #fff; }
.bell span { position: absolute; top: -4px; right: -6px; background: var(--orange); color: var(--navy); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 5px; }
.bell span:empty { display: none; }
@media (min-width: 900px) {
  .office-top { position: fixed; inset: 0 auto 0 0; width: var(--side); flex-direction: column; align-items: stretch; flex-wrap: nowrap; padding: 16px 12px; gap: 10px; overflow-y: auto; }
  .office-top .brand { display: block; background: #fff; color: var(--navy); border-radius: 12px; padding: 10px; text-align: center; }
  .office-top .brand img { display: block; width: 100%; height: auto; max-height: 70px; padding: 0; border-radius: 0; }
  .office-top .brand span { display: block; margin-top: 4px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--navy); }
  .office-top nav { flex-direction: column; flex: 1; }
  .office-top nav button { padding: 9px 12px; }
  .office-top .bell { align-self: flex-start; margin-left: 12px; }
  .office-top + main.office, .office-top ~ main { margin-left: var(--side); max-width: none; }
}
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.grid th { text-align: left; color: var(--ink); font-weight: 600; background: #f6f8fa; border-bottom: 1px solid var(--line); padding: 8px 11px; position: sticky; top: 0; }
table.grid td { border-bottom: 1px solid var(--line); padding: 8px 11px; vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.click { cursor: pointer; }
table.grid tr.click:hover { background: var(--soft); }
table.scores td.big { font-size: 20px; font-weight: 700; color: var(--navy); background: none; min-height: 0; border: 0; box-shadow: none; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--soft); color: var(--navy); margin: 2px; }
.pill.off { opacity: .5; }
.pill.test { background: var(--soft); color: #9a4a12; margin-left: 8px; font-weight: 600; border: 1px solid #f7c99a; }
.flags { background: #fff; border: 1px solid #f3c2bd; border-left: 4px solid var(--bad); border-radius: var(--r); padding: 4px 16px 12px; margin-bottom: 16px; }
.flag { border-bottom: 1px solid var(--line); padding: 8px 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.gallery img, .gallery figure img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; background: var(--line); cursor: zoom-in; }
.gallery figure { margin: 0; }
.gallery figcaption { font-size: 12px; color: var(--muted); }
.notice { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.notice.unread span { font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; align-items: end; }
.qa { padding: 3px 0; font-size: 14px; }
@media (max-width: 700px) { table.grid { font-size: 13px; } main.office { padding: 14px 12px; } }
.loadbar { position: fixed; top: 0; left: 0; height: 3px; width: 40%; background: var(--orange); z-index: 70; animation: load 1s ease-in-out infinite; }
@keyframes load { from { left: -40%; } to { left: 100%; } }

/* View as (admins) */
.viewasbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; gap: 12px; align-items: center; justify-content: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--orange); color: var(--navy); font-size: 15px; }
.viewasbar .btn { background: #fff; color: var(--navy); border-color: #fff; }
body.viewing-as main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
body.viewing-as .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
.viewaspick { width: auto; padding: 6px 10px; font-size: 14px; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.viewaspick option { color: var(--ink); }

/* office on a phone: one compact bar, the menu scrolls sideways, wide tables scroll inside themselves */
@media (max-width: 899px) {
  .office-top { gap: 8px 10px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; }
  .office-top .brand img { height: 22px; }
  .office-top nav { order: 9; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .office-top nav::-webkit-scrollbar { display: none; }
  .office-top nav button { white-space: nowrap; flex: none; }
  .office-top .bell { margin-left: auto; }
  .office-top .viewaspick { max-width: 140px; font-size: 13px; }
  table.grid { display: block; overflow-x: auto; white-space: nowrap; }
}
/* an empty list says so instead of showing bare headings */
table.grid:has(tbody:empty)::after { content: "Nothing yet."; display: block; padding: 12px; color: var(--muted); font-size: 14px; }

/* the app's own camera: full screen, one big shutter, the last photo and Done */
.cam { position: fixed; inset: 0; z-index: 80; background: #000; display: flex; flex-direction: column; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: camflash .25s ease-out; }
@keyframes camflash { from { opacity: .7; } to { opacity: 0; } }
.cam-top, .cam-bottom, .cam-foot { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; }
.cam-top { padding-top: calc(12px + env(safe-area-inset-top)); }
.cam-bottom { margin-top: auto; padding-bottom: 8px; }
.cam-foot { justify-content: center; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.cam-close, .cam-light { width: 48px; height: 48px; border-radius: 99px; border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 26px; cursor: pointer; }
.cam-light.on { background: var(--orange); }
.cam-count { min-width: 48px; text-align: center; color: #fff; font-weight: 700; font-size: 18px; background: rgba(0,0,0,.45); border-radius: 99px; padding: 6px 12px; }
.cam-count:empty { visibility: hidden; }
.cam-shutter { width: 84px; height: 84px; border-radius: 99px; border: 6px solid #fff; background: var(--orange); cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.cam-shutter:active { transform: scale(.92); }
.cam-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; border: 2px solid #fff; background: rgba(255,255,255,.15); }
.cam-thumb:not([src]) { visibility: hidden; }
.cam .cam-done { min-width: 96px; background: var(--orange); border-color: var(--orange); color: var(--navy); }
.cam-phone { background: none; border: 0; color: #fff; text-decoration: underline; font: inherit; font-size: 14px; opacity: .85; cursor: pointer; }
