/* Atom · invoices. One stylesheet for the desk and the phones. */
:root {
  --bg: #F3F5FB;
  --surface: #FFFFFF;
  --ink: #0A0E2E;
  --ink-soft: #4D5373;
  --ink-faint: #868CA8;
  --line: #DCE1F0;
  --brand: #0000FA;
  --brand-deep: #0000B8;
  --brand-tint: #ECEEFF;
  --amber: #8F5300;
  --amber-mark: #F5A524;
  --amber-tint: #FFF3DC;
  --grey-tint: #ECEEF4;
  --red: #C8261E;
  --red-tint: #FCE6E4;
  --paper: #F7EDB9;
  --r-small: 8px;
  --r-big: 16px;
  --font: "Commissioner", "Helvetica Neue", Arial, sans-serif;
  --on-brand: #FFFFFF;
  --hover: #F7F8FD;
  --shadow: rgba(10, 14, 46, 0.12);
  --desk: #1B1F3B;
  --toast-bg: #0A0E2E;
  --toast-fg: #FFFFFF;
  /* Atom's logo blue as a filled surface (buttons, the day card, the camera), the same in light and dark;
     --brand above is the blue for text, edges and outlines, which dark mode lightens to stay readable. */
  --brand-fill: #0000FA;
  --on-fill: #FFFFFF;
  --card-line: #DCE1F0;  /* the hairline around white cards on the light grey page; none in dark */
  --ask-bg: #FFF3DC; --ask-line: transparent;  /* the question card: amber tint; in dark a navy card with an amber edge */
  color-scheme: light;
}

/* Dark: Atom's own navy, deep and blue rather than grey-black; follows the computer or phone,
   unless the person picked one with the button. The two blocks must stay identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080B27; --surface: #121946; --ink: #EEF0FF; --ink-soft: #A6ADD6; --ink-faint: #6C74A8; --line: #222A62;
    --brand: #8E99FF; --brand-deep: #C7CCFF; --brand-tint: #1C2462; --amber: #FFC46A; --amber-mark: #F5A524;
    --amber-tint: #382A10; --grey-tint: #1C2250; --red: #FF8A80; --red-tint: #3D1C2A; --paper: #4A4430;
    --on-brand: #FFFFFF; --hover: #18205A; --shadow: rgba(0, 0, 0, 0.5); --desk: #05071A;
    --toast-bg: #EEF0FF; --toast-fg: #080B27; --card-line: transparent; --ask-bg: #19205A; --ask-line: rgba(245, 165, 36, 0.5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #080B27; --surface: #121946; --ink: #EEF0FF; --ink-soft: #A6ADD6; --ink-faint: #6C74A8; --line: #222A62;
    --brand: #8E99FF; --brand-deep: #C7CCFF; --brand-tint: #1C2462; --amber: #FFC46A; --amber-mark: #F5A524;
    --amber-tint: #382A10; --grey-tint: #1C2250; --red: #FF8A80; --red-tint: #3D1C2A; --paper: #4A4430;
    --on-brand: #FFFFFF; --hover: #18205A; --shadow: rgba(0, 0, 0, 0.5); --desk: #05071A;
    --toast-bg: #EEF0FF; --toast-fg: #080B27; --card-line: transparent; --ask-bg: #19205A; --ask-line: rgba(245, 165, 36, 0.5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-small);
  padding: 10px 16px;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--ink-faint); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-fill); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary[disabled] { background: var(--ink-faint); border-color: var(--ink-faint); cursor: default; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }

/* ---------- who are you ---------- */
.who { max-width: 520px; margin: 12vh auto 0; padding: 0 20px; }
.who h1 { font-size: 28px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.01em; }
.who p { color: var(--ink-soft); margin: 0 0 24px; }
.people { display: grid; gap: 10px; }
.person {
  display: flex; align-items: center; gap: 14px; text-align: left;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-big); padding: 14px 16px;
}
.person:hover { border-color: var(--brand); }
.person .face {
  flex: none;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-deep); font-weight: 700;
}
.person b { display: block; font-weight: 600; }
.person span { color: var(--ink-soft); font-size: 13px; }
.who .note { margin-top: 22px; font-size: 13px; color: var(--ink-faint); }

