[hidden] { display: none !important; }
.flush { margin-top: 0; }
.card p.small { font-size: 13px; }
.alert { background: var(--surface); border: 2px solid var(--warn); color: var(--warn); border-radius: 10px; padding: 10px 12px; margin: 0 0 16px; font-weight: 600; overflow-wrap: anywhere; }
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.jump a { display: inline-flex; align-items: center; min-height: 32px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: 14px; }

/* forms */
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 12px; margin: 0 0 10px; }
.fgrid > * { min-width: 0; }
.f.wide { grid-column: 1 / -1; }
.f label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 2px; }
.f textarea { resize: vertical; }
.chk { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 8px; min-height: 32px; }
.chk input[type="checkbox"] { width: 20px; height: 20px; padding: 0; margin: 2px 0 0; flex: none; }
.chk label { font-size: 14px; }
.card .row { margin-bottom: 4px; }
.row > label.small { flex: 0 0 auto; }
label.btn { display: inline-flex; align-items: center; }
#import-file:focus-visible + label.btn { outline: 3px solid var(--accent); outline-offset: 2px; }
h3.flush { margin: 0 0 8px; }

/* lists */
.list { list-style: none; padding: 0; margin: 12px 0 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; }
.list li.total { border-style: dashed; }
.list .t { font-weight: 600; overflow-wrap: anywhere; }
.list .meta { grid-column: 1 / -1; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.list .notes { grid-column: 1 / -1; font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.list .acts { display: flex; gap: 4px; align-items: start; flex-wrap: wrap; justify-content: flex-end; }
.list .acts button { min-height: 32px; padding: 2px 8px; font-size: 13px; }
.list .acts button[aria-pressed="true"] { background: var(--chip); }
.list .pk { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 13px; color: var(--muted); }
.list .pk .pill { margin: 0; }
.list .pk .amt, .list .meta .amt { color: var(--ink); font-weight: 600; }
.pill.flag { border: 1px solid var(--warn); font-weight: 700; }
.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; margin: 0; }
.stats > div { min-width: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* invoice */
.invoice { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink); }
.inv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.inv-biz { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.inv-title { font-size: 20px; font-weight: 700; }
.inv-num { font-weight: 400; font-size: 14px; margin-left: 8px; overflow-wrap: anywhere; }
.inv-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 16px; margin: 0 0 14px; }
.inv-meta > div { min-width: 0; }
.inv-meta dt { font-size: 12px; color: var(--muted); }
.inv-meta dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.inv-lines { list-style: none; margin: 0 0 8px; padding: 0; border-top: 1px solid var(--line); }
.inv-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "d a" "x a" "s a"; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.il-d { grid-area: d; font-size: 13px; color: var(--muted); }
.il-x { grid-area: x; overflow-wrap: anywhere; }
.il-n { display: block; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.il-s { grid-area: s; font-size: 13px; }
.il-a { grid-area: a; text-align: right; font-weight: 600; white-space: nowrap; }
@media (min-width: 560px) { .inv-lines li { grid-template-columns: 13em minmax(0, 1fr) 9em 8em; grid-template-areas: "d x s a"; } }
.inv-totals { margin: 8px 0 0 auto; max-width: 420px; }
.inv-totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.inv-totals dt { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.inv-totals dd { margin: 0; font-weight: 600; text-align: right; }
.inv-totals .due { font-size: 18px; border-bottom: 2px solid var(--ink); }
.inv-totals .due dt { color: var(--ink); font-weight: 700; }
.invoice p.inv-warn { color: var(--warn); font-weight: 600; font-size: 14px; margin: 10px 0 0; }
.invoice p.inv-foot { color: var(--ink); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0 0; }

/* print: only the invoice, always dark ink on white, whatever the screen theme is */
@media print {
  @page { margin: 14mm; }
  :root { --bg: #fff; --surface: #fff; --ink: #000; --muted: #333; --line: #999; --accent: #000; --warn: #000; --chip: #eee; }
  html, body { background: #fff; color: #000; }
  body { font-size: 12pt; }
  .wrap { max-width: none; padding: 0; }
  .wrap > :not(#invoice-sec) { display: none !important; }
  #invoice-sec { border: 0; padding: 0; background: #fff; }
  #invoice-sec .inv-controls, #inv-empty { display: none !important; }
  .invoice { margin: 0; padding: 0; border: 0; }
  .inv-lines li { break-inside: avoid; }
  a { color: #000; }
}
