/* The phone upload page and its Thank you page. Colours, buttons, fields, chips, toasts and the progress bar come from
   common.css; spacing follows its scale (--s1 to --s8). The theme follows the phone unless the person picks one. */
body { font-size: 17px; padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
main, .top-row, .who { max-width: 560px; margin-inline: auto; }
main { padding: 0 var(--s4) var(--s6); display: grid; gap: var(--s4); align-content: start; }
main p { margin: 0; }
#app { display: grid; gap: var(--s4); }

/* top bar: the mark, the page name, then the dashboard link, the theme and the language */
.top {
  position: sticky; top: 0; z-index: 6; background: var(--topbar); border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) var(--s4) 0; margin-bottom: var(--s5);
}
.top-row { display: flex; align-items: center; gap: var(--s3); min-height: 58px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #FFFFFF; flex: none; overflow: hidden; }
.brand-mark svg { display: block; width: 100%; height: 100%; }  /* the logo, inline (app.py LOGO) */
h1 { margin: 0; flex: 1; min-width: 0; display: grid; line-height: 1.15; }  /* the name over the page's job */
h1 b, h1 small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
h1 b { font-size: 19px; font-weight: 800; }
h1 small { font-size: 13px; font-weight: 700; color: var(--muted); }
.top-links { display: flex; align-items: center; gap: 2px; font-size: 15px; }
.lang-btn, .dash-btn { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; font-size: 15px; font-weight: 700; text-decoration: none; }
.dash-btn[hidden] { display: none; }
.who { margin: 0 auto; padding: 0 0 var(--s3); color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.who b { color: var(--text); }

/* sign in / sign up */
.form { display: grid; gap: var(--s3); padding: 24px 22px; }
.form h2 { font-size: 24px; margin-bottom: var(--s1); }
.form label { margin-top: var(--s1); font-size: 15px; }
.form .btn.primary { min-height: 52px; margin-top: var(--s2); font-size: 17px; }
.form select, .form input { min-height: 50px; }
.form .small { font-size: 15px; }
.form .mascot { margin-bottom: var(--s1); }  /* the mascot greets above the title */

/* the counters */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 10px;
  display: grid; gap: 2px; text-align: center;
}
.stat b { font-size: 26px; line-height: 1.15; }
.stat span { font-size: 13px; color: var(--muted); }
#stats + .bar { height: 8px; border-radius: 4px; }
#stats + .bar i { border-radius: 4px; }

/* the packs of this account */
.packs { display: grid; gap: var(--s3); }
#packs, .pack { scroll-margin-top: 112px; }  /* back from Thank you (?see): clear of the sticky top bar */
.pack { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 6px; }
.pack b { font-size: 18px; }
.pack-head { line-height: 1.5; }  /* label · writer · "2 of 3 in" · change: one line that wraps as a sentence */
.pack.done { background: color-mix(in oklab, var(--ok) 7%, var(--card)); border-color: color-mix(in oklab, var(--ok) 40%, var(--line)); }
.pack.asked { border-color: color-mix(in oklab, var(--bad) 50%, var(--line)); }
.pack.finished { opacity: .85; border-style: dashed; }
.pack .who-change { padding: 0 4px; font-size: 14px; }
.pack .who-missing { color: var(--busy); font-weight: 700; }
.pack .reshoot { display: flex; align-items: center; gap: 8px; color: var(--bad); font-weight: 700; }
.pack .reshoot-hint { color: var(--muted); font-size: 14px; }
.pack-actions { margin-top: var(--s2); display: flex; align-items: center; gap: var(--s3); }
.pack-actions .btn, .pack-done { width: 100%; min-height: 48px; font-size: 16px; }

/* "who wrote this pack?" / "are these sheets {name}'s?": a modal pop-up in the middle of the screen, one question at a
   time (upload.js). Centred, not a bottom sheet: a tap meant for the camera button never lands on an answer. */
.who-dialog {
  width: min(460px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-pop);
}
.who-dialog[open] { animation: who-in .2s ease-out; }
.who-dialog.arming .who-sheet { pointer-events: none; }  /* the first moment after it opens */
.who-sheet { position: relative; display: grid; gap: var(--s3); padding: 24px 20px 20px; outline: none; }
.who-sheet h2 { font-size: 20px; line-height: 1.4; }
.who-sheet:has(.who-x) h2 { padding-inline-end: 40px; }
.who-x { position: absolute; top: 12px; inset-inline-end: 12px; }
.who-sheet .hint { font-size: 14px; color: var(--muted); }
.pack-code {  /* the pack's label, e.g. B2 · W0001: always readable as one piece */
  display: inline-block; padding: 0 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
  font-weight: 800; white-space: nowrap; direction: ltr; unicode-bidi: isolate;
}
.who-picks { display: grid; gap: var(--s2); margin-top: var(--s1); }
.who-pick {
  display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 56px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); color: var(--text);
  font: inherit; font-size: 17px; font-weight: 700; text-align: start; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background-color .15s;
}
.who-pick bdi { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.who-pick .i { color: var(--muted); }
.who-pick:hover { border-color: var(--muted); }
.who-pick:active { transform: scale(.99); }
.who-pick.current, .who-pick.picked { border-color: var(--accent); }
.who-pick.current .i { color: var(--accent); }
.who-pick.picked { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.who-pick:disabled { cursor: default; }
.who-dialog.is-busy .who-pick:not(.picked) { opacity: .5; }
.who-picks .btn { width: 100%; min-height: 56px; font-size: 17px; white-space: normal; line-height: 1.3; }
.who-new { display: grid; gap: var(--s2); }
.who-new label { font-size: 15px; }
.who-new input { min-height: 52px; font-size: 17px; }
.who-new .btn.primary { min-height: 54px; font-size: 17px; margin-top: var(--s1); }
.who-new .link, .who-cancel { justify-self: center; font-size: 15px; min-height: 40px; }
.who-more { font-size: 14px; color: var(--muted); text-align: center; }
@keyframes who-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* photos with no QR: their answer cards */
.choices { display: grid; gap: var(--s2); }
.choice {
  display: flex; align-items: center; gap: var(--s3); min-height: 52px; padding: 10px 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); font-weight: 700;
}
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); }
.choice input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.who-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.who-actions .btn.primary { min-height: 52px; flex: 1; }

