@font-face { font-family: 'GnuMICR'; src: url('vendor/GnuMICR.ttf') format('truetype'); font-display: block; }
:root { --text: #1c2024; --muted: #5f6b76; --line: #d9dde1; --line2: #eceef0; --blue: #1d4f91; --red: #b42318; --green: #17713a; --amber: #8a5a00; --radius: 8px; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--text); background: #fff; }
[hidden] { display: none !important; }
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.12rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .error { color: var(--red); min-height: 1.2em; }
.neg { color: var(--red); } .pos { color: var(--green); } .warn { color: var(--amber); } .blue { color: var(--blue); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; padding: 30px 26px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 12px; }
.login-card h1 { margin: 0; font-size: 1.6rem; }
.login-card p { margin: 0; }
.login-name { font-weight: 600; color: var(--blue); letter-spacing: .02em; }

/* Shell: QuickBooks-style menu on the left (always shown from 769 px up; a Menu button opens it on phones) */
:root { --side-w: 236px; --side-bg: #f4f6f9; }
.sidenav { position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); z-index: 30; background: var(--side-bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 10px; border-bottom: 1px solid var(--line); }
.brand { text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.08rem; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-weight: 500; color: var(--muted); font-size: .92rem; }
.side-brand { flex-direction: column; gap: 0; }
.side-brand span:first-child { white-space: normal; line-height: 1.25; }
.side-x { display: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: .88rem; padding: 6px 10px; cursor: pointer; color: var(--text); }
.sidelinks { flex: 1; overflow-y: auto; padding: 6px 0 10px; scrollbar-width: thin; }
.sidelinks > a, .side-sub a { display: block; color: #2e3740; text-decoration: none; padding: 6px 16px 6px 13px; border-left: 3px solid transparent; font-size: .95rem; line-height: 1.3; }
.sidelinks > a:hover, .side-sub a:hover { background: #e9edf2; color: var(--text); }
.sidelinks > a.active { background: #e2eaf5; color: var(--blue); border-left-color: var(--blue); font-weight: 600; }
.side-group { margin: 10px 16px 2px; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7682; }
.side-sub { padding: 0 0 4px; }
.side-sub a { padding: 5px 16px 5px 29px; font-size: .88rem; color: var(--muted); }
.side-sub a.active { color: var(--blue); font-weight: 600; }
.side-view { margin: 0 12px 6px 16px; }
.side-view-l { display: block; font-size: .76rem; color: var(--muted); margin: 0 0 4px; }
.side-view-b { display: flex; border: 1px solid #c6ccd3; border-radius: 7px; overflow: hidden; background: #fff; }
.side-view-b button { flex: 1; min-width: 0; background: #fff; border: 0; border-right: 1px solid #c6ccd3; padding: 7px 2px; font: inherit; font-size: .8rem; color: var(--text); cursor: pointer; white-space: nowrap; }
.side-view-b button:last-child { border-right: 0; }
.side-view-b button.active { background: var(--blue); color: #fff; font-weight: 600; }
.side-foot { border-top: 1px solid var(--line); padding: 8px 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.who { color: var(--muted); font-size: .88rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar { display: none; }
.side-scrim { position: fixed; inset: 0; background: rgba(20, 28, 38, .35); z-index: 25; }
#app { padding-left: var(--side-w); }
main { max-width: 1400px; margin: 0 auto; padding: 20px 24px 80px; outline: none; }
@media (max-width: 768px) {
  #app { padding-left: 0; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .navtoggle { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font: inherit; font-size: .95rem; color: var(--text); cursor: pointer; flex: none; }
  .burger { display: inline-grid; gap: 3px; width: 18px; }
  .burger i { display: block; height: 2px; background: var(--text); border-radius: 1px; }
  .sidenav { width: min(300px, 86vw); transform: translateX(-102%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  body.nav-open .sidenav { transform: none; visibility: visible; transition: transform .2s ease; box-shadow: 0 0 24px rgba(0, 0, 0, .18); }
  .side-x { display: inline-block; }
  .sidelinks > a, .side-sub a { padding-top: 10px; padding-bottom: 10px; }
}
@media (min-width: 769px) { .side-scrim { display: none !important; } }

/* Blocks */
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; background: #fff; }
.card h2 { margin-bottom: .6em; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 2px 0 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .k { color: var(--muted); font-size: .85rem; }
.kpi .v { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .s { font-size: .85rem; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; }
.span2 { grid-column: span 2; } .spanall { grid-column: 1 / -1; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a, .tabs button { background: none; border: 0; font: inherit; color: var(--muted); padding: 9px 12px; border-bottom: 2px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.tabs .active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* Forms */
label { min-width: 0; display: grid; gap: 4px; font-weight: 600; font-size: .88rem; color: #39424b; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: .95rem; color: var(--text); }
label.check input { width: 20px; height: 20px; min-height: 0; }
input, select, textarea { min-width: 0; max-width: 100%; font: inherit; font-size: 16px; font-weight: 400; width: 100%; padding: 9px 11px; border: 1px solid #c9cfd5; border-radius: 6px; background: #fff; color: var(--text); min-height: 44px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 2px rgba(29,79,145,.15); }
input[readonly] { background: #fafafa; }
.hint { color: var(--muted); font-size: .84rem; font-weight: 400; }
.btn { font: inherit; font-weight: 600; font-size: .95rem; border: 1px solid #c9cfd5; background: #fff; color: var(--text); border-radius: 6px; padding: 9px 14px; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #9aa3ad; }
.btn.primary { color: var(--blue); border-color: var(--blue); }
.btn.danger { color: var(--red); }
.btn.small { min-height: 34px; padding: 5px 10px; font-size: .88rem; }
.btn.big { min-height: 50px; font-size: 1.02rem; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 14px; }
.search { max-width: 280px; }
.pill { display: inline-block; font-size: .8rem; padding: 1px 8px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--green); } .pill.bad { color: var(--red); } .pill.warn { color: var(--amber); } .pill.blue { color: var(--blue); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line2); text-align: left; vertical-align: middle; }
th { font-weight: 600; color: #39424b; font-size: .84rem; background: #fff; white-space: nowrap; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #fafbfc; }
.actions-cell { white-space: nowrap; text-align: right; display: inline-block; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* Pay grid */
.grid-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 250px); -webkit-overflow-scrolling: touch; }
table.pay { font-size: .9rem; }
table.pay th, table.pay td { padding: 4px 5px; border-right: 1px solid var(--line2); }
table.pay thead th { position: sticky; top: 0; z-index: 2; text-align: center; white-space: normal; line-height: 1.2; }
table.pay .namecol { position: sticky; left: 0; z-index: 1; background: #fff; min-width: 130px; max-width: 180px; border-right: 1px solid var(--line); }
table.pay thead .namecol { z-index: 3; }
table.pay input { min-height: 38px; padding: 4px 5px; text-align: right; width: 72px; font-size: 15px; font-variant-numeric: tabular-nums; border-color: #dde1e5; }
table.pay input.changed { border-color: var(--blue); }
table.pay input:disabled { background: #f6f7f8; color: #444; }
table.pay tfoot td { position: sticky; bottom: 0; background: #fff; z-index: 1; }
table.pay tfoot .namecol { z-index: 2; }
table.pay td.net { font-weight: 700; min-width: 90px; }
table.pay tr.excluded .namecol a { color: var(--muted); }
.grouphead { color: var(--muted); font-weight: 500; }

/* Sheet (dialog) */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(20,24,28,.35); display: flex; align-items: flex-start; justify-content: center; padding: 30px 14px; overflow-y: auto; }
.sheet-card { background: #fff; border-radius: 10px; width: 100%; max-width: 760px; padding: 18px 20px 20px; border: 1px solid var(--line); }
.sheet-card.wide { max-width: 1100px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; }
.sheet-x { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; font: inherit; color: var(--muted); cursor: pointer; min-height: 38px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #fff; color: var(--text); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.12); padding: 11px 18px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; }
.toast.bad { color: var(--red); }
.check-preview svg { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; }
.note { border-left: 2px solid var(--line); padding: 4px 10px; color: var(--muted); font-size: .9rem; margin: 8px 0; }
.ledger td.bal { font-weight: 600; }
.bar { height: 6px; background: var(--line2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: #8aa4c8; }

#print-area { display: none; }
/* Receipts and letters */
.logo-box { min-height: 90px; display: flex; align-items: center; justify-content: center; border: 1px dashed #c8ccd2; border-radius: 10px; padding: 12px; background: #fff; }
.logo-box img { max-width: 100%; max-height: 120px; object-fit: contain; }
.tpl-row { border: 1px solid #e3e5e8; border-radius: 10px; padding: 12px; }
.letter-preview { border: 1px solid #d5d8dc; border-radius: 8px; background: #f4f5f7; padding: 10px; text-align: center; }
.letter-preview img { width: 100%; max-width: 560px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
textarea[dir=auto] { unicode-bidi: plaintext; }

@media print {
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  #print-area { font-size: 11pt; color: #000; }
  #print-area table { font-size: 10pt; }
  #print-area th, #print-area td { padding: 4px 6px; border-bottom: 1px solid #ccc; }
  #print-area h1 { font-size: 16pt; } #print-area .ph { display: flex; justify-content: space-between; border-bottom: 1px solid #999; margin-bottom: 10px; padding-bottom: 6px; }
  @page { margin: 14mm; }
}

@media (max-width: 1000px) {
  .grid4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  main { padding: 14px 12px 70px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi .v { font-size: 1.15rem; }
  .search { max-width: none; }
  .sheet { padding: 0; }
  .sheet-card { border-radius: 0; min-height: 100vh; border: 0; }
}

.nowrap { white-space: nowrap; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; flex: none; }
.page-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.page-head > .row { flex-shrink: 0; max-width: 100%; justify-content: flex-end; }
.stack > *, .grid2 > *, .grid3 > *, .grid4 > *, .kpis > * { min-width: 0; }

/* Hours sheets */
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.review .card { margin-bottom: 0; }
.rvimg { position: sticky; top: 100px; padding: 12px; }
.rvwrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: 4px; background: #fff; -webkit-overflow-scrolling: touch; }
.rvwrap canvas { display: block; width: 100%; height: auto; }
.seg { display: inline-flex; }
.seg .btn { border-radius: 0; } .seg .btn:first-child { border-radius: 6px 0 0 6px; } .seg .btn:last-child { border-radius: 0 6px 6px 0; border-left: 0; }
.btn.on { color: var(--blue); border-color: var(--blue); }
.seg .btn.on + .btn { border-left: 0; }
table.hoursin { font-size: .9rem; }
table.hoursin th, table.hoursin td { padding: 4px 3px; text-align: center; }
table.hoursin th.wk { text-align: left; white-space: nowrap; font-size: .85rem; }
table.hoursin input { min-height: 40px; padding: 4px 3px; text-align: center; font-variant-numeric: tabular-nums; min-width: 40px; }
table.hoursin input.tot { font-weight: 650; }
table.hoursin td.num { text-align: right; white-space: nowrap; font-size: .85rem; }
input.ocr, table.pay input.fromsheet { color: var(--blue); }
.umgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.umcard { margin: 0; }
.umimg { display: block; width: 100%; padding: 0; border: 1px solid var(--line); background: #fff; cursor: zoom-in; border-radius: 4px; overflow: hidden; }
.umimg img { display: block; width: 100%; height: 220px; object-fit: cover; object-position: top; }
@media (max-width: 1100px) {
  .review { grid-template-columns: 1fr; }
  .rvimg { top: 92px; z-index: 5; }
  .rvwrap { max-height: 38vh; }
}

/* pay sheet layout: calculated columns, side columns (not in totals), notes under names */
table.pay td.ro { font-weight: 600; white-space: nowrap; min-width: 76px; text-align: right; }
table.pay th.ro { color: var(--text); }
table.pay td.side input { color: var(--muted); }
table.pay .rownote { white-space: normal; line-height: 1.25; font-size: .78rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.pay thead th span[dir="auto"] { unicode-bidi: plaintext; }
table.mapt td { vertical-align: middle; }
table.mapt select { min-width: 220px; }

/* Kollel funding (Nov 2026) */
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line2); }
ul.plain li:last-child { border-bottom: 0; }
.card h3 { margin-top: 14px; }
table.kollel td.num, table.kollel th.num { white-space: nowrap; }

/* Bank register (Nov 2026): view switch, Quicken-style grid, JLS-style colors */
.viewswitch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 12px; max-width: 100%; flex-wrap: wrap; }
.viewswitch button { background: #fff; border: 0; border-right: 1px solid var(--line); padding: 9px 16px; font: inherit; color: var(--text); cursor: pointer; }
.viewswitch button:last-child { border-right: 0; }
.viewswitch button.active { background: var(--blue); color: #fff; font-weight: 600; }
.viewswitch.small { border: 0; gap: 18px; }
.regbar { display: flex; gap: 10px 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.regbar label { min-width: 150px; } .regbar label.grow { flex: 1; min-width: 180px; }
table.reg-our td { padding-top: 10px; padding-bottom: 10px; }
.exportlist .btn { width: 100%; text-align: left; }
/* Quicken style: compact, classic register grid */
.table-wrap.qk { border-color: #9aa5b1; }
table.qk { font-size: .82rem; border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.qk th { background: #dfe6ee; color: #1c2024; font-weight: 600; padding: 4px 6px; border-bottom: 1px solid #9aa5b1; text-align: left; white-space: nowrap; }
table.qk td { padding: 3px 6px; border-bottom: 1px solid #e3e7eb; white-space: nowrap; }
table.qk tr.alt td { background: #f6f8e9; }
table.qk tr.rec td { color: #6b7580; }
table.qk td.c, table.qk th.c { text-align: center; width: 34px; cursor: pointer; }
table.qk td.num, table.qk th.num { text-align: right; }
table.qk tfoot td { font-weight: 650; background: #eef1f4; border-top: 1px solid #9aa5b1; }
/* JLS style: color carries meaning */
table.jls { font-size: .88rem; }
table.jls tr.jls-undep td { border-top: 2px solid var(--red); }
table.jls tr.jls-post td { background: #e3f4e6; }
table.jls tr.jls-dep td { background: #f3f5f8; }
table.jls tr.jls-part td { font-weight: 700; }
table.jls tr.jls-item td { font-size: .84rem; color: var(--muted); }
.jls-key { display: inline-block; width: 22px; height: 10px; vertical-align: middle; margin-right: 4px; }
.jls-key.undep { border-top: 2px solid var(--red); } .jls-key.post { background: #e3f4e6; border: 1px solid #b8dfc0; }

ul.reg-list { display: none; list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
ul.reg-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line2); }
ul.reg-list li:last-child { border-bottom: 0; }
.rl-main, .rl-amt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rl-amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { table.reg-our { display: none; } #rbody > .table-wrap:has(table.reg-our) { display: none; } ul.reg-list { display: block; } }

/* Donors (Nov 2026) */
.sentbox { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; font-weight: 400; }
.sentbox input { width: 18px; height: 18px; min-height: 0; margin: 0; }
.kpi .v.warn { color: var(--amber); }
@media (max-width: 700px) {
  table.donor-table th:nth-child(2), table.donor-table td:nth-child(2), table.donor-table th:nth-child(3), table.donor-table td:nth-child(3),
  table.donor-table th:nth-child(4), table.donor-table td:nth-child(4), table.donor-table th:nth-child(6), table.donor-table td:nth-child(6) { display: none; }
  table.donor-table th:nth-child(7), table.donor-table td:nth-child(7) { display: none; }
}
