/* My Business App. Ruled-ledger look: blue ballpoint on white paper, red margin lines marking every record. */
:root {
  --paper: #f4f6f8;
  --surface: #fff;
  --ink: #1b2742;
  --muted: #5d6882;
  --blue: #12306b;
  --blue-dark: #0a1f4d;
  --accent: #f56445;
  --wash: #e8edf8;
  --rule: #d3ddee;
  --red: #d6403a;
  --green: #17613c;
  --amber: #7a5200;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 60px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0; }
p { margin: 0 0 .6em; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #9bb0f5; outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--red); }
.strong { font-weight: 700; }
.scroll-x { overflow-x: auto; }
.boot { padding: 40px 20px; color: var(--muted); }

/* ---------- shell ---------- */
#app { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100vh; height: 100dvh; }
#app > .auth { grid-row: 1 / -1; grid-column: 1 / -1; }
#view { grid-row: 1; overflow-y: auto; min-height: 0; outline: none; }
.view-chat { overflow: hidden !important; }

.nav { grid-row: 2; display: flex; background: var(--surface); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
.nav .brand { display: none; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--nav-h); font-size: 12px; text-decoration: none; color: var(--muted); }
.nav a[aria-current] { color: var(--blue); font-weight: 600; box-shadow: inset 0 3px 0 var(--blue); }

@media (min-width: 860px) {
  #app { grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: 1fr; }
  .nav { grid-row: 1; grid-column: 1; flex-direction: column; align-items: stretch; border-top: 0; border-right: 1px solid var(--rule); padding: 20px 12px; gap: 4px; }
  .nav .brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; }
  .nav .brand strong { font-family: var(--serif); font-size: 19px; display: block; line-height: 1.1; }
  .nav .brand .biz-name { font-size: 13px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
  .nav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 12px; font-size: 15px; border-radius: 8px; }
  .nav a[aria-current] { background: var(--wash); box-shadow: none; }
  #view { grid-column: 2; grid-row: 1; }
}

#toasts { position: fixed; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 20; padding: 0 12px; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; max-width: 460px; font-size: 15px; box-shadow: 0 4px 14px rgb(27 39 66 / .25); }
.toast.bad { background: #8f1f1a; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1.5px solid var(--blue); background: var(--blue); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--blue-dark); }
.btn.ghost { background: transparent; color: var(--blue); }
.btn.ghost:hover { background: var(--wash); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--blue); cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 600; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--red); }
.link.back { display: inline-block; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border: 1.5px solid var(--rule); border-radius: 99px; background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; font-size: 14px; text-align: left; }
.chip:hover { border-color: var(--blue); }
.chip.on { background: var(--wash); border-color: var(--blue); color: var(--blue-dark); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chips.row .chip { flex: none; }
.chips.small .chip { min-height: 32px; font-size: 13px; }

input, select, textarea { width: 100%; min-height: 44px; padding: 8px 12px; background: var(--surface); border: 1.5px solid var(--rule); border-radius: 8px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 3px solid #cdd8fa; outline-offset: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--muted); }
label.inline input { width: auto; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-size: 16px; }
label.check input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--blue); }
.hint { font-size: 13px; font-weight: 400; color: var(--muted); }
.form { display: grid; gap: 14px; }
fieldset { border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); padding: 16px; margin: 0 0 16px; }
legend { font: 700 17px/1.2 var(--serif); padding: 0 6px; }
.form.nested { padding: 4px 0 0; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.toolbar input[type="search"] { flex: 1 1 200px; width: auto; }
.toolbar .spacer { flex: 1; }
.toolbar .dates { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar .btn { min-height: 40px; padding: 0 14px; }
label.inline.check-inline { color: var(--ink); font-size: 14px; }
label.inline.check-inline input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--blue); }
.toolbar input[type="date"] { min-height: 40px; }

