[hidden] { display: none !important; }
.flush { margin-top: 0; }
.card { margin: 0 0 16px; }
.note { margin: 0 0 16px; padding: 10px 12px; border-left: 4px solid var(--accent); background: var(--chip); border-radius: 8px; font-size: 14px; }
.alert { margin: 0 0 16px; padding: 10px 12px; border: 2px solid var(--warn); border-radius: 8px; background: var(--surface); color: var(--warn); font-weight: 600; overflow-wrap: anywhere; }
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.jump a { display: inline-flex; align-items: center; min-height: 32px; padding: 2px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); font-size: 14px; text-decoration: none; }
h3.sub { font-size: 15px; margin: 18px 0 8px; color: var(--muted); }
.card > h3.sub:first-of-type { margin-top: 8px; }

.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 8px; margin: 0 0 10px; }
.form .f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.form .wide { grid-column: 1 / -1; }
.f label, .f .k { font-size: 13px; color: var(--muted); }
.f input, .f select, .f textarea { min-width: 0; max-width: 100%; }
.f label.chk, label.chk { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 16px; color: var(--ink); }
.chk input { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; padding: 0; }
.chk span { min-width: 0; overflow-wrap: anywhere; }
.pets { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.card .row { margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 4px; }
.chips button { min-height: 32px; padding: 2px 12px; border-radius: 99px; font-size: 14px; }

.list { list-style: none; padding: 0; margin: 0; }
.list > li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: start; }
.card .list > li { background: var(--bg); }
.list .t { font-weight: 600; overflow-wrap: anywhere; }
.list .meta { grid-column: 1 / -1; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.list .owedline { grid-column: 1 / -1; font-size: 16px; font-weight: 700; }
.list .notes { grid-column: 1 / -1; font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
/* Lines that echo names the user typed ("Added ...", "Logged: ...", the repeat hint) can break anywhere. */
[role="status"], #v-same-hint, #visit-setup { overflow-wrap: anywhere; }
.acts { display: flex; flex-wrap: wrap; gap: 4px; align-items: start; justify-content: flex-end; }
.acts button { min-height: 32px; padding: 2px 8px; font-size: 13px; }
.acts button[aria-pressed="true"] { background: var(--chip); border-color: var(--accent); }
.sublist { grid-column: 1 / -1; list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.sublist > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: start; border-top: 1px solid var(--line); padding-top: 6px; }
.list .pill { margin: 0 0 0 6px; }

.amt { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.stat { display: flex; flex: 1 1 130px; flex-direction: column; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.stat .l { font-size: 12px; color: var(--muted); }
.stat .n { font-size: 20px; font-weight: 700; }
.stat.strong { flex-basis: 100%; border-color: var(--accent); }

#statement { margin-top: 8px; }
.st-title { font-size: 20px; margin: 0 0 4px; overflow-wrap: anywhere; }
.st-meta { margin: 0 0 4px; font-size: 14px; overflow-wrap: anywhere; }
.st-note { margin: 12px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Tables hold user-typed text and amounts of any size: they scroll inside their box, so the page itself never scrolls sideways. */
.tablewrap { max-width: 100%; overflow-x: auto; }
table.stmt { margin: 10px 0 12px; font-size: 14px; }
table.stmt th.what, table.stmt td.what { min-width: 4.5rem; overflow-wrap: anywhere; }
table.stmt th, table.stmt td { padding: 6px 6px 6px 0; }
table.stmt th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.stmt .t { font-weight: 600; }
.num { text-align: right; white-space: nowrap; }
.nw { white-space: nowrap; }
table.sum { width: auto; min-width: 230px; margin-left: auto; }
table.sum th { font-weight: 400; }
table.sum td { padding-right: 0; }
table.sum tr[data-k="owed"] th, table.sum tr[data-k="owed"] td { font-size: 17px; font-weight: 700; border-top: 2px solid var(--ink); }

@media (max-width: 379px) {
  table.stmt th:first-child, table.stmt td:first-child { white-space: normal; }
  table.stmt th, table.stmt td { padding-right: 4px; }
}
@media print {
  .tablewrap { overflow: visible; }
  .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .wrap { max-width: none; margin: 0; padding: 0; }
  .card.print-area { border: 0; border-radius: 0; padding: 0; margin: 0; background: #fff; }
  #statement, #statement .muted, #statement .small { color: #000; }
  .st-title { font-size: 20pt; }
  table.stmt th, table.stmt td, table.sum th, table.sum td { border-bottom: 1px solid #888; color: #000; }
  table.stmt tr { break-inside: avoid; }
}
