/* Big type, big targets: built for a phone held in one hand. */
:root {
  --ink: #16202b; --muted: #5b6673; --line: #d5dbe2; --bg: #f3f5f8; --card: #fff;
  --brand: #1d2b3a; --accent: #0b6bcb; --paid: #1f7a3a; --unpaid: #8a5a00; --overdue: #b3261e; --est: #5a4bb3;
  --tap: 60px; --radius: 14px;
  font-size: 20px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.35; }
body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
header#top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff; min-height: 64px; padding: 6px 14px; }
header h1 { font-size: 1.25rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: transparent; color: #fff; border: 0; font-size: 1.6rem; min-width: var(--tap); min-height: var(--tap); }
main { padding: 14px; max-width: 760px; margin: 0 auto; outline: none; }
#banner { background: #fff4d6; color: #5a4300; padding: 14px 16px; font-size: 1rem; border-bottom: 1px solid #f0d78c; }
#banner button { margin-top: 8px; }
nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: #fff;
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav#tabs a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .8rem;
  min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
nav#tabs a span { font-size: 1.5rem; }
nav#tabs a.on { color: var(--accent); font-weight: 700; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; }
h3 { font-size: 1rem; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08); }
a.card { display: block; color: inherit; text-decoration: none; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.big { font-size: 1.15rem; font-weight: 700; }
.muted { color: var(--muted); font-size: .9rem; }
.right { text-align: right; white-space: nowrap; }
.pill { display: inline-block; border-radius: 999px; padding: 3px 12px; font-size: .8rem; font-weight: 700; color: #fff; }
.pill.paid { background: var(--paid); } .pill.unpaid, .pill.partial { background: var(--unpaid); }
.pill.overdue { background: var(--overdue); } .pill.estimate, .pill.converted { background: var(--est); }
.pill.draft, .pill.imported { background: #7a8794; }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .95rem; }
input, select, textarea, button { font: inherit; font-size: 1rem; }
input, select, textarea { width: 100%; min-height: var(--tap); padding: 12px 14px; border: 2px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink); }
textarea { min-height: 120px; resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input[type=checkbox] { width: 32px; height: 32px; min-height: 32px; vertical-align: middle; margin: 0 10px 0 0; }
.check { display: flex; align-items: center; min-height: var(--tap); font-weight: 600; margin: 6px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1.3fr .8fr 1fr; gap: 0 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap);
  padding: 10px 20px; border-radius: 14px; border: 2px solid var(--accent); background: #fff; color: var(--accent);
  font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { border-color: var(--overdue); color: var(--overdue); }
.btn.block { display: flex; width: 100%; margin: 10px 0; }
.btn.huge { min-height: 84px; font-size: 1.2rem; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.chip { flex: none; min-height: 52px; padding: 8px 18px; border-radius: 999px; border: 2px solid var(--line);
  background: #fff; font-weight: 700; color: var(--muted); }
.chip.on { border-color: var(--accent); color: var(--accent); background: #e9f2fc; }
.fab { position: fixed; right: 18px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 6; min-width: 84px;
  min-height: 84px; border-radius: 42px; border: 0; background: var(--accent); color: #fff; font-size: 1.1rem;
  font-weight: 800; padding: 0 22px; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.item { border-left: 6px solid var(--accent); }
.amount { font-size: 1.1rem; font-weight: 700; }
.totals .row { padding: 6px 0; } .totals .row.total { border-top: 2px solid var(--line); margin-top: 6px; padding-top: 10px; }
.totals .bal { font-size: 1.3rem; font-weight: 800; }
.sticky-actions { position: sticky; bottom: calc(80px + env(safe-area-inset-bottom)); background: var(--bg);
  padding: 8px 0; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; z-index: 4; }
.sticky-actions .btn { padding: 8px; }
#toast { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); background: #222; color: #fff;
  padding: 14px 22px; border-radius: 14px; font-size: 1rem; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 90vw; z-index: 20; }
#toast.show { opacity: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; display: flex; align-items: flex-end; }
.sheet { background: #fff; width: 100%; max-height: 85vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.sheet .opt { display: block; width: 100%; text-align: left; min-height: var(--tap); padding: 12px 14px; border: 0;
  border-bottom: 1px solid var(--line); background: #fff; }
.small { font-size: .85rem; }
