/* SKYL ERP Field - the phone app of the Delivery and Technician logins.
   Mobile first: one column, big touch targets, readable outdoors. It fits any
   screen: nothing is wider than the phone (no sideways scroll, no zoom-out),
   type and spacing follow the screen width, the main actions sit in a bar at
   the bottom, and the sheets and the camera fit the height that is visible. */
:root {
  color-scheme: light;
  --bg: #f3f1ec;
  --card: #ffffff;
  --text: #1f252d;
  --muted: #66707b;
  --line: #dcd8cf;
  --accent: #2f4a66;
  --accent-2: #3d6491;
  --accent-soft: #e6edf5;
  --ok: #1f7a46;
  --ok-soft: #e3f3e9;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --bad: #b3261e;
  --bad-soft: #fbe7e5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 45, .08), 0 2px 8px rgba(20, 30, 45, .06);
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Nirmala UI', sans-serif;
  --bar-h: 60px;                                   /* the top bar - the tabs stick under it */
  --act-h: 72px;                                   /* the action bar at the bottom */
  --pad: clamp(10px, 3.4vw, 18px);                 /* the screen's side margin */
  --vh: 1vh;                                       /* 1% of the visible height (dvh: the browser's bars left out) */
  /* the camera box at most: under half the screen, and what the number box
     below it needs left over (in em, so a larger text size leaves it room) */
  --cam-h: min(calc(46 * var(--vh)), calc(100 * var(--vh) - var(--bar-h) - 21em));
}
@supports (height: 1dvh) { :root { --vh: 1dvh; } }
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  font-size: clamp(15px, calc(10.5px + 1.25vw), 17px);   /* 15px on a phone, up to 17px on a wide screen */
  scroll-padding-top: calc(var(--bar-h) + env(safe-area-inset-top) + 10px);
}
html:has(.actions) { scroll-padding-bottom: calc(var(--act-h) + env(safe-area-inset-bottom) + 10px); }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ui); font-size: 1rem; line-height: 1.4; color: var(--text); background: var(--bg);
  min-height: 100vh; min-height: 100dvh; -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: clip;                                /* never sideways (the last guard against a zoomed-out page) */
  overflow-wrap: break-word;
}
button, input, textarea, select { font: inherit; color: inherit; }
/* iOS zooms the page into a box whose text is under 16px when it is tapped */
input, select, textarea { font-size: max(16px, 1rem); }
img, video, canvas { max-width: 100%; }
a { color: var(--accent-2); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wide-only { display: none; }
@media (min-width: 400px) { .wide-only { display: inline; } }

/* ---- top bar + tabs ---- */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; min-height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: calc(8px + env(safe-area-inset-top)) var(--pad) 8px; background: var(--accent); color: #fff;
}
.bar .logo { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.bar .who { flex: 1; min-width: 0; line-height: 1.2; }
.bar .who b { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .who small { display: block; font-size: .8rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .icon-btn { flex: none; background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 8px; min-width: 44px; height: 44px; padding: 0 10px; font-size: .933rem; white-space: nowrap; cursor: pointer; }
.bar .icon-btn:active { background: rgba(255,255,255,.26); }
.tabs { display: flex; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top)); z-index: 19; }
.tabs button { flex: 1; min-width: 0; min-height: 48px; border: 0; background: none; padding: 10px 6px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: .8rem; }

/* ---- layout ---- */
main { max-width: 720px; margin: 0 auto; padding: 14px var(--pad) calc(var(--act-h) + 48px); }
h1 { font-size: 1.333rem; margin: 4px 0 12px; overflow-wrap: anywhere; }
h2 { font-size: .867rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 18px 2px 8px; font-weight: 700; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(12px, 3.6vw, 16px); margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: .867rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
/* a heading and its badge: the badge goes under the heading when they do not fit side by side */
.card > .row:first-child { flex-wrap: wrap; row-gap: 6px; }
.card > .row:first-child > .grow { flex: 1 1 12em; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: .867rem; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 340px) { .kv { grid-template-columns: minmax(0, 1fr); row-gap: 0; } .kv dd { margin-bottom: 6px; } }
.text-block { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; border: 0; background: none; color: var(--accent-2); font-weight: 600; padding: 4px 10px 4px 0; margin-bottom: 2px; cursor: pointer; font-size: 1rem; }

/* ---- buttons + fields ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text); text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 56px; font-size: 1.133rem; }
.btn.sm { min-height: 44px; padding: 6px 12px; font-size: .933rem; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.field { display: block; margin-bottom: 12px; }
.field > span, .field > label { display: block; font-size: .867rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.input, .field input, .field textarea {
  width: 100%; min-height: 50px; padding: 10px 12px; border: 1px solid #c9c4b9; border-radius: 10px; background: #fff;
}
.field textarea, textarea.input { min-height: 84px; resize: vertical; }
.input:focus, .field input:focus, .field textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(61,100,145,.2); }
.pw { position: relative; }
.pw input { padding-right: 70px; }
.pw button { position: absolute; right: 3px; top: 3px; height: 44px; min-width: 60px; border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 0 10px; font-size: .867rem; font-weight: 600; cursor: pointer; }
.error { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-weight: 500; overflow-wrap: anywhere; }
.note { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }

/* ---- sign-in ---- */
.login { max-width: 420px; margin: 0 auto; padding: calc(clamp(14px, 4vh, 28px) + env(safe-area-inset-top)) var(--pad) 40px; }
.login .brand { text-align: center; margin-bottom: 18px; }
.login .brand img { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); }
.login .brand h1 { margin: 10px 0 2px; font-size: 1.467rem; }
.login .brand p { margin: 0; color: var(--muted); font-size: .933rem; }
.install { margin-top: 18px; padding: 14px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.install b { display: block; margin-bottom: 4px; }
.install ol { margin: 6px 0 0; padding-left: 20px; }
.login .foot { margin-top: 18px; text-align: center; font-size: .867rem; color: var(--muted); }

/* ---- badges ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.wip { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

/* ---- lists ---- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: flex; gap: 12px; align-items: center; border: 0; width: 100%; min-height: 56px; text-align: left; cursor: pointer; }
.item .main { flex: 1; min-width: 0; }
.item .main b { display: block; overflow-wrap: anywhere; }
.item .main small { display: block; color: var(--muted); font-size: .867rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .side { text-align: right; font-size: .867rem; color: var(--muted); flex: none; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; background: var(--card); border-radius: var(--radius); }

/* the technician's job list: Job Card, Customer, Required date, Status, Open -
   a card per job on a phone (number and status, the customer, the required
   date and Open), a table from 640px */
.jobs { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.jobs .jh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.jobs .jr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "no st" "cust cust" "when open"; gap: 6px 10px; align-items: center; padding: 12px 14px; }
.jobs .jr + .jr { border-top: 1px solid var(--line); }
.jobs .jr > :nth-child(1) { grid-area: no; }
.jobs .jr > :nth-child(2) { grid-area: cust; }
.jobs .jr > :nth-child(3) { grid-area: when; }
.jobs .jr > :nth-child(4) { grid-area: st; justify-self: end; }
.jobs .jr > :nth-child(5) { grid-area: open; justify-self: end; }
.jobs .jr b { overflow-wrap: anywhere; }
.jobs .jr .cust { min-width: 0; }
.jobs .jr .cust span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.jobs .jr .cust small { display: block; color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobs .jr .lbl { color: var(--muted); font-size: .867rem; }
.jobs .jr .req { font-size: .933rem; }
.jobs .jr .req.late { color: var(--bad); font-weight: 700; }
.jobs .jr .req.today { color: var(--warn); font-weight: 700; }
.jobs .jr .btn { min-height: 44px; padding: 6px 18px; }
@media (min-width: 640px) {
  .jobs .jh { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .jobs .jh, .jobs .jr { display: grid; grid-template-columns: 5rem minmax(0, 1fr) 5.5rem 6.5rem 5rem; grid-template-areas: none; gap: 8px; align-items: center; padding: 10px 14px; }
  .jobs .jh { background: #f7f5f1; font-size: .8rem; color: var(--muted); font-weight: 700; }
  .jobs .jr { border-top: 1px solid var(--line); }
  .jobs .jr > :nth-child(n) { grid-area: auto; justify-self: stretch; }
  .jobs .jr .lbl { display: none; }
  .jobs .jr .req { font-size: .867rem; }
  .jobs .jr .btn { width: 100%; padding: 6px 4px; }
}

/* ---- scanner: the camera, and the bill number typed ----
   The camera box never takes more than its share of the visible height, so the
   number box stays on screen; side by side on a wide or turned phone */
.scan { display: grid; gap: 0 14px; }
.cam { position: relative; background: #111; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; width: min(100%, calc(max(var(--cam-h), 120px) * 4 / 3)); margin: 0 auto; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam .aim { position: absolute; left: 10%; right: 10%; top: 30%; bottom: 30%; border: 3px solid rgba(255,255,255,.9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.3); }
.cam .aim::after { content: ''; position: absolute; left: 8px; right: 8px; top: 50%; height: 2px; background: #ff5a4f; animation: scanline 1.6s ease-in-out infinite alternate; }
@keyframes scanline { from { transform: translateY(-26px); } to { transform: translateY(26px); } }
@media (prefers-reduced-motion: reduce) { .cam .aim::after { animation: none; } }
#cam-note { margin: 8px 0 12px; }
.find-row { display: flex; flex-wrap: wrap; gap: 8px; }
.find-row input { flex: 2 1 9em; min-width: 0; }
.find-row .btn { flex: 1 0 auto; }
.scan .hint { margin: 8px 0 0; font-size: .867rem; }
@media (orientation: landscape) and (min-width: 560px) { .scan { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

/* ---- bill lines (delivery): the tick, the item, the qty handed over (under the item on a phone) ---- */
.line { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.line:first-of-type { border-top: 0; }
.chk { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -6px 0 0 -8px; cursor: pointer; }
.chk input[type="checkbox"] { width: 26px; height: 26px; margin: 0; accent-color: var(--accent); cursor: pointer; }
span.chk { color: var(--ok); font-weight: 700; cursor: default; }
.line .info { min-width: 0; }
.line .info b { display: block; overflow-wrap: anywhere; }
.line .info small { display: block; color: var(--muted); font-size: .867rem; overflow-wrap: anywhere; }
.line.done { opacity: .6; }
.qty { grid-column: 2; display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.qty button { width: 44px; height: 44px; flex: none; border: 1px solid var(--line); background: #faf9f6; border-radius: 8px; font-size: 1.2rem; cursor: pointer; }
.qty input { width: 4.6em; min-height: 44px; text-align: center; border: 1px solid #c9c4b9; border-radius: 8px; padding: 4px; }
@media (min-width: 520px) {
  .line { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 12px; }
  .qty { grid-column: 3; grid-row: 1; margin-top: 0; }
}
.photo-box { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.photo-box img { width: clamp(72px, 24vw, 120px); height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #eee; }
.photo-box .ph-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-opt { color: var(--muted); font-weight: 600; font-size: .867rem; text-transform: none; letter-spacing: 0; }
.line .info .rate-line { color: var(--text); }
.line .info small b { display: inline; }

/* ---- View bill (sheet) ---- */
.bv-line { border-top: 1px solid var(--line); padding: 10px 0; }
.bv-line:first-of-type { border-top: 0; }
.bv-line .row { flex-wrap: wrap; row-gap: 4px; }
.bv-line .grow { flex: 1 1 12em; }
.bv-line .grow b { display: block; overflow-wrap: anywhere; }
.bv-line .grow small { display: block; font-size: .833rem; overflow-wrap: anywhere; }
.bv-line > small { display: block; color: var(--muted); font-size: .867rem; margin-top: 2px; }
.bv-nums { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; margin-top: 4px; font-size: .933rem; }
.bv-who { margin: 6px 0 0; padding-left: 18px; font-size: .867rem; }
.bv-who li { margin: 3px 0; }
.bv-who .btn.sm { min-width: 44px; padding: 2px 8px; font-size: .867rem; vertical-align: middle; }
.proof-img { display: block; width: 100%; max-height: min(calc(56 * var(--vh)), 520px); object-fit: contain; border-radius: 10px; background: #111; }

/* ---- job card work lines: the qty and the rate, then the amount (one row from 480px) ---- */
.wl { border-top: 1px solid var(--line); padding: 10px 0; }
.wl:first-of-type { border-top: 0; }
.wl .desc { position: relative; }
.wl .desc b { display: block; overflow-wrap: anywhere; }
.wl .desc small { display: block; color: var(--muted); font-size: .833rem; overflow-wrap: anywhere; }
.wl .nums { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "qty rate" "amt end"; gap: 8px; margin-top: 8px; align-items: end; }
.wl .nums > :nth-child(1) { grid-area: qty; }
.wl .nums > :nth-child(2) { grid-area: rate; }
.wl .nums > :nth-child(3) { grid-area: amt; }
.wl .nums > :nth-child(4) { grid-area: end; justify-self: end; }
@media (min-width: 480px) {
  .wl .nums { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1fr) 44px; grid-template-areas: "qty rate amt end"; }
  .wl .nums .amt { justify-content: flex-end; }
}
.wl .nums label, .wl .nums .lbl { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }
.wl .rate { min-height: 44px; display: flex; align-items: center; justify-content: flex-end; padding: 0 8px; border-radius: 8px; background: #f1efea; color: var(--muted); font-weight: 600; white-space: nowrap; }
.part-search { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.part-search .desc { position: relative; flex: 1; min-width: 0; }
.part-search .btn.sm { min-height: 50px; }
/* the part search open: room below it to scroll it up to the top, its list under it */
body.ps-open main { padding-bottom: calc(70 * var(--vh)); }
/* the job card's warranty status on Work details */
.wty { border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.wty span { display: block; font-weight: 700; }
.wty small { display: block; font-size: .867rem; }
.wty.yes { background: var(--ok-soft); color: var(--ok); }
.wty.no { background: #f1efea; color: var(--text); }
.wty.no small { color: var(--muted); }
.wl .nums input { width: 100%; min-height: 44px; padding: 6px 8px; border: 1px solid #c9c4b9; border-radius: 8px; text-align: right; background: #fff; }
.wl .amt { min-height: 44px; display: flex; align-items: center; justify-content: flex-start; font-weight: 700; white-space: nowrap; }
.wl .del { width: 44px; height: 44px; border: 0; background: var(--bad-soft); color: var(--bad); border-radius: 8px; font-size: 1.067rem; cursor: pointer; }
.wl .lock { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.wl.locked input { background: #f1efea; color: var(--muted); }
.wl .why { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.sugg { position: absolute; left: 0; right: 0; top: 100%; z-index: 15; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: min(260px, calc(42 * var(--vh))); overflow: auto; overscroll-behavior: contain; margin-top: 4px; }
.sugg button { display: flex; width: 100%; min-height: 48px; gap: 8px; justify-content: space-between; align-items: center; border: 0; background: none; padding: 10px 12px; text-align: left; border-top: 1px solid #f0ede7; cursor: pointer; }
.sugg button > span { min-width: 0; overflow-wrap: anywhere; }
.sugg button > small { flex: none; }
.sugg button:first-child { border-top: 0; }
.sugg button:active, .sugg button:focus { background: var(--accent-soft); outline: none; }
.sugg small { color: var(--muted); }
.totals { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; margin-top: 10px; padding-top: 10px; border-top: 2px solid var(--line); }
.totals b { text-align: right; }

/* ---- the action bar stuck to the bottom (its buttons in line with the page on a wide screen) ---- */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; gap: 10px;
  padding: 10px max(var(--pad), calc((100% - 720px) / 2 + var(--pad))) calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(6px);
}
.actions .btn { flex: 1; min-width: 0; min-height: 52px; }
.actions .btn.big { min-height: 52px; font-size: 1.067rem; }
.actions .btn.ok { flex: 1.5; }
/* the delivery's photo in the bar: the camera icon (and "Photo" on a wider phone); ✓ once taken */
.actions .btn.photo { position: relative; flex: 0 0 auto; min-width: 56px; padding: 8px 14px; font-size: 1.2rem; }
.actions .btn.photo .wide-only { font-size: 1rem; }
.actions .btn.photo.taken { border-color: var(--ok); background: var(--ok-soft); }
.actions .btn.photo.taken::after { content: '✓'; position: absolute; top: 2px; right: 5px; color: var(--ok); font-weight: 800; font-size: .867rem; line-height: 1; }

/* ---- sheets (confirm, photo) + toast ---- */
.sheet-back { position: fixed; inset: 0; background: rgba(15, 22, 32, .5); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  --sheet-pb: calc(16px + env(safe-area-inset-bottom));
  background: var(--card); width: 100%; max-width: 560px; border-radius: 16px 16px 0 0; padding: 18px var(--pad) var(--sheet-pb);
  max-height: 92vh; max-height: calc(92 * var(--vh)); overflow: auto; overscroll-behavior: contain;
}
.sheet h3 { margin: 0 0 10px; font-size: 1.2rem; overflow-wrap: anywhere; }
.sheet .row { margin-top: 14px; }
.sheet .row .btn { flex: 1; }
/* the sheet's buttons stay at its foot while what is above them scrolls */
.sheet > .row:last-child {
  position: sticky; bottom: calc(-1 * var(--sheet-pb)); z-index: 1; margin: 14px calc(-1 * var(--pad)) calc(-1 * var(--sheet-pb));
  padding: 10px var(--pad) var(--sheet-pb); background: var(--card); border-top: 1px solid var(--line);
}
.toast {
  position: fixed; left: 50%; bottom: calc(var(--act-h) + 14px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: #1f252d; color: #fff; padding: 10px 16px; border-radius: 10px; max-width: calc(100% - 32px); z-index: 60;
  transition: opacity .2s, transform .2s; pointer-events: none; font-weight: 500; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.done-card { text-align: center; padding: 28px 16px; }
.done-card .tick { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 40px; line-height: 72px; margin: 0 auto 10px; }
.done-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5em, 1fr)); gap: 10px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.offline { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .867rem; padding: 6px; font-weight: 600; }

/* ---- a phone turned sideways: little height, so everything is tighter ---- */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --bar-h: 52px; --act-h: 60px; --cam-h: calc(100 * var(--vh) - var(--bar-h) - 10em); }   /* the number box sits beside it */
  html { font-size: 15px; }
  .bar { padding-top: calc(4px + env(safe-area-inset-top)); padding-bottom: 4px; }
  main { padding-top: 6px; }
  h1 { margin: 0 0 6px; }
  .btn.big { min-height: 48px; }
  .actions { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .actions .btn, .actions .btn.big { min-height: 46px; }
  .done-card { padding: 12px 16px; }
  .done-card .tick { width: 44px; height: 44px; line-height: 44px; font-size: 26px; margin-bottom: 4px; }
  /* sign in: the logo beside the name, the boxes two by two */
  .login { max-width: 680px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .login .brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; text-align: left; }
  .login .brand img { width: 44px; height: 44px; border-radius: 12px; }
  .login .brand h1 { margin: 0; font-size: 1.2rem; }
  #lg-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; align-items: end; }
  #lg-form .btn { margin-bottom: 12px; }
}