/* ---------- desk header ---------- */
.top {
  display: flex; align-items: center; gap: 18px; padding: 12px 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand b { font-size: 21px; font-weight: 700; color: var(--brand); letter-spacing: -0.02em; }
.brand span { font-size: 17px; color: var(--ink-soft); }
.companies { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 999px; }
.companies button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; color: var(--ink-soft); font-weight: 500; }
.companies button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; }
.me .face { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-fill); color: var(--on-fill); font-weight: 700; border: 0; }

/* ---------- desk actions ---------- */
.actions { display: flex; align-items: center; gap: 12px; padding: 18px 24px; flex-wrap: wrap; }
.actions .lead { display: flex; flex-direction: column; margin-right: 6px; }
.actions .lead strong { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.actions .lead small { color: var(--ink-soft); font-size: 13px; }

/* ---------- desk body ---------- */
.desk { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 0; padding: 0 24px 24px; align-items: start; }
.list { display: grid; gap: 10px; }
.list h2 { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center;
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: var(--surface);
  padding: 10px 14px 10px 12px; text-align: left; position: relative;
}
.row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--edge, transparent); }
.row:hover { background: var(--hover); }
.row.sel { background: var(--brand-tint); }
.row img { width: 46px; height: 60px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: var(--paper); }
.row .what b { display: block; font-weight: 600; font-size: 15px; }
.row .what span { display: block; color: var(--ink-soft); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.row .amt { text-align: right; }
.row .amt b { display: block; font-weight: 600; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-top: 3px; }
.s-ok { --edge: var(--brand); }
.s-ok .pill, .pill.s-ok { background: var(--brand-tint); color: var(--brand-deep); }
.s-check { --edge: var(--amber-mark); }
.s-check .pill, .pill.s-check { background: var(--amber-tint); color: var(--amber); }
.s-duplicate { --edge: var(--ink-faint); }
.s-duplicate .pill, .pill.s-duplicate { background: var(--grey-tint); color: var(--ink-soft); }
.s-void { --edge: var(--ink-faint); }
.s-void .pill, .pill.s-void { background: var(--grey-tint); color: var(--ink-soft); }
.s-error { --edge: var(--red); }
.s-error .pill, .pill.s-error { background: var(--red-tint); color: var(--red); }
.s-reading .pill, .s-queued .pill, .pill.s-reading, .pill.s-queued { background: var(--grey-tint); color: var(--ink-soft); }
.s-reading { --edge: var(--brand-tint); }
.s-reading .pill::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-right: 6px; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.2; } }
.empty { padding: 36px 20px; color: var(--ink-soft); text-align: center; }