.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: #e8ecf5; color: var(--ink); white-space: nowrap; }
.tag.paid { background: #dff3e8; color: var(--green); }
.tag.overdue { background: #fde4e2; color: #a52620; }
.tag.partial { background: #fff0cc; color: var(--amber); }
.tag.void { background: #ececec; color: #666; }

/* ---------- pages ---------- */
.page { max-width: 880px; margin: 0 auto; padding: 20px 16px 100px; }
.page-head { margin-bottom: 14px; }
.page-head h1 { font-size: 28px; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.empty { color: var(--muted); padding: 24px 4px; }
.warn { background: #fff0cc; color: var(--amber); padding: 10px 12px; border-radius: 8px; }
.loading { color: var(--muted); }
.block { margin-top: 24px; }
.block h2 { font-size: 19px; margin-bottom: 8px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.btnrow { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }

table { border-collapse: collapse; width: 100%; }
.grid { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; font-size: 15px; }
.grid th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 2px solid var(--blue); white-space: nowrap; }
.grid th.num { text-align: right; }
.grid td { padding: 9px 10px; border-bottom: 1px solid var(--rule); }
.grid tfoot td { font-weight: 600; border-top: 1px solid var(--rule); border-bottom: 0; }
.grid tfoot tr:first-child td { border-top: 2px solid var(--ink); }
.grid tfoot .strong td { font-weight: 700; }
.grid tr.voided td { text-decoration: line-through; color: var(--muted); }
.mini { font-size: 14px; margin-top: 6px; }
.mini th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--rule); }
.mini th.num { text-align: right; }
.mini td { padding: 4px 6px; border-bottom: 1px dotted var(--rule); }
.mini td:first-child { width: 100%; }
.mini th:first-child { width: 100%; }
.mini tr.cr td:first-child { padding-left: 20px; }

/* list rows */
.entries, .invoice-list { display: grid; gap: 8px; }
.entry { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 0 12px; }
.entry summary { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: baseline; padding: 11px 0; cursor: pointer; list-style: none; }
.entry summary::-webkit-details-marker { display: none; }
.entry .d { color: var(--muted); font-size: 14px; }
.entry .a { font-variant-numeric: tabular-nums; }
.entry.voided .m, .entry.voided .a { text-decoration: line-through; color: var(--muted); }
.entry-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 10px; font-size: 13px; }
.inv-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.inv-row:hover { border-color: var(--blue); }
.inv-row .sub { display: block; font-size: 13px; color: var(--muted); }
.inv-row .right { text-align: right; display: grid; gap: 4px; justify-items: end; }

/* ---------- chat ---------- */
.chat { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-width: 860px; margin: 0 auto; }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 1px; background: var(--rule); border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.stat { background: var(--surface); padding: 7px 14px; display: grid; align-content: start; min-width: 0; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat strong { font: 700 17px/1.3 var(--serif); font-variant-numeric: tabular-nums; }
.stat .note { font-size: 12px; color: var(--red); line-height: 1.2; }
.stat:nth-child(4) .note { color: var(--muted); }
.thread { overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { display: flex; flex-direction: column; max-width: min(92%, 600px); gap: 6px; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.assistant { align-self: flex-start; }
.bubble { padding: 10px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--rule); overflow-wrap: anywhere; }
.bubble p { margin: 0 0 .5em; } .bubble p:last-child { margin: 0; }
.bubble ul { margin: .3em 0; padding-left: 1.2em; }
.msg.user .bubble { background: var(--blue); border-color: var(--blue); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant .bubble { border-bottom-left-radius: 4px; }
.msg.error .bubble { background: #fde4e2; border-color: #f2b8b4; color: #7d1a15; }
.typing { display: flex; gap: 5px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .6; } .thread { scroll-behavior: auto; } }

.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + env(safe-area-inset-bottom) * 0); background: var(--paper); border-top: 1px solid var(--rule); }
.composer textarea { flex: 1; min-height: 46px; max-height: 140px; border-radius: 23px; padding: 11px 16px; resize: none; line-height: 1.35; }
.send, .mic { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; }
.send { background: var(--blue); color: #fff; }
.send:disabled { opacity: .5; }
.mic { background: var(--surface); border: 1.5px solid var(--rule); font-size: 18px; }
.mic.live { background: #fde4e2; border-color: var(--red); }

.welcome { margin: auto 0; padding: 8px 2px; max-width: 520px; }
.welcome h2 { font-size: 26px; margin-bottom: 8px; }
.welcome p { color: var(--muted); }
.welcome .chips { flex-direction: column; align-items: flex-start; margin-top: 14px; }

/* the receipt slip: red margin lines mark every record the app made */
.slip { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 10px 14px 8px 38px; max-width: 100%; }
.slip::before, .slip::after { content: ""; position: absolute; top: 0; bottom: 0; width: 1.5px; background: var(--red); opacity: .7; }
.slip::before { left: 14px; } .slip::after { left: 19px; }
.slip-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.slip .what { display: block; font-weight: 600; overflow-wrap: anywhere; }
.slip .when { display: block; font-size: 13px; color: var(--muted); }
.slip .total { font: 700 18px/1.3 var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; }
.slip details { margin-top: 4px; }
.slip summary { font-size: 13px; color: var(--blue); cursor: pointer; }
.slip-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 6px; min-height: 28px; font-size: 14px; }
.slip.voided .what, .slip.voided .total { text-decoration: line-through; color: var(--muted); }
.slip .sure { font-size: 14px; }
.undone-note { font-size: 13px; color: var(--muted); margin: 0; }
.report-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; max-width: 100%; }
.report-card .report-sheet { border: 0; padding: 0; }
.report-card .link { margin-top: 6px; }

/* ---------- reports ---------- */
.reports .chips.row { margin-bottom: 12px; }
.report-controls { align-items: center; }
.report-sheet { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 18px 16px; }
.report-sheet header { margin-bottom: 12px; }
.report-sheet .biz { margin: 0; font-size: 13px; color: var(--muted); }
.report-sheet h3 { font-size: 22px; }
.report-sheet .period { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.stmt td, .stmt th { padding: 7px 4px; }
.stmt td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 16px; }
.stmt .sec th { text-align: left; font: 700 16px/1.3 var(--serif); padding-top: 18px; border-bottom: 1px solid var(--rule); }
.stmt .ind { padding-left: 18px; }
.stmt .sub td { font-weight: 600; border-top: 1px solid var(--rule); }
.stmt .grand td { font: 700 18px/1.3 var(--serif); border-top: 2px solid var(--blue); padding-top: 10px; }
.check { margin: 14px 0 0; font-size: 14px; }
.check.ok { color: var(--green); } .check.bad { color: var(--red); font-weight: 600; }
.report-sheet tr.sub td { font-weight: 600; background: #f7f9fc; }
.report-sheet .grid { border: 0; }

/* ---------- auth ---------- */
.auth { display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; background: radial-gradient(1200px 600px at 15% -10%, #e4ebff 0%, transparent 60%), radial-gradient(900px 500px at 100% 110%, #dfe7ff 0%, transparent 55%), var(--paper); }
.auth-shell { width: 100%; max-width: 440px; margin: auto; }
.auth-hero { display: none; }
.auth-card { width: 100%; background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; padding: 28px 24px; position: relative; box-shadow: 0 10px 40px rgb(27 39 66 / .08); }
.auth-card .mobile-brand { margin-bottom: 18px; }
.auth-card h1 { font-size: 28px; margin: 0 0 8px; }
.auth-title { font-size: 26px; }
.auth-sub { color: var(--muted); margin: 6px 0 0; }
.lede { color: var(--muted); }
.brand.big { display: flex; align-items: center; gap: 12px; font: 700 22px/1 var(--serif); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--paper); border-radius: 12px; padding: 4px; margin: 20px 0 18px; }
.seg button { border: 0; background: transparent; min-height: 42px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(27 39 66 / .15); }
.auth-card input[type=email], .auth-card input[type=text], .auth-card input[type=password] { min-height: 48px; border-radius: 10px; }
.auth-card .btn.wide { min-height: 50px; font-size: 16px; border-radius: 10px; box-shadow: 0 6px 16px rgb(18 48 107 / .28); }
@media (min-width: 900px) {
  .auth { padding: 40px; }
  .auth-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(380px, 460px); max-width: 1020px; min-height: 600px; background: var(--surface); border: 1px solid var(--rule); border-radius: 24px; overflow: hidden; box-shadow: 0 24px 70px rgb(27 39 66 / .16); }
  .auth-hero { display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 52px 48px; color: #fff; background: linear-gradient(155deg, #1b3f86 0%, #12306b 55%, #0a1f4d 100%); position: relative; overflow: hidden; }
  .auth-hero::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: rgb(245 100 69 / .20); }
  .auth-hero .brand.big { font-size: 24px; margin-bottom: 18px; }
  .auth-hero h1 { font-size: 40px; line-height: 1.12; color: #fff; }
  .auth-hero .lede { color: rgb(255 255 255 / .8); font-size: 17px; max-width: 34em; }
  .auth-hero .points { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 12px; position: relative; z-index: 1; }
  .auth-hero .points li { display: flex; gap: 12px; align-items: flex-start; }
  .auth-hero .points svg { flex: none; margin-top: 2px; }
  .auth-hero .fine { margin: 18px 0 0; font-size: 13px; color: rgb(255 255 255 / .6); }
  .auth-card { border: 0; border-radius: 0; box-shadow: none; padding: 52px 44px; display: flex; flex-direction: column; justify-content: center; }
  .auth-card .mobile-brand { display: none; }
}
@media (min-width: 600px) and (max-width: 899px) {
  .auth-shell { max-width: 500px; }
  .auth-card { padding: 36px 36px; }
}
.auth-form { display: grid; gap: 14px; }
.form-error { color: #a52620; background: #fde4e2; padding: 8px 12px; border-radius: 8px; margin: 0; }

/* ---------- print: reports and invoices only ---------- */
@media print {
  body { background: #fff; }
  #app { display: block; height: auto; }
  .nav, .toolbar, .page-head, .chips, #toasts, .composer, .strip, .link.back { display: none !important; }
  #view { overflow: visible; }
  .page { padding: 0; max-width: none; }
  .report-sheet { border: 0; padding: 0; }
}

/* ---------- notes saved offline ---------- */
.offline-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 14px; background: #fff6dd; border-bottom: 1px solid #ecd68a; color: #5c4700; font-size: 14px; }
.offline-note[hidden] { display: none; }
.msg.user.pending .bubble { background: #fff; color: var(--ink); border: 1.5px dashed var(--blue); }
.pending-tag { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); white-space: normal; }
.chat { grid-template-columns: minmax(0, 1fr); }
.chat-top { min-width: 0; }
.offline-note.bill a { font-weight: 600; color: inherit; }

/* Admin page (owner only) */
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 12px 0; }
.admin-tile { background: #fff; border: 1px solid var(--line, #dfe3ee); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.admin-tile span { color: var(--muted); font-size: 13px; }
.admin-tile strong { font-size: 22px; }
.admin-tile small { color: var(--muted); font-size: 12px; }
.admin-user { background: #fff; border: 1px solid var(--line, #dfe3ee); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.admin-user header { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.admin-user p { margin: 4px 0; overflow-wrap: anywhere; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.admin-actions input { width: 76px; padding: 8px; }
.admin-secret { background: #fff6dd; border: 1px solid #ecd68a; border-radius: 12px; padding: 12px 14px; margin: 10px 0; display: grid; gap: 8px; justify-items: start; }
.admin-secret[hidden] { display: none; }
.admin-secret code { font-size: 20px; letter-spacing: 1px; user-select: all; }

/* Password eye */
.pw { position: relative; display: block; }
.pw input { padding-right: 48px; }
.eye { position: absolute; right: 2px; top: 0; bottom: 0; width: 44px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 8px; }
.eye:hover { color: var(--blue); }

/* Chat top bar */
.chat-bar { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--rule); }
.chat-bar .link { font-size: 15px; }

/* Home dashboard */
.home .page-head h1 { font-size: 26px; }
.home-body { display: grid; gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.tile { display: grid; gap: 2px; align-content: start; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--blue); border-radius: 10px; padding: 12px 14px; color: var(--ink); text-decoration: none; }
a.tile:hover { border-color: var(--blue); }
.tile .label { color: var(--muted); font-size: 13px; }
.tile strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.tile .note { color: var(--muted); font-size: 12px; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 14px; }
.card h2 { font-size: 18px; margin-bottom: 8px; }
.card.ok { border-color: #8fcfa9; background: #f1faf5; }
.bar-row { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 10px; margin: 6px 0; font-size: 14px; }
.bar-track { background: #eef1f8; border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; min-width: 2px; }
.bar-fill.in { background: var(--blue); }
.bar-fill.out { background: var(--red); }
.bar-total { margin: 10px 0 0; font-weight: 600; }
.recent li, .recon li { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: baseline; }
.recon li { grid-template-columns: 64px 1fr auto auto; }
.recent .m, .recon .m { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .d, .recon .d { color: var(--muted); font-size: 13px; }
.fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); z-index: 10; display: inline-flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 20px 0 16px; border-radius: 99px; background: var(--blue); color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 6px 18px rgb(18 48 107 / .4); }
.fab:hover { background: var(--blue-dark); }
@media (min-width: 860px) { .fab { right: 28px; bottom: 28px; } }
@media print { .fab { display: none; } }

/* Bank reconciliation */
.stmt { display: grid; gap: 2px; padding: 12px 14px; margin-top: 8px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; color: var(--ink); text-decoration: none; }
.stmt:hover { border-color: var(--blue); }
.recon-table td { padding: 8px 10px; }
.recon-table tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
.recon-sum h2 { font-size: 20px; }
.card + .card, .card + .block, .form.card { margin-top: 14px; }
details.block summary { cursor: pointer; font-weight: 600; font-size: 18px; font-family: var(--serif); }

.link.forgot { justify-self: start; margin-top: -4px; }

.md-table { overflow-x: auto; margin: .4em 0; }
.md-table table { border-collapse: collapse; font-size: 14px; width: 100%; }
.md-table th, .md-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.md-table th { font-weight: 600; color: var(--muted, #5b6478); }

.picker { display: grid; gap: 10px; }
.choice { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 14px 16px; border: 1.5px solid var(--rule); border-radius: 14px; background: var(--surface); font: inherit; color: var(--ink); min-height: 56px; cursor: pointer; }
.choice span { color: var(--muted, #5b6478); font-size: 14px; }
.choice.small { min-height: 48px; justify-content: center; }
.choice.on, .choice:hover { border-color: var(--blue); }
.chosen { margin: 0; font-weight: 600; color: var(--blue); }
.skip { margin-top: 16px; }

.opt { border: 1.5px solid var(--rule); border-radius: 14px; background: var(--surface); overflow: hidden; }
.opt-head { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 16px; font: inherit; font-weight: 600; color: var(--ink); background: none; border: 0; min-height: 52px; text-align: left; cursor: pointer; }
.opt-body { padding: 0 16px 16px; display: grid; gap: 10px; }
.opt .rows { display: grid; gap: 8px; }
.opt .row { display: grid; gap: 8px; align-items: center; }
.opt .row input { min-width: 0; }
.worth { margin: 0; font-weight: 600; }
.opt-body[hidden] { display: none; }

.loan-card { display: block; color: inherit; text-decoration: none; }
.loan-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.loan-card p { margin: .3em 0 0; }
.loan-note { display: block; margin: 6px 0 0; font-size: 14px; color: var(--blue); }
.md-table tr.late td { color: #b3261e; }

.cam-wrap { position: relative; flex: none; }
.mic.cam { color: var(--ink); }
.msg.wide .bubble { width: 100%; max-width: 100%; }
.rc-card { display: grid; gap: 10px; min-width: 0; }
.rc-head { display: flex; gap: 12px; align-items: center; }
.rc-head p { margin: 2px 0 0; }
.rc-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--rule); cursor: zoom-in; flex: none; }
.rc-warn { margin: 0; padding: 10px 12px 10px 28px; background: #fff4d6; border: 1px solid #f0d58a; border-radius: 12px; font-size: 14px; color: #6b4e00; }
.rc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rc-meta label, .rc-pay { display: grid; gap: 4px; font-size: 14px; }
.rc-rows { display: grid; gap: 8px; }
.rc-row { display: grid; grid-template-columns: 24px 1fr 92px; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--rule); border-radius: 12px; }
.rc-row input[type=checkbox] { width: 22px; height: 22px; min-height: 22px; accent-color: var(--blue); }
.rc-row input[type=text], .rc-row select { min-width: 0; width: 100%; min-height: 40px; font-size: 15px; }
.rc-row select, .rc-row input[inputmode] + select { grid-column: 2 / 4; }
.rc-row select[hidden], .rc-row input[hidden] { display: none; }
.rc-row input[placeholder="How many"] { grid-column: 2 / 4; }
.rc-total { margin: 0; font-weight: 600; font-size: 14px; }
.rc-actions { display: flex; gap: 12px; align-items: center; }
.rc-actions .btn { flex: 1; }
.store-bar { height: 12px; border-radius: 6px; background: var(--rule); overflow: hidden; }
.store-fill { height: 100%; background: var(--blue); }
.store-fill.hot { background: #d98a00; }
.store-fill.full { background: #b3261e; }
.rc-list { display: grid; gap: 8px; margin: 10px 0; }
.rc-item { display: grid; grid-template-columns: 24px 56px 1fr; gap: 10px; align-items: center; }
.rc-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--rule); }
.rc-item input[type=checkbox] { width: 22px; height: 22px; min-height: 22px; accent-color: var(--blue); }

.rc-head { flex-wrap: wrap; }
.rc-thumb.big { width: 100%; height: auto; max-height: 70vh; object-fit: contain; cursor: zoom-out; }

.composer { gap: 6px; padding: 8px 8px; }
.composer textarea { min-width: 0; padding: 10px 14px; }
.send, .mic { width: 40px; height: 40px; }
.composer textarea { min-height: 40px; }
.cam-menu { position: absolute; bottom: 48px; left: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.18); padding: 4px; z-index: 20; display: grid; min-width: 190px; }
.cam-menu[hidden] { display: none; }
.cam-opt { background: none; border: 0; text-align: left; padding: 12px 14px; font: inherit; border-radius: 8px; cursor: pointer; color: var(--ink); }
.cam-opt:hover, .cam-opt:focus-visible { background: var(--surface); }

.agree { display: flex; flex-direction: row; gap: 10px; align-items: flex-start; font-weight: 400; line-height: 1.4; }
.agree input { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-text { color: var(--red); border-color: transparent; }
.legal { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; line-height: 1.55; }
.legal h1 { font-size: 26px; margin: 8px 0 4px; }
.legal h2 { font-size: 18px; margin: 26px 0 6px; }
.legal p, .legal li { color: var(--ink); }
.legal .when { color: var(--muted); font-size: 14px; }
.legal a { color: var(--blue); }

.rc-row.ask { border-color: #e0b84a; background: #fff8e1; }
.rc-ask { grid-column: 1 / -1; margin: 0; color: var(--amber); font-weight: 600; font-size: 14px; }
.rc-ask[hidden] { display: none; }

/* Money tools: tab strip, hero heading, tool cards, status banners, progress bars, asset cards */
.tool-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 14px; padding-bottom: 2px; scrollbar-width: none; }
.tool-tabs::-webkit-scrollbar { display: none; }
.tool-tabs a { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 0 14px; border: 1.5px solid var(--rule); border-radius: 99px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tool-tabs a[aria-current="page"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-head.hero { display: flex; align-items: center; gap: 14px; }
.toolicon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--wash); color: var(--blue); }
.toolicon.big { width: 54px; height: 54px; }
.toolcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.toolcard { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; color: var(--ink); text-decoration: none; min-height: 84px; }
.toolcard:hover { border-color: var(--blue); }
.tooltext { display: grid; gap: 1px; min-width: 0; }
.tooltext .label { color: var(--muted); font-size: 13px; }
.tooltext strong { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tooltext .note { color: var(--muted); font-size: 12.5px; }
.tooltext .note.flag { color: #a15c00; font-weight: 600; }
.card.banner { border-left: 5px solid var(--blue); }
.card.banner.todo { border-left-color: #e0a100; background: #fffaf0; }
.card.banner.ok { border-left-color: #2e9e5b; }
.howto { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.stmt-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.prog { height: 8px; border-radius: 99px; background: #e8ecf5; overflow: hidden; margin: 8px 0 2px; }
.prog-fill { height: 100%; background: var(--blue); border-radius: 99px; }
.loan-big { font-size: 20px; font-weight: 700; margin: 6px 0 0; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.asset { padding: 0; overflow: hidden; }
.asset + .asset, .asset + .card, .asset + details { margin-top: 10px; }
.asset-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 14px; background: none; border: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-height: 56px; }
.asset-name, .asset-val { display: grid; gap: 1px; min-width: 0; }
.asset-val { text-align: right; flex: none; }
.asset .prog { margin: 0 14px 12px; }
.asset-more { padding: 0 14px 14px; display: grid; gap: 12px; border-top: 1px solid var(--rule); }
.asset-more[hidden] { display: none; }
.asset-more h3 { font-size: 16px; }
.asset-more .form { margin: 0; padding: 0; border: 0; }
.page .tiles { margin-bottom: 14px; }
.page .tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.page .tiles .tile strong { font-size: 19px; overflow-wrap: anywhere; }
.asset-name .muted, .asset-val .muted { font-size: 13px; }
.asset-name strong { overflow-wrap: anywhere; }
.block > h2 { margin-bottom: 8px; }
.tile.money { grid-column: 1 / -1; }
.tile .subs { display: grid; gap: 4px; margin-top: 6px; }
.tile .sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 8px; background: var(--wash); color: var(--ink); text-decoration: none; }
.tile .sub:hover { outline: 1.5px solid var(--blue); }
.tile .sub strong { font-size: 17px; }
a.stat { color: inherit; text-decoration: none; }
a.stat:hover, a.tile:hover { background: var(--wash); }
a.bar-row { color: inherit; text-decoration: none; }
a.drill { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
a.drill:hover { color: var(--blue); border-bottom-color: var(--blue); }
.report-sheet a.drill { padding: 4px 0; }
.toolcards.compact { grid-template-columns: repeat(2, 1fr); }
.toolcards.compact .toolcard { min-height: 0; padding: 10px; gap: 8px; }
.toolcards.compact .toolicon { width: 34px; height: 34px; }
.toolcards.compact .tooltext strong { font-size: 15px; }
.toolcards.compact .tooltext .note { display: none; }
@media print { a.drill { border: 0; } }
.auth-card > .link { align-self: flex-start; margin-top: 8px; }
.ledger-sum { margin-bottom: 12px; }
.report-sheet td.num.in { color: #1f7a45; }
.report-sheet td.num.out { color: #a52620; }
.report-sheet tr.voided td { color: var(--muted); text-decoration: line-through; }
.ledger-sum .tile { padding: 10px 12px; } .ledger-sum .tile strong { font-size: 17px; white-space: nowrap; } .ledger-sum .tile .label { font-size: 12.5px; }

.brand.big span:not(.brand-tile) { font-family: var(--sans); font-weight: 800; letter-spacing: -.01em; }
.brand-tile { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; background: #fff; border-radius: 16px; box-shadow: 0 4px 14px rgb(0 0 0 / .18); }
.nav .brand img { width: 30px; height: auto; }
.nav .brand strong { font-family: var(--sans); font-weight: 800; }
.auth-card .mobile-brand img { width: 44px; height: auto; }
.card h2 a.drill { border-bottom: 0; }

/* Report controls: one compact, wrapping row so the report itself stays near the top */
.report-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.report-controls .rc-account, .report-controls .rc-dates, .report-controls .rc-quick, .report-controls .rc-actions { display: contents; }
.report-controls select { width: auto; min-width: 200px; max-width: 280px; min-height: 36px; padding-top: 0; padding-bottom: 0; font-size: 14px; }
.report-controls input[type=date] { min-height: 36px; padding-top: 0; padding-bottom: 0; font-size: 14px; width: auto; }
.report-controls label.inline { font-size: 13px; gap: 6px; }
.report-controls .chips.row { gap: 6px; margin: 0; flex-wrap: wrap; overflow: visible; }
.report-controls .chip { min-height: 32px; padding: 0 12px; font-size: 13px; }
.report-controls .btn { min-height: 36px; padding: 0 14px; font-size: 14px; }
.report-controls .spacer { flex: 1 1 0; min-width: 0; }
.report-controls label.check-inline { font-size: 13px; }
.report-controls .btn, .report-controls .chip { white-space: nowrap; }
.report-controls .rc-dates label.inline { flex: 0 0 auto; }
.report-controls .rc-quick select { min-width: 150px; }
@media (max-width: 600px) {
  .report-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
  .report-controls label.inline { display: grid; gap: 4px; min-width: 0; }
  .report-controls input[type=date], .report-controls select { width: 100%; min-width: 0; max-width: none; }
  .report-controls select, .report-controls label.check-inline { grid-column: 1 / -1; }
  .report-controls .btn { width: 100%; }
  .report-controls .spacer { display: none; }
}
@media (max-width: 480px) { .toolcards.compact .toolicon { display: none; } .toolcards.compact .tooltext strong { font-size: 15px; } }
.block + .report-controls, .block + .toolbar { margin-top: 18px; }
.toolcards.compact .tooltext { flex: 1; }

/* Recording a statement line without leaving the reconciliation */
.rec-line { flex-wrap: wrap; }
.rec-top { display: flex; align-items: baseline; gap: 10px; width: 100%; }
.rec-top .m { flex: 1; min-width: 0; }
.rec-form { width: 100%; margin-top: 10px; padding: 14px; background: #f6f8fc; border: 1px solid #dfe5f0; border-radius: 12px; display: grid; gap: 10px; }
.rec-form label { display: grid; gap: 4px; font-size: 14px; }
.rec-form select, .rec-form input[type=text] { width: 100%; }
.rec-form .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.recon li.rec-line { display: block; }

/* Projects and budgets */
.card.proj { display: block; color: inherit; text-decoration: none; margin-bottom: 12px; }
.proj-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.proj-nums { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; margin: 8px 0 0; }
.proj-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.budget-row { display: grid; grid-template-columns: 1fr 130px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.budget-row select, .budget-row input { width: 100%; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.report-sheet .proj-head { margin: 22px 0 2px; font-size: 18px; }
.report-sheet tr.over td { color: #a52620; }
td .prog { margin-top: 6px; }
@media (max-width: 520px) { .budget-row { grid-template-columns: 1fr 100px auto; } }

.report-foot { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--muted); }
.report-foot img { width: 18px; height: 18px; }

.note-offer { margin-top: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
.note-offer .row, .block form.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.notes-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.notes-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; }
.block form.row input { flex: 1 1 220px; }
