/* Shared styles for the intake prototypes: tokens, form controls, cards, camera overlay, viewer. */
:root { --ink:#1d1d1f; --muted:#6e6e73; --line:#d2d2d7; --bg:#f5f5f7; --accent:#0a7c4a; --accent-soft:#e6f4ec; --warn:#b45309; --warn-soft:#fff4dc; --err:#b91c1c; --err-soft:#fee2e2; --brand:#ffd60a; }
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html { height:100%; }
body { margin:0; min-height:100%; font-family:-apple-system,system-ui,Segoe UI,Roboto,sans-serif; color:var(--ink); background:var(--bg); -webkit-text-size-adjust:100%; }
body.locked { overflow:hidden; }
button { font-family:inherit; }
.hidden { display:none !important; }
main { padding:16px; max-width:560px; margin:0 auto; padding-bottom:calc(110px + env(safe-area-inset-bottom)); }
.card { background:#fff; border:1px solid var(--line); border-radius:14px; padding:14px; margin-bottom:12px; }
label { display:block; font-size:13px; color:var(--muted); margin:10px 0 4px; }
input, select, textarea { width:100%; font-size:16px; padding:12px; border:1px solid var(--line); border-radius:10px; background:#fff; color:var(--ink); min-height:48px; }
textarea { min-height:70px; }
input[type=date] { -webkit-appearance:none; appearance:none; display:block; max-width:100%; line-height:1.2; }
input::-webkit-date-and-time-value { text-align:left; }
.row { display:flex; gap:10px; } .row > * { flex:1 1 0; min-width:0; }
.btn { display:flex; align-items:center; justify-content:center; gap:8px; width:100%; font-size:18px; font-weight:700; padding:16px; min-height:58px; border-radius:14px; border:0; background:var(--accent); color:#fff; margin-top:12px; }
.btn.secondary { background:#fff; color:var(--ink); border:1px solid var(--line); }
.btn.warn { background:var(--warn); }
.btn:disabled { opacity:.45; }
.hint { font-size:13px; color:var(--muted); margin-top:6px; }
.note { font-size:14px; padding:10px 12px; border-radius:10px; background:var(--accent-soft); color:#065f46; margin-top:10px; }
.note.warn { background:var(--warn-soft); color:var(--warn); }
.error { font-size:14px; padding:10px 12px; border-radius:10px; background:var(--err-soft); color:var(--err); margin-top:10px; white-space:pre-wrap; }
.error ul.docs { margin:8px 0 0; padding-left:18px; font-size:13px; color:var(--ink); white-space:normal; }
.pill { font-size:12px; padding:3px 9px; border-radius:999px; background:#eef; color:#334; white-space:nowrap; }
.pill.err { background:var(--err-soft); color:var(--err); } .pill.ok { background:#dcfce7; color:#166534; } .pill.warn { background:#fef3c7; color:var(--warn); }
.sticky { position:fixed; left:0; right:0; bottom:0; padding:10px 16px calc(12px + env(safe-area-inset-bottom)); background:rgba(255,255,255,.96); border-top:1px solid var(--line); z-index:3; }
.sticky .btn { margin-top:0; }
.lang { flex:0 0 auto; border:1px solid var(--accent); background:#fff; color:var(--accent); font-size:15px; font-weight:700; padding:8px 14px; border-radius:10px; min-height:40px; }
.fatal { text-align:center; padding:28px 16px; font-size:15px; }
.spinner { width:36px; height:36px; border:4px solid var(--line); border-top-color:var(--accent); border-radius:50%; margin:0 auto 12px; animation:spin .9s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* status dots and ticks shared by the list-style designs */
.dot { width:30px; height:30px; border-radius:50%; border:2px solid var(--line); background:#fff; display:inline-flex; align-items:center; justify-content:center; font-size:16px; font-weight:800; flex:0 0 auto; }
.dot.ok { background:var(--accent); border-color:var(--accent); color:#fff; }
.dot.warn { background:var(--warn); border-color:var(--warn); color:#fff; }
.dot.busy { border-color:var(--accent); border-top-color:transparent; animation:spin .9s linear infinite; }
.dot.err { background:var(--err); border-color:var(--err); color:#fff; }

/* thumbnails and pages */
.thumbs { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.thumb { position:relative; width:76px; height:76px; border-radius:10px; overflow:hidden; border:1px solid var(--line); background:#eee; padding:0; }
.thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.thumb .x { position:absolute; top:2px; right:2px; width:26px; height:26px; border-radius:13px; border:0; background:rgba(0,0,0,.6); color:#fff; font-size:15px; line-height:26px; padding:0; }
.thumb .n { position:absolute; left:4px; bottom:3px; font-size:11px; color:#fff; background:rgba(0,0,0,.55); border-radius:4px; padding:1px 5px; }
.thumb .zoom { position:absolute; inset:0; border:0; background:transparent; padding:0; }
.addpage { width:76px; height:76px; border:2px dashed var(--line); border-radius:10px; background:#fff; color:var(--accent); font-size:12px; font-weight:700; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
.addpage b { font-size:22px; line-height:1; }

/* check cards: compact row that expands to the full form */
.invcard { border:1px solid var(--line); border-radius:14px; background:#fff; margin-bottom:10px; overflow:hidden; }
.invcard.ok { border-color:var(--accent); } .invcard.warn { border-color:var(--warn); } .invcard.bad { border-color:var(--err); } .invcard.saved { border-color:var(--accent); background:#f6fbf8; }
.invcard .head { display:flex; align-items:center; gap:12px; padding:10px 12px; background:transparent; border:0; width:100%; text-align:left; color:var(--ink); }
.invcard .head img { width:56px; height:56px; border-radius:8px; object-fit:cover; background:#eee; flex:0 0 auto; }
.invcard .head .mid { flex:1 1 auto; min-width:0; }
.invcard .head .vend { font-size:17px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.invcard .head .sub { font-size:13px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.invcard .head .amt { font-size:20px; font-weight:800; white-space:nowrap; }
.invcard .head .amt.missing { color:var(--warn); font-size:14px; font-weight:700; }
.invcard .body { padding:0 12px 12px; border-top:1px solid var(--line); }
.invcard .why { font-size:13px; color:var(--warn); padding:8px 12px 0; }
.radios { display:flex; gap:10px; } .radios label { flex:1; margin:0; }
.radios input { display:none; }
.radios span { display:block; text-align:center; padding:12px; border:1px solid var(--line); border-radius:10px; font-size:16px; color:var(--ink); }
.radios input:checked + span { border-color:var(--accent); background:var(--accent-soft); font-weight:700; }
.flag { border-color:var(--warn); background:#fffbeb; }
.linkbtn { font-size:14px; color:var(--accent); background:none; border:0; padding:6px 0; text-decoration:underline; }

/* receipt */
.kv { font-size:15px; text-align:left; margin-top:12px; } .kv div { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid var(--line); }
.kv div:last-child { font-weight:800; border-bottom:0; }

/* busy overlay */
#busy { position:fixed; inset:0; z-index:40; background:rgba(245,245,247,.96); display:flex; flex-direction:column; align-items:center; justify-content:center; padding:24px; text-align:center; }
#busy .txt { font-size:18px; font-weight:700; }
#busy .progress { width:220px; height:8px; background:var(--line); border-radius:4px; overflow:hidden; margin-top:14px; }
#busy .progress i { display:block; height:100%; background:var(--accent); width:0; transition:width .3s; }
#busy .sec { font-size:13px; color:var(--muted); margin-top:8px; }

/* camera overlay. Two buttons, no mode: the white circle starts a new invoice, the yellow square adds a page to the
   ringed invoice. Flex column: the viewfinder takes what the bottom panel leaves. */
.cam { position:fixed; inset:0; background:#000; z-index:30; display:flex; flex-direction:column; --cam-font:'Big Shoulders Text',-apple-system,system-ui,sans-serif; }
.cam video { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; background:#000; }
.cam .view { position:relative; flex:1 1 auto; min-height:0; margin-top:calc(62px + env(safe-area-inset-top)); overflow:hidden; }
.cam .frame { position:absolute; left:12px; top:8px; width:100px; height:129px; pointer-events:none; border-radius:4px; box-shadow:0 0 0 4000px rgba(0,0,0,.42); }
.cam .frame i { position:absolute; width:36px; height:36px; border:5px solid #fff; filter:drop-shadow(0 0 2px rgba(0,0,0,.8)); }
.cam .frame .tl { left:-3px; top:-3px; border-right:0; border-bottom:0; border-radius:8px 0 0 0; }
.cam .frame .tr { right:-3px; top:-3px; border-left:0; border-bottom:0; border-radius:0 8px 0 0; }
.cam .frame .bl { left:-3px; bottom:-3px; border-right:0; border-top:0; border-radius:0 0 0 8px; }
.cam .frame .br { right:-3px; bottom:-3px; border-left:0; border-top:0; border-radius:0 0 8px 0; }
.cam .rotate { display:none; position:absolute; inset:0; z-index:1; background:rgba(0,0,0,.8); color:#fff; align-items:center; justify-content:center; gap:14px; padding:0 24px; text-align:center; font-family:var(--cam-font); font-size:22px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
.cam .rotate b { font-size:40px; line-height:1; }
.cam.rotate .rotate { display:flex; }
.cam.rotate .frame { display:none; }
.cam .ctop { position:absolute; top:0; left:0; right:0; display:flex; justify-content:space-between; align-items:center; gap:8px; padding:calc(8px + env(safe-area-inset-top)) 12px 10px; color:#fff; background:linear-gradient(rgba(0,0,0,.7),transparent); }
.cam .ctop .x { background:rgba(255,255,255,.2); color:#fff; border:0; border-radius:12px; width:46px; height:46px; font-size:22px; font-weight:700; flex:0 0 auto; }
.cam .ctop .title { flex:1 1 auto; text-align:center; font-family:var(--cam-font); font-size:20px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; text-shadow:0 1px 3px #000; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cam .ctop .done { flex:0 0 auto; background:var(--accent); color:#fff; border:0; border-radius:12px; height:46px; padding:0 16px; font-family:var(--cam-font); font-size:19px; font-weight:800; text-transform:uppercase; letter-spacing:.03em; white-space:nowrap; box-shadow:0 1px 4px rgba(0,0,0,.5); }
/* bottom panel: filmstrip, last-shot line, buttons */
.cam .panel { position:relative; flex:0 0 auto; display:flex; flex-direction:column; align-items:center; gap:8px; padding:8px 12px calc(6px + env(safe-area-inset-bottom)); background:rgba(0,0,0,.84); }
.cam .panel > * { width:100%; max-width:520px; }
.cam .strip { display:flex; gap:8px; padding:3px 0 0; overflow-x:auto; scrollbar-width:none; }
.cam .strip::-webkit-scrollbar { display:none; }
.cam .strip button { position:relative; flex:0 0 auto; width:58px; height:56px; border-radius:8px; border:2px solid #fff; padding:0; overflow:hidden; background:#333; }
.cam .strip img { width:100%; height:100%; object-fit:cover; display:block; }
.cam .strip .n { position:absolute; left:0; bottom:0; right:0; font-family:var(--cam-font); font-size:14px; font-weight:800; text-transform:uppercase; letter-spacing:.03em; color:#000; background:#fff; text-align:center; line-height:17px; white-space:nowrap; }
.cam .strip button.target { border-color:var(--brand); box-shadow:0 0 0 3px var(--brand); }
.cam .strip button.target .n { background:var(--brand); }
.cam .strip .p { position:absolute; top:0; right:0; font-size:11px; font-weight:800; color:#fff; background:var(--accent); padding:1px 5px; border-radius:0 0 0 6px; }
/* last-shot line: the hint before any shot, then what the last tap saved, with Undo for ten seconds */
.cam .banner { min-height:46px; display:flex; align-items:center; justify-content:center; gap:10px; padding:6px 12px; border-radius:12px; background:rgba(255,255,255,.12); color:#fff; text-align:center; }
.cam .banner .status { font-size:15px; font-weight:700; line-height:1.2; }
.cam .banner.saved .status { font-family:var(--cam-font); font-size:21px; font-weight:800; text-transform:uppercase; letter-spacing:.03em; line-height:1; }
.cam .banner.page .status { color:var(--brand); }
.cam .banner .undo { flex:0 0 auto; background:#fff; color:#000; border:0; border-radius:10px; min-height:38px; padding:0 14px; font-size:15px; font-weight:800; }
/* the three controls sit together around the center, a fixed gap apart, whatever the screen width */
.cam .cbar { display:flex; align-items:flex-start; justify-content:center; gap:18px; padding:2px 0 0; }
.cam .ctl { flex:0 1 108px; min-width:96px; display:flex; flex-direction:column; align-items:center; gap:7px; }
.cam .ctl.ghost { visibility:hidden; }
.cam .clabel { font-family:var(--cam-font); font-size:16px; font-weight:800; text-transform:uppercase; letter-spacing:.05em; color:#fff; white-space:nowrap; line-height:1; text-shadow:0 1px 3px #000; text-align:center; }
.cam .ctl.main .clabel { font-size:18px; }
.cam .ctl.page .clabel { color:var(--brand); white-space:normal; line-height:1.05; font-size:15px; }
.cam .round { width:64px; height:64px; border-radius:50%; border:0; background:rgba(255,255,255,.22); color:#fff; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:0; }
.cam .round b { font-size:26px; line-height:1; }
.cam .round.on { background:var(--brand); color:#000; }
/* white circle: new invoice */
.cam .shutter { width:80px; height:80px; border-radius:50%; background:#fff; border:3px solid #000; box-shadow:0 0 0 4px #fff, 0 2px 8px rgba(0,0,0,.6); padding:0; }
.cam .shutter:active { background:#ddd; }
.cam .shutter:disabled { opacity:.4; }
/* yellow square: another page of the ringed invoice */
.cam .pagebtn { width:64px; height:64px; margin-top:8px; border-radius:16px; background:var(--brand); color:#000; border:3px solid #000; box-shadow:0 0 0 3px var(--brand), 0 2px 8px rgba(0,0,0,.6); padding:0; display:flex; flex-direction:column; align-items:center; justify-content:center; line-height:1; }
.cam .pagebtn b { font-size:30px; font-weight:900; line-height:.9; }
.cam .pagebtn span { font-family:var(--cam-font); font-size:13px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.cam .pagebtn:active { background:#e6c000; }
.cam .pagebtn:disabled { opacity:.4; }
.cam .flash { position:absolute; inset:0; background:#fff; opacity:0; pointer-events:none; transition:opacity .2s; z-index:1; }
.cam .flash.on { opacity:.8; transition:none; }
.cam .toast { position:absolute; left:16px; right:16px; top:calc(70px + env(safe-area-inset-top)); background:rgba(185,28,28,.94); color:#fff; padding:12px; border-radius:10px; font-size:15px; font-weight:700; text-align:center; z-index:2; }
.cam .shotnum { position:absolute; left:0; right:0; top:26%; text-align:center; font-family:var(--cam-font); color:#fff; text-transform:uppercase; letter-spacing:.03em; line-height:1; text-shadow:0 2px 12px rgba(0,0,0,.8); pointer-events:none; opacity:0; transform:scale(.6); z-index:1; }
.cam .shotnum b { display:block; font-size:72px; font-weight:900; }
.cam .shotnum small { display:block; font-size:28px; font-weight:800; margin-top:8px; }
.cam .shotnum.page { color:var(--brand); }
.cam .shotnum.pop { animation:pop .8s ease-out; }
@keyframes pop { 0% { opacity:0; transform:scale(.6); } 20% { opacity:1; transform:scale(1.1); } 70% { opacity:1; transform:scale(1); } 100% { opacity:0; transform:scale(1); } }

/* viewer */
.viewer { position:fixed; inset:0; background:#000; z-index:35; display:flex; flex-direction:column; touch-action:none; }
.viewer .vtop { display:flex; justify-content:space-between; align-items:center; color:#fff; padding:calc(8px + env(safe-area-inset-top)) 12px 8px; font-size:14px; }
.viewer .vtop button, .viewer .vbar button { background:rgba(255,255,255,.18); color:#fff; border:0; border-radius:10px; padding:12px 14px; font-size:15px; font-weight:700; }
.viewer .stage { flex:1; overflow:hidden; position:relative; }
.viewer .stage img { position:absolute; left:0; top:0; transform-origin:0 0; will-change:transform; user-select:none; -webkit-user-drag:none; }
.viewer .vbar { display:flex; flex-wrap:wrap; gap:8px; padding:8px 12px calc(12px + env(safe-area-inset-bottom)); }
.viewer .vbar button { flex:1 1 40%; min-height:50px; }
.viewer .vbar button.accent { background:var(--brand); color:#000; }
.viewer .vsheet { position:absolute; left:0; right:0; bottom:0; z-index:2; max-height:75%; display:flex; flex-direction:column; gap:8px; padding:14px 12px calc(14px + env(safe-area-inset-bottom)); background:#1c1c1e; color:#fff; border-radius:18px 18px 0 0; box-shadow:0 -6px 24px rgba(0,0,0,.6); }
.viewer .vsheet h4 { margin:0 0 4px; font-size:17px; font-weight:800; text-align:center; }
.viewer .vsheet .vlist { display:flex; flex-direction:column; gap:8px; overflow-y:auto; min-height:0; }
.viewer .vsheet .vlist button { display:flex; align-items:center; gap:12px; min-height:60px; padding:8px 12px; border:0; border-radius:12px; background:rgba(255,255,255,.12); color:#fff; font-size:16px; font-weight:700; text-align:left; }
.viewer .vsheet .vlist button img { width:44px; height:44px; border-radius:8px; object-fit:cover; background:#333; flex:0 0 auto; }
.viewer .vsheet .vlist button span { display:flex; flex-direction:column; gap:2px; }
.viewer .vsheet .vlist button small { font-size:13px; font-weight:600; opacity:.7; }
.viewer .vsheet .vlist button.new { background:transparent; border:2px dashed var(--brand); color:var(--brand); }
.viewer .vsheet .vlist button.new b { width:44px; text-align:center; font-size:28px; }
.viewer .vsheet > button { background:rgba(255,255,255,.18); color:#fff; border:0; border-radius:12px; min-height:48px; font-size:16px; font-weight:700; }
.viewer .vbar button.danger { background:rgba(185,28,28,.85); }
