/* JL Accounting. One stylesheet, no framework. Each business has its own accent colour (body[data-biz]) so it's
   always clear whose books are open. Light and dark follow the system. */

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --border: #e3e1d9;
  --text: #1d1c19;
  --muted: #6c695f;
  --accent: #26241f;
  --accent-ink: #ffffff;
  --accent-soft: #ecebe5;
  --warn: #a15c07;
  --warn-soft: #fcf1df;
  --ok: #18794e;
  --ok-soft: #e3f4ea;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 18, 12, .05), 0 4px 16px rgba(20, 18, 12, .05);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
body[data-biz="jl"] { --accent: #0d6e66; --accent-ink: #ffffff; --accent-soft: #e2f2ef; }
body[data-biz="pvi"] { --accent: #4136c4; --accent-ink: #ffffff; --accent-soft: #ebe9fc; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #18191c;
    --surface-2: #202227;
    --border: #2d3036;
    --text: #ecebe6;
    --muted: #9b988f;
    --accent: #ecebe6;
    --accent-ink: #111214;
    --accent-soft: #26282d;
    --warn: #f2b55a;
    --warn-soft: #33270f;
    --ok: #5fd39a;
    --ok-soft: #12291d;
    --danger: #ff8a7f;
    --danger-soft: #3a1714;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
  body[data-biz="jl"] { --accent: #3fcfbd; --accent-ink: #062521; --accent-soft: #11302c; }
  body[data-biz="pvi"] { --accent: #a9a3ff; --accent-ink: #15123d; --accent-soft: #23214a; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 680; }
h2 { font-size: 1.1rem; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.1em; height: 1.1em; vertical-align: -.18em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 64px; }

/* ── Top bar ── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar .wrap { display: flex; align-items: center; gap: 16px; min-height: 58px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 720; text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--text); color: var(--bg); display: inline-grid; place-items: center; font-size: .74rem; font-weight: 800; letter-spacing: .02em; }
.biz-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.biz-tab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; border: 1px solid transparent; white-space: nowrap; transition: background .2s, color .2s, border-color .2s; }
.biz-tab:hover { color: var(--text); background: var(--surface-2); }
.biz-tab .dot { width: 9px; height: 9px; border-radius: 50%; }
.biz-tab.jl .dot { background: #0d6e66; }
.biz-tab.pvi .dot { background: #4136c4; }
.biz-tab.on { color: var(--accent-ink); background: var(--accent); }
.biz-tab.on .dot { background: var(--accent-ink); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar-end form { margin: 0; }
@media (max-width: 720px) {
  .topbar .wrap { gap: 8px 12px; padding-top: 8px; padding-bottom: 8px; }
  .biz-tabs { order: 3; width: 100%; }
  .biz-tab { flex: 1; justify-content: center; }
}

/* The business band: a strip in the business's colour under the top bar. */
.biz-band { background: var(--accent-soft); border-bottom: 1px solid var(--border); }
.biz-band .wrap { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 650; font-size: .92rem; color: var(--accent); }
.biz-band .swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .93rem; line-height: 1.2; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .biz-tab:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 11px; font-size: .86rem; border-radius: 9px; }
.btn-lg { padding: 12px 20px; font-size: 1rem; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ── Page header ── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: .88rem; margin-bottom: 8px; }
.back:hover { color: var(--text); }

/* ── Cards, alerts, badges ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); animation: rise .35s ease-out both; }
.card + .card, .stack > * + * { margin-top: 16px; }
.card-body { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 16px; font-size: .93rem; animation: rise .3s ease-out both; }
.alert .icon { margin-top: .18em; }
.alert-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.alert-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.alert-error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert-info { background: var(--accent-soft); border-color: transparent; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

/* ── Stats ── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; animation: rise .35s ease-out both; }
.stat-n { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-l { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.stat.attention .stat-n { color: var(--warn); }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Year switch ── */
.years { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 11px; flex-wrap: wrap; }
.years a { padding: 5px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .88rem; font-variant-numeric: tabular-nums; }
.years a:hover { color: var(--text); }
.years a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ── Drop zone and upload queue ── */
.drop { border: 2px dashed color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: var(--radius); padding: 32px 16px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; background: var(--surface); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.over { transform: scale(1.01); }
.drop-icon { width: 44px; height: 44px; color: var(--accent); margin-bottom: 6px; }
.drop-title { font-size: 1.12rem; font-weight: 680; }
.drop .btn-row { justify-content: center; margin-top: 14px; }
.drop-disabled { opacity: .55; pointer-events: none; }
.queue { list-style: none; margin: 14px 0 0; padding: 0; }
.queue li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--border); font-size: .92rem; animation: rise .25s ease-out both; }
.queue .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue .state { color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.queue .state.ok { color: var(--ok); }
.queue .state.bad { color: var(--danger); white-space: normal; text-align: right; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Receipt rows ── */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--border); }
.row-link { display: flex; align-items: center; gap: 14px; padding: 10px 6px; text-decoration: none; border-radius: 10px; transition: background .15s; }
.row-link:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: .84rem; color: var(--muted); }
.row-amount { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.thumb { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; display: inline-grid; place-items: center; color: var(--muted); border: 1px solid var(--border); }
.thumb .icon { width: 22px; height: 22px; }

/* ── Tables ── */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--border); border-bottom: 0; }
.table .num { text-align: right; }
.table a.cell-link { text-decoration: none; font-weight: 600; }
.table a.cell-link:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .table.stack thead { display: none; }
  .table.stack tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-size: .84rem; text-align: left; }
  .table.stack td.num { text-align: right; }
  .table.stack tfoot tr { border-bottom: 0; }
}

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.f-6 { grid-column: span 6; } .f-3 { grid-column: span 3; } .f-2 { grid-column: span 2; }
@media (max-width: 640px) { .f-3, .f-2 { grid-column: span 6; } }
label, .label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); outline: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea { background: var(--surface-2); color: var(--muted); }
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; min-width: 0; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 5px; min-height: 1em; }
.field-error, .validation-summary-errors { color: var(--danger); font-size: .86rem; }
.validation-summary-errors ul { margin: 0 0 10px; padding-left: 18px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: .92rem; }

