/* OOP Expenses: VIFM brand (navy #111232, blue #5391D5, Open Sans). Mobile first. */
:root {
  --navy: #111232; --ink: #010131; --blue: #5391D5; --blue-d: #3a76b8; --bg: #f4f6fa; --card: #fff;
  --line: #e2e6ee; --muted: #6b7280; --ok: #1f9d55; --warn: #c27c0e; --bad: #c0392b;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--blue-d); }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon.sm { width: 16px; height: 16px; }
header.bar { position: sticky; top: 0; z-index: 10; background: var(--navy); color: #fff; display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
header.bar img { height: 26px; }
header.bar .title { font-weight: 700; flex: 1; font-size: 16px; }
header.bar button { background: transparent; color: #fff; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; display: inline-flex; }
nav.tabs { display: flex; gap: 4px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); padding: 0 8px; }
nav.tabs button { border: 0; background: none; padding: 12px 12px; font: inherit; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; cursor: pointer; }
nav.tabs button.on { color: var(--navy); border-color: var(--blue); }
main { max-width: 980px; margin: 0 auto; padding: 14px 14px calc(90px + var(--safe-b)); }
h2 { font-size: 18px; margin: 4px 0 12px; color: var(--navy); }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.card.tap { cursor: pointer; }
.card.tap:active { background: #f0f4fb; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount { font-weight: 700; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eef2f8; color: var(--navy); white-space: nowrap; }
.chip.draft { background: #eef2f8; }
.chip.submitted { background: #e3effc; color: #1d5fa8; }
.chip.reviewed { background: #efe6fb; color: #6b3fb0; }
.chip.returned { background: #fdf1dc; color: var(--warn); }
.chip.posting, .chip.approved { background: #e6f6ee; color: var(--ok); }
.chip.posted { background: var(--ok); color: #fff; }
.chip.posting_failed { background: #fbe4e1; color: var(--bad); }
.chip.flag { background: #fdf1dc; color: var(--warn); white-space: normal; border-radius: 8px; }
.chip.card { background: #e8eaf6; color: #303f9f; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 11px 16px; font: inherit; font-weight: 700; cursor: pointer; background: var(--blue); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.dark { background: var(--navy); }
.btn.ok { background: var(--ok); }
.btn.bad { background: #fff; color: var(--bad); border: 1px solid #f1c3bd; }
.btn.block { width: 100%; }
.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; background: #fff; border-top: 1px solid var(--line); padding: 10px 14px calc(10px + var(--safe-b)); display: flex; gap: 8px; }
.actions .btn { flex: 1; }
.banner { border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; display: flex; gap: 8px; align-items: flex-start; }
.banner.warn { background: #fdf1dc; color: #7a4d06; }
.banner.bad { background: #fbe4e1; color: #7f1d14; }
.banner.ok { background: #e6f6ee; color: #14532d; }
.banner.info { background: #e3effc; color: #164a85; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 18px; font-weight: 700; color: var(--navy); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%), linear-gradient(135deg, #6b7280 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input[type=checkbox] { width: 20px; height: 20px; -webkit-appearance: checkbox; appearance: auto; vertical-align: middle; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-weight: 600; color: var(--ink); font-size: 14px; }
.sheet-bg { position: fixed; inset: 0; background: rgba(1,1,49,.45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 16px; } }
.sheet .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet .foot { display: flex; gap: 8px; margin-top: 16px; }
.sheet .foot .btn { flex: 1; }
.thumb { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: #eef2f8; flex: none; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.receipt-big { width: 100%; max-height: 340px; object-fit: contain; border-radius: 10px; background: #f0f2f6; }
table.je { width: 100%; border-collapse: collapse; font-size: 13px; }
table.je th, table.je td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.je td.n, table.je th.n { text-align: right; white-space: nowrap; }
table.je tfoot td { font-weight: 700; border-top: 2px solid var(--navy); }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: 90vw; font-weight: 600; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #111232 0%, #121140 60%, #1d3a6e 100%); }
.login { background: #fff; border-radius: 16px; padding: 26px 22px; width: 100%; max-width: 380px; }
.login img { height: 44px; display: block; margin: 0 auto 10px; }
.login h1 { text-align: center; font-size: 20px; margin: 0 0 4px; color: var(--navy); }
.login p { text-align: center; margin: 0 0 14px; }
.err { color: var(--bad); font-weight: 600; font-size: 14px; margin-top: 10px; min-height: 20px; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
