/* SOLVE brand tokens — lifted from solve-booking-app/src/app/globals.css so the
   expense form matches the solar booking app and the training portal. */
:root {
  --core: #1C2418;
  --concrete: #E8ECE1;
  --green: #25B34B;
  --green-dark: #1e943c;
  --white: #FFFFFF;
  --error: #C0392B;

  --bg: var(--concrete);
  --surface: var(--white);
  --text: var(--core);
  --muted: #5A6455;
  --border: #D5D9CF;
  --input-bg: var(--concrete);
  --input-focus-bg: var(--white);
  --placeholder: #9AA193;
  --card-shadow: 0 8px 30px rgba(28, 36, 24, 0.08);
  --logo-filter: brightness(0) saturate(100%);
  --error-bg: rgba(192, 57, 43, 0.08);
  --error-border: rgba(192, 57, 43, 0.25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121710;
    --surface: #1C2418;
    --text: #E8ECE1;
    --muted: #B9C0B2;
    --border: #3A4336;
    --input-bg: #121710;
    --input-focus-bg: #252D20;
    --placeholder: #7A8272;
    --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    --logo-filter: brightness(0) invert(1);
    --error-bg: rgba(239, 68, 68, 0.12);
    --error-border: rgba(239, 68, 68, 0.35);
    --error: #F87171;
  }
}

* { box-sizing: border-box; }
/* Several rules below set display:flex/grid, which beats the `hidden`
   attribute's UA style. Without this, hidden elements still show. */
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

/* masthead */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.masthead img { height: 22px; width: auto; filter: var(--logo-filter); display: block; }
.tag {
  font-size: 11px; font-weight: 500; letter-spacing: .15em;
  text-transform: uppercase; color: var(--muted);
}

main { max-width: 620px; margin: 0 auto; padding: 20px 16px 8px; display: grid; gap: 18px; }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--card-shadow); padding: 26px 24px;
}
@media (max-width: 560px) { .card { padding: 22px 16px; border-radius: 14px; } }
.card h2 {
  margin: 0 0 18px;
  font-size: 11px; font-weight: 500; letter-spacing: .15em; text-transform: uppercase;
  color: var(--text); display: flex; align-items: center; gap: 10px;
}
.num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--green); color: var(--white);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0;
}

/* receipt dropzone */
.dropzone {
  display: block; border: 1.5px dashed var(--border); border-radius: 12px;
  padding: 32px 16px; text-align: center; cursor: pointer;
  background: var(--input-bg); color: var(--muted);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--green); background: var(--input-focus-bg); }
.dz-inner { display: grid; gap: 6px; justify-items: center; }
.dz-inner strong { font-size: 15px; font-weight: 600; color: var(--text); }
.dz-inner span { font-size: 13px; color: var(--muted); }
.dz-icon { width: 32px; height: 32px; color: var(--green); }
#preview { max-width: 100%; max-height: 300px; border-radius: 10px; display: block; margin: 0 auto; }

.row { display: flex; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1; }

.status { margin: 14px 0 0; font-size: 13.5px; color: var(--muted); }
.status.work::before { content: "◴ "; }
.status.good { color: var(--green-dark); }
.status.good::before { content: "✓ "; }
.status.bad { color: var(--error); }

/* fields */
.field { margin-bottom: 16px; position: relative; }
label {
  display: block; font-size: 11px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text); margin-bottom: 7px;
}
.req { color: var(--muted); letter-spacing: .08em; margin-left: 5px; }
input, select {
  width: 100%; padding: 14px 14px; font: inherit; font-size: 16px;
  color: var(--text); background-color: var(--input-bg);
  border: 1px solid var(--border); border-radius: 10px;
  transition: background .15s, border-color .15s;
}
input::placeholder { color: var(--placeholder); }
input:focus, select:focus {
  outline: none; background-color: var(--input-focus-bg);
  border-color: var(--green); box-shadow: 0 0 0 3px rgba(37, 179, 75, .15);
}
.hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); font-weight: 300; }
.hint.warn {
  color: var(--text); font-weight: 400;
  background: rgba(192, 57, 43, .07); border-left: 3px solid var(--error);
  padding: 10px 12px; border-radius: 0 8px 8px 0; margin-bottom: 16px;
}
.hint.ok {
  color: var(--text); font-weight: 400;
  background: rgba(37, 179, 75, .08); border-left: 3px solid var(--green);
  padding: 10px 12px; border-radius: 0 8px 8px 0; margin-bottom: 16px;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* job search */
.suggest {
  position: absolute; z-index: 20; left: 0; right: 0; top: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  margin-top: 6px; max-height: 260px; overflow: auto; box-shadow: var(--card-shadow);
}
.suggest button {
  display: block; width: 100%; text-align: left; padding: 12px 14px;
  background: none; border: 0; border-bottom: 1px solid var(--border);
  font: inherit; font-size: 14px; color: var(--text); cursor: pointer;
}
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover { background: var(--input-bg); }
.suggest .pid { color: var(--muted); font-size: 12.5px; }

.chosen {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 13px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--input-bg); font-size: 14.5px;
}
.chosen.locked { border-color: var(--green); background: rgba(37, 179, 75, .08); }
.chosen.locked::before { content: "🔗"; font-size: 13px; }
.chosen button { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }

