:root {
  --bg: #f6f5f2; --card: #fff; --ink: #1d1d1f; --muted: #6b6b70; --line: #e4e2dc;
  --accent: #c62828; --accent-soft: rgba(198, 40, 40, .12); --on-accent: #fff;
  --red: #c62828; --red-soft: #fdecea; --green: #1b7f4b; --green-soft: #e6f4ec;
  --amber: #a15c00; --amber-soft: #fff3e0; --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416; --card: #1e1e21; --ink: #ececee; --muted: #9a9aa1; --line: #2e2e33;
    --accent: #ef5350; --accent-soft: rgba(239, 83, 80, .16);
    --red: #ef5350; --red-soft: #3a1f1f; --green: #4cc38a; --green-soft: #183326;
    --amber: #ffb74d; --amber-soft: #3a2c16;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.45; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: normal; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nowrap { white-space: nowrap; }

.top { background: var(--card); border-top: 5px solid var(--accent); border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.swatch { position: relative; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--ink); }
.custom-color { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.custom-color input[type=color] { width: 56px; height: 40px; padding: 2px; cursor: pointer; }
.color-preview { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0; padding: 14px; border: 1px dashed var(--line); border-radius: 8px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; padding: 10px 24px; flex-wrap: wrap; max-width: 1400px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; display: flex; align-items: flex-start; gap: 10px; line-height: 1.2; }
.brand .dot { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.brand .who { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); }
.brand.has-logo { align-items: center; gap: 16px; }
.brand-logo { display: block; max-height: 76px; max-width: 280px; width: auto; height: auto; }
.brand-text { display: flex; flex-direction: column; gap: 4px; }
.brand-text strong { font-size: 1.3rem; font-weight: 800; line-height: 1.15; }
.brand-text small { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; color: var(--muted); }
.brand-text small .dot { width: 9px; height: 9px; margin: 0; }
.home-head { display: flex; align-items: center; gap: 24px; }
.home-logo { max-height: 120px; max-width: 320px; width: auto; height: auto; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
@media (max-width: 720px) {
  .brand-logo { max-height: 60px; max-width: 200px; }
  .brand-text strong { font-size: 1.1rem; }
  .home-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .home-logo { max-height: 90px; max-width: 100%; }
}
nav { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.nav-btn { display: inline-block; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.nav-btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.nav-btn.signout { background: transparent; color: var(--muted); }
@media (max-width: 720px) {
  .top-row { padding: 10px 16px; }
  nav { width: 100%; justify-content: stretch; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  nav .inline { display: contents; }
  .nav-btn { text-align: center; padding: 12px 6px; font-size: .95rem; }
}
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); display: inline-block; }
.inline { display: inline; margin: 0; }
.foot { color: var(--muted); font-size: .85rem; padding: 32px 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card.danger { border-color: var(--red-soft); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.grid2 .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + section { margin-top: 20px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head-row h1, .head-row h2 { margin: 0; }

.flash { background: var(--green-soft); color: var(--green); padding: 10px 14px; border-radius: 8px; }
.error { background: var(--red-soft); color: var(--red); padding: 10px 14px 10px 30px; border-radius: 8px; }
p.error { padding-left: 14px; }

input, select, button { font: inherit; }
input, select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: .9rem; font-weight: 600; }
label input, label select { margin-top: 4px; font-weight: normal; }
.stack { display: grid; gap: 14px; }

.btn { display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.bad { background: transparent; border-color: var(--red); color: var(--red); }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; }

.auth { max-width: 420px; margin: 40px auto; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; border-top: 4px solid var(--line); }
.stat span { display: block; color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat.in, .stat.pos { border-top-color: var(--green); }
.stat.out { border-top-color: var(--amber); }
.stat.neg { border-top-color: var(--red); }
.stat.neg strong { color: var(--red); }

.entry-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: end; }
.entry-form .kind { grid-column: 1 / -1; border: 0; padding: 0; margin: 0; display: flex; gap: 10px; }
.entry-form .wide { grid-column: 1 / 4; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.pill input { width: auto; margin: 0; }
.pill.in:has(input:checked) { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.pill.out:has(input:checked) { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.bar-label a { color: var(--ink); }
.bar-label span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; border-radius: 4px; }
.bar.in i { background: var(--green); }
.bar.out i { background: var(--amber); }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters select { width: auto; }
.filters input { flex: 1; min-width: 180px; width: auto; }
.empty { padding: 20px 0; text-align: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.in { color: var(--green); font-weight: 600; }
td.out { color: var(--ink); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .82rem; white-space: nowrap; }
.tag.in { background: var(--green-soft); color: var(--green); }
.tag.out { background: var(--amber-soft); color: var(--amber); }

@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr; }
  .entry-form { grid-template-columns: 1fr 1fr; }
  .entry-form .wide { grid-column: 1 / -1; }
  .entry-form .btn { grid-column: 1 / -1; }
  .stat strong { font-size: 1.35rem; }
}

.acting { background: var(--amber-soft); color: var(--amber); border-bottom: 1px solid var(--amber); margin: -24px 0 24px; padding: 10px 0; }
.acting .wrap { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
td.actions form { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin: 0; }

/* Reports and balances */
.small { font-size: .85rem; }
.tabs { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tab { padding: 6px 14px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.tab.on { background: var(--accent); color: var(--on-accent); }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.range { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.range label { width: auto; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.report-head { text-align: center; margin-bottom: 18px; }
.report-head h2 { margin: 2px 0; font-size: 1.35rem; }
.report-co { font-weight: 700; font-size: 1.05rem; }
.statement { max-width: 720px; margin: 0 auto; }
.statement td { border-bottom: 1px solid var(--line); }
.statement .sec td { font-weight: 700; padding-top: 18px; border-bottom: 2px solid var(--line); }
.statement .ind { padding-left: 24px; }
.statement .sub td { font-weight: 700; border-top: 1px solid var(--ink); }
.statement .grand td { font-weight: 800; font-size: 1.08rem; border-top: 2px solid var(--ink); border-bottom: 4px double var(--ink); }
.statement .grand.neg td.num:first-of-type { color: var(--red); }
.balanced { text-align: center; color: var(--green); font-weight: 600; margin: 16px 0 0; }
.unbalanced { max-width: 720px; margin: 16px auto 0; background: var(--amber-soft); color: var(--ink); border-left: 4px solid var(--amber); padding: 12px 14px; border-radius: 8px; }
.pill.sect-asset:has(input:checked), .pill.sect-liability:has(input:checked), .pill.sect-equity:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.update-bal { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.update-bal input { width: auto; flex: 1; min-width: 110px; padding: 6px 8px; }
.hist { margin-top: 6px; font-size: .85rem; }
.hist summary { cursor: pointer; color: var(--muted); }
.hist ul { margin: 6px 0 0; padding-left: 18px; }
tfoot th { border-bottom: 0; color: var(--ink); }

/* Home */
.home-head h1 { margin-bottom: 0; }
.home-head p { margin-top: 2px; }
.home-quick { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 700px) { .home-quick { margin-left: 0; } }
.ask { border-top: 4px solid var(--accent); }
.ask h2 { font-size: 1.3rem; }
.suggestions { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.sugg { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; border-left: 4px solid var(--line); background: var(--bg); }
.sugg.bad { border-left-color: var(--red); background: var(--red-soft); }
.sugg.warn { border-left-color: var(--amber); background: var(--amber-soft); }
.sugg.info { border-left-color: var(--accent); background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--accent); }
.sugg .btn { white-space: nowrap; }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.action { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.action:hover, .action:focus-visible { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-1px); }
.action-icon { font-size: 1.7rem; line-height: 1; }
.action-title { font-weight: 700; font-size: 1.02rem; margin-top: 6px; }
.action-sub { color: var(--muted); font-size: .85rem; }
.setup .meter { margin-bottom: 12px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 20px; }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.check { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; }
.checklist li.done .check { background: var(--green); border-color: var(--green); color: #fff; text-decoration: none; }
.section-title { margin: 28px 0 12px; font-size: 1.2rem; }
.overview { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.overview .card { margin: 0; }
.overview .wide { grid-column: 1 / -1; }
.overview h3 { margin: 0; font-size: 1.05rem; }
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 10px; }
.figures dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.figures dd { margin: 2px 0 0; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.figures dd.in, .in-text { color: var(--green); }
.figures dd.neg, strong.neg { color: var(--red); }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list li > span { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.camera-btn.pulse { animation: pulse 1.4s ease-in-out 4; background: var(--accent); color: var(--on-accent); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 8px var(--accent-soft); } }
@media (max-width: 900px) { .action-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) {
  .overview, .checklist { grid-template-columns: 1fr; }
  .figures dd { font-size: 1.1rem; }
  .sugg { flex-direction: column; align-items: flex-start; }
  .mini-list li { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* Client import */
.import-card { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.import-card > div { flex: 1; min-width: 260px; }
.import-card input[type=file] { width: auto; max-width: 100%; }
.map-table select { width: auto; min-width: 180px; }
.radio-line { display: flex; gap: 10px; align-items: flex-start; font-weight: normal; margin: 8px 0; }
.radio-line input { width: auto; margin-top: 4px; }
.import-counts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tag.bad-tag { background: var(--red-soft); color: var(--red); }
tr.dim td { opacity: .5; }
.import-actions { margin-top: 16px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Budget */
.meter { height: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; border-radius: 999px; }
.meter.good i { background: var(--green); }
.meter.warn i { background: var(--amber); }
.meter.over i, .meter.low i { background: var(--red); }
.budget-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.budget-note { font-size: .85rem; margin-top: 4px; color: var(--muted); }
.budget-note.warn { color: var(--amber); }
.budget-note.over { color: var(--red); font-weight: 600; }
.budget-mini .budget-note { margin-bottom: 0; }
.budget-edit input { width: 130px; text-align: right; padding: 6px 8px; }
.budget-edit .new-cat input[name="cat[]"] { width: 100%; text-align: left; }
.budget-edit .goal-row td { background: var(--green-soft); }
.budget-edit .sec td { font-weight: 700; padding-top: 18px; }
#budget-form .btn-row { margin-top: 16px; }
.period-nav { gap: 12px; }

/* Receipt photos */
.snap-btn { display: none; width: 100%; padding: 14px; font-size: 1.05rem; margin-bottom: 16px; }
@media (max-width: 720px), (pointer: coarse) { .snap-btn { display: block; } }
.receipt-field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.receipt-label { font-size: .9rem; font-weight: 600; }
.receipt-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.receipt-buttons .btn { cursor: pointer; }
.camera-btn { border-color: var(--accent); color: var(--accent); }
.receipt-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.receipt-preview img, .receipt-current img { max-height: 120px; max-width: 160px; border-radius: 6px; border: 1px solid var(--line); object-fit: cover; }
.receipt-current { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.remove-receipt { display: flex; gap: 6px; align-items: center; font-weight: normal; }
.remove-receipt input { width: auto; margin: 0; }
.receipt-link { white-space: nowrap; font-size: .85rem; margin-left: 6px; }
@media (max-width: 720px) { .receipt-buttons .btn { flex: 1; text-align: center; padding: 12px; font-size: 1rem; } }

/* Invoices */
.center { text-align: center; }
.pre { white-space: pre-line; }
textarea { font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); resize: vertical; }
label textarea { margin-top: 4px; font-weight: normal; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.grid-form .wide2 { grid-column: span 2; }
.grid-form .btn-row { grid-column: 1 / -1; }
.terms { display: flex; gap: 10px; margin-top: 6px; font-weight: normal; font-size: .85rem; }
.lines-edit td { padding: 6px 4px; vertical-align: middle; }
.lines-edit td:first-child { width: 55%; }
.lines-edit .qty { width: 70px; text-align: right; }
.lines-edit .rate { width: 110px; text-align: right; }
.lines-edit .remove { font-size: 1.4rem; text-decoration: none; color: var(--muted); }
.totals-edit { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; margin-top: 16px; }
.totals-edit label { width: 160px; }
.totals-edit table { width: auto; min-width: 240px; }
.totals-edit td, .totals-edit th { text-align: right; padding: 4px 8px; }
.totals-edit .due td, .totals-edit .due th { font-size: 1.15rem; font-weight: 800; border-top: 2px solid var(--ink); }

.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.status.sent { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.status.overdue { background: var(--red-soft); color: var(--red); border-color: transparent; }
.status.paid { background: var(--green-soft); color: var(--green); border-color: transparent; }
.status.void { text-decoration: line-through; }
.filter-tabs { display: inline-flex; flex-wrap: wrap; margin-bottom: 14px; }
.inv-actions .btn-row { margin-bottom: 8px; }
.pay-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.pay-form label { width: auto; }
.pay-form strong { align-self: center; }
input.copy { width: 100%; max-width: 560px; font-size: .85rem; padding: 5px 8px; margin-top: 4px; }
.public-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 820px; margin: 0 auto 14px; flex-wrap: wrap; }

.invoice-doc { position: relative; background: #fff; color: #1d1d1f; max-width: 820px; margin: 0 auto 24px; padding: 48px; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 12px rgba(0,0,0,.06); overflow: hidden; }
.invoice-doc .muted { color: #6b6b70; }
.inv-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 24px; border-bottom: 3px solid #c62828; }
.inv-logo { display: block; max-width: 260px; max-height: 90px; width: auto; height: auto; margin-bottom: 12px; }
.logo-preview { display: flex; align-items: center; justify-content: center; min-height: 100px; padding: 16px; margin-bottom: 14px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; }
.logo-preview img { max-width: 100%; max-height: 120px; }
.empty-logo { color: #6b6b70; font-size: .9rem; }
.logo-remove { margin-top: 10px; }
.inv-from { font-size: 1.3rem; font-weight: 800; }
.inv-title { text-align: right; }
.inv-title h2 { font-size: 2rem; letter-spacing: .12em; color: #c62828; margin: 0 0 8px; }
.inv-meta { width: auto; margin-left: auto; }
.inv-meta th, .inv-meta td { border: 0; padding: 2px 0 2px 16px; text-align: right; font-size: .95rem; color: #1d1d1f; text-transform: none; letter-spacing: 0; }
.inv-meta th { color: #6b6b70; font-weight: 600; }
.inv-to { margin: 24px 0; }
.invoice-doc .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: #6b6b70; font-weight: 700; margin-bottom: 4px; }
.inv-lines th { color: #6b6b70; border-bottom: 2px solid #1d1d1f; }
.inv-lines td { border-bottom: 1px solid #e4e2dc; }
.inv-totals { width: auto; min-width: 280px; margin: 16px 0 0 auto; }
.inv-totals th, .inv-totals td { border: 0; padding: 6px 8px; text-align: right; text-transform: none; letter-spacing: 0; font-size: 1rem; color: #1d1d1f; }
.inv-totals .due th, .inv-totals .due td { font-size: 1.25rem; font-weight: 800; border-top: 2px solid #1d1d1f; background: #fdecea; }
.inv-notes { margin-top: 24px; }
.inv-thanks { margin-top: 32px; text-align: center; color: #6b6b70; }
.stamp { position: absolute; top: 34px; left: 50%; transform: translateX(-50%) rotate(-12deg); border: 4px solid; border-radius: 8px; padding: 4px 18px; font-size: 1.8rem; font-weight: 900; letter-spacing: .15em; opacity: .75; }
.stamp.paid { color: #1b7f4b; }
.stamp.void { color: #c62828; }

@media (max-width: 720px) {
  .grid-form { grid-template-columns: 1fr; }
  .grid-form .wide2 { grid-column: auto; }
  .invoice-doc { padding: 22px 16px; }
  .inv-title { text-align: left; }
  .inv-meta { margin-left: 0; }
}

@media print {
  .top, .foot, .no-print, .acting, .flash { display: none !important; }
  :root { --ink: #000; --muted: #555; --line: #ccc; --card: #fff; --bg: #fff; --red: #b71c1c; --green: #1b5e20; }
  body { background: #fff; color: #000; }
  .card { border: 0; padding: 0; }
  .report { margin: 0; }
  .invoice-doc { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .inv-totals .due th, .inv-totals .due td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Disclaimer on the sign-in and sign-up forms */
.disclaimer { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--bg); }
.disclaimer h2 { font-size: 1rem; margin: 0 0 6px; }
.disclaimer-text { max-height: 260px; overflow-y: auto; font-size: .88rem; color: var(--muted); padding-right: 6px; }
.disclaimer-text p { margin: 0 0 8px; }
.disclaimer label.opt { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; margin-top: 8px; }
.disclaimer label.opt input { width: auto; margin-top: 3px; flex: none; }
.disclaimer .small { font-size: .82rem; margin: 6px 0 0; }
.disclaimer-text h3 { font-size: .9rem; color: var(--ink); margin: 12px 0 4px; }
.disclaimer-text h3:first-child { margin-top: 0; }
.disclaimer-text ul { margin: 0 0 8px; padding-left: 20px; }
.disclaimer h2 + .small { margin: 0 0 8px; }

/* Switching between accounts that share one sign-in */
.book-switch label { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.book-switch select { width: auto; max-width: 220px; margin-top: 0; padding: 6px 10px; color: var(--ink); font-weight: 600; }
.book-list { list-style: none; padding: 0; margin: 0 0 14px; }
.book-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.email-check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 0 0 14px; }
.email-check input { width: auto; margin: 0; }

/* People added to an account */
.member-list li { align-items: flex-start; }
.member-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.member-actions select { width: auto; margin: 0; padding: 5px 8px; }
fieldset.roles { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0; display: grid; gap: 8px; }
fieldset.roles legend { font-weight: 600; padding: 0 4px; }
fieldset.roles label.opt { display: flex; gap: 10px; align-items: flex-start; font-weight: normal; }
fieldset.roles label.opt input { width: auto; margin-top: 4px; flex: none; }
.flash input { margin-top: 6px; font-size: .85rem; }
h3.sub { font-size: .95rem; margin: 6px 0 4px; }
.acting.shared { background: var(--accent-soft); }
/* Read-only and reports-only access: hide ways into screens they cannot use */
.role-read main a[href*="/invoices/new"], .role-read main a[href*="/invoice/edit"], .role-read main a[href*="#add-entry"],
.role-read main a[href*="budget?edit"], .role-read main a[href*="/clients/import"], .role-read main a[href*="template.csv"],
.role-read main a[href*="/clients?edit"], .role-read main a[href*="/billing?edit"], .role-read main .bill-pick, .role-reports main a[href*="/balances"] { display: none !important; }

/* Billing categories picker on the invoice form */
.bill-pick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 16px; margin-bottom: 12px; }
.bill-pick label { flex: 1 1 260px; max-width: 420px; }
.bill-pick p { margin: 0; }
/* People with access: needs room for a name, an email, a role and buttons, so it
   takes the full width of the Settings grid and lets each row wrap. */
#people { grid-column: 1 / -1; }
.member-list li { flex-wrap: wrap; }
.member-list li > span:first-child { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.member-actions { flex: 0 1 auto; justify-content: flex-start; }
#people form.stack { max-width: 760px; }
fieldset.roles { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Client statements */
.stmt-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 22px; }
.stmt-sum > div { border: 1px solid #e4e2dc; border-radius: 10px; padding: 12px 14px; }
.stmt-sum span { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #6b6b70; font-weight: 700; }
.stmt-sum strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stmt-sum em { display: block; font-style: normal; font-size: .85rem; color: #c62828; font-weight: 600; }
.stmt-sum .owe { border-color: #c62828; background: #fdecea; }
.stmt-sum .clear { border-color: #1b7f4b; background: #e6f4ec; }
.stmt-lines td, .stmt-lines th { vertical-align: middle; }
.stmt-lines .void-row td { color: #9a9aa1; }
.stmt-actions { margin-top: 10px; }
.book-cta { margin: 6px 0 18px; }
@media (max-width: 600px) {
  .stmt-sum { grid-template-columns: 1fr; }
  /* Room for what matters on a phone: the invoice, its status, amount and balance. */
  .stmt-lines th:nth-child(2), .stmt-lines td:nth-child(2), .stmt-lines th:nth-child(3), .stmt-lines td:nth-child(3), .stmt-lines td .muted { display: none; }
  .stmt-lines th, .stmt-lines td { padding-left: 4px; padding-right: 4px; }
}
.stmt-lines td:first-child { white-space: nowrap; }

/* Redbird Calendar appointments */
.appt-list { list-style: none; margin: 0; padding: 0; }
.appt-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.appt-list li:last-child { border-bottom: 0; }
#calendar .flash input { margin-top: 6px; font-size: .85rem; }

/* Redbird HQ bar, shown while a super admin is in from HQ */
.hq-bar { position: fixed; left: 12px; bottom: 12px; z-index: 1000; display: flex; gap: 2px; align-items: center; background: #1d1d1f; color: #fff;
  border-radius: 999px; padding: 4px; box-shadow: 0 4px 16px rgba(0,0,0,.25); font: 600 13px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hq-bar b { background: #c62828; border-radius: 999px; padding: 6px 10px; }
.hq-bar a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 999px; }
.hq-bar a:hover { background: rgba(255,255,255,.15); }
.hq-bar a.here { background: rgba(255,255,255,.2); }
@media print { .hq-bar { display: none; } }

/* Per-invoice booking link */
.book-opt .opt { display: flex; gap: 8px; align-items: center; }
.book-opt .opt input { width: auto; margin: 0; }
.book-opt #booking-field { margin-top: 12px; }
.book-opt #booking-field p { margin: 6px 0 0; }
.inv-book a { overflow-wrap: anywhere; }

/* Client progress (jobs) */
.client-tabs { display: inline-flex; margin: 0 0 16px; }
.client-tabs a { padding: 8px 18px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; }
.client-tabs a.on { background: var(--accent); color: var(--on-accent); }
.jobs { display: grid; gap: 14px; margin-bottom: 20px; }
.job { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.job-in_progress { border-left-color: var(--amber); }
.job-ready { border-left-color: var(--green); }
.job-delivered { opacity: .8; }
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-head h3 { margin: 0; font-size: 1.1rem; }
.jstatus { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 3px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.jstatus.in_progress { background: var(--amber-soft); color: var(--amber); }
.jstatus.ready { background: var(--green-soft); color: var(--green); }
.jbar { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: 12px 0; }
.jbar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.job-ready .jbar i, .job-delivered .jbar i { background: var(--green); }
.jfacts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.jfacts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.jfacts dd { margin: 2px 0 0; font-weight: 600; }
.jupdates { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: .92rem; }
.jupdates time { color: var(--muted); font-weight: 700; font-size: .82rem; min-width: 52px; display: inline-block; }
.job-edit { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.job-edit summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.job-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; margin-top: 10px; }
.job-form .wide { grid-column: 1 / -1; }
.job-form .opt { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.job-form .opt input { width: auto; margin: 0; }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.progress-public .section-title { margin-top: 0; }
@media print { .jupdates { break-inside: avoid; } }
.progress-public { max-width: 820px; margin: 0 auto 24px; }

/* Job stages */
.jstages { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.jstages-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.jstages ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.jstages li { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.jstages li .sname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.jstages li.done .sname { color: var(--muted); text-decoration: line-through; }
.jstages .tick { flex: none; width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--line); background: var(--card); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: .85rem; padding: 0; line-height: 1; }
.jstages button.tick { cursor: pointer; }
.jstages button.tick:hover { border-color: var(--green); }
.jstages li.done .tick { background: var(--green); border-color: var(--green); }
.jstages form { margin: 0; display: inline; }
.stage-del button { color: var(--muted); text-decoration: none; font-size: 1.1rem; }
.stage-add { display: flex; gap: 8px; margin-top: 10px; }
.stage-add input { flex: 1; min-width: 0; }
.tpl-list { list-style: none; margin: 0; padding: 0; }
.tpl-list > li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tpl-list > li:last-child { border-bottom: 0; }
.tpl-stages { margin: 6px 0 0; padding-left: 20px; color: var(--muted); font-size: .92rem; }

/* Client intake form */
.intake-grid .card { margin-bottom: 0; }
.intake-grid + .card { margin-top: 20px; }
.intake-public { max-width: 680px; margin: 10px auto 24px; }
.intake-public h1 { margin-bottom: 2px; }
.intake-logo { display: block; max-height: 70px; max-width: 240px; margin-bottom: 12px; }
.intake-intro { background: var(--bg); border-radius: 8px; padding: 12px 14px; }
.intake-public .grid-form { align-items: start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.intake-answers summary { cursor: pointer; }
.intake-answers dl { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 8px 16px; margin: 14px 0 0; }
.intake-answers dt { color: var(--muted); font-weight: 600; font-size: .9rem; }
.intake-answers dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .intake-answers dl { grid-template-columns: 1fr; } .intake-answers dd { margin-bottom: 8px; } }
#calendar .cal-code input { margin: 6px 0; }
#calendar .cal-code .btn-row { margin: 4px 0 10px; }

/* Client page: details, overview, open invoices */
.client-head { display: flex; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; align-items: flex-start; }
.client-head h1 { margin: 0 0 6px; }
.ch-contact { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.ch-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.overview-grid { margin-bottom: 20px; }
.open-total { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px; border-radius: 10px; background: var(--amber-soft); margin-bottom: 8px; }
.open-total span { font-weight: 700; color: var(--amber); }
.open-total strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.open-list { list-style: none; margin: 0; padding: 0; }
.open-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.open-list li:last-child { border-bottom: 0; }
.open-list .oi-main { flex: 1 1 180px; display: flex; flex-direction: column; }
.open-list .oi-amt { font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; }
.open-list li.late .oi-amt { color: var(--red); }
.job-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.job-mini li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.job-mini .jbar { grid-column: 1 / -1; margin: 2px 0; }
.job-mini .muted { grid-column: 1 / -1; }
.open-public .card { margin-bottom: 0; }
.pay-note { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.email-inv .opt, .stmt-actions .opt { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; margin: 0 6px; }
.email-inv .opt input, .stmt-actions .opt input { width: auto; margin: 0; }
.copy-check { margin-top: -6px; padding-left: 26px; font-weight: normal; }

/* Booking button wording */
.booking-words { margin: 0 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.preview-btn { pointer-events: none; margin-left: 4px; }

/* Progress board: every client's jobs */
.pb-stats { grid-template-columns: repeat(4, 1fr); }
.pb-stats .stat { text-decoration: none; color: inherit; }
.pb-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pb-tools .tabs { display: inline-flex; flex-wrap: wrap; }
.pb-tools .tabs a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem; }
.pb-tools .tabs a.on { background: var(--accent); color: var(--on-accent); }
.pb-tools input { max-width: 280px; }
.pb-list { display: grid; }
.pb-row { display: grid; grid-template-columns: minmax(160px, 1.1fr) 2fr auto; gap: 8px 20px; align-items: center; padding: 14px 10px 14px 14px;
  border-bottom: 1px solid var(--line); border-left: 4px solid var(--line); text-decoration: none; color: inherit; }
.pb-row:hover { background: var(--bg); }
.pb-row.job-in_progress { border-left-color: var(--amber); }
.pb-row.job-ready { border-left-color: var(--green); }
.pb-row.job-delivered { opacity: .75; }
.pb-who { display: flex; flex-direction: column; min-width: 0; }
.pb-who strong, .pb-who span { overflow-wrap: anywhere; }
.pb-line { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.pb-stage { font-size: .92rem; }
.pb-row .jbar { margin: 8px 0 4px; }
.pb-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-facts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 90px; }
.pb-facts strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.pb-facts .late { color: var(--red); font-weight: 700; }
@media (max-width: 720px) {
  .pb-stats { grid-template-columns: 1fr 1fr; }
  .pb-row { grid-template-columns: 1fr auto; }
  .pb-where { grid-column: 1 / -1; grid-row: 2; }
  .pb-tools input { max-width: none; }
}

/* Home: client progress tile */
.pt-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.pt-counts a { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 10px; background: var(--bg); text-decoration: none; color: inherit; }
.pt-counts strong { font-size: 1.4rem; }
.pt-counts strong.pos { color: var(--green); } .pt-counts strong.neg { color: var(--red); }
.pt-counts span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.pt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pt-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; }
.pt-list a { color: inherit; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-list .jbar { grid-column: 1 / -1; margin: 0; height: 6px; }

/* Home: calendar and appointments on the right */
.wrap.wide { max-width: 1360px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.home-grid.no-side { grid-template-columns: minmax(0, 1fr); }
.home-side { position: sticky; top: 16px; display: grid; gap: 16px; }
.home-side .card { margin: 0; }
.home-side h2 { font-size: 1.05rem; margin: 0; }
.mc-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.mc { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mc-dow { font-size: .72rem; font-weight: 700; color: var(--muted); padding: 2px 0 4px; }
.mc-day { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 50%;
  color: var(--ink); text-decoration: none; font-size: .9rem; font-variant-numeric: tabular-nums; }
.mc-day:hover { background: var(--bg); }
.mc-day.has { font-weight: 800; color: var(--accent); }
.mc-day i { position: absolute; bottom: 4px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.mc-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.mc-day.sel { background: var(--accent); color: var(--on-accent); }
.mc-day.sel i { background: var(--on-accent); }
.ap-list { list-style: none; margin: 8px 0 0; padding: 0; }
.ap-day { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 4px; }
.ap-day:first-child { margin-top: 0; }
.ap { display: grid; grid-template-columns: 70px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ap:last-child { border-bottom: 0; }
.ap-time { font-weight: 700; font-size: .88rem; font-variant-numeric: tabular-nums; }
.ap-what { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 1080px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-side { position: static; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}

/* Start-a-job page */
.start-card .gap-row { margin: 8px 0 12px; }
.start-setup { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.start-setup .opt { display: flex; gap: 8px; align-items: center; font-weight: normal; }
.start-setup .opt input { width: auto; margin: 0; }
.start-public .form-sec { font-size: 1rem; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.job-pick { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: grid; gap: 6px; margin: 0; }
.job-pick legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
.job-pick .jp { display: flex; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 8px; cursor: pointer; font-weight: normal; }
.job-pick .jp:has(input:checked) { background: var(--accent-soft); }
.job-pick .jp input { width: auto; margin: 0; }
.center-logo { margin: 0 auto 12px; }
.tag.req { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.jtags { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Invoice copies between accounts */
.copy-to { display: inline-flex; gap: 6px; align-items: center; }
.copy-to select { width: auto; padding: 5px 8px; }
.copy-note { background: var(--amber-soft); color: var(--ink); border-left: 4px solid var(--amber); padding: 10px 14px; border-radius: 8px; }

/* Clients at the center: directory and profile */
.count-pill { font-size: 1rem; background: var(--bg); border-radius: 999px; padding: 2px 10px; vertical-align: middle; }
.client-search select { width: auto; }
.client-dir { list-style: none; margin: 0; padding: 0; }
.client-dir > li { display: grid; grid-template-columns: minmax(220px, 1.3fr) 1.5fr auto; gap: 8px 16px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.client-dir > li:last-child { border-bottom: 0; }
.cd-main { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.cd-main:hover strong { color: var(--accent); }
.cd-avatar, .pf-avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.cd-avatar { width: 42px; height: 42px; font-size: .95rem; }
.cd-who { display: flex; flex-direction: column; min-width: 0; }
.cd-who strong, .cd-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.owe { background: var(--amber-soft); color: var(--amber); }
.badge.ready { background: var(--green-soft); color: var(--green); }
.badge.job { background: var(--accent-soft); color: var(--accent); }
.cd-actions { display: flex; gap: 6px; }
@media (max-width: 760px) {
  .client-dir > li { grid-template-columns: 1fr auto; }
  .cd-badges { grid-column: 1 / -1; grid-row: 2; padding-left: 54px; }
}
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
.inline-h { display: inline; margin: 0; }
details.card[open] > summary { margin-bottom: 14px; }
.delete-client { margin-top: 10px; }
.profile { padding: 0; overflow: hidden; }
.pf-top { display: flex; gap: 18px; padding: 20px; flex-wrap: wrap; align-items: flex-start; }
.pf-avatar { width: 64px; height: 64px; font-size: 1.4rem; }
.pf-who { flex: 1 1 280px; min-width: 0; }
.pf-who h1 { margin: 0 0 4px; }
.pf-edit { margin-top: 6px; }
.pf-edit summary { cursor: pointer; color: var(--accent); }
.pf-edit form { margin-top: 10px; }
.pf-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.pf-stats a { display: flex; flex-direction: column; padding: 14px 20px; text-decoration: none; color: inherit; border-right: 1px solid var(--line); }
.pf-stats a:last-child { border-right: 0; }
.pf-stats a:hover { background: var(--bg); }
.pf-stats span { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pf-stats strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.pf-stats strong.small-strong { font-size: 1rem; padding-top: 4px; }
.pf-stats em { font-style: normal; color: var(--red); font-size: .82rem; font-weight: 700; }
.pf-stats a.owe strong { color: var(--amber); }
@media (max-width: 720px) { .pf-stats { grid-template-columns: 1fr 1fr; } .pf-stats a:nth-child(2) { border-right: 0; } .pf-stats a:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
.pf-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pf-list li { display: flex; flex-direction: column; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline a { color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.timeline a:hover { color: var(--accent); }
.tl-paid a { color: var(--green); font-weight: 600; }
.notes-list { list-style: none; margin: 0; padding: 0; }
.notes-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.notes-list li:last-child { border-bottom: 0; }
.note-meta { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
@media (max-width: 560px) {
  .cd-actions .btn:not(.primary) { display: none; }
  .client-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; border-radius: 999px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .client-tabs a { white-space: nowrap; flex: none; }
}

/* Driver's license photo */
.pf-id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.pf-id-thumb img { display: block; width: 96px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.id-form { display: inline-flex; gap: 6px; }
.id-form .btn { cursor: pointer; }
.id-field .error { margin: 0; }
.id-field [hidden], .receipt-preview[hidden] { display: none !important; }
.pf-id form { display: inline-flex; align-items: center; margin: 0; }

/* Menu on the left */
.mtop { display: none; }
.side { position: fixed; top: 0; left: 0; bottom: 0; width: 240px; box-sizing: border-box; z-index: 50; display: flex; flex-direction: column; gap: 14px;
  padding: 18px 12px 14px; background: var(--card); border-top: 5px solid var(--accent); border-right: 1px solid var(--line); overflow-y: auto; }
.side-brand { padding: 0 8px 4px; }
.side-brand .brand-logo { max-width: 100%; max-height: 64px; }
.side-brand .brand-text strong { font-size: 1.05rem; }
.side .book-switch { padding: 0 8px; }
.side .book-switch label { flex-direction: column; align-items: stretch; gap: 4px; }
.side .book-switch select { max-width: none; width: 100%; }
.side nav.side-nav { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px; margin: 0; width: auto; }
.side-link { display: flex; align-items: center; gap: 12px; width: 100%; box-sizing: border-box; padding: 10px 12px; border: 0; border-radius: 10px; background: none;
  color: var(--ink); font: inherit; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.side-link .ic { width: 22px; flex: none; text-align: center; }
.side-link:hover { background: var(--bg); color: var(--accent); }
.side-link.on, .side-link.on:hover { background: var(--accent); color: var(--on-accent); }
.side-link.signout { color: var(--muted); }
.side-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.side-foot form { margin: 0; }
body.has-side { padding-left: 240px; }
.has-side main.wrap { padding-top: 28px; }
.has-side .acting { margin: 0; }
.has-side .hq-bar { left: 252px; }
.side-shade { display: none; }
.side-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
@media (max-width: 900px) {
  body.has-side { padding-left: 0; }
  .mtop { display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 40; padding: 10px 16px;
    background: var(--card); border-top: 5px solid var(--accent); border-bottom: 1px solid var(--line); }
  .mtop .brand { font-size: 1rem; align-items: center; }
  .mtop .brand .dot { margin-top: 0; }
  .side { width: 272px; transform: translateX(-100%); transition: transform .2s ease; }
  .side-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .side-open .side-shade { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .35); }
  .has-side main.wrap { padding-top: 20px; }
  .has-side .hq-bar { left: 12px; }
}
@media print { body.has-side { padding-left: 0; } .side, .mtop, .side-shade { display: none !important; } }

/* Two-step sign-in */
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.dev-list { list-style: none; margin: 0 0 12px; padding: 0; }
.dev-list li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dev-list li:last-child { border-bottom: 0; }

/* Intake question editor */
.q-label { font-weight: 600; }
.q-list { list-style: none; margin: 8px 0 10px; padding: 0; display: grid; gap: 8px; counter-reset: q; }
.q-row { display: grid; grid-template-columns: 26px 1fr auto auto; gap: 8px; align-items: center; counter-increment: q; }
.q-row::before { content: counter(q) "."; color: var(--muted); font-weight: 700; text-align: right; }
.q-row input, .q-row select { margin: 0; }
.q-row select { width: auto; }
.q-btns { display: flex; gap: 4px; }
.q-btns button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; font: inherit; }
.q-btns button:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 560px) {
  .q-row { grid-template-columns: 22px 1fr auto; }
  .q-btns { grid-column: 2 / -1; justify-content: flex-end; }
}
#intake-form { grid-column: 1 / -1; }
#intake-form .intake-setup { max-width: 760px; }

/* Several intake forms */
.form-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; }
.form-box > summary { cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-box[open] > summary { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.form-delete { margin-top: 10px; }
.form-add { display: flex; gap: 8px; flex-wrap: wrap; max-width: 760px; }
.form-add input { flex: 1 1 240px; margin: 0; }
.form-list { list-style: none; margin: 0 0 12px; padding: 0; }
.form-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.form-links { margin-left: auto; display: flex; gap: 12px; }
.intake-setup label.opt { display: flex; flex-direction: row; align-items: center; gap: 10px; font-weight: 600; }
.intake-setup label.opt input { width: auto; margin: 0; flex: none; }
.stack label.basis-opt { display: flex; flex-direction: row; align-items: flex-start; gap: .6rem; font-weight: normal; }
.basis-opt input { width: auto; margin-top: .3rem; flex: none; }
.notes-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.notes-box summary { cursor: pointer; }
.note-edit { margin-top: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.kiosk h2 { margin-top: 8px; }
.kiosk-search input { width: 100%; font-size: 1.4rem; padding: 14px 16px; }
.kiosk-results { display: grid; gap: 10px; margin-top: 14px; }
.kiosk-results .btn { width: 100%; justify-content: center; font-size: 1.2rem; padding: 16px; }
.tile-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.tile-picks legend { grid-column: 1 / -1; }
.people-list li > span:first-child { display: block; white-space: normal; min-width: 0; line-height: 1.5; }
.people-list li > .person-side { flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.person-btns { display: flex; gap: 6px; }
@media (max-width: 700px) { .people-list li > .person-side { flex-direction: row; align-items: center; } }
#taxes .figures { margin-top: 18px; }
.report h3 { margin: 22px 0 8px; }
.callout { background: var(--bg, #f6f4f0); border-left: 4px solid var(--brand, #c62828); padding: 10px 14px; border-radius: 6px; }
.howto { padding-left: 20px; } .howto li { margin-bottom: 8px; }
.mail-to { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mail-to p { margin: 4px 0 0; font-weight: 600; }
table.filing td { vertical-align: top; }
.state-ui { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.state-ui ul { margin: 6px 0; padding-left: 18px; } .state-ui li { margin: 3px 0; }
.inline-note { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; }
.mail-addr { font-weight: 600; margin: 6px 0 0; }
.unpay-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; padding: 10px 12px; background: var(--amber-soft); border: 1px solid var(--amber); border-radius: 10px; }
.unpay-bar form { margin: 0; }
.btn.unpay { background: var(--amber); border-color: var(--amber); color: #fff; font-weight: 700; }
.btn.unpay:hover { filter: brightness(1.08); }
@media (prefers-color-scheme: dark) { .btn.unpay { color: #1a1200; } }

/* Job cards on a client's Jobs & progress tab */
.jcard { scroll-margin-top: 16px; }
.jcard-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.jcard-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.jcard-title h3 { margin: 0; font-size: 1.15rem; }
.jcard-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.jcard-tools form { margin: 0; }
.jseg { display: flex; flex-wrap: wrap; margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; width: fit-content; max-width: 100%; }
.jseg form { margin: 0; display: flex; }
.jseg-btn { border: 0; border-right: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.jseg form:last-child .jseg-btn { border-right: 0; }
.jseg-btn:hover:not(.on) { background: var(--bg); }
.jseg-btn.on { cursor: default; color: #fff; background: var(--muted); }
.jseg-btn.on.in_progress { background: var(--amber); }
.jseg-btn.on.ready { background: var(--green); }
.jseg-btn.on.delivered { background: var(--accent); color: var(--on-accent); }
.jfacts-line { margin: 0 0 8px; }
.jnote { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 4px; }
.jnote input[name=note] { flex: 1 1 260px; min-width: 0; }
.jnote-mail { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; white-space: nowrap; }
.jnote-mail input { width: auto; margin: 0; flex: none; }
.jcard-edit { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.jcard-edit summary, .jupdates-box summary, .jdone summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.jupdates-box { margin-top: 10px; }
.jupdates-box summary { font-weight: 500; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.jdone-list { list-style: none; margin: 10px 0 0; padding: 0; }
.jdone-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.job-mini-tools { display: flex; gap: 6px; grid-column: 1 / -1; margin-top: 4px; }
.job-mini-tools form { margin: 0; }
@media (max-width: 600px) { .jseg { width: 100%; } .jseg form { flex: 1; } .jseg-btn { flex: 1; padding: 8px 6px; font-size: .85rem; } }

/* Job cards, refreshed: status stripe, chips, pill status picker, % switch */
.jcard { position: relative; border-left: 5px solid var(--line); padding-top: 18px; }
.jcard.job-in_progress { border-left-color: var(--amber); }
.jcard.job-ready { border-left-color: var(--green); }
.jcard-title h3 { font-size: 1.2rem; letter-spacing: -.01em; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid transparent; background: var(--bg); color: var(--ink); font: inherit; font-size: .88rem; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.icon-btn:hover { border-color: var(--line); background: var(--card); }
.icon-btn.danger { color: var(--red); background: transparent; }
.icon-btn.danger:hover { background: var(--red-soft, #fdecea); border-color: transparent; }
.jchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.jchip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--bg); font-size: .85rem; color: var(--ink); text-decoration: none; }
.jchip.quiet { color: var(--muted); background: transparent; border: 1px dashed var(--line); }
.jchip.late { background: var(--red-soft, #fdecea); color: var(--red); font-weight: 600; }
.jchip .status { font-size: .72rem; }
.jseg { border: 0; gap: 6px; padding: 4px; background: var(--bg); border-radius: 999px; margin: 0 0 12px; }
.jseg-btn { border: 0 !important; border-radius: 999px; background: transparent; padding: 7px 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s; }
.jseg-btn:hover:not(.on) { background: var(--card); color: var(--ink); }
.jseg-btn .ji { font-size: .95em; line-height: 1; }
.jseg-btn.on { color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.jseg-btn.on.planned { background: var(--muted); }
.jprog { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.jprog .jbar { flex: 1; margin: 0; height: 8px; }
.jpct-num { font-weight: 800; font-size: .9rem; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }
.job-in_progress .jprog .jbar i { background: var(--amber); }
.jchecks { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 2px; }
.jchecks li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.jchecks li:hover { background: var(--bg); }
.jchecks li.done .sname { color: var(--muted); text-decoration: line-through; }
.jchecks .sname { flex: 1; }
.jchecks form { margin: 0; }
.jchecks .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 800; cursor: pointer; padding: 0; }
.jchecks li.done .tick { background: var(--green); border-color: var(--green); }
.jchecks .stage-del button { opacity: 0; transition: opacity .15s; }
.jchecks li:hover .stage-del button, .jchecks .stage-del button:focus { opacity: 1; }
.jnote { background: var(--bg); border-radius: 999px; padding: 5px 5px 5px 14px; gap: 10px; }
.jnote input[name=note] { border: 0; background: transparent; padding: 6px 0; }
.jnote input[name=note]:focus { outline: none; }
.jnote:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.jnote .btn { border-radius: 999px; }
.jobs-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.jobs-bar p { margin: 0; }
.pct-switch { display: flex; align-items: center; gap: 8px; margin: 0; }
.switch { position: relative; width: 40px; height: 22px; border-radius: 999px; border: 0; background: var(--line); cursor: pointer; padding: 0; transition: background .15s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.switch.on { background: var(--green); }
.switch.on .knob { left: 21px; }
@media (max-width: 600px) { .jseg { border-radius: 14px; } .jseg-btn { padding: 7px 8px; } .jnote { border-radius: 14px; padding: 8px; } .jnote input[name=note] { flex-basis: 100%; } }

/* Jobs tab: compact list, one job open at a time */
.jobs-panel { padding-bottom: 8px; }
.jobs-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.jobs-top h2 { margin: 0; display: flex; align-items: baseline; gap: 10px; }
.jobs-top-tools { display: flex; align-items: center; gap: 14px; }
.jobs-empty { margin: 14px 0; }
.jlist { margin: 0; }
.jrow { scroll-margin-top: 16px; }
.jrow-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 10px; background: var(--bg); border-radius: 12px 12px 0 0; }
/* Job buttons: pick which job to see and update */
.jpick { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 14px; }
.jtab { display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); text-decoration: none; max-width: 300px; min-width: 0; line-height: 1.25; }
.jtab:hover { border-color: var(--accent); }
.jtab.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.jtab-text { display: grid; min-width: 0; }
.jtab-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jtab-text small { font-size: .78rem; color: var(--muted); font-weight: 600; }
.jtab.job-in_progress small { color: var(--amber); }
.jtab.job-ready small { color: var(--green); }
.jdot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line); box-shadow: 0 0 0 3px var(--bg); }
.jdot.in_progress { background: var(--amber); }
.jdot.ready { background: var(--green); }
.jrow-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.jrow-title { font-weight: 700; font-size: 1.02rem; }
.jrow-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .86rem; color: var(--muted); }
.jrow-meta .late { color: var(--red); font-weight: 600; }
.jrow-status { font-weight: 600; color: var(--ink); }
.jrow-status.in_progress { color: var(--amber); }
.jrow-status.ready { color: var(--green); }
.jrow-pct { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.jmini { width: 70px; height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; display: block; }
.jmini i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.job-in_progress .jmini i { background: var(--amber); }
.job-ready .jmini i { background: var(--green); }
.jpanel { background: var(--bg); border-radius: 0 0 12px 12px; padding: 4px 18px 16px 30px; margin-bottom: 10px; }
.jstep { margin-top: 14px; }
.jstep-label { font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.jstep-label .muted { font-weight: 400; margin-left: 6px; }
.jupdate .jseg { background: var(--card); margin: 0; }
.jseg-btn input { position: absolute; opacity: 0; pointer-events: none; }
label.jseg-btn { cursor: pointer; font-weight: 600; font-size: .92rem; }
label.jseg-btn:has(input:checked) { color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); background: var(--muted); }
label.jseg-btn.in_progress:has(input:checked) { background: var(--amber); }
label.jseg-btn.ready:has(input:checked) { background: var(--green); }
label.jseg-btn.delivered:has(input:checked) { background: var(--accent); color: var(--on-accent); }
label.jseg-btn:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.jupdate .jchecks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.jupdate .jchecks li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 8px; background: var(--card); }
.jupdate .jchecks label { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; flex: 1; }
.jupdate .jchecks input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.jupdate .jchecks .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line); background: var(--card); flex: none; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: .75rem; font-weight: 800; }
.jupdate .jchecks input:checked + .box { background: var(--green); border-color: var(--green); }
.jupdate .jchecks input:checked + .box::after { content: '\2713'; }
.jupdate .jchecks input:checked ~ .sname { color: var(--muted); text-decoration: line-through; }
.jupdate .jchecks input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.jrange { display: flex; align-items: center; gap: 12px; }
.jrange input { flex: 1; padding: 0; accent-color: var(--accent); background: transparent; border: 0; }
.jrange output { font-weight: 800; min-width: 4ch; text-align: right; }
.jupdate textarea { width: 100%; background: var(--card); }
.jpanel-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; margin-top: 14px; }
.jpanel-save { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.jpanel-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: .9rem; }
.jpanel-links form { margin: 0; }
.link.danger, .jpanel-links .danger { color: var(--red); }
.jdetails { margin-top: 14px; padding: 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.jdetails-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.jdetails-form .wide { grid-column: 1 / -1; }
.jdetails-stages { margin-top: 14px; }
.stage-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; margin: 0; border-bottom: 1px dashed var(--line); }
.jhistory { margin-top: 12px; }
.jhistory summary { cursor: pointer; color: var(--muted); font-size: .88rem; font-weight: 600; }
.jdone { border-top: 1px solid var(--line); margin: 6px -8px 0; padding: 12px 8px 4px; }
.jdone > summary { cursor: pointer; font-weight: 700; }
.jdone .jdone-list li { border-top: 0; border-bottom: 1px solid var(--line); }
.add-job > summary { cursor: pointer; list-style: none; }
.add-job > summary::-webkit-details-marker { display: none; }
.add-job > summary h2 { display: inline; margin: 0; color: var(--accent); }
.add-job[open] > summary { margin-bottom: 12px; }
@media (max-width: 640px) {
  .jrow-head { flex-wrap: wrap; padding: 12px 12px 8px; }
  .jtab { flex: 1 1 100%; max-width: none; }
  .jrow-pct { order: 3; width: 100%; padding-left: 22px; }
  .jmini { flex: 1; width: auto; }
  .jpanel { padding: 4px 12px 14px; }
  .jdetails-form { grid-template-columns: 1fr; }
}
@media (max-width: 640px) { .jupdate .jseg { display: grid; grid-template-columns: 1fr 1fr; border-radius: 14px; width: 100%; } .jupdate label.jseg-btn { justify-content: center; white-space: nowrap; border-radius: 10px; } }
/* No dropdown arrows on the Jobs tab: these open like buttons instead */
.jobs-panel details > summary, .add-job > summary { list-style: none; cursor: pointer; }
.jobs-panel details > summary::-webkit-details-marker, .add-job > summary::-webkit-details-marker { display: none; }
.jdone > summary, .jhistory > summary { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 600; }
.jdone > summary:hover, .jhistory > summary:hover { border-color: var(--accent); color: var(--accent); }
.jdone[open] > summary, .jhistory[open] > summary { border-color: var(--accent); background: var(--accent-soft); }

/* Bank reconciliation */
.stmt-list { list-style: none; margin: 0; padding: 0; }
.stmt-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.stmt-list li:first-child { border-top: 0; }
.stmt-link { display: grid; gap: 2px; color: var(--ink); text-decoration: none; }
.stmt-link:hover strong { color: var(--accent); }
.bank-upload .grid-form { margin-top: 0; }
.filebox input[type=file] { margin: 6px 0 4px; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; width: 100%; background: var(--bg); }
.filebox .small { display: block; font-weight: normal; }
.bal-note { align-self: end; margin: 0 0 6px; }
.amt-in { color: var(--green); font-weight: 700; }
.amt-out { color: var(--ink); }
.map-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.raw-peek summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.raw-peek table { font-size: .82rem; margin-top: 10px; }
.raw-peek tr.is-head td { font-weight: 700; background: var(--bg); }
.bank-stats { grid-template-columns: repeat(4, 1fr); }
.bank-stats .stat strong small { font-size: .9rem; }
.bank-stats .stat .jbar { margin-top: 8px; }
.bank-stats .stat.pos .jbar i { background: var(--green); }
.bal-math { text-transform: none !important; letter-spacing: 0 !important; font-weight: normal !important; font-size: .8rem !important; margin-top: 4px; }
.small-strong { font-size: 1.1rem !important; display: block; }
.big-tag { font-size: .95rem; padding: 6px 12px; font-weight: 700; }
.bal-form summary { cursor: pointer; font-weight: 600; }
.bank-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.blines { display: grid; }
.bline { display: grid; grid-template-columns: 62px minmax(160px, 1.2fr) 110px minmax(300px, 2fr) 22px; gap: 6px 14px; align-items: center; padding: 10px 6px 10px 10px; border-top: 1px solid var(--line); border-left: 4px solid transparent; scroll-margin-top: 20px; }
.bline:first-child { border-top: 0; }
.bline.open { border-left-color: var(--amber); }
.bline.matched { border-left-color: var(--green); }
.bline.ignored { border-left-color: var(--line); }
.bline.ignored .bline-desc, .bline.ignored .bline-amt { color: var(--muted); text-decoration: line-through; }
.bline:target { background: var(--accent-soft); }
.bline-date { font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; }
.bline-desc { min-width: 0; overflow-wrap: anywhere; font-size: .93rem; }
.bline-amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bline-act { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; font-size: .9rem; }
.bline-act .inline { margin: 0; }
.bmatch { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; color: var(--green); font-weight: 700; min-width: 0; }
.bmatch > span:first-child { color: var(--ink); font-weight: normal; }
.bform { display: flex; gap: 6px; align-items: center; margin: 0; flex: 1 1 240px; min-width: 0; }
.bform select, .bform input { flex: 1; min-width: 0; padding: 6px 8px; font-size: .88rem; }
.bform .btn { white-space: nowrap; }
.bline-del { margin: 0; text-align: right; }
.bline-del .link { color: var(--muted); font-size: 1.1rem; text-decoration: none; }
.bline-del .link:hover { color: var(--red); }
.add-line { margin-top: 14px; }
.add-line > summary { list-style: none; cursor: pointer; }
.add-line > summary::-webkit-details-marker { display: none; }
.add-line[open] > summary { margin-bottom: 4px; }
.inline-file { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.inline-file input[type=file] { width: auto; }
@media (max-width: 900px) {
  .bank-stats { grid-template-columns: repeat(2, 1fr); }
  .bline { grid-template-columns: 56px 1fr auto 22px; }
  .bline-act { grid-column: 1 / -1; padding-left: 0; }
  .bline-del { grid-column: 4; grid-row: 1; }
}
.stmt-files .gap, h2.gap, .btn-row.gap { margin-top: 16px; }
.bank-tools .tabs { flex-wrap: wrap; }
.bank-tools .tabs a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem; }
.bank-tools .tabs a.on { background: var(--accent); color: var(--on-accent); }
.map-grid label.opt { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.map-grid label.opt input { width: auto; margin: 0; flex: none; }
.bform input[name=category] { min-width: 150px; }
/* Merchant services */
.m-months td, .m-months th { white-space: nowrap; }
.m-days { margin-top: 12px; }
.m-days > summary, .raw-peek > summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.m-imports { list-style: none; margin: 6px 0 0; padding: 0; }
.m-imports li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.m-imports li > span:first-child { display: grid; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; } .inline-form label { flex: 1 1 200px; } .gap-sm { margin: 8px 0; }
.inline-form[hidden], .m-new[hidden], #bank-new[hidden] { display: none; }

/* Jobs tab fixes: the hidden status radios no longer stretch the page on phones,
   and on a phone the job buttons are one row you swipe through. */
label.jseg-btn { position: relative; }
.jseg-btn input { width: 1px !important; height: 1px; margin: 0; left: 0; top: 0; }
@media (max-width: 640px) {
  .jpick { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; scrollbar-width: none; padding: 2px 2px 6px; margin: 10px -4px 12px; }
  .jpick::-webkit-scrollbar { display: none; }
  .jtab { flex: 0 0 auto; max-width: 70vw; scroll-snap-align: start; padding: 8px 12px; }
}

/* Settings > Home page tiles: show/hide and rename each tile */
.tile-names { border: 0; padding: 0; margin: 0 0 6px; display: grid; gap: 6px; }
.tile-names legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.tile-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tile-show { display: flex; align-items: center; justify-content: center; width: 28px; flex: none; margin: 0; }
.tile-show input { width: 18px; height: 18px; margin: 0; }
.tile-name { flex: 1 1 220px; max-width: 360px; margin: 0; }
.tile-row:has(.tile-show input:not(:checked)) .tile-name { opacity: .55; }
.ov-switch { display: inline-flex; gap: 2px; padding: 3px; margin: 2px 0 10px; background: var(--bg); border-radius: 999px; }
.ov-switch a { padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.ov-switch a:hover { color: var(--ink); }
.ov-switch a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.internal-note { border-left: 4px solid var(--amber); background: var(--amber-soft); }
.internal-note h2 { margin: 0; font-size: 1.05rem; }
.internal-note textarea { background: var(--card); }
.note-flag { cursor: help; font-size: .9em; }