/* ---------- one invoice: paper next to its reading ---------- */
#detail { padding-left: 20px; position: sticky; top: 74px; }
.paper {
  margin: 0; background: var(--desk); border-radius: var(--r-big); padding: 14px; overflow: auto; max-height: calc(100vh - 110px); position: relative;
  cursor: zoom-in;
}
.paper img { margin: 0 auto; border-radius: 3px; transition: width 0.2s ease; width: 100%; }
.paper.zoom { cursor: zoom-out; }
.paper.zoom img { width: 190%; max-width: none; }
.reading { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-big); padding: 20px 22px; max-height: calc(100vh - 110px); overflow: auto; }
.reading .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.reading .head h3 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.reading .head h3 small { font-size: 13px; color: var(--ink-faint); font-weight: 500; margin-right: 6px; }
.fields { display: grid; grid-template-columns: 112px 1fr; gap: 6px 12px; margin: 0 0 16px; }
.fields dt { color: var(--ink-soft); font-size: 13px; padding-top: 2px; }
.fields dd { margin: 0; font-weight: 500; }
.lines { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 14px; }
.lines th { text-align: left; font-weight: 500; color: var(--ink-soft); font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.lines td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.lines td.r, .lines th.r { text-align: right; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin-left: auto; width: 62%; }
.totals span { color: var(--ink-soft); }
.totals b { text-align: right; font-weight: 600; }
.totals .grand { font-size: 19px; font-weight: 700; color: var(--ink); }
.was { display: block; font-size: 12px; font-weight: 500; color: var(--amber); text-align: right; }
.fixedval { box-shadow: inset 0 -3px 0 var(--brand-tint); }
.notes { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; font-size: 13.5px; }
.notes li { padding: 7px 10px; border-radius: var(--r-small); background: var(--bg); color: var(--ink-soft); }
.notes li.fixed { background: var(--brand-tint); color: var(--brand-deep); font-weight: 500; }
.notes li.warn { background: var(--amber-tint); color: var(--amber); }
.notes li.ok { background: transparent; padding-left: 0; }

.ask { margin-top: 16px; background: var(--ask-bg); box-shadow: inset 0 0 0 1px var(--ask-line); border-radius: var(--r-big); padding: 16px; }
.ask h4 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.ask p { margin: 0 0 12px; color: var(--amber); font-size: 13.5px; }
.choices { display: grid; gap: 8px; }
.choice {
  text-align: left; border: 2px solid transparent; background: var(--surface); border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; box-shadow: 0 1px 2px var(--shadow);
}
.choice:hover { border-color: var(--brand); }
.choice b { font-size: 16px; font-weight: 600; }
.choice span { font-size: 12.5px; color: var(--ink-soft); }

.learned { margin: 18px 24px 24px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-soft); }
.learned .habit { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; color: var(--ink); }
.learned .habit b { color: var(--brand-deep); }

.drop {
  position: fixed; inset: 0; background: rgba(0, 0, 200, 0.88); color: #fff; display: grid; place-items: center;
  font-size: 28px; font-weight: 600; z-index: 20;
}
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-fg);
  padding: 12px 18px; border-radius: 12px; z-index: 30; font-weight: 500; max-width: 90vw;
}
.menu { position: absolute; right: 24px; top: 58px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; display: grid; min-width: 210px; box-shadow: 0 8px 24px var(--shadow); z-index: 10; }
.menu button { border: 0; background: transparent; text-align: left; padding: 10px 12px; border-radius: 8px; }
.menu button:hover { background: var(--bg); }

@media (max-width: 1000px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  #detail { padding-left: 0; margin-top: 16px; position: static; }
}

/* ---------- phones ---------- */
body.phone { font-size: 17px; background: var(--bg); }
.ph { max-width: 520px; margin: 0 auto; min-height: 100%; padding: 18px 18px 40px; padding-top: max(18px, env(safe-area-inset-top)); }
.ph-top { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.ph-top .brand b { font-size: 22px; }
.ph-top .face { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-fill); color: var(--on-fill); display: grid; place-items: center; font-weight: 700; border: 0; }
.ph h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 4px; line-height: 1.15; }
.ph .sub { color: var(--ink-soft); margin: 0 0 18px; }
.ph .companies { margin-bottom: 18px; overflow-x: auto; }
.wide { width: 100%; justify-content: center; padding: 18px; font-size: 19px; border-radius: var(--r-big); margin-bottom: 10px; }
.ph .learned { margin: 18px 0 0; }
.review img { border-radius: 12px; margin-bottom: 14px; width: 100%; }
.review .ask { margin-top: 0; }
.review .choice { padding: 18px; }
.review .choice b { font-size: 21px; }
.done { text-align: center; padding: 40px 10px; }
.done .tick { width: 96px; height: 96px; border-radius: 50%; background: var(--brand-fill); color: var(--on-fill); display: grid; place-items: center; margin: 0 auto 18px; }
.done .tick svg { width: 52px; height: 52px; }
.jobs { display: grid; gap: 12px; }
.job {
  display: grid; grid-template-columns: 1fr 64px; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-big); padding: 16px;
}
.job b { display: block; font-size: 19px; font-weight: 600; }
.job span { color: var(--ink-soft); font-size: 15px; }
.job .cam { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-fill); color: var(--on-fill); display: grid; place-items: center; }
.job .cam svg { width: 30px; height: 30px; }
.job.sent .cam { background: var(--brand-tint); color: var(--brand); }
.day { font-size: 15px; color: var(--ink-soft); margin: 18px 0 8px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- the paper being read ---------- */
.scan { position: relative; overflow: hidden; border-radius: 3px; }
.scan::after {
  content: ""; position: absolute; left: -10%; right: -10%; height: 22%; top: -22%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 250, 0.16) 70%, rgba(0, 0, 250, 0.8) 98%, transparent);
  animation: scan 1.8s ease-in-out infinite alternate;
}
@keyframes scan { to { top: 100%; } }
.reading .wait { color: var(--ink-soft); margin: 0; }
.reading .wait b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* ---------- theme button ---------- */
.theme { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); display: grid; place-items: center; padding: 0; }
.theme svg { width: 18px; height: 18px; }
.ph-top .theme { width: 38px; height: 38px; }