.taxnote {
  border-left: 3px solid var(--green); background: rgba(37, 179, 75, .07);
  padding: 11px 14px; border-radius: 0 10px 10px 0;
  font-size: 13.5px; color: var(--text); margin-bottom: 16px;
}

.more { margin-bottom: 16px; }
.more summary {
  cursor: pointer; font-size: 11px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); padding: 8px 0;
}

.total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 16px 0; border-top: 1px solid var(--border); margin-bottom: 18px;
}
.total span { font-size: 11px; font-weight: 500; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.total strong { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; background: var(--green); color: var(--white);
  border: none; border-radius: 10px; padding: 16px 24px;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--green-dark); }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.btn.ghost:hover { background: var(--input-bg); }

.error {
  color: var(--error); background: var(--error-bg);
  border: 1px solid var(--error-border); border-radius: 10px;
  padding: 11px 14px; font-size: 14px; margin: 0 0 14px;
}

/* done */
.done { text-align: center; }
.tick {
  width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--green); color: var(--white);
  display: grid; place-items: center; font-size: 28px;
}
.done h2 {
  justify-content: center; font-size: 22px; font-weight: 700;
  letter-spacing: -0.02em; text-transform: none;
}
.done dl {
  text-align: left; display: grid; grid-template-columns: auto 1fr; gap: 9px 18px;
  font-size: 14px; margin: 18px 0 22px;
  border-top: 1px solid var(--border); padding-top: 18px;
}
.done dt { color: var(--muted); font-weight: 300; }
.done dd { margin: 0; font-weight: 600; text-align: right; }

.foot {
  text-align: center; font-size: 12px; font-weight: 300; color: var(--muted);
  padding: 12px 16px 32px;
}

/* manual-entry escape hatch under the receipt pane */
.btn.manual { margin-top: 14px; font-size: 14px; padding: 13px 16px; }

