/* ADA receipts. The ADA design system (ada-design-system/tokens.css), as in the feedback app: pure white paper, cool
   slate ink, the ink-blue accent, Heebo for all Hebrew, hairline rules, tight radii, no shadows, no gradients.
   Hebrew, right to left, logical properties only. Sized for a phone held in one hand (360-440 px wide). */
@font-face { font-family: 'Heebo'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/fonts/heebo-hebrew-v28.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/fonts/heebo-latin-ext-v28.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Heebo'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/fonts/heebo-latin-v28.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --paper: #FFFFFF;
  --ink: #233137;
  --ink-2: #5F6B70;
  --ink-3: #8E999D;
  --rule: #E8E8E8;
  --rule-2: #D2D7D9;
  --tint: #F3F5F6;
  --accent: #1F2C3A;
  --accent-2: #33475A;
  --ok: #2A513C;
  --warn: #7A4A12;
  --err: #5C1A1F;
  --radius: 6px;
  --sans: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

body.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.bar { position: relative; flex: none; display: flex; justify-content: center; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 20px 12px; border-bottom: 1px solid var(--rule); }
.logo { display: block; height: 24px; width: auto; }
.test-badge { position: absolute; inset-inline-start: 20px; top: calc(env(safe-area-inset-top, 0px) + 17px);
  font-size: 12px; letter-spacing: 0.04em; color: var(--err); border: 1px solid currentColor; border-radius: 3px; padding: 1px 7px; }

main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; outline: none;
  padding: 22px 16px calc(env(safe-area-inset-bottom, 0px) + 28px); }