/* ---------- the day at a glance ---------- */
.actions .lead strong .num { color: var(--brand); }
.btn.look { background: var(--amber-tint); border-color: var(--amber-tint); color: var(--amber); font-weight: 600; }
.btn.look:hover { border-color: var(--amber-mark); }

/* The whole job card (or the office's camera button) is the photo button; the file input stays out of sight. */
label.job, label.btn { cursor: pointer; position: relative; }
.pick { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
label.job:focus-within, label.btn:focus-within { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Phones: the company names never break, and nothing hides behind the browser's bottom bar. */
.companies button { white-space: nowrap; }
.ph { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.review .ask { margin-bottom: 12px; }
.peek { display: block; width: 100%; padding: 0; border: 0; background: var(--desk); border-radius: 12px; overflow: hidden; height: 230px; margin-bottom: 10px; }
.peek img { width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; }
.peek.bottom img { object-position: 50% 82%; }
.peek.top img { object-position: 50% 18%; }
.peek.middle img { object-position: 50% 50%; }
.peek.open { height: auto; }
.peek.open img { height: auto; object-fit: contain; }

/* ---------- the desk list in groups: one click opens or closes a group; closed, it shows at most 4 photos ---------- */
.grp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-big); overflow: hidden; }
.g-check { --edge: var(--amber-mark); }
.g-reading { --edge: var(--brand); }
.g-error { --edge: var(--red); }
.g-ok { --edge: var(--brand); }
.g-receipts { --edge: var(--brand); }
.g-duplicate { --edge: var(--ink-faint); }
.g-void { --edge: var(--ink-faint); }
.grp-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 0; background: transparent; text-align: left; }
.grp-head:hover { background: var(--hover); }
.grp-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--edge); flex: none; }
.grp-title { font-weight: 600; font-size: 16px; }
.grp-n { color: var(--ink-faint); font-weight: 600; }
.grp-head .end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.grp-sum { font-weight: 600; }
.chev { width: 20px; height: 20px; color: var(--ink-faint); transition: transform 0.15s ease; flex: none; }
.grp.open .chev { transform: rotate(180deg); }
.minis { display: flex; align-items: center; gap: 8px; padding: 0 16px 14px 36px; }
.mini, .thumb, .photo-btn { padding: 0; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--paper); flex: none; cursor: zoom-in; }
.mini { width: 40px; height: 52px; }
.thumb { width: 40px; height: 52px; }
.photo-btn { width: 46px; height: 60px; }
.mini img, .thumb img, .photo-btn img { width: 100%; height: 100%; object-fit: cover; }
.mini:hover, .thumb:hover, .photo-btn:hover { border-color: var(--brand); }
.plus-n { font-size: 13px; font-weight: 600; color: var(--ink-soft); padding-left: 2px; }
.grp-body { border-top: 1px solid var(--line); }
.inv { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; padding: 8px 14px 8px 16px; border-bottom: 1px solid var(--line); position: relative; }
.inv:last-child { border-bottom: 0; }
.inv:hover { background: var(--hover); }
.inv.sel { background: var(--brand-tint); }
.inv.sel::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.inv-main { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 4px 0; text-align: left; min-width: 0; }
.inv-main .what { flex: 1; min-width: 0; }
.inv-main .what b { display: block; font-weight: 600; }
.inv-main .what span { display: block; color: var(--ink-soft); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-main .amt { font-weight: 600; white-space: nowrap; }
.list .empty { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-big); }