/* receipt thumbnail row — shown once a photo is chosen */
.thumbrow { display: flex; gap: 14px; align-items: stretch; }
.thumbrow img {
  width: 92px; height: 92px; object-fit: cover; flex: 0 0 92px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg);
}
.thumbactions { flex: 1; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.thumbactions .btn { padding: 11px 16px; font-size: 14px; }

/* separates the receipt from the details inside the single pane */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* scan confidence — a bar, because "medium" in prose gets skimmed past */
.scanresult { margin: 14px 0 0; }
.confbar {
  height: 6px; border-radius: 99px; background: var(--border);
  overflow: hidden; margin-bottom: 9px;
}
.confbar span {
  display: block; height: 100%; width: 0; border-radius: 99px;
  transition: width .4s ease, background .2s;
}
.confhead { margin: 0; font-size: 14px; font-weight: 600; }
.confnote { margin: 6px 0 0; font-size: 13px; font-weight: 300; color: var(--muted); }

.scanresult.high   .confbar span { width: 100%; background: var(--green); }
.scanresult.medium .confbar span { width: 62%;  background: #C79A2B; }
.scanresult.low    .confbar span { width: 28%;  background: var(--error); }
.scanresult.high   .confhead { color: var(--green-dark); }
.scanresult.medium .confhead { color: #9A7510; }
.scanresult.low    .confhead { color: var(--error); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .scanresult.medium .confhead { color: #E0B84A; }
  :root:not([data-theme="light"]) .scanresult.high   .confhead { color: var(--green); }
}

/* job arriving by URL — confirmed on the landing pane */
.jobbanner {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 18px;
  background: rgba(37, 179, 75, .09); border: 1px solid var(--green);
  border-radius: 10px;
}
.jobbanner .jb-label {
  font-size: 10px; font-weight: 500; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.jobbanner strong { font-size: 14.5px; font-weight: 600; }

/* receipt lightbox */
#preview { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 14, 9, .92);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; cursor: zoom-out;
  animation: lbfade .15s ease;
}
@keyframes lbfade { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.lb-close {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  font-size: 26px; line-height: 1; cursor: pointer;
}
.lb-close:hover { background: rgba(255, 255, 255, .22); }

/* post-scan validation: red = required and empty, amber = probably wanted */
.field.invalid input,
.field.invalid select {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-bg);
}
.field.warnfield input,
.field.warnfield select { border-color: #C79A2B; }
.field.invalid > label::after {
  content: " \2014 needed";
  color: var(--error); letter-spacing: 0; text-transform: none; font-weight: 500;
}
.field.warnfield > label::after {
  content: " \2014 check";
  color: #C79A2B; letter-spacing: 0; text-transform: none; font-weight: 500;
}

/* ── native control polish ─────────────────────────────────────────────────
   The default select arrow sits hard against the right edge and the date
   picker icon renders black on our dark surfaces. */

/* tell the browser to render native controls for the active theme — this is
   what makes the date picker icon light instead of black */
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235A6455' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 40px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23B9C0B2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

/* date input: give the picker icon room and make it visible on dark */
input[type="date"] { padding-right: 14px; }
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: .75; margin-left: 6px;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.6);
  }
}

/* fields are locked while a receipt is being read, so a scan result can't
   land on top of something the person was midway through typing */
#details.scanning { opacity: .55; pointer-events: none; transition: opacity .15s; }
#details.scanning input,
#details.scanning select { cursor: wait; }
.btn:disabled { opacity: .5; cursor: wait; }

/* name and job apply to every receipt in the batch, so they sit above the tabs */
#shared.scanning { opacity: .55; pointer-events: none; }


/* ── receipt rows ──────────────────────────────────────────────────────────
   One row per receipt, the open one holding the fields. Rows beat tabs past
   about four: a vendor name fits, and a dozen of them still read as a list. */
.rlist { margin-bottom: 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rrow + .rrow { border-top: 1px solid var(--border); }
.rrow.open { background: var(--input-bg); }

.rhead {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; background: none; border: 0; cursor: pointer;
  font: inherit; color: var(--text); text-align: left;
}
.rhead:hover { background: rgba(127, 127, 127, .06); }
.rnum {
  flex: 0 0 20px; font-size: 11px; font-weight: 600; color: var(--muted);
  text-align: center;
}
.rthumb {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 7px;
  object-fit: cover; background: var(--surface); border: 1px solid var(--border);
}
.rthumb.noimg {
  display: grid; place-items: center; color: var(--muted); font-size: 13px;
}
.rname {
  flex: 1 1 auto; font-size: 14px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rtotal { flex: 0 0 auto; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.rrow.ready .rtotal { color: var(--text); }
.tdot { width: 8px; height: 8px; border-radius: 50%; background: #C79A2B; flex: 0 0 8px; }
.rrow.ready .tdot { background: var(--green); }
.rchev {
  flex: 0 0 auto; color: var(--muted); font-size: 18px; line-height: 1;
  transform: rotate(90deg); transition: transform .15s;
}
.rrow.open .rchev { transform: rotate(-90deg); }

.rslot:not(:empty) { padding: 4px 12px 16px; }

.tabcount {
  margin: -8px 0 16px; font-size: 11px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: #C79A2B;
}
.tabcount.alldone { color: var(--green); }

/* row status line */
.rmain { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rmain .rname { flex: none; }
.rstatus {
  font-size: 11.5px; font-weight: 400; color: #C79A2B;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rrow.ready .rstatus { color: var(--green); }

/* confirm step: a scan is a draft until someone says the figures are right */
.confirmbtn { margin-top: 18px; }
.rrow.ready:not(.confirmed) .tdot { background: #4A90D9; }
.rrow.ready:not(.confirmed) .rstatus { color: #4A90D9; }
.rrow.confirmed .tdot { background: var(--green); }
.rrow.confirmed .rstatus { color: var(--green); }

/* animated ellipsis while a receipt is being read — width-stepped rather than
   animating `content`, which browsers disagree about */
.rrow.scanning .rstatus::after,
.status.reading::after,
.status.work::after {
  content: '...';
  display: inline-block;
  width: 0;
  overflow: hidden;
  vertical-align: bottom;
  animation: ellip 1.2s steps(4) infinite;
}
@keyframes ellip { to { width: 1.1em; } }

/* a brief pulse when the batch becomes submittable, so the button that just
   appeared is noticed rather than hunted for */
.btn.justready { animation: pulse 1.4s ease; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 179, 75, 0); }
  30%      { box-shadow: 0 0 0 7px rgba(37, 179, 75, .35); }
}

/* ── scanning a row ────────────────────────────────────────────────────────
   Spinner in the amount slot, because the amount is what is being worked out.
   Paired with the row tint so a long batch reads as busy at a glance. */
.rrow.scanning .rtotal::after {
  content: '';
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  vertical-align: -3px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.rrow.scanning { background: rgba(37, 179, 75, .05); }
.rrow.scanning .rthumb { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.rrow.scanning .rstatus { color: var(--green); }

/* ── chooser (/) ─────────────────────────────────────────────────────────── */
.chooser { max-width: 560px; }
.chooser-q {
  margin: 0 0 20px; font-size: 20px; font-weight: 600; line-height: 1.3;
  letter-spacing: -0.01em;
}
.choice {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 18px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--input-bg); color: inherit; text-decoration: none;
  transition: border-color .15s, background .15s, transform .08s;
}
.choice:hover { border-color: var(--green); background: var(--input-focus-bg); }
.choice:active { transform: translateY(1px); }
.choice-icon {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(37, 179, 75, .12); color: var(--green);
}
.choice-icon svg { width: 22px; height: 22px; }
.choice-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; }
.choice-text strong { font-size: 15.5px; font-weight: 600; }
.choice-text span { font-size: 13px; color: var(--muted); line-height: 1.45; }
.choice-go { flex: 0 0 auto; color: var(--muted); font-size: 18px; }
.choice:hover .choice-go { color: var(--green); }
.masthead a { display: inline-flex; }

/* ── warehouse: uploaded file chips ──────────────────────────────────────── */
.filerow { margin-top: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 5px 5px 5px 6px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--input-bg);
  font-size: 12.5px; line-height: 1.6; max-width: 100%;
}
.chip-kind {
  flex: 0 0 auto;
  font-size: 9.5px; font-weight: 700; letter-spacing: .07em; line-height: 1;
  padding: 4px 5px 3px; border-radius: 5px;
  background: rgba(37, 179, 75, .14); color: var(--green);
}
.chip-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px;
  padding-right: 1px;
}
.chip-x {
  flex: 0 0 auto; margin-left: 1px;
  display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 5px;
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0;
}
.chip-x:hover { background: rgba(214, 69, 69, .12); }
.chip-x:hover { color: var(--error); }

/* ── warehouse: checkbox rows and the form's own warnings ────────────────── */
.checkfield { margin-top: 2px; }
.checkrow {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--text); cursor: pointer;
}
.checkrow input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; margin: 0;
}
/* The Notion form carries these warnings; they are the only instructions
   warehouse staff get about pre-selling, so they travel with the fields. */
.warn-note {
  border-left: 2px solid #C79A2B; padding-left: 10px; margin-top: 7px;
}
.warn-note::before { content: "⚠ "; color: #C79A2B; }
.warn-note a { color: var(--green); }

textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background-color: var(--input-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 12px; resize: vertical;
}
textarea:focus { outline: none; border-color: var(--green); background-color: var(--input-focus-bg); }
input[type="file"] { font-size: 13px; color: var(--muted); margin-bottom: 8px; }


/* ── warehouse: first-page thumbnail of the order ────────────────────────── */
.thumbrow { display: flex; align-items: flex-start; gap: 14px; }
.pothumb {
  position: relative; flex: 0 0 auto;
  width: 112px; min-height: 92px; max-height: 150px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--input-bg); overflow: hidden; cursor: zoom-in;
  display: grid; place-items: center;
}
.pothumb:hover { border-color: var(--green); }
.pothumb canvas, .pothumb img {
  display: block; width: 100%; height: auto; max-height: 150px;
  object-fit: cover; object-position: top;
  /* pdf.js paints glyphs on transparency; without paper behind it a white
     page reads as a black rectangle on the dark card. */
  background: #fff;
}
.pothumb .pagecount {
  position: absolute; right: 4px; bottom: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: .04em;
  padding: 2px 5px; border-radius: 4px;
  background: rgba(28, 36, 24, .78); color: var(--concrete);
}
.pothumb .pdffallback {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted);
}
.thumbrow .thumbactions {
  flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px;
}
@media (max-width: 520px) {
  .thumbrow { flex-direction: column; }
  .pothumb { width: 100%; max-height: 180px; }
}

/* ── warehouse: the order is being read ──────────────────────────────────── */
#details.scanning { opacity: .5; pointer-events: none; }
#details.scanning input,
#details.scanning select,
#details.scanning textarea { cursor: wait; }

/* the thumbnail is the thing being read, so the spinner belongs on it */
.filerow.scanning .pothumb::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 26px; height: 26px;
  border: 3px solid rgba(255, 255, 255, .55);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.filerow.scanning .pothumb { cursor: wait; }
.filerow.scanning .pothumb canvas,
.filerow.scanning .pothumb img { animation: breathe 1.6s ease-in-out infinite; }
.filerow.scanning .chip { opacity: .55; }
.status.reading { color: var(--green); }

/* the page chips sit under the thumbnail and its buttons; they need clear air
   above them or they read as part of the button stack */
.filerow .chips { margin-top: 14px; }
