@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url("../fonts/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("../fonts/poppins-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("../fonts/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("../fonts/poppins-latin-700-normal.woff2") format("woff2"); }

:root {
  --brand: #90253c; --brand-dark: #5c0f22; --brand-soft: #fbeef1; --brand-line: #ecd3da;
  --bg: #f5f2f3; --panel: #fff; --text: #241a1d; --muted: #6e5f64; --border: #e7dfe2;
  --ok: #1d7a46; --ok-soft: #e6f4ec; --warn: #9a5b00; --warn-soft: #fff4e0; --err: #b3261e; --err-soft: #fdecea;
  --radius: 14px; --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --brand: #e47b93; --brand-soft: #2a171c; --brand-line: #4a2a32; --bg: #121011; --panel: #1c1719; --text: #f3ecee;
    --muted: #b3a5aa; --border: #33292c; --ok: #6fd39a; --ok-soft: #12291c; --warn: #f0b45a; --warn-soft: #2d2210; --err: #ff8a80; --err-soft: #331614; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 Poppins, system-ui, sans-serif; background: var(--bg); color: var(--text); overscroll-behavior: none; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--border); background: var(--panel); border-radius: 12px; padding: 10px 14px; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { button.primary { background: #a3304a; border-color: #a3304a; } }
button.big { width: 100%; padding: 14px; font-size: 16px; }
button.huge { width: 100%; padding: 18px; font-size: 19px; border-radius: 16px; display: flex; align-items: center; justify-content: center; gap: 10px; }
button.danger { color: var(--err); }
input[type=text], input[type=password], input[type=search] { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); font-size: 16px; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.status { min-height: 1.2em; margin: 8px 0; font-size: 14px; }
.status.err { color: var(--err); }
.status.ok { color: var(--ok); }
.note { margin: 10px 0; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; background: var(--brand-soft); }
.note.warn { background: var(--warn-soft); color: var(--warn); }

.screen { min-height: 100%; display: flex; flex-direction: column; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--top)) 12px 10px;
  background: var(--brand-dark); color: #fff; }
.bar-logo { height: 30px; }
.bar-title { flex: 1; font-weight: 600; font-size: 16px; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.bar-title small { font-weight: 400; font-size: 12px; opacity: .8; }
.bar-space { width: 44px; }
.icon-btn { background: transparent; border: 0; color: #fff; font-size: 24px; width: 44px; height: 44px; padding: 0; }
.bar-action { background: #fff; color: var(--brand-dark); border: 0; font-weight: 600; padding: 9px 14px; }
.body { padding: 14px 14px calc(24px + var(--bottom)); display: flex; flex-direction: column; gap: 12px; }
h2 { font-size: 15px; margin: 14px 2px 0; }

/* starting + sign in */
.boot, .login { background: linear-gradient(170deg, var(--brand-dark), #3a0613 70%); color: #fff; align-items: center; justify-content: center; gap: 12px; }
.boot-logo { width: 170px; }
.login { justify-content: flex-start; padding: calc(40px + var(--top)) 18px calc(18px + var(--bottom)); }
.login-top { text-align: center; margin-bottom: 18px; }
.login-logo { width: 180px; }
.login-top h1 { margin: 10px 0 0; font-size: 24px; }
.login-top p { margin: 2px 0 0; opacity: .85; }
.login-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.login-card label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.login-card button { margin-top: 14px; }
.foot { margin-top: auto; font-size: 11.5px; opacity: .7; text-align: center; }

/* home */
.company-pick { position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 1px; padding-right: 40px; width: 100%; }
.company-pick strong { font-size: 17px; }
.chev { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 26px; color: var(--muted); }
.scan-actions { display: flex; flex-direction: column; gap: 10px; }
.ico { font-size: 22px; }
.draft { text-align: left; border-color: var(--brand-line); background: var(--brand-soft); width: 100%; }
.sent-list { display: flex; flex-direction: column; gap: 8px; }
.sent { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.sent strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sent .meta { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.sent .acts { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 6px; }
.sent .acts button { padding: 6px 12px; font-size: 13px; }
.tag { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--border); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.err { background: var(--err-soft); color: var(--err); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.bar-prog { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.bar-prog i { display: block; height: 100%; background: var(--brand); }
.empty { text-align: center; color: var(--muted); padding: 18px; font-size: 13.5px; }

/* companies */
.co-list { display: flex; flex-direction: column; gap: 8px; }
.co-item { text-align: left; display: flex; flex-direction: column; width: 100%; }
.co-item strong { font-size: 15.5px; }
.co-item[aria-current="true"] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

/* camera */
.camera { position: fixed; inset: 0; background: #000; color: #fff; overflow: hidden; }
#camVideo, #camOverlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
.cam-flash.on { opacity: .8; transition: none; }
.cam-top { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: center; padding: calc(12px + var(--top)) 14px 12px;
  background: linear-gradient(rgba(0,0,0,.55), transparent); }
.cam-btn { width: 48px; height: 48px; border-radius: 50%; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.35); color: #fff; font-size: 20px; padding: 0; }
.cam-btn[aria-pressed="true"] { background: #fff; color: #000; }
.cam-chip { background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 999px; padding: 8px 14px; font-size: 13.5px; }
.cam-chip[aria-pressed="true"] { background: #fff; color: var(--brand-dark); font-weight: 600; }
.cam-hint { position: absolute; left: 50%; bottom: calc(132px + var(--bottom)); transform: translateX(-50%); margin: 0; background: rgba(0,0,0,.6);
  padding: 7px 14px; border-radius: 999px; font-size: 14px; white-space: nowrap; }
.cam-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; align-items: center;
  padding: 16px 20px calc(22px + var(--bottom)); background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.shutter { width: 78px; height: 78px; border-radius: 50%; background: #fff; border: 5px solid rgba(255,255,255,.45); background-clip: padding-box; padding: 0; }
.shutter:active { transform: scale(.94); }
.cam-thumb { position: relative; width: 56px; height: 56px; padding: 0; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.12); border: 2px solid #fff; }
.cam-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-thumb img:not([src]) { visibility: hidden; }
.cam-thumb span { position: absolute; top: -2px; right: -2px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.cam-error { position: absolute; inset: 0; background: rgba(0,0,0,.88); display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 30px; text-align: center; }
.cam-error button:not(.primary) { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }

/* review */
.review { height: 100%; }
.rv-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px; background: #2a2326; }
#rvImg { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 6px 20px rgba(0,0,0,.4); background: #fff; }
.rv-busy { position: absolute; margin: 0; background: rgba(0,0,0,.7); color: #fff; padding: 8px 16px; border-radius: 999px; }
.rv-filters { display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; background: var(--panel); border-top: 1px solid var(--border); }
.rv-filters button { flex: none; padding: 8px 12px; font-size: 13.5px; }
.rv-filters button[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); font-weight: 600; background: var(--brand-soft); }
.rv-tools { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--panel); border-top: 1px solid var(--border); }
.rv-tools button { border: 0; border-radius: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; padding: 10px 2px; }
.rv-tools button span { font-size: 20px; line-height: 1; }
.rv-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); border-top: 1px solid var(--border); }
.rv-row > button { padding: 8px 12px; }
.join { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.join input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.join span { display: flex; flex-direction: column; line-height: 1.25; }
.join small { color: var(--muted); font-size: 11.5px; }
.join.off { opacity: .45; }
.rv-strip { display: flex; gap: 8px; padding: 10px 10px calc(10px + var(--bottom)); overflow-x: auto; background: var(--panel); border-top: 1px solid var(--border); }
.th { flex: none; width: 66px; padding: 0; border-radius: 8px; overflow: hidden; position: relative; border: 2px solid transparent; background: var(--bg); }
.th img { width: 100%; height: 84px; object-fit: cover; display: block; }
.th span { display: block; font-size: 10.5px; padding: 2px 0; text-align: center; background: var(--panel); white-space: nowrap; }
.th[aria-current="true"] { border-color: var(--brand); }
.th.joined { margin-left: -6px; border-left-style: dashed; }
.th.add { display: grid; place-items: center; font-size: 30px; color: var(--brand); height: 106px; border: 2px dashed var(--brand-line); }

/* crop */
.crop { position: fixed; inset: 0; background: #111; }
.cr-stage { position: relative; flex: 1; min-height: 0; margin: 18px; touch-action: none; display: flex; align-items: center; justify-content: center; }
#crImg { max-width: 100%; max-height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
#crSvg { position: absolute; overflow: visible; pointer-events: none; }
.cr-handle { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 3px solid #fff; background: rgba(144,37,60,.55); touch-action: none; z-index: 2; }
.cr-tools { display: flex; gap: 10px; padding: 10px 14px calc(14px + var(--bottom)); }
.cr-tools button { flex: 1; background: #2a2326; color: #fff; border-color: #443a3e; }

/* send */
.lbl { font-size: 13px; color: var(--muted); margin: 0 2px -6px; }
.summary { display: flex; flex-direction: column; gap: 8px; }
.summary .bills { display: flex; flex-wrap: wrap; gap: 8px; }
.summary .bill { display: flex; gap: 3px; padding: 4px; border-radius: 8px; background: var(--bg); }
.summary .bill img { width: 40px; height: 52px; object-fit: cover; border-radius: 4px; }
.summary .bill b { font-size: 11px; align-self: flex-end; padding: 0 3px; }

/* menu + toast */
.sheet { border: 0; border-radius: 18px 18px 0 0; margin: auto 0 0; width: 100%; max-width: 100%; padding: 18px 16px calc(18px + var(--bottom));
  background: var(--panel); color: var(--text); display: flex; flex-direction: column; gap: 10px; }
.sheet:not([open]) { display: none; }
.sheet::backdrop { background: rgba(0,0,0,.5); }
.mn-user { margin: 0 0 4px; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--bottom)); transform: translateX(-50%); z-index: 50; max-width: 92vw;
  background: #241a1d; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.toast.top { bottom: auto; top: calc(78px + var(--top)); }
