/* ABT BillDesk — design system */
:root {
  --bg: #f2f5f9; --panel: #ffffff; --ink: #0f1c2e; --ink-2: #334155; --muted: #64748b; --line: #e3e8ef; --line-2: #eef2f6;
  --primary: #0b7ea3; --primary-2: #0a6a8a; --primary-soft: #e3f4f9; --primary-ink: #075d78;
  --side: #0b1726; --side-2: #13233a; --side-ink: #a9b8cc;
  --ok: #15803d; --ok-bg: #e7f6ec; --warn: #a16207; --warn-bg: #fef6e0; --bad: #b42318; --bad-bg: #fdecea;
  --violet: #6d28d9; --violet-bg: #f1ebfd;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 28, 46, .05), 0 4px 16px rgba(15, 28, 46, .05);
  --shadow-lg: 0 10px 40px rgba(15, 28, 46, .18);
  --side-w: 248px; --top-h: 60px; --tab-h: 64px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); }
h1 { font-size: 22px; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15.5px; margin: 0; letter-spacing: -.005em; }
h3 { font-size: 14px; margin: 0; }
.sub { color: var(--muted); margin: 4px 0 0; }
.hint { color: var(--muted); font-size: 12.5px; }
.muted { color: var(--muted); }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic.lg { width: 22px; height: 22px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------- app shell ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; z-index: 40; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; color: #fff; }
.side .brand img { width: 38px; height: 38px; object-fit: contain; }
.side .brand b { display: block; font-size: 15px; letter-spacing: .01em; }
.side .brand small { display: block; font-size: 11px; color: var(--side-ink); }
.side nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.side .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #6b7d95; margin: 16px 10px 6px; font-weight: 600; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px; color: var(--side-ink); font-weight: 500; margin: 1px 0; }
.side nav a:hover { background: var(--side-2); color: #fff; }
.side nav a.on { background: linear-gradient(90deg, rgba(34, 182, 216, .22), rgba(34, 182, 216, .06)); color: #fff; box-shadow: inset 3px 0 0 #22b6d8; }
.side nav a .count { margin-left: auto; background: #22b6d8; color: #04212c; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; }
.side .me { border-top: 1px solid var(--side-2); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #22b6d8, #0b7ea3); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.side .me .who { flex: 1; min-width: 0; line-height: 1.3; }
.side .me .who b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .me .who span { font-size: 11.5px; }
.side .me form { margin: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(127, 140, 160, .16); }
.scrim { position: fixed; inset: 0; background: rgba(8, 15, 28, .45); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .2s; }

.main { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); background: rgba(242, 245, 249, .85); backdrop-filter: saturate(1.6) blur(10px); display: flex; align-items: center; gap: 10px; padding: 0 28px; border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .menu { display: none; }
.topbar .crumb { font-weight: 600; color: var(--ink-2); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .mobile-brand { display: none; }
.content { padding: 8px 28px 48px; max-width: 1360px; width: 100%; }

.tabbar { display: none; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 20px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- panels & grids ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel.flush .panel-head { padding: 16px 20px 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* stat cards */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 18px; }
.stat { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); color: inherit; display: block; transition: transform .12s, box-shadow .12s, border-color .12s; }
a.stat:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(15, 28, 46, .08); border-color: #cfd8e3; color: inherit; }
.stat .top { display: flex; align-items: center; justify-content: space-between; }
.stat .k { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; line-height: 1.1; }
.stat .n { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.chip-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.chip-ic.warn { background: var(--warn-bg); color: var(--warn); }
.chip-ic.ok { background: var(--ok-bg); color: var(--ok); }
.chip-ic.bad { background: var(--bad-bg); color: var(--bad); }
.chip-ic.violet { background: var(--violet-bg); color: var(--violet); }

/* hero / split panels */
.hero { background: linear-gradient(120deg, #0b1726 0%, #0e3150 55%, #0b7ea3 130%); color: #dbe8f5; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; box-shadow: var(--shadow); }
.hero h1 { color: #fff; }
.hero .sub { color: #a9c0d8; }
.hero .btn { background: #22b6d8; border-color: #22b6d8; color: #04212c; }
.hero .btn:hover { background: #4cc7e3; }
.hero .btn.ghost { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .25); color: #fff; }

.section-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--primary-ink); background: var(--primary-soft); border-radius: 99px; padding: 3px 10px; }
.section-tag.direct { color: var(--violet); background: var(--violet-bg); }

/* ---------- forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: 9px 12px; border: 1px solid #cdd6e1; border-radius: var(--radius-sm); background: #fff; transition: border-color .12s, box-shadow .12s; min-height: 40px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11, 126, 163, .15); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; min-height: 0; accent-color: var(--primary); padding: 0; }
input[type=file] { padding: 7px; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.req::after { content: " *"; color: var(--bad); }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; padding: 9px 15px; min-height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--primary); background: var(--primary); color: #fff; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(11, 126, 163, .25); }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: #cdd6e1; }
.btn.ghost:hover { background: #f5f8fb; border-color: #b9c5d3; color: var(--ink); }
.btn.soft { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.btn.soft:hover { background: #cfeaf3; }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.ok:hover { background: #116a33; }
.btn.bad { background: #fff; color: var(--bad); border-color: #efc2bd; }
.btn.bad:hover { background: var(--bad-bg); }
.btn.violet { background: var(--violet); border-color: var(--violet); }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 12px 20px; min-height: 48px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.inline { display: inline; }

/* segmented control */
.seg { display: inline-flex; background: #e8edf3; border-radius: 12px; padding: 4px; gap: 4px; width: 100%; }
.seg a, .seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--muted); padding: 10px 12px; border-radius: 9px; cursor: pointer; text-align: center; }
.seg .on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 28, 46, .12); }
.seg .on.direct { color: var(--violet); }

/* filters */
details.filters { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
details.filters > summary { list-style: none; cursor: pointer; padding: 13px 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
details.filters > summary::-webkit-details-marker { display: none; }
details.filters > summary .count { margin-left: auto; font-size: 12px; color: var(--primary); font-weight: 600; }
details.filters[open] > summary { border-bottom: 1px solid var(--line-2); }
details.filters form { padding: 16px 18px 18px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: #f8fafc; white-space: nowrap; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #fafcfe; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; background: #f3f7fb; }
tr.hl td { background: #fffbea; }
.desc { max-width: 440px; word-break: break-word; }
.strong { font-weight: 600; }
.amount { font-weight: 650; font-variant-numeric: tabular-nums; }
.amount.debit { color: var(--ink); }
.amount.credit { color: var(--ok); }
.cell-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: #eef2f6; color: var(--ink-2); white-space: nowrap; }
.badge.pending, .badge.open { background: var(--warn-bg); color: var(--warn); }
.badge.approved, .badge.tallied, .badge.paid, .badge.attached { background: var(--ok-bg); color: var(--ok); }
.badge.rejected, .badge.over, .badge.cancelled, .badge.missing { background: var(--bad-bg); color: var(--bad); }
.badge.nobill, .badge.direct { background: var(--violet-bg); color: var(--violet); }
.badge.bccp { background: var(--primary-soft); color: var(--primary-ink); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* progress */
.bar { height: 8px; background: #e6ebf2; border-radius: 99px; overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.bar.over > i { background: var(--bad); }
.bar.tallied > i { background: var(--ok); }

/* toasts */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 12px; padding: 12px 12px 12px 14px; box-shadow: var(--shadow-lg); animation: toast-in .25s ease-out; }
.toast.error { border-left-color: var(--bad); }
.toast .ic { color: var(--ok); margin-top: 1px; }
.toast.error .ic { color: var(--bad); }
.toast .msg { flex: 1; font-size: 13.5px; }
.toast .icon-btn { width: 26px; height: 26px; color: var(--muted); }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }

.alert { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; margin: 10px 0; border: 1px solid; }
.alert.ok { background: var(--ok-bg); color: #0f5f2e; border-color: #bfe6cc; }
.alert.warn { background: var(--warn-bg); color: #7a4a05; border-color: #f2dc9f; }
.alert.error { background: var(--bad-bg); color: #8f1c13; border-color: #f3c3be; }
.alert.info { background: var(--primary-soft); color: var(--primary-ink); border-color: #c3e6f1; }
.alert a { font-weight: 600; }
/* legacy names used by scanner.js */
.warnbox { background: var(--warn-bg); color: #7a4a05; border: 1px solid #f2dc9f; border-radius: 12px; padding: 10px 12px; font-size: 13px; margin: 10px 0; }
.errbox { background: var(--bad-bg); color: #8f1c13; border: 1px solid #f3c3be; border-radius: 12px; padding: 10px 12px; font-size: 13px; margin: 10px 0; }
.okbox { background: var(--ok-bg); color: #0f5f2e; border: 1px solid #bfe6cc; border-radius: 12px; padding: 10px 12px; font-size: 13px; margin: 10px 0; }

/* empty state */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .chip-ic { margin: 0 auto 10px; width: 46px; height: 46px; border-radius: 14px; }
.empty b { display: block; color: var(--ink-2); margin-bottom: 2px; }

/* bank reconcile */
details.recon > summary { cursor: pointer; color: var(--primary); font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.recon > summary::-webkit-details-marker { display: none; }
details.recon[open] { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 8px; }
.recon-opts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 10px; }
.recon-opts form { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.recon-opts form.direct { border-color: #d9c9f7; background: #fcfaff; }
.recon-opts h4 { margin: 0; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.chk { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; color: var(--ink); font-size: 13px; margin: 2px 0; cursor: pointer; }
.chk input { margin-top: 2px; }
.sugg { display: inline-flex; align-items: center; gap: 5px; color: var(--ok); font-size: 12.5px; font-weight: 600; }

/* login */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.auth .art { background: radial-gradient(1200px 600px at -10% 110%, #0b7ea3 0%, transparent 60%), linear-gradient(160deg, #0b1726, #0f2b47); color: #cfe0f1; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .art img { width: 76px; }
.auth .art h2 { color: #fff; font-size: 30px; line-height: 1.2; margin: 18px 0 10px; letter-spacing: -.02em; }
.auth .art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.auth .art li { display: flex; gap: 10px; align-items: center; }
.auth .art li .ic { color: #22b6d8; }
.auth .form-side { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth form { width: 100%; max-width: 380px; }
.auth form h1 { margin-bottom: 4px; }
.auth .mobile-logo { display: none; }

/* ---------- scanner ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 16px; }
.steps .st { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-radius: 10px; background: #e9eef4; }
.steps .st i { font-style: normal; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--muted); font-size: 12px; flex: none; }
.steps .st.on { background: var(--primary-soft); color: var(--primary-ink); }
.steps .st.on i { background: var(--primary); color: #fff; }
.steps .st.done i { background: var(--ok); color: #fff; }
.scan-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 18px; align-items: start; }
.scan-layout > .panel { margin-bottom: 0; }
.stage { position: relative; background: #1b2636; border-radius: 12px; min-height: 280px; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; user-select: none; padding: 14px; }
.stage .wrap { position: relative; line-height: 0; }
.stage img { max-width: 100%; max-height: 68vh; display: block; border-radius: 4px; }
.stage svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage .h { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgba(34, 182, 216, .25); border: 3px solid #22b6d8; cursor: grab; touch-action: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.stage .h:active { cursor: grabbing; background: rgba(34, 182, 216, .5); }
.drop { border: 2px dashed #b8c7d8; border-radius: 14px; padding: 26px 18px; text-align: center; background: linear-gradient(180deg, #fbfdff, #f5f9fc); transition: background .15s, border-color .15s; }
.drop.over { background: var(--primary-soft); border-color: var(--primary); }
.drop .big-ic { width: 52px; height: 52px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 10px; }
.drop .row { justify-content: center; margin-top: 12px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; align-items: center; }
.tools select { width: auto; min-height: 32px; padding: 4px 10px; font-size: 12.5px; }
.preview { max-width: 100%; max-height: 62vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: block; margin: 10px auto 0; box-shadow: var(--shadow); }
.queue { font-size: 12.5px; color: var(--muted); }
.sim { font-size: 12.5px; margin-top: 6px; }
.sim button { border: 0; background: var(--primary-soft); color: var(--primary-ink); border-radius: 99px; padding: 3px 10px; margin: 3px 4px 0 0; cursor: pointer; font: inherit; font-weight: 600; }
/* auto-read bill fields */
.read-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; border-radius: 99px; padding: 4px 11px; background: var(--primary-soft); color: var(--primary-ink); }
.read-status.done { background: #fff6d6; color: #7a5a00; }
.read-status.fail { background: #f1f4f8; color: var(--muted); }
.spinner { width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input.auto, select.auto, textarea.auto { background: #fffbea; border-color: #eccb6a; }
.auto-tag { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #8a6400; background: #fff1bf; border-radius: 5px; padding: 0 5px; vertical-align: 1px; }
.auto-tag.low { color: var(--bad); background: var(--bad-bg); }
details.read-text { margin: 0 0 12px; font-size: 12.5px; }
details.read-text summary { cursor: pointer; color: var(--muted); font-weight: 600; }
details.read-text pre { white-space: pre-wrap; background: #f6f8fb; border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-height: 220px; overflow: auto; font: 12px/1.5 ui-monospace, Consolas, monospace; margin: 8px 0 0; }
.for-emp { background: var(--primary-soft); border: 1px solid #c3e6f1; border-radius: 12px; padding: 12px; }
.for-emp select { font-weight: 600; }
.for-direct { background: var(--violet-bg); border: 1px solid #ddd0f8; border-radius: 12px; padding: 12px; }
.save-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bill-img { max-width: 100%; border: 1px solid var(--line); border-radius: 12px; display: block; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

/* expense rows */
.bill-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bill-chip { display: inline-flex; align-items: center; gap: 6px; background: #f3f6fa; border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; font-size: 12.5px; color: var(--ink-2); }
.bill-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-select { min-height: 32px; padding: 4px 8px; font-size: 12.5px; max-width: 210px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .scan-layout, .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .topbar { padding: 0 12px; background: #fff; border-bottom-color: var(--line); }
  .topbar .menu { display: inline-grid; }
  .topbar .mobile-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
  .topbar .mobile-brand img { width: 28px; height: 28px; }
  .topbar .crumb { display: none; }
  .content { padding: 14px 14px calc(var(--tab-h) + 28px); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); z-index: 35; box-shadow: 0 -4px 20px rgba(15, 28, 46, .06); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: inherit; font-size: 11px; font-weight: 600; color: var(--muted); background: none; border: 0; cursor: pointer; }
  .tabbar .on { color: var(--primary); }
  .tabbar .fab { position: relative; }
  .tabbar .fab span.circle { width: 54px; height: 54px; margin-top: -26px; border-radius: 18px; background: linear-gradient(135deg, #22b6d8, #0b7ea3); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(11, 126, 163, .4); border: 4px solid #fff; }
  .tabbar .fab span.circle .ic { width: 24px; height: 24px; }
  .toasts { top: auto; bottom: calc(var(--tab-h) + 14px); right: 12px; left: 12px; width: auto; }
  .page-head { margin-top: 4px; align-items: flex-start; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  h1 { font-size: 20px; }
  .panel { padding: 16px; border-radius: 12px; }
  .panel.flush .panel-head { padding: 14px 16px 0; }
  .hero { padding: 18px; }
  .hero .actions { width: 100%; }
  .hero .actions .btn { flex: 1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat .v { font-size: 20px; }
  .stat .chip-ic { display: none; }
  .g2, .g3, .g-main { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth .art { display: none; }
  .auth .mobile-logo { display: block; width: 64px; margin: 0 auto 14px; }
  .auth form h1, .auth form .sub { text-align: center; }
  .steps .st span { display: none; }
  .steps .st { justify-content: center; }
  .save-bar.sticky { position: sticky; bottom: calc(var(--tab-h) + 8px); background: #fff; padding: 10px; margin: 0 -6px; border-radius: 12px; box-shadow: 0 -2px 16px rgba(15, 28, 46, .12); z-index: 5; }
  .save-bar .btn.lg { flex: 1; }
  .kv { grid-template-columns: 110px 1fr; }

  /* tables become cards */
  table.cards thead { display: none; }
  table.cards, table.cards tbody { display: block; }
  table.cards tr { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 10px; background: #fff; }
  table.cards tr:hover { background: #fff; }
  table.cards tr.total { background: #f3f7fb; }
  table.cards td { display: flex; justify-content: space-between; gap: 14px; align-items: center; border: 0; padding: 5px 0; text-align: right; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; flex: none; }
  table.cards td[data-label=""]::before, table.cards td:not([data-label])::before { content: none; }
  table.cards td.card-title { display: block; font-weight: 650; font-size: 14.5px; text-align: left; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px dashed var(--line); word-break: break-word; }
  table.cards td.card-title .cell-sub { font-weight: 400; }
  table.cards td.card-title .badge { margin-left: 4px; }
  table.cards td.card-title::before { content: none; }
  table.cards td.desc:not(.card-title) { max-width: none; text-align: right; }
  table.cards td.full { display: block; text-align: left; }
  table.cards td.full::before { display: block; margin-bottom: 6px; }
  table.cards td:empty { display: none; }
  .panel.flush table.cards { padding: 12px; }
}
@media (min-width: 901px) {
  .only-mobile { display: none !important; }
}
@media (max-width: 900px) {
  .only-desktop { display: none !important; }
}