/* ---------- one invoice: the reading; the photo waits behind its picture ---------- */
.reading .head { justify-content: flex-start; gap: 14px; }
.reading .head .pill { margin-left: auto; }
.reading .wait { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); animation: pulse 1s ease-in-out infinite; flex: none; }
.chips { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 999px; }
.chip.fixed { background: var(--brand-tint); color: var(--brand-deep); }
.chip.warn { background: var(--amber-tint); color: var(--amber); }
.details { margin-top: 12px; }
.details summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 500; padding: 4px 0; }
.details summary::-webkit-details-marker { display: none; }
.details summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform 0.15s ease; }
.details[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.details summary:hover { color: var(--ink); }
.details .notes { margin-top: 6px; }
.details .notes li { font-size: 13px; }

/* ---------- the photo, over everything, until it is closed ---------- */
body.lb-on { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(8, 12, 10, 0.9); display: flex; flex-direction: column; }
.lb-bar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; color: #FFFFFF; }
.lb-bar b { font-size: 17px; }
.lb-bar span { color: rgba(255, 255, 255, 0.72); }
.lb-close { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.12); color: #FFFFFF; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 999px; padding: 8px 16px; font-weight: 600; }
.lb-close:hover { background: rgba(255, 255, 255, 0.22); }
.lb-close svg { width: 16px; height: 16px; }
.lb-photo { flex: 1; overflow: auto; display: grid; place-items: center; padding: 0 18px 18px; }
.lb-frame { position: relative; }
.lb-frame img { max-height: calc(100vh - 92px); width: auto; max-width: 100%; border-radius: 4px; cursor: zoom-in; }
.lightbox.zoom .lb-photo { place-items: start center; }
.lightbox.zoom .lb-frame img { max-height: none; max-width: none; cursor: zoom-out; }
@media (max-width: 600px) { .lb-close span { display: none; } .lb-bar span { display: none; } }

/* ---------- what it has learned, on each invoice: only the hand that wrote it ---------- */
.learned-inv { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; }
.learned-inv .lbl { color: var(--ink-soft); }
.habits { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.learned-inv .habit { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.learned-inv .habit b { color: var(--brand-deep); }
.learned-inv .habit small { color: var(--ink-faint); margin-left: 6px; font-size: 12px; }
.learned-inv .details { margin-top: 0; width: 100%; }
.learned-inv .details .habits { margin-top: 6px; }
.learned-line { font-size: 15px; color: var(--ink-soft); margin: 0 0 12px; }
.learned-line b { color: var(--brand-deep); }

/* ---------- a narrow window: the header wraps, 16px at the sides, nothing wider than the screen ---------- */
@media (max-width: 700px) {
  .top { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  #switch { order: 3; width: 100%; overflow-x: auto; }
  .me > span { display: none; }
  .actions { padding: 14px 16px; }
  .desk { padding: 0 16px 16px; }
  .minis { padding-left: 16px; }
}
.minis { flex-wrap: wrap; }
.grp-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- the whole width: on a wide screen the invoice sits left in its card, what needs doing beside it ---------- */
.r-side:empty { display: none; }
@media (min-width: 1200px) {
  .r-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 0 36px; align-items: start; }
  .r-side > :first-child { margin-top: 0; }
  .r-side:empty { display: block; }
}

/* ---------- the office phone: the paper behind one tap ---------- */
.see-paper { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; text-align: left; font-weight: 600; }
.see-paper img { width: 44px; height: 58px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: var(--paper); margin: 0; }

/* ---------- the desk fills the window: one list panel and the invoice card reach the bottom, each scrolls inside ---------- */
.desk-page .list { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-big); overflow: hidden; }  /* block: groups keep their height and the panel scrolls */
.desk-page .grp { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.desk-page .list .empty { border: 0; }
@media (min-width: 1001px) {
  body.desk-page { height: 100vh; overflow: hidden; }
  .desk-page #app { height: 100vh; display: flex; flex-direction: column; }
  .desk-page .desk { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  .desk-page .list { height: 100%; overflow-y: auto; }
  .desk-page #detail { height: 100%; min-height: 0; position: static; }
  .desk-page .reading { height: 100%; max-height: none; overflow-y: auto; }
}

/* ---------- phones fill the screen; on the review and done screens the buttons sit at the bottom under the thumb ---------- */
.ph { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.ph-actions { margin-top: auto; display: grid; gap: 10px; padding-top: 14px; }
.ph-actions .wide, .ph-actions .see-paper { margin-bottom: 0; }
.review { flex: 1; display: flex; flex-direction: column; }
.done { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.done .ph-actions { margin-top: 28px; }
.days { display: grid; gap: 10px; }
.phone .grp-title { font-size: 18px; }
.day-grp .jobs { padding: 0 12px 12px; }
.sent-n { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 600; }
.sent-n svg { width: 16px; height: 16px; }

/* ---------- without a connection: a small note; what waits on the phone shows a clock ---------- */
.net-note { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 45; max-width: calc(100vw - 32px); background: var(--amber-tint); color: var(--amber); border: 1px solid var(--amber-mark); padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: 0 2px 8px var(--shadow); text-align: center; }
.job.waiting .cam { background: var(--amber-tint); color: var(--amber); }
.done .tick.wait { background: var(--amber-mark); color: var(--ink); }

/* ---------- the code a phone types through the link ---------- */
.pin-in { width: 100%; font: inherit; font-size: 40px; font-weight: 700; letter-spacing: 0.4em; text-align: center; padding: 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); }
.pin-in:focus { border-color: var(--brand); outline: none; }
.pin-msg { color: var(--red); min-height: 1.5em; margin-top: 12px; }

/* ---------- the desk's phone panel ---------- */
.panel-back { align-items: center; justify-content: center; padding: 16px; }
.panel { background: var(--surface); color: var(--ink); border-radius: var(--r-big); padding: 18px 22px 22px; width: min(460px, 100%); box-shadow: 0 12px 40px var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head b { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; }
.panel-head svg, .panel .btn svg { width: 20px; height: 20px; }
.panel .lb-close { margin-left: 0; background: var(--bg); color: var(--ink); border-color: var(--line); }
.panel p { margin: 0 0 12px; color: var(--ink-soft); }
.lk-label { font-size: 13px; margin-bottom: 4px !important; }
.lk-pin { font-size: 52px; font-weight: 700; letter-spacing: 0.3em; color: var(--brand) !important; margin-bottom: 14px !important; }
.lk-url a { color: var(--brand); font-weight: 600; word-break: break-all; }
.lk-note { font-size: 13px; margin-top: 12px !important; }
/* the "no connection" note never covers the header */
body.net-on .ph { padding-top: calc(54px + env(safe-area-inset-top)); }
body.net-on.desk-page #app { padding-top: 44px; }

.lk-qr { display: block; width: 210px; height: 210px; margin: 2px auto 12px; padding: 10px; background: #FFFFFF; border: 1px solid var(--line); border-radius: 14px; image-rendering: pixelated; }

/* ---------- phones, 26 Nov (John: the boxes were too big, the date sat on them, and it looked plain).
   One Atom-blue card holds the day and its two numbers; everything else is a quiet surface.
   The same words, buttons and taps as before. Layout only under .phone: the desk shares these classes. ---------- */
.phone .ph-top { margin-bottom: 22px; }
.phone .ph-top .theme { border: 0; background: var(--surface); box-shadow: inset 0 0 0 1px var(--card-line); }
.phone .ph h1 { font-size: 28px; margin: 0 0 6px; }
.phone .ph .sub { margin: 0 0 22px; font-size: 16px; }

/* the day card */
.today { background: var(--brand-fill); color: var(--on-fill); border-radius: 24px; padding: 18px 20px 20px; margin-bottom: 14px; }
.phone .today h1 { font-size: 17px; font-weight: 600; letter-spacing: 0; line-height: 1.3; margin: 0; }
.today-sub { margin: 2px 0 0; font-size: 14px; opacity: 0.78; }
.counts { display: grid; grid-template-columns: 1fr 1fr; margin-top: 22px; }
.count { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0;
         padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.count + .count { padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, 0.24); }
.count b { font-size: clamp(50px, 16vw, 72px); font-weight: 700; line-height: 0.85; letter-spacing: -0.045em; }
.count span { font-size: 15px; opacity: 0.84; }
.count.check b { color: rgba(255, 255, 255, 0.42); }
.count.check.has b { color: var(--amber-mark); }
button.count[disabled] { cursor: default; }
button.count:focus-visible { outline-color: #FFFFFF; }

/* the buttons under it */
.phone .ph-actions.home { margin-top: 0; padding-top: 0; }
.phone .wide { min-height: 58px; padding: 14px 16px; font-size: 18px; border-radius: 16px; }
.phone .btn:not(.primary):not(.attn):not(.quiet) { border-color: var(--card-line); }
/* Blue belongs to Atom (the day card, the camera); amber means a paper needs a look; the main button is ink,
   so it never melts into the blue card above it. */
.phone .btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.phone .btn.attn { background: var(--amber-mark); border-color: var(--amber-mark); color: #0A0E2E; font-weight: 600; }
.phone .btn.attn:hover { filter: brightness(1.05); }

/* the technician's days: one list per day, no boxes inside boxes */
.phone .days { gap: 18px; }
.phone .day-grp { background: transparent; border: 0; border-radius: 0; overflow: visible; }
.phone .day-grp .grp-head { padding: 4px 4px 10px; }
.phone .day-grp .grp-head:hover { background: transparent; }
.phone .day-grp .grp-n { color: var(--ink-soft); }
.phone .day-grp .jobs { gap: 0; padding: 0; background: var(--surface); border: 1px solid var(--card-line); border-radius: 20px; overflow: hidden; }
.phone .job { grid-template-columns: 1fr 52px; gap: 14px; padding: 14px 14px 14px 18px; background: transparent; border: 0; border-radius: 0; }
.phone .job + .job { border-top: 1px solid var(--line); }
.phone .job b { font-size: 17px; color: var(--ink); }  /* the customer in full ink, the job under it softer */
.phone .job span { font-size: 14px; }
.phone .job .cam { width: 52px; height: 52px; }
.phone .job .cam svg { width: 24px; height: 24px; }
.phone label.job:focus-within { outline-offset: -3px; }

/* the office's question: no tinted card around it (on navy any amber tint turns muddy brown); the question,
   its amber hint, and the answers as plain cards */
.phone .review .ask { background: transparent; padding: 0; border-radius: 0; }
.phone .review .ask h4 { font-size: 22px; font-weight: 700; line-height: 1.25; margin: 0 0 6px; }
.phone .review .ask p { font-size: 15px; margin: 0 0 16px; }
.phone .choice { box-shadow: none; border: 1px solid var(--card-line); background: var(--surface); border-radius: 16px; }
.phone .choice:hover { border-color: var(--brand); }
.phone .see-paper { border-color: var(--card-line); }
.person b { color: var(--ink); }  /* the name in full ink (it sits inside a softer span) */
.phone .person { border-color: var(--card-line); }

/* «Άλλο…»: a typed answer when none of the choices is right */
.choice.other { border-style: dashed; }
.choice.other b { color: var(--brand); }
.other-box { display: grid; gap: 8px; }
.other-in { width: 100%; height: 46px; padding: 0 14px; border: 1.5px solid var(--brand); border-radius: 12px;
  font: inherit; font-size: 16px; background: var(--surface); color: var(--ink); box-sizing: border-box; }
.other-in:focus { outline: 3px solid var(--brand-tint); outline-offset: 1px; }
.other-out { display: grid; gap: 8px; }
.other-out:empty { display: none; }

/* Sign in and first sign in on Atom's server (1 Dec 2026): email, password, the code from the phone. */
.signin label { display: block; margin: 0 0 14px; font-weight: 500; }
.signin input:not(.pin-in) { display: block; width: 100%; margin-top: 6px; font: inherit; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.signin input:not(.pin-in):focus { border-color: var(--brand); outline: none; }
.signin .pin-in { font-size: 28px; margin-top: 6px; }
.signin .btn.primary { width: 100%; padding: 14px; font-size: 16px; margin-top: 4px; }
.signin .hint { font-size: 13px; color: var(--ink-faint); margin: -6px 0 14px; }
.signin .qr { background: #FFFFFF; border-radius: 12px; padding: 8px; width: min(260px, 100%); margin: 0 auto 12px; }
.signin .qr svg { display: block; width: 100%; height: auto; }
.signin .same-phone { display: block; text-align: center; margin: 0 0 12px; }
.signin details { margin: 0 0 16px; color: var(--ink-soft); }
.signin summary { cursor: pointer; }
.signin .secret { font-size: 18px; letter-spacing: 0.08em; user-select: all; word-break: break-all; color: var(--ink); }
.signin [hidden] { display: none; }
.signin .btn.primary { justify-content: center; text-align: center; }

/* Για το BTMS (1 Dec 2026): ready papers, typed into the accounting program and marked. Plain and large, so a person
   or Claude on the office computer reads each field without doubt. */
.btms { max-width: 760px; margin: 0 auto; padding: 16px; }
.btms-top { display: flex; align-items: baseline; gap: 14px; margin: 8px 0 12px; }
.btms-top h1 { font-size: 24px; margin: 0; }
.btms-back { color: var(--brand); text-decoration: none; font-weight: 600; }
.btms-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 14px 0; background: var(--surface); }
.btms-card h2 { font-size: 20px; margin: 0 0 8px; }
.btms-card h2 span { font-weight: 500; color: var(--ink-soft); margin-left: 8px; }
.btms-table { overflow-x: auto; margin: 10px 0; }
.btms-lines { width: 100%; border-collapse: collapse; }
.btms-lines th, .btms-lines td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.btms-lines .num, .btms-lines th:not(:first-child) { text-align: right; }
.btms-sum { display: grid; grid-template-columns: max-content max-content; gap: 4px 16px; margin: 10px 0 14px; }
.btms-sum dt { color: var(--ink-soft); }
.btms-sum dd { margin: 0; text-align: right; }
.btms-ref { display: block; margin-bottom: 10px; }
.btms-ref input { display: block; margin-top: 6px; font: inherit; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); width: 100%; max-width: 280px; }
.btms-done { color: var(--green, #1E7B34); font-weight: 600; }
.btms-empty { color: var(--ink-soft); margin: 24px 0; }
.btms-note { background: var(--amber-tint); color: var(--amber); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.btms-card.left { border-color: var(--amber-mark); }
.btms-problem { background: var(--amber-tint); border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }
.btms-problem p { margin: 0 0 8px; color: var(--ink); }
.empty p { margin: 6px 0 0; }