/* ── Receipt page ── */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.preview { overflow: hidden; }
.preview img { display: block; width: 100%; max-height: 74vh; object-fit: contain; background: #0b0b0c; }
.preview iframe { display: block; width: 100%; height: 74vh; border: 0; background: #fff; }
.preview-none { padding: 48px 20px; text-align: center; color: var(--muted); }
.preview-meta { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; font-size: .86rem; color: var(--muted); border-top: 1px solid var(--border); }
.preview-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Home ── */
.biz-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
@media (max-width: 720px) { .biz-cards { grid-template-columns: minmax(0, 1fr); } }
.biz-card { display: block; text-decoration: none; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; animation: rise .4s ease-out both; }
.biz-card:nth-child(2) { animation-delay: .06s; }
.biz-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--card-accent); }
.biz-card.jl { --card-accent: #0d6e66; }
.biz-card.pvi { --card-accent: #4136c4; }
.biz-card:hover { transform: translateY(-2px); border-color: var(--card-accent); }
.biz-card h2 { font-size: 1.3rem; }
.biz-card .meta { margin-top: 10px; color: var(--muted); font-size: .92rem; display: flex; gap: 14px; flex-wrap: wrap; }
.biz-card .go { margin-top: 18px; display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--card-accent); }
@media (prefers-color-scheme: dark) { .biz-card.jl { --card-accent: #3fcfbd; } .biz-card.pvi { --card-accent: #a9a3ff; } }

/* ── Sign-in ── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.4rem; margin-top: 18px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .84rem; margin: 20px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
details.password > summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .92rem; list-style: none; text-align: center; padding: 6px; border-radius: 8px; }
details.password > summary::-webkit-details-marker { display: none; }
details.password > summary:hover { color: var(--text); }
details.password[open] > summary { margin-bottom: 12px; }

/* ── Passkeys list ── */
.keys { list-style: none; margin: 0; padding: 0; }
.keys li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.keys li:first-child { border-top: 0; }
.keys .grow { flex: 1; min-width: 0; }

.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.footer-note { margin-top: 28px; text-align: center; color: var(--muted); font-size: .8rem; }
.add-passkey-cell { display: flex; align-items: flex-end; }
#addPasskeyForm { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.password-form { margin-top: 14px; }
.error-home { margin-top: 18px; }
.queue-done { justify-content: flex-end; margin-top: 10px; }
.table-note { margin-top: 10px; }
.delete-row { margin-top: 14px; text-align: right; }
.upper { text-transform: uppercase; }
.preview-none .icon { width: 36px; height: 36px; margin-bottom: 8px; }

/* ══ The phone app (James, 2026-10-24: installed on his phone, that's the interface he'll use) ══ */
.show-phone { display: none; }
@media (max-width: 720px) {
  .hide-phone { display: none !important; }
  .show-phone { display: inline; }
  /* iPhones zoom into any field under 16px. */
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea { font-size: 16px; }
  h1 { font-size: 1.45rem; }
  main.wrap { padding-top: 16px; }
}
.wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.topbar { padding-top: env(safe-area-inset-top); }

/* Bottom tab bar: phones only. The top bar's business tabs move down here. */
.tabbar { display: none; }
@media (max-width: 720px) {
  body.has-tabbar main.wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.has-tabbar .biz-tabs { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); padding: 6px max(6px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-right)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; border-radius: 12px;
    text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 650; transition: color .15s, background .15s; -webkit-tap-highlight-color: transparent; }
  .tabbar a .icon { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--text); background: var(--surface-2); }
  .tab-badge { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 5px; border-radius: 7px; color: #fff; font-size: .68rem; font-weight: 800; letter-spacing: .03em; }
  .tabbar a.jl .tab-badge { background: #0d6e66; }
  .tabbar a.pvi .tab-badge { background: #4136c4; }
  .tabbar a:not(.on) .tab-badge { opacity: .75; }
}

/* The camera button on a business's pages: one tap from anywhere in that business to the camera. */
.fab { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 25;
  width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px rgba(0, 0, 0, .22); transition: transform .15s; animation: pop .35s ease-out both; }
.fab:active { transform: scale(.94); }
.fab .icon { width: 26px; height: 26px; }
@media (max-width: 720px) { .fab { bottom: calc(84px + env(safe-area-inset-bottom)); } }
@media (min-width: 721px) { .fab { display: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }

/* Snap home: one big button per business, straight to the camera. */
.snap-head { margin-bottom: 16px; }
.snap-head p { margin-top: 6px; }
.snap-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 720px) { .snap-tiles { grid-template-columns: minmax(0, 1fr); gap: 14px; } }
.snap-tile { --tile: #0d6e66; border-radius: 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); animation: rise .4s ease-out both; }
.snap-tile.pvi { --tile: #4136c4; animation-delay: .06s; }
.snap-shoot { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 16px; align-items: center; margin: 0;
  padding: 26px 22px; min-height: 132px; cursor: pointer; color: #fff; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--tile) 70%, #fff) 0%, var(--tile) 55%, color-mix(in srgb, var(--tile) 80%, #000) 100%);
  transition: filter .15s, transform .15s; }
.snap-shoot:hover { filter: brightness(1.06); }
.snap-shoot:active { transform: scale(.985); filter: brightness(.95); }
.snap-icon { grid-row: span 2; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .18); }
.snap-icon .icon { width: 30px; height: 30px; }
.snap-name { font-size: 1.3rem; font-weight: 720; letter-spacing: -.01em; line-height: 1.2; }
.snap-hint { font-size: .92rem; opacity: .85; font-weight: 600; }
.snap-more { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; }
.snap-more .btn { flex: 1; min-height: 42px; }
.snap-review { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); background: var(--warn-soft); }
.sr-only:focus-visible + .snap-more, .snap-shoot:focus-within { outline: 2px solid var(--tile); }

/* "Put it on your home screen" */
.install-tip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 16px; border-radius: 14px; background: var(--accent-soft); font-size: .9rem; animation: rise .3s ease-out both; }
.install-tip > span { flex: 1; }

/* The tray: receipts on their way, above the tab bar on phones and in the corner on a computer. */
.tray { position: fixed; z-index: 28; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); bottom: calc(82px + env(safe-area-inset-bottom));
  max-height: 46vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .18); animation: rise .25s ease-out both; }
@media (min-width: 721px) { .tray { left: auto; right: 20px; bottom: 20px; width: 400px; } }
body:has(.fab) .tray { bottom: calc(156px + env(safe-area-inset-bottom)); }
@media (min-width: 721px) { body:has(.fab) .tray { bottom: 20px; } }
.tray-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 8px 16px; border-bottom: 1px solid var(--border); }
.tray-list { list-style: none; margin: 0; padding: 4px 6px; overflow-y: auto; }
.tray-item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 12px; animation: rise .25s ease-out both; }
.tray-item + .tray-item { border-top: 1px solid var(--border); border-radius: 0; }
.tray-thumb { width: 44px; height: 44px; border-radius: 10px; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.tray-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tray-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tray-title { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: .92rem; min-width: 0; }
.tray-title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #0d6e66; }
.tray-item.pvi .tray-dot { background: #4136c4; }
.tray-sub { font-size: .8rem; color: var(--muted); }
.tray-item[data-state=failed] .tray-sub { color: var(--danger); }
.tray-item[data-state=read] .tray-sub { color: var(--ok); }
.tray-end { flex-shrink: 0; color: var(--muted); }

/* Reviewing a receipt on a phone: a focused screen (no tab bar), a smaller picture (tap it for full size) and its
   buttons pinned to the bottom, always in reach. */
@media (max-width: 720px) {
  body.focus .tabbar { display: none; }
  body.focus main.wrap { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  body.focus .tray { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .preview img { max-height: 42vh; }
  .preview iframe { height: 50vh; }
  /* No entrance animation here: an animated transform would make the card, not the screen, hold the pinned bar. */
  .receipt-form { animation: none; }
  .receipt-form .card-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; border-radius: 0; gap: 8px;
    padding: 10px max(14px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--surface) 94%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .08); flex-wrap: nowrap; }
  .receipt-form .card-foot .btn-row { flex: 1; flex-wrap: nowrap; }
  .receipt-form .card-foot .btn-primary { flex: 1; min-height: 48px; }
  .receipt-form .card-foot .btn { min-height: 48px; white-space: nowrap; }

  /* The tray never hides the snap buttons: two receipts at a time, the rest a scroll away. */
  .tray-list { max-height: 128px; }

  /* A business's receipts: the camera button does the snapping, so the drop zone stays small. */
  .drop { padding: 16px 12px; }
  .drop-icon, .drop > .muted.small { display: none; }
  .drop-title { font-size: 1rem; }
  .drop .btn-row { margin-top: 10px; }
  .drop .btn-row .btn { flex: 1; min-height: 46px; }
}

/* The offline page (served by the service worker without a connection). */
.offline-text { margin: 10px 0 18px; }
.auth-card.still, .still { animation: none; }