/* photos with no QR: "what is it and who wrote it?", and the ones to take again */
.photo-asks { display: grid; gap: var(--s3); }
.photo-ask { display: grid; gap: var(--s3); border-color: color-mix(in oklab, var(--busy) 50%, var(--line)); background: color-mix(in oklab, var(--busy) 5%, var(--card)); }
.photo-ask-top { display: grid; grid-template-columns: 64px 1fr; gap: var(--s3); align-items: start; }
.photo-ask h2 { font-size: 18px; margin: 0 0 4px; }
.photo-ask h3 { font-size: 15px; margin: 2px 0 0; color: var(--muted); }
.photo-ask .hint { font-size: 14px; color: var(--muted); }
.photo-ask .ask-nick { width: 100%; }
/* a pack page whose QR can't be read: "which sheet is this?" (the header line it is printed with, the pack, the page) */
.sheet-example { margin: 6px 0 0; font-weight: 700; font-size: 15px; }
.sheet-example bdi[dir="ltr"] { white-space: nowrap; }
.sheet-ask .sheet-pack { width: 100%; min-height: 50px; }
.choices.sheet-pages { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.photo-retake { border-color: color-mix(in oklab, var(--bad) 50%, var(--line)); }
.photo-retake .reshoot { color: var(--bad); font-weight: 700; }
.photo-retake .reshoot-hint { color: var(--muted); font-size: 14px; }

/* the photos sent from this phone: one card each, the state in its first line (icon and words) */
#queue-note { font-size: 15px; display: flex; align-items: center; gap: var(--s3); }
#queue-note:not(.working) .mark { display: none; }  /* the fast writer: only while photos are on their way */
.empty { color: var(--muted); text-align: center; padding: var(--s5) 0 var(--s6); display: grid; justify-items: center; gap: var(--s3); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.item {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.item.bad { background: color-mix(in oklab, var(--bad) 8%, var(--card)); border-color: color-mix(in oklab, var(--bad) 40%, var(--line)); }
.thumb { width: 64px; height: 84px; border-radius: var(--radius-sm); object-fit: cover; background: var(--panel-2); display: block; }
.title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.title .i { font-size: 18px; }
.item.ok .title .i { color: var(--ok); }
.item.bad .title .i { color: var(--bad); }
.item.busy .title .i { color: var(--busy); }
.msg { font-size: 15px; color: var(--muted); }
.item.ok .msg { color: var(--ok); }
.item.bad .msg { color: var(--bad); }
.progress { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: var(--s2); }
.progress i { display: block; height: 100%; background: var(--progress); transition: width .2s; }
.item .btn { margin-top: var(--s2); min-height: 44px; font-size: 15px; padding: 6px 16px; }
/* a refused photo: what to fix drawn on its thumbnail, bigger (green: a corner square read; red ring: one that
   couldn't be read; dashed red box: where the QR is) */
.item.marked { grid-template-columns: 120px 1fr; align-items: start; }
.thumb.marked { position: relative; width: 120px; height: auto; overflow: hidden; }
.thumb.marked img { display: block; width: 100%; height: 100%; }
.thumb.marked svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mk-ok { fill: none; stroke: var(--ok); stroke-width: 2; vector-effect: non-scaling-stroke; }
.mk-bad { fill: color-mix(in oklab, var(--bad) 15%, transparent); stroke: var(--bad); stroke-width: 3; vector-effect: non-scaling-stroke; }
.mk-qr { stroke-dasharray: 5 3; }
.marks-hint { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* how to photograph */
.tips { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.tips summary { font-weight: 700; cursor: pointer; }
.tips ul { margin: var(--s3) 0 var(--s1); padding-inline-start: 20px; display: grid; gap: 6px; }

/* the two big buttons, always at hand */
.actions {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3);  /* both labels on one line */
  padding: 12px max(16px, calc((100% - 560px) / 2)) calc(12px + env(safe-area-inset-bottom));
  background: var(--topbar); border-top: 1px solid var(--line);
}
.actions .btn { min-height: 58px; border-radius: 16px; white-space: nowrap; line-height: 1.25; text-align: center; padding: 8px 10px; font-size: 16px; gap: 8px; }
.actions .btn .i { font-size: 22px; }
/* the real file inputs: invisible but still tappable through their label */
.file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }

/* "Done": the Finished section and the thank-you screen */
.finished-box { display: grid; gap: var(--s2); }
.finished-box h2 { font-size: 16px; color: var(--muted); margin: 0; }
.thanks { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: var(--backdrop); }
.thanks[hidden] { display: none; }
.thanks-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 32px 24px; max-width: 420px; width: 100%;
  text-align: center; display: grid; gap: var(--s3); box-shadow: var(--shadow-pop);
}
.thanks-mark { font-size: 44px; color: var(--ok); line-height: 1; }
.thanks-card h2 { font-size: 26px; margin: 0; }
.thanks-card .hint { font-size: 14px; color: var(--muted); }
.thanks-card .btn { min-height: 52px; margin-top: var(--s2); }

/* the Thank you page (thanks.html): a pack with every page in, the next step first; in the middle of the phone */
.thanks-page { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }  /* no camera bar on this page */
.thanks-page main { min-height: calc(100dvh - 140px); align-content: center; }
.thanks-done { max-width: 420px; width: 100%; margin: 0 auto; display: grid; justify-items: center; gap: var(--s3); text-align: center; }
.thanks-done .mascot { margin-bottom: var(--s2); }
.thanks-done h2 { font-size: 30px; line-height: 1.2; }
.th-pack { font-size: 18px; line-height: 1.45; }
.th-pack bdi { font-weight: 800; white-space: nowrap; }
.th-actions { width: 100%; display: grid; gap: var(--s3); margin-top: var(--s4); }
.th-actions .btn { min-height: 48px; font-size: 16px; }
.th-actions .btn.primary { min-height: 60px; border-radius: 16px; font-size: 18px; gap: 10px; }
.th-actions .btn .i { font-size: 22px; }
.th-others {
  width: 100%; margin-top: var(--s3); padding: 14px 16px; display: grid; gap: var(--s2); text-align: start;
  background: var(--busy-bg); border: 1px solid color-mix(in oklab, var(--busy) 40%, var(--line)); border-radius: var(--radius);
}
.th-others p { font-weight: 700; }
.th-others ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 2px; font-size: 15px; }
.th-others .btn { min-height: 48px; }

/* photo result cards: a line that holds a name or text from the data follows its own direction */
.item .msg, .reshoot, .item .title bdi { unicode-bidi: plaintext; }

/* soft note: a pack of another group is accepted, the coordinator reviews it */
.pool-note, .item.ok .pool-note { color: var(--busy); font-weight: 600; }

@media (max-width: 420px) {  /* the page name keeps its room: the language button shows only its icon (its word stays for screen readers) */
  .top-links .lang-label, .top-links .dash-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .lang-btn, .dash-btn { width: 40px; padding: 0; justify-content: center; }
}