h1 { margin: 0; font-size: 22px; font-weight: 500; line-height: 1.35; }
.lead { margin: 8px 0 22px; font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.label { display: block; margin: 0 0 8px; font-size: 15px; font-weight: 500; color: var(--ink); }
.small { font-size: 14px; line-height: 1.5; }
.muted { color: var(--ink-2); }
.hint { margin: 10px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.hint.warn { color: var(--warn); }
.error { margin: 10px 0 0; font-size: 15px; color: var(--err); }
.notice { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--rule-2); border-radius: var(--radius);
  font-size: 15px; line-height: 1.5; color: var(--ink-2); }

.field { display: block; width: 100%; font: inherit; font-size: 17px; line-height: 1.4; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 12px 14px; }
.field:focus { outline: none; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.field::placeholder { color: var(--ink-3); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px;
  padding: 0 20px; border-radius: var(--radius); border: 1px solid var(--rule-2); background: var(--paper);
  font-size: 17px; font-weight: 500; cursor: pointer; transition: background-color 140ms var(--ease), opacity 140ms var(--ease); }
.btn:active { background: var(--tint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn.primary:active { background: var(--accent-2); }
.btn[disabled] { opacity: 0.35; cursor: default; }
.btn.wide { width: 100%; margin-top: 22px; }
.btn.big { width: 100%; min-height: 64px; font-size: 19px; }
.btn .mark { width: 24px; height: 24px; flex: none; }
.mark { display: inline-flex; width: 22px; height: 22px; }
.mark svg { width: 100%; height: 100%; display: block; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -8px;
  border: 0; background: none; border-radius: var(--radius); cursor: pointer; }
.icon-btn:active { background: var(--tint); }
.icon-btn .mark { width: 24px; height: 24px; }
.link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 8px 0; cursor: pointer;
  font-size: 14px; color: var(--ink-2); }
.link .mark { width: 18px; height: 18px; }

/* segmented choice: the month, the scan's look */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--rule-2); border-radius: var(--radius); overflow: hidden; }
.seg-btn { min-height: 50px; padding: 0 10px; border: 0; background: var(--paper); font-size: 16px; cursor: pointer; }
.seg-btn + .seg-btn { border-inline-start: 1px solid var(--rule-2); }
.seg-btn:active { background: var(--tint); }
.seg-btn[aria-checked="true"] { background: var(--accent); color: #FFFFFF; font-weight: 500; }
.small-seg .seg-btn { min-height: 42px; font-size: 15px; }

/* sign-in */
.signin { padding-top: 12px; }

/* home */
.home .actions { display: grid; gap: 12px; margin-top: 22px; }
.home .folder { margin: 12px 0 0; }
.home .count { margin: 4px 0 0; color: var(--ok); }
.section { margin: 30px 0 4px; font-size: 15px; font-weight: 500; color: var(--ink-2); }
.items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.item { border-bottom: 1px solid var(--rule); }
.item-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 2px; text-align: start;
  border: 0; background: none; cursor: default; }
button.item-btn { cursor: pointer; }
button.item-btn:active { background: var(--tint); }
.item .st { flex: none; width: 22px; height: 22px; color: var(--ink-3); }
.item.s-saved .st { color: var(--ok); }
.item.s-failed .st, .item.s-retry .st { color: var(--warn); }
.item.s-uploading .st svg { animation: spin 1.1s linear infinite; }
.item .txt { flex: 1; min-width: 0; }
.item .n { display: flex; gap: 10px; align-items: baseline; font-size: 16px; font-variant-numeric: tabular-nums; }
.item .status { font-size: 14px; color: var(--ink-2); }
.item.s-failed .status, .item.s-retry .status { color: var(--warn); }
.item .m { display: block; margin-top: 2px; font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.items .empty { padding: 16px 2px; font-size: 15px; color: var(--ink-3); }
.tag { flex: none; font-size: 12px; padding: 3px 7px; border-radius: 3px; border: 1px solid var(--err); color: var(--err); }
.foot { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; }
.ver { font-size: 12px; color: var(--ink-3); }

/* corners and review */
.top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; margin-bottom: 4px; }
.top h1 { text-align: center; font-size: 19px; }
.top-end { text-align: end; font-size: 13px; white-space: nowrap; }
.crop .hint { text-align: center; margin: 4px 0 14px; }
.stage { position: relative; margin: 0 auto; touch-action: none; -webkit-user-select: none; user-select: none; }
.stage .photo { display: block; border-radius: 2px; }
.stage .quad { position: absolute; left: 0; top: 0; touch-action: none; overflow: visible; }
.quad .shade { fill: rgba(15, 23, 30, 0.42); }
.quad .edge { fill: none; stroke: rgba(15, 23, 30, 0.55); stroke-width: 4; }
.quad .edge2 { fill: none; stroke: #FFFFFF; stroke-width: 2; }
.quad .knob { fill: #FFFFFF; stroke: var(--accent); stroke-width: 2.5; }
.quad .knob.on { fill: var(--accent); stroke: #FFFFFF; }
.loupe { position: absolute; width: 128px; height: 128px; border-radius: 50%; border: 2px solid #FFFFFF; outline: 1px solid var(--accent); pointer-events: none; }
.tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.tool { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 12px; border: 1px solid var(--rule-2);
  border-radius: var(--radius); background: var(--paper); font-size: 15px; cursor: pointer; }
.tool:active { background: var(--tint); }
.tool .mark { width: 20px; height: 20px; }
.review .tools .seg { flex: 1 1 100%; }
.sheet { margin: 10px 0 0; display: flex; justify-content: center; }
.sheet img { display: block; max-width: 100%; max-height: 46vh; max-height: 46dvh; border: 1px solid var(--rule-2); background: var(--paper); }
.strip { display: flex; gap: 8px; list-style: none; margin: 16px 0 0; padding: 0 0 4px; overflow-x: auto; }
.strip li { position: relative; flex: none; }
.strip img { display: block; height: 72px; width: auto; border: 1px solid var(--rule-2); }
.strip li.current img { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.strip .pn { position: absolute; inset-inline-start: 3px; bottom: 3px; font-size: 11px; line-height: 1; padding: 2px 4px; background: rgba(255, 255, 255, 0.9); border-radius: 2px; }
.strip .del { position: absolute; inset-inline-end: -2px; top: -2px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule-2); border-radius: 50%; background: var(--paper); cursor: pointer; padding: 0; }
.strip .del .mark { width: 16px; height: 16px; }
.review .label { margin-top: 20px; }
/* save and add-page stay at the bottom of the screen, whatever is above them */
.row-btns { position: sticky; bottom: 0; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 20px -16px calc(-28px - env(safe-area-inset-bottom, 0px)); padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: var(--paper); border-top: 1px solid var(--rule); }

/* overlay: busy, dialog */
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(255, 255, 255, 0.92); }
.busy { display: flex; flex-direction: column; align-items: center; gap: 14px; font-size: 16px; color: var(--ink-2); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--rule-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card { width: 100%; max-width: 420px; padding: 26px 22px 22px; border: 1px solid var(--rule-2); border-radius: 8px; background: var(--paper); }
.card h2 { margin: 0 0 10px; font-size: 20px; font-weight: 500; }
.card p { margin: 0 0 22px; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.card-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.toast { position: fixed; inset-inline: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 20; margin: 0 auto; max-width: 520px;
  padding: 13px 16px; border-radius: var(--radius); background: var(--accent); color: #FFFFFF; font-size: 15px; line-height: 1.45; text-align: center; }

@media (prefers-reduced-motion: reduce) { .spinner, .item.s-uploading .st svg { animation-duration: 3s; } }
.hint.center { text-align: center; }
