/* QBO-like look: dark sidebar, white work area, green actions, blue links */
:root {
  --bg: #f4f5f8; --surface: #fff; --surface-2: #f4f5f8; --ink: #393a3d; --ink-2: #6b6c72; --line: #dcdee2;
  --brand: #2ca01c; --brand-ink: #fff; --go: #2ca01c; --go-ink: #fff; --link: #0077c5;
  --side: #21262a; --side-ink: #d4d7dc; --side-hi: #393f45;
  --radius: 4px; --shadow: 0 1px 2px rgb(0 0 0 / .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141618; --surface: #1d2023; --surface-2: #26292d; --ink: #e6e7e9; --ink-2: #a2a5ab; --line: #34383d;
    --link: #4fb3ff; --side: #0f1113; --side-hi: #2a2e33; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #141618; --surface: #1d2023; --surface-2: #26292d; --ink: #e6e7e9; --ink-2: #a2a5ab; --line: #34383d;
  --link: #4fb3ff; --side: #0f1113; --side-hi: #2a2e33; --shadow: none;
}
body { font: 14px/1.45 "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; display: flex; min-height: 100dvh; }

/* sidebar */
.side { width: 220px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; color: #fff; font-size: 17px; }
.logo { width: 42px; height: 42px; display: block; }
.newwrap { position: relative; padding: 4px 14px 14px; }
.newbtn { width: 100%; height: 38px; border-radius: 20px; border: 1px solid #fff; background: transparent; color: #fff; font-weight: 700; font-size: 15px; }
.newbtn:hover { background: rgb(255 255 255 / .08); }
.newmenu { position: absolute; left: 14px; right: 14px; top: 46px; background: var(--surface); color: var(--ink); border-radius: 6px; box-shadow: 0 6px 24px rgb(0 0 0 / .3); z-index: 20; padding: 6px 0; }
.newmenu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 16px; }
.newmenu button:hover { background: var(--surface-2); }
.newmenu { right: auto; width: 600px; display: grid; grid-template-columns: repeat(3, 1fr); padding: 14px 6px; }
.newmenu[hidden] { display: none; }
.nmcol h4 { margin: 0 0 6px; padding: 0 16px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.newmenu .nmcol button { padding: 7px 16px; border-radius: 4px; }
.dlg .head h3 { flex: 1; }
.bigamt { text-align: right; line-height: 1.1; }
.bigamt b { display: block; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dlg .row { display: flex; gap: 12px; flex-wrap: wrap; }
.dlg .row > .field { flex: 1 1 200px; }
#tabs { display: grid; }
#tabs a { display: flex; align-items: center; gap: 12px; padding: 10px 18px; color: var(--side-ink); text-decoration: none; border-left: 4px solid transparent; font-weight: 600; }
#tabs a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#tabs a:hover { background: var(--side-hi); color: #fff; }
#tabs a.on { background: var(--side-hi); color: #fff; border-left-color: var(--brand); }

/* top bar */
.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 8px 20px; min-height: 52px; }
.co { border: 0; background: transparent; font-weight: 700; font-size: 16px; color: var(--ink); padding: 4px; }
.topbar .btn-ghost { color: var(--link); min-height: 34px; font-weight: 600; }
.grow { flex: 1; }

main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 18px 24px 40px; display: grid; gap: 14px; }
.ptitle h1 { font-size: 24px; font-weight: 700; margin: 4px 0 0; }
.card { border-radius: var(--radius); }
.pad { padding: 16px; }
.center { display: grid; place-items: center; }
.login { max-width: 400px; margin: 40px auto; padding: 24px; display: grid; gap: 12px; }
.login h2 { margin: 0; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 18px; margin: 0; font-weight: 600; }
.muted { color: var(--ink-2); }

/* controls */
.bar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.bar .field { min-width: 140px; }
.bar .grow { flex: 1; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, select.input { min-height: 36px; padding: 6px 10px; border-radius: 4px; border: 1px solid #babec5; background: var(--surface); }
.btn { min-height: 36px; padding: 0 16px; border-radius: 20px; border: 1px solid #8d9096; background: var(--surface); font-weight: 600; color: var(--ink); }
.btn:hover { background: var(--surface-2); }
.btn-go, .btn-primary { background: var(--go); color: #fff; border-color: var(--go); }
.btn-go:hover, .btn-primary:hover { background: #108000; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-stop { background: #d52b1e; color: #fff; border-color: #d52b1e; }
a.link, .linkbtn { color: var(--link); font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; text-decoration: none; }
a.link:hover, .linkbtn:hover { text-decoration: underline; }
.sep { color: var(--line); margin: 0 4px; }

/* report tabs */
.seg { display: flex; gap: 22px; border-bottom: 1px solid var(--line); width: 100%; overflow-x: auto; }
.seg button { white-space: nowrap; }
.seg button { border: 0; background: none; padding: 8px 2px 10px; font-weight: 600; color: var(--ink-2); border-bottom: 4px solid transparent; margin-bottom: -1px; }
.seg button.on { color: var(--ink); border-bottom-color: var(--brand); }

/* report sheet */
.rhead { text-align: center; padding: 26px 16px 18px; }
.rco { font-size: 15px; color: var(--ink-2); }
.rhead h2 { font-size: 22px; font-weight: 700; margin: 2px 0; }
.rper { font-size: 14px; color: var(--ink-2); }
#rpt.sheet { max-width: 900px; width: 100%; margin: 0 auto; }
table.rpt { width: 100%; border-collapse: collapse; }
.rpt th, .rpt td { padding: 6px 14px; text-align: left; vertical-align: top; }
.rpt th { font-size: 12px; color: var(--ink-2); font-weight: 700; letter-spacing: .03em; border-bottom: 1px solid var(--ink-2); border-top: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; }
.rpt td { border-bottom: 1px solid transparent; }
.rpt td.n, .rpt th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rpt tr.sec td { font-weight: 700; padding-top: 12px; }
.rpt tr.tot td { font-weight: 700; border-top: 1px solid var(--line); }
.rpt tr.grand td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
.rpt tr.parent td:first-child { font-weight: 600; }
.rpt tr.parent.closed td { font-weight: 700; }
.rpt tr.click { cursor: pointer; }
.rpt tr.click:hover td { background: #eef7fd; }
.rpt tr.click:hover .an { color: var(--link); text-decoration: underline; }
@media (prefers-color-scheme: dark) { .rpt tr.click:hover td { background: var(--surface-2); } }
.rpt .neg { color: inherit; }
.rpt .void td { text-decoration: line-through; color: var(--ink-2); }
.caret { border: 0; background: none; width: 18px; padding: 0; margin-right: 4px; color: var(--ink-2); font-size: 12px; cursor: pointer; }
.nocaret { display: inline-block; width: 22px; }
.tw { overflow-x: auto; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 3px; background: var(--surface-2); color: var(--ink-2); }
.tag.void { background: #fde7e5; color: #8c1d16; }
.check { font-size: 13px; padding: 8px 12px; margin: 0 16px 12px; }
.acct-type { font-size: 13px; color: var(--ink-2); }

/* journal entry dialog */
dialog { border: 0; border-radius: 6px; padding: 0; width: min(1040px, calc(100% - 24px)); background: var(--surface); color: var(--ink); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgb(0 0 0 / .5); }
.dlg { padding: 20px 24px; display: grid; gap: 14px; }
.dlg .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin: -4px -24px 0; padding-left: 24px; padding-right: 16px; }
.lines { width: 100%; border-collapse: collapse; }
.lines th { font-size: 12px; color: var(--ink-2); text-align: left; padding: 6px; border-bottom: 1px solid var(--ink-2); letter-spacing: .03em; }
.lines td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.lines td.ac { min-width: 300px; width: 38%; }
.lines td.pj { width: 170px; }
.lines .input { min-height: 34px; padding: 5px 8px; font-size: 14px; border-color: var(--line); }
.lines .input:focus { border-color: var(--go); outline: 2px solid rgb(44 160 28 / .25); }
.lines td.amt { width: 120px; }
.lines td.amt .input { text-align: right; font-variant-numeric: tabular-nums; }
.lines td.x { width: 76px; white-space: nowrap; }
.lines tfoot td { font-weight: 700; padding-top: 10px; border: 0; }
.off { color: #d52b1e; }
.even { color: var(--go); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.actions .left { margin-right: auto; }
.banner { border-radius: 4px; }
.toast { bottom: 24px; border-radius: 6px; }

/* phones: sidebar becomes a top strip */
@media (max-width: 760px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { padding: 10px 14px; }
  .newwrap { padding: 0 10px; margin-left: auto; }
  .newbtn { width: auto; padding: 0 16px; height: 34px; }
  .newmenu { left: auto; right: 10px; width: min(92vw, 340px); top: 40px; grid-template-columns: 1fr 1fr; max-height: 75vh; overflow-y: auto; }
  .bigamt b { font-size: 19px; }
  #tabs { display: flex; width: 100%; overflow-x: auto; }
  #tabs a { border-left: 0; border-bottom: 3px solid transparent; padding: 10px 12px; white-space: nowrap; }
  #tabs a.on { border-bottom-color: var(--brand); }
  #tabs a svg { display: none; }
  main { padding: 14px 12px 30px; }
  .rpt th, .rpt td { padding: 6px 8px; }
  .lines td.memo, .lines th.memo { display: none; }
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tfoot { display: block; }
  .lines tr { display: grid; grid-template-columns: 1fr 1fr 40px; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .lines td { padding: 0; border: 0; }
  .lines td.ac { grid-column: 1 / -1; min-width: 0; width: auto; }
  .lines td.amt { width: auto; }
  .lines td.pj { grid-column: 1 / 3; width: auto; }
  .lines td.desc { grid-column: 1 / -1; }
  .lines tfoot td.desc { display: none; }
  .lines tfoot tr { grid-template-columns: auto 1fr 1fr; align-items: center; border: 0; }
  .lines tfoot td:last-child { grid-column: 1 / -1; }
}
@media print {
  .side, .topbar, .bar, .noprint, .ptitle, .seg { display: none !important; }
  body { display: block; }
  main { max-width: none; padding: 0; }
  .card { border: 0; box-shadow: none; }
  .rpt th { position: static; }
  .caret { visibility: hidden; }
}

/* page tools, tiles, chips */
.ptitle { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ptools { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { text-align: left; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: 4px; padding: 12px 14px; display: grid; gap: 4px; color: var(--ink); }
.tile.on { border-top-color: var(--brand); box-shadow: 0 2px 8px rgb(0 0 0 / .1); }
.tile .tn { font-weight: 700; font-size: 15px; }
.tile .tb { display: flex; justify-content: space-between; gap: 8px; }
.tile .tcount { margin-top: 4px; font-weight: 700; color: var(--link); }
.tile .tcount.done { color: var(--ink-2); font-weight: 600; }
.warnc { color: #b25e00; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: #e3f1fb; color: #005a94; margin: 3px 4px 0 0; }
.chip.rc { background: #e6f4e2; color: #1d6b12; }
.empty { display: grid; gap: 8px; }
.empty h2 { font-size: 18px; }
.empty p { margin: 0; }
.nowrap { white-space: nowrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { padding: 12px 16px; }
.kpi .kv { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* bank review table */
.rpt.review td { vertical-align: middle; border-bottom: 1px solid var(--line); }
.rpt.review .input { min-height: 32px; padding: 4px 8px; font-size: 13px; width: 100%; min-width: 140px; }
.rpt.review td.desc { max-width: 260px; font-size: 13px; }
.rpt.review .btn.small { min-height: 30px; padding: 0 14px; font-size: 13px; }
.rpt.review .more { font-size: 12px; margin-top: 4px; }
.btn.small { min-height: 30px; padding: 0 12px; font-size: 13px; }
@media (max-width: 760px) {
  .rpt.review thead { display: none; }
  .rpt.review, .rpt.review tbody, .rpt.review tr, .rpt.review td { display: block; width: 100%; }
  .rpt.review tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .rpt.review td { border: 0; padding: 3px 0; text-align: left !important; max-width: none; }
}
main > * { min-width: 0; }
.chip { white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.rpt.review .input.cat { min-width: 190px; }
.rpt.review .input.vend { min-width: 120px; }
.rpt.review .input.proj { min-width: 120px; }
.rpt.review th, .rpt.review td { padding-left: 8px; padding-right: 8px; }
.mlabel { display: none; }
@media (max-width: 760px) { .mlabel { display: inline; color: var(--ink-2); } .rpt.review td:empty { display: none; } }
.rpt.review td.desc { min-width: 150px; max-width: 220px; }
.seg .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }

.rpt.review td.act { width: 120px; white-space: normal; }
.rpt.review td.act .more { line-height: 1.7; }
.rpt.review td.act .more .sep { margin: 0 2px; }

/* ---- sharper look: darker text, crisp 1px lines, no blur ---- */
:root { --ink: #1f2023; --ink-2: #4f535a; --line: #d3d6db; --shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ink: #f1f2f4; --ink-2: #b4b8bf; --line: #3a3f45; } }
:root[data-theme="dark"] { --ink: #f1f2f4; --ink-2: #b4b8bf; --line: #3a3f45; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body { font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif; letter-spacing: 0.005em; }
.card { border: 1px solid var(--line); box-shadow: none; }
.topbar { box-shadow: 0 1px 0 var(--line); border-bottom: 0; }
.rpt td { border-bottom: 1px solid #edeff2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rpt td { border-bottom-color: #2a2e33; } }
.rpt th { color: #3c3f45; border-bottom: 1px solid #8d9096; }
.rpt tr.sec td, .rpt tr.tot td, .rpt tr.grand td { border-bottom-color: transparent; }
.rpt tr.tot td { border-top: 1px solid #b9bdc3; }
.btn { border-color: #6b6e75; }
.input, select.input { border-color: #a9adb4; }
.input:focus, select.input:focus { border-color: var(--brand); outline: 2px solid rgb(44 160 28 / .22); outline-offset: 0; }
.ptitle h1 { letter-spacing: -0.01em; }
.tile { border-color: var(--line); }
.tile.on { box-shadow: 0 0 0 1px var(--brand); }
.loginbrand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; color: var(--ink); }
.loginbrand img { width: 60px; height: 60px; }
/* payroll */
.rpt.pay .input.sm, .mini .input.sm, #lit .input.sm { width: 90px; min-height: 30px; padding: 3px 6px; text-align: right; }
#lit .input.ld { min-height: 30px; padding: 3px 6px; }
.brk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; padding: 6px 4px 10px; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini th { text-align: left; font-size: 12px; color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 3px 4px; }
.mini td { padding: 3px 4px; border-bottom: 1px solid #f0f1f3; }
.mini td.n { text-align: right; font-variant-numeric: tabular-nums; }
.mini tr.tot td { font-weight: 700; border-top: 1px solid #b9bdc3; }
.brkrow > td { background: var(--surface-2); }
.tag.warn { background: #fff1d6; color: #7a4a00; }
.tag.ok { background: #e3f4df; color: #1d6b12; }
h4 { margin: 6px 0 0; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.fedgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 10px; }
.fedt .input.sm { width: 100%; text-align: right; }
details summary { cursor: pointer; margin: 4px 0; }
small.muted { font-size: 12px; }

/* ---------------- Home */
.htiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.htile { display: grid; gap: 2px; padding: 14px 16px; text-decoration: none; color: var(--ink); border-top: 3px solid var(--go); transition: box-shadow .15s; }
.htile:hover { box-shadow: 0 4px 14px rgb(0 0 0 / .08); }
.htile span { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.htile b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.htile small { color: var(--ink-2); font-size: 12px; }
.htile.warn { border-top-color: #e8a31a; }
.hgrid { display: grid; gap: 16px; align-items: start; }
.hseg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.hcol { display: grid; gap: 16px; align-content: start; min-width: 0; }
.hcard { padding: 16px 18px 18px; display: grid; gap: 14px; }
.hcard header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.hcard h2 { margin: 0; font-size: 17px; }
.hrow { display: grid; gap: 5px; }
.hl { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.hl span { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hl em { font-style: normal; font-weight: 400; color: var(--ink-2); font-size: 13px; }
a.hn { color: var(--ink); text-decoration: none; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.hn:hover { color: var(--go); text-decoration: underline; }
.hs { font-size: 12px; color: var(--ink-2); }
.hbar { height: 12px; border-radius: 6px; background: #e3e6ea; overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 6px; background: var(--go); }
.hbar.near i { background: #e8a31a; } .hbar.over i { background: #d52b1e; }
.hbar.loan i { background: #0077c5; }
.hbar.eq i { background: #2ca01c; } .hbar.eq { background: #c9d0d8; }
.hbar.owe { background: #e3e6ea; } .hbar.owe i { background: #4a4f57; }
.hbar.in i { background: #2ca01c; } .hbar.out i { background: #8d9096; }
.htab { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.htab th { font-size: 11px; color: var(--ink-2); text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.htab td { padding: 7px 6px; border-bottom: 1px solid var(--line); }
.htab .n { text-align: right; white-space: nowrap; } .htab tr.tot td { font-weight: 800; border-bottom: 0; border-top: 2px solid var(--ink); }
.htab td:first-child { max-width: 0; width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos { color: #1d7a10; } .neg { color: #c4271b; }
.hpl { display: grid; gap: 12px; }
.hpl > div { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; }
.hpl > div .hbar, .hpl > div small { grid-column: 1 / -1; } .hpl small { color: var(--ink-2); font-size: 12px; }
.hpl b { font-variant-numeric: tabular-nums; font-size: 17px; }
.hpl .hnet { border-top: 2px solid var(--ink); padding-top: 10px; } .hpl .hnet b { font-size: 22px; font-weight: 800; }
.hfoot { margin: 0; }
.hw { min-width: 0; } .hw.hwide { grid-column: 1 / -1; } .hw .htiles { margin-bottom: 0; }
.htab.hsale td { padding: 5px 6px; } .htab.hsale td:first-child { width: auto; max-width: none; white-space: normal; }
.htab.hsale tr.hgap td { padding: 4px 0; border: 0; }
.hgrid.arranging .hw { position: relative; border: 2px dashed #b8bec6; border-radius: 10px; padding: 8px; background: var(--surface-2); cursor: grab; }
.hgrid.arranging .hw > :not(.hwbar) { pointer-events: none; max-height: 220px; overflow: hidden; opacity: .75; }
.hgrid.arranging .hw.off > :not(.hwbar) { opacity: .3; }
.hgrid.arranging .hw.drag { opacity: .4; } .hgrid.arranging .hw.dropto { border-color: var(--go); background: #eaf6e7; }
.hwbar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.hwbar b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hwbar .grip { color: var(--ink-2); letter-spacing: -2px; font-weight: 800; }
.hwbar .btn.sm { padding: 4px 10px; min-height: 32px; }
@media (max-width: 1100px) { .htiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .htiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .htile b { font-size: 18px; } }

/* ---------------- Upload bill */
.newmenu .nmcol button.nmhi { color: var(--go); font-weight: 700; }
.drop { display: grid; justify-items: center; gap: 6px; padding: 34px 20px; border: 2px dashed #b8bec6; border-radius: 8px; cursor: pointer; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; }
.drop svg { width: 34px; height: 34px; fill: none; stroke: var(--go); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drop:hover, .drop.over { border-color: var(--go); background: #eef8ec; }
.drop.busy { opacity: .55; pointer-events: none; }
.spinner.sm { display: inline-block; width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; margin-right: 6px; }
.aibox { font-size: 14px; display: grid; gap: 4px; }
dialog:has(.withdoc) { width: min(1500px, calc(100% - 24px)); }
.dlg.withdoc { display: grid; grid-template-columns: minmax(300px, 38%) 1fr; gap: 0; padding: 0; }
.dlg.withdoc .dmain { padding: 20px 24px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.docprev { background: #525659; min-height: 70vh; position: sticky; top: 0; max-height: calc(100dvh - 24px); overflow: auto; }
.docprev iframe { width: 100%; height: calc(100dvh - 30px); border: 0; display: block; background: #fff; }
.docprev img { width: 100%; display: block; }
.docprev .pad { color: #ddd; }
@media (max-width: 900px) {
  .dlg.withdoc { grid-template-columns: 1fr; }
  .docprev { position: static; min-height: 0; max-height: 46vh; }
  .docprev iframe { height: 46vh; }
}
.withdoc .lines td.ac { min-width: 200px; width: 34%; }
.withdoc .lines td.desc { min-width: 150px; }

/* ---------------- App feel: no bouncing, no zooming, no sideways drift.
   The page itself never scrolls; only the content area does, with the menu and header fixed. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { height: 100dvh; min-height: 0; touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.side { overscroll-behavior: contain; }
.shell { height: 100dvh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.topbar { position: sticky; top: 0; z-index: 15; }
dialog, .newmenu, .docprev { overscroll-behavior: contain; }
.tw { overscroll-behavior-x: contain; overscroll-behavior-y: auto; }
.side, .topbar, .seg, .btn, .newbtn, #tabs a, .htile { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#tabs { overscroll-behavior-x: contain; scrollbar-width: none; } #tabs::-webkit-scrollbar { display: none; }
@media (max-width: 760px) {
  .shell { height: auto; flex: 1; min-height: 0; padding-bottom: env(safe-area-inset-bottom); }
  .side { flex: none; overflow: visible; padding-top: env(safe-area-inset-top); }
  .topbar { position: static; }
  /* phones zoom into any box with text under 16px when you tap it; keep fields at 16px */
  input.input, select.input, textarea.input, .lines .input, .rpt.review .input, .input.sm { font-size: 16px; }
}
@media print {
  html, body { height: auto; overflow: visible; }
  .shell { height: auto; overflow: visible; }
}
.lotdot { color: var(--ink-2); font-weight: 400; }
.aligntab td { padding: 4px 8px; } .aligntab .input.sm { width: 90px; text-align: right; }

/* sortable list headers */
.rpt th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.rpt th.sortable:hover { color: var(--ink); }
.rpt th.sortable::after { content: "\2195"; opacity: .25; margin-left: 4px; font-weight: 400; }
.rpt th.sortable[aria-sort="ascending"]::after { content: "\25B2"; opacity: .8; font-size: 9px; }
.rpt th.sortable[aria-sort="descending"]::after { content: "\25BC"; opacity: .8; font-size: 9px; }
.rpt td.ck, .rpt th.nosortcol { width: 34px; } .rpt td.ck input, .rpt th.nosortcol input { width: 18px; height: 18px; }
.ptsel { border-bottom: 1px solid var(--line); }

.hnav { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 4px; } .hnav .btn.sm { min-height: 28px; padding: 0 8px; font-size: 16px; }

/* Home tabs + Projects for sale (stats, one bar per project, details folded away) */
.hsegtabs { margin: -4px 0 16px; }
.srow { display: grid; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.srow:last-of-type { border-bottom: 0; padding-bottom: 0; }
.sstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 8px; }
.sstat { display: grid; gap: 1px; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; }
.sstat span { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.sstat b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sstat small { font-size: 12px; color: var(--ink-2); }
.sbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: #e3e6ea; gap: 2px; }
.sbar i { display: block; height: 100%; min-width: 3px; }
.skey { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); }
.skey span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.skey b { color: var(--ink); font-variant-numeric: tabular-nums; }
.skey i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.sl { background: #7b8794; } .sb { background: #0077c5; } .sf { background: #e8a31a; } .ss { background: #9b59b6; } .sp { background: #2ca01c; }
.sdet summary { cursor: pointer; font-size: 13px; color: var(--link); font-weight: 600; list-style: none; padding: 2px 0; }
.sdet summary::-webkit-details-marker { display: none; }
.sdet summary::before { content: "▸ "; } .sdet[open] summary::before { content: "▾ "; }
.sdet[open] summary { margin-bottom: 6px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sbar { background: #34383d; } }
:root[data-theme="dark"] .sbar { background: #34383d; }
@media (max-width: 760px) { .sstat { padding: 7px 8px; } .sstat b { font-size: 17px; } .sstat span { font-size: 10px; letter-spacing: .02em; } .sstat small { font-size: 11px; } }

/* Banking: account switcher (two rows of chips: bank accounts, cards), then a summary strip for the picked account */
.aswitch { padding: 10px 14px; display: grid; gap: 8px; }
.arow { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start; }
.arow + .arow { border-top: 1px solid var(--line); padding-top: 8px; }
.al { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); padding-top: 9px; }
.achips { display: flex; flex-wrap: wrap; gap: 6px; }
.achip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 18px; padding: 6px 8px 6px 14px; font-weight: 600; font-size: 14px; max-width: 100%; cursor: pointer; }
.achip:hover { border-color: var(--ink-2); }
.achip .an { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.achip .ab { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #e8a31a; color: #fff; font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }
.achip .ab.ok { background: transparent; color: var(--ink-2); font-weight: 700; }
.achip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.achip.on .ab.ok { color: var(--surface); }
.ahead { padding: 14px 18px; display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; justify-content: space-between; }
.ahead .aid { min-width: 0; flex: 1 1 320px; } .ahead h2 { margin: 0 0 2px; font-size: 20px; }
.afs { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.af { display: grid; gap: 1px; } .af span { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.af b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .arow { grid-template-columns: 1fr; gap: 4px; } .al { padding-top: 0; } .achip { font-size: 13px; padding: 5px 6px 5px 11px; } .af b { font-size: 16px; } .afs { gap: 8px 18px; } }
.alinks { margin-top: 4px; }
.agroups { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-start; }
.agroup { display: grid; gap: 4px; padding: 6px 8px 8px; border: 1px dashed var(--line); border-radius: 12px; }
.agn { font-size: 11px; font-weight: 700; color: var(--ink-2); padding-left: 4px; }
.af small { font-size: 11px; color: var(--ink-2); }
.ashare { margin-top: 4px; color: var(--ink-2); }
.mcell .minfo { display: grid; gap: 2px; padding: 6px 10px; border-left: 3px solid var(--go); background: var(--surface-2); border-radius: 4px; }
.mcell .mfields { display: grid; gap: 6px; }
.chip.ok { background: #e3f4df; color: #1d6b12; }

/* P&L: projects & properties picker */
.tagpick { position: relative; min-width: 220px; }
.tpbtn { text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.tpbtn::after { content: " ▾"; color: var(--ink-2); }
.tppop { position: absolute; z-index: 30; top: 100%; left: 0; margin-top: 4px; width: 320px; max-width: 90vw; padding: 10px; display: grid; gap: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .15); }
.tplist { max-height: 340px; overflow-y: auto; display: grid; }
.tpg { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); padding: 8px 4px 2px; }
.tpi { display: flex; gap: 8px; align-items: center; padding: 5px 4px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.tpi:hover { background: var(--surface-2); } .tpi.unit { padding-left: 24px; font-size: 13px; }
.tpact { display: flex; gap: 8px; }
.hmode { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.hmode button { border: 0; background: none; padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--ink-2); min-height: 26px; }
.hmode button.on { background: var(--brand); color: #fff; }
.hcard > p.hs { margin: 8px 0; }
#rentun .caret { display: inline-block; width: 1em; }
.rentun { padding: 4px 0 8px; max-height: 360px; overflow: auto; }
.rentun .hun td { padding: 5px 6px; font-size: 13px; color: var(--ink); }
.rentun .hun td:first-child { white-space: nowrap; color: var(--ink-2); }
.rentun .hun { table-layout: auto; width: 100%; }
.rentun .hun td:nth-child(2), .rentun .hs { white-space: normal; overflow: visible; text-overflow: clip; }
.rentun .hun td:first-child { width: 1%; max-width: none; overflow: visible; }
/* projects for sale: compact rows, tap to open the breakdown */
details.srow { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
details.srow:last-of-type { border-bottom: 0; }
details.srow > summary { list-style: none; cursor: pointer; display: grid; gap: 6px; }
details.srow > summary::-webkit-details-marker { display: none; }
details.srow > summary .hn::before { content: "▸ "; color: var(--ink-2); font-size: 12px; }
details.srow[open] > summary .hn::before { content: "▾ "; }
details.srow .sbar { height: 10px; border-radius: 5px; }
.sprof { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sprof em { font-style: normal; font-weight: 400; font-size: 12px; color: var(--ink-2); }
.sdetail { padding-top: 10px; }
.hcard > .skey { margin: 10px 0 2px; }
/* a grid's children default to min-width:auto, so a wide table stretched the whole page past the screen (vendor page on
   phones) instead of scrolling inside its own box. Let them shrink so .tw scrolls sideways. */
[style*="display:grid"] > *, .hgrid > *, .hcol > * { min-width: 0; }
.reg td.clr, .reg th.clr { text-align: center; font-weight: 700; color: var(--ink-2); width: 34px; }
.reg td:nth-child(3) { min-width: 200px; }
/* reconcile */
.rckpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kv.ok { color: var(--go); } .kv.off { color: var(--stop); }
.rctab td.clr, .rctab th.clr { width: 36px; text-align: center; }
.rctab tr.on td { background: color-mix(in srgb, var(--go) 7%, transparent); }

/* bank review: column picker + resizable columns */
.colpick { position: relative; margin-left: auto; }
.colpick > summary { list-style: none; cursor: pointer; }
.colpick > summary::-webkit-details-marker { display: none; }
.colpick .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 10px 14px; width: 240px; display: grid; gap: 6px; }
.colpick .menu label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.rpt.review th { position: relative; }
.rpt.review th .rz { position: absolute; top: 0; right: -4px; width: 9px; height: 100%; cursor: col-resize; z-index: 2; touch-action: none; }
.rpt.review th .rz::after { content: ""; position: absolute; left: 4px; top: 25%; height: 50%; border-left: 1px solid var(--line); }
.rpt.review th:hover .rz::after, .rpt.review.resizing .rz::after { border-left: 2px solid var(--accent, #2a6); }
.rpt.review.resizing { user-select: none; cursor: col-resize; }
.rpt.review.sized { table-layout: fixed; }
.rpt.review.sized th { box-sizing: border-box; }
.rpt.review.sized td, .rpt.review.sized th { overflow: hidden; overflow-wrap: anywhere; }
.rpt.review.sized td.desc { min-width: 0; max-width: none; }
.rpt.review.sized .input, .rpt.review.sized .input.cat, .rpt.review.sized .input.vend, .rpt.review.sized .input.proj { min-width: 0; }
.rpt.review.sized td.act { width: auto; }
.rpt.review.hide-date .c-date, .rpt.review.hide-desc .c-desc, .rpt.review.hide-payee .c-payee, .rpt.review.hide-proj .c-proj,
.rpt.review.hide-spent .c-spent, .rpt.review.hide-recv .c-recv,
.rpt.review.hide-payee .mfields .vend, .rpt.review.hide-proj .mfields .proj { display: none; }
@media (max-width: 760px) {
  .rpt.review.sized { width: 100% !important; table-layout: auto; }
  .rpt.review th .rz, .colpick { display: none; }
}

/* tax calendar popup */
dialog.taxdlg { width: min(900px, calc(100% - 24px)); }
.taxpop tr.tlate td:first-child { box-shadow: inset 3px 0 0 var(--stop, #c33); }
.taxpop tr.tsoon td:first-child { box-shadow: inset 3px 0 0 #d99a00; }
.taxpop tr.tdone { opacity: .55; }
.taxpop td { vertical-align: top; }

/* payroll tax liabilities + taxes coming out (Banking) */
.tqhead, .tohead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tqhead h2 { margin: 0; }
details.qdet > summary { cursor: pointer; list-style: revert; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px 24px; padding: 0 16px 12px; }
.qgrid h3 { margin: 14px 0 6px; font-size: 15px; }
.qgrid tr.sub td { padding-left: 24px; color: var(--muted); font-size: 13px; }
.taxout { border-left: 3px solid #d99a00; }
.taxout .afs { display: flex; gap: 24px; }

/* custom reports */
.crbuild { display: grid; gap: 4px; }
.crbuild .bar { margin: 0; }
.crsaved { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.crsaved .achip { padding: 5px 14px; }
.crquick { display: flex; flex-wrap: wrap; gap: 6px; }
.rpt.crdet td.crmemo { max-width: 340px; overflow-wrap: anywhere; }
.rpt.crsum td.click:hover { text-decoration: underline; cursor: pointer; }
.rpt tr.tot.sub td { font-weight: 600; border-top: 1px solid var(--line); }

/* Customize on the P&L and balance sheet */
#czbtn.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
#czbox { max-width: 900px; width: 100%; margin: 0 auto; }
#czbox:empty { display: none; }
#rpt.sheet:has(table.czt.wide) { max-width: none; }
.czt th.n { font-size: 11px; letter-spacing: .04em; white-space: normal; min-width: 92px; vertical-align: bottom; }
.czt.wide td:first-child { min-width: 220px; }
.czt tr.czclosed td { font-weight: 700; }
@media print { .czt.wide { font-size: 10px; } .czt.wide td, .czt.wide th { padding: 2px 5px; } }
.taxpop tr.tpay td { background: var(--bg, #f4f5f8); }
.tpaybox { display: grid; gap: 8px; padding: 4px 0; }
.tpaybox .bar { margin: 0; align-items: end; }
