/* Apartment CRM · billing grid, invoices, payments queue. Tokens come from app.css. */

/* ---------- shared small bits ---------- */
.apt-ell{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom;min-width:0}
.apt-btn-ok{background:var(--ok);color:#fff}
.apt-btn-ok:hover{background:#17835A;color:#fff}
.apt-filters{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}
.apt-filters .input,.apt-filters .select{width:auto;height:36px;font-size:13px;min-width:0}
.apt-filters .select{max-width:220px}
.apt-filters .checkbox{height:36px}
.apt-chk-filter span:last-child{white-space:nowrap}
.apt-range{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.apt-range .input{width:150px}
.apt-kpis{margin:16px 0}
.tabs-wrap > .apt-filters{margin-top:-4px}
.dt .table-tools .apt-filters{flex:1}
@media (max-width:700px){
  .apt-filters .input[type=month],.apt-filters .input[type=date],.apt-filters .select{flex:1 1 140px;max-width:none}
  .apt-range{flex:1 1 100%}
  .apt-range .input{flex:1;width:auto}
}

/* ---------- billing top bar ---------- */
.apt-bill-bar{display:flex;align-items:flex-end;gap:16px;flex-wrap:wrap;margin-top:14px}
.apt-bill-ctl{display:flex;flex-direction:column;gap:5px;min-width:0}
.apt-ctl-lbl{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.apt-month{display:flex;align-items:center;gap:6px}
.apt-month .btn-icon{height:38px;width:38px}
.apt-month-in{width:170px;height:38px}
.apt-bldg-sel{width:220px;height:38px}
.apt-date-in{width:160px;height:38px}
.apt-kbd-hint{white-space:nowrap}
@media (max-width:700px){
  .apt-bill-bar{gap:10px}
  .apt-bill-ctl{flex:1 1 100%}
  .apt-month{width:100%}
  .apt-month-in{flex:1;width:auto}
  .apt-bldg-sel,.apt-date-in{width:100%}
  .apt-kbd-hint{display:none}
}

/* ---------- billing grid ---------- */
.apt-bill-card{display:flex;flex-direction:column;min-width:0}
.apt-bill-host{min-width:0}
.apt-bill-wrap{overflow:auto;max-height:min(70vh,calc(100vh - 300px));min-height:200px;-webkit-overflow-scrolling:touch;border-top:1px solid var(--line)}
.apt-bill{min-width:1180px;font-size:13px}
.apt-bill th{position:sticky;z-index:3;background:#FCFAF8;padding:7px 10px}
.apt-bill thead tr.apt-grp-head th{top:0;height:26px;padding:4px 10px;font-size:10.5px;letter-spacing:.1em;text-align:center;border-bottom:1px solid var(--line)}
.apt-bill thead tr:nth-child(2) th{top:26px;height:34px}
.apt-bill th.apt-grp.blank{background:#FCFAF8}
.apt-bill th.apt-grp.elec{background:#FFF6E5;color:#A16207}
.apt-bill th.apt-grp.water{background:#EAF3FB;color:var(--navy)}
.apt-bill td{padding:5px 10px;vertical-align:middle;height:44px}
.apt-bill td.apt-chk,.apt-bill th.apt-chk{width:38px;padding-left:12px;padding-right:0}
.apt-cell-chk{height:auto}
.apt-bill td.apt-unit{max-width:170px;min-width:120px}
.apt-unit-no{font-family:var(--display);font-weight:700;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.apt-tenant{display:block;max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.2}
.apt-bill td.num{white-space:nowrap}
.apt-bill tbody tr:hover td{background:#FBF8F3}
.apt-bill tbody tr.invoiced td{background:#FAFAF9;color:var(--muted)}
.apt-bill tbody tr.invoiced td.num{color:var(--body)}
.apt-bill tbody tr.apt-grp-row td{background:var(--info-tint);color:var(--navy);font-size:12.5px;padding:6px 12px;height:32px;position:sticky;left:0;border-bottom:1px solid var(--line)}
.apt-bill tbody tr.apt-grp-row td svg{margin-right:6px;vertical-align:-3px}
.apt-bill tbody tr.apt-grp-row td b{color:var(--navy)}
/* compact reading inputs: right-aligned numbers, ~90px, no spinner */
.apt-in{width:90px;height:32px;padding:0 8px;text-align:right;font-family:var(--display);font-weight:600;font-variant-numeric:tabular-nums;font-size:13px;background:#fff;-moz-appearance:textfield;appearance:textfield}
.apt-in::-webkit-outer-spin-button,.apt-in::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.apt-in.first{width:78px;font-weight:500;background:var(--field)}
.apt-in::placeholder{color:var(--muted);font-weight:500;font-size:12px}
.apt-in:focus{background:#fff;border-color:var(--navy);box-shadow:0 0 0 3px rgba(31,69,106,.14)}
.apt-in.dirty{border-color:#E0B300;background:#FFFBEA;box-shadow:inset 0 0 0 1px #F2D34D}
.apt-in.dirty:focus{box-shadow:inset 0 0 0 1px #F2D34D,0 0 0 3px rgba(234,179,8,.18);border-color:#D4A600}
.apt-in.err{border-color:var(--danger);background:var(--danger-tint);box-shadow:inset 0 0 0 1px var(--danger)}
.apt-in.err:focus{box-shadow:inset 0 0 0 1px var(--danger),0 0 0 3px rgba(220,38,38,.16)}
.apt-usage.apt-preview{color:var(--muted);font-weight:500;font-style:italic}
.apt-usage.apt-preview.text-danger{color:var(--danger)}
.apt-amt.muted{font-weight:500}
.apt-lock{display:inline-flex;align-items:center;gap:4px;color:var(--body);white-space:nowrap}
.apt-lock svg{color:var(--muted);width:12px;height:12px}
.apt-bill td.apt-other{white-space:nowrap}
.apt-plus{width:30px;padding:0;justify-content:center}
.apt-other-chip{height:26px;padding:0 9px;font-size:12px;margin-left:6px;font-family:var(--display);font-weight:600;font-variant-numeric:tabular-nums}
.apt-bill td.apt-status{white-space:nowrap}
.apt-inv-link .pill{cursor:pointer}
.apt-inv-link:hover .pill{filter:brightness(.95);text-decoration:underline}
.apt-status-sub{line-height:1.2;margin-top:2px}
/* sticky action bar at the bottom of the card */
.apt-bill-actions{position:sticky;bottom:0;z-index:4;display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:10px 16px;background:#fff;border-top:1px solid var(--line);border-radius:0 0 var(--radius) var(--radius);box-shadow:0 -6px 16px rgba(20,30,39,.05)}
.apt-bar-info{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.apt-bar-btns{display:flex;gap:8px;margin-left:auto;flex-wrap:wrap}
@media (max-width:860px){.apt-bill-actions{bottom:60px}}
@media (max-width:700px){
  .apt-bill-wrap{max-height:none}
  .apt-bar-info{flex:1 1 100%;white-space:normal}
  .apt-bar-btns{width:100%;margin-left:0}
  .apt-bar-btns .btn{flex:1}
  .apt-bill-card .card-head{padding:14px 16px 10px}
}

/* ---------- generate result modal ---------- */
.apt-gen-table{max-height:260px;border:1px solid var(--line);border-radius:10px}
.apt-gen-total{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 4px 0;font-size:13.5px;color:var(--body)}
.apt-gen-total b{font-size:16px;color:var(--ink)}
.apt-skip-row{display:flex;align-items:center;gap:8px;padding:4px 0;min-width:0}
.apt-skip-row span:last-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--body)}

/* ---------- line editor (invoices + other charges) ---------- */
.apt-lines{display:flex;flex-direction:column;gap:8px}
.apt-line{display:grid;grid-template-columns:120px minmax(0,1fr) 150px 34px;gap:8px;align-items:center;min-width:0}
.apt-line.apt-line-other{grid-template-columns:minmax(0,1fr) 150px 34px}
.apt-line .input,.apt-line .select{height:36px;min-width:0}
.apt-line .input-group{background:#fff;min-width:0}
.apt-line .input-group .prefix{height:36px}
.apt-line-head{display:grid;grid-template-columns:120px minmax(0,1fr) 150px 34px;gap:8px;font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-weight:600;margin-bottom:6px}
.apt-line-foot{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap;margin-top:10px}
@media (max-width:700px){
  .apt-line{grid-template-columns:1fr 34px;grid-template-areas:"kind x" "desc desc" "amt amt"}
  .apt-line > .select{grid-area:kind}
  .apt-line > .input{grid-area:desc}
  .apt-line > .input-group{grid-area:amt}
  .apt-line > .btn{grid-area:x}
  .apt-line.apt-line-other{grid-template-columns:minmax(0,1fr) 34px;grid-template-areas:"desc x" "amt amt"}
  .apt-line-head{display:none}
}

/* ---------- invoice detail ---------- */
.apt-inv-layout{margin-top:16px}
.apt-inv-layout > *{min-width:0}
.apt-dl dd{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.apt-dl dd a{color:var(--navy)}
.apt-paylink{margin-top:14px;padding-top:12px;border-top:1px dashed var(--line)}
.apt-link-row{display:flex;gap:6px;align-items:center;min-width:0}
.apt-link-input{flex:1;min-width:0;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px;text-overflow:ellipsis}
.apt-totals{padding:10px 20px 16px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:2px;margin-left:auto;max-width:360px;width:100%}
.apt-tot-row{display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding:4px 0;font-size:13px;color:var(--body)}
.apt-tot-row b{font-size:14px;color:var(--ink);white-space:nowrap}
.apt-tot-row.grand{border-top:1px solid var(--line);margin-top:4px;padding-top:9px;font-weight:600;color:var(--ink)}
.apt-tot-row.grand b{font-size:17px}
.apt-tot-row.ok b{color:var(--ok)}
.apt-tot-row.balance{border-top:2px solid var(--navy);margin-top:4px;padding-top:9px;font-weight:700;color:var(--ink)}
.apt-tot-row.balance b{font-size:24px;letter-spacing:-.02em}
.apt-tot-row.balance.due b{color:var(--danger)}
.apt-tot-row.balance.ok b{color:var(--ok)}
.apt-tot-row.balance.muted b{color:var(--muted)}
.apt-tot-row.pending{color:var(--orange)}
.apt-tot-row.pending b{color:var(--orange)}
.apt-pay-table td{vertical-align:top}
.apt-pay-table tr.apt-pending-row td{background:var(--warn-tint)}
.apt-pay-note{max-width:240px}
.apt-pay-row-actions{display:flex;gap:4px;justify-content:flex-end;flex-wrap:wrap}
.apt-file{padding:6px 10px;height:auto;line-height:1.4}
.apt-send{display:flex;flex-direction:column;gap:12px}
.apt-send .btn-lg{width:100%}
.apt-send-text{font-size:14px;line-height:1.55;color:var(--body)}
.apt-proof-img{text-align:center}
.apt-proof-img img{max-height:75vh;object-fit:contain;border-radius:8px;border:1px solid var(--line)}
.apt-proof-pdf{display:flex;flex-direction:column;align-items:center;gap:12px;padding:24px 0;color:var(--navy)}
/* print host: parked off-screen; app.css @media print makes .print-doc the only visible thing */
.apt-print-host{position:fixed;left:-10000px;top:0;width:820px}
@media print{.apt-print-host{position:static;width:auto}}

/* ---------- payments queue cards ---------- */
.apt-pay-cards{display:flex;flex-direction:column;gap:12px}
.apt-pay-card{display:grid;grid-template-columns:120px minmax(0,1fr) auto;gap:16px;align-items:start;padding:14px;background:#fff;border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--card-shadow);min-width:0}
.apt-thumb{width:120px;height:120px;object-fit:cover;border-radius:10px;border:1px solid var(--line);background:var(--field);cursor:zoom-in;display:block}
.apt-thumb-ph{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;color:var(--muted);font-size:11.5px;font-weight:600;cursor:pointer;text-align:center}
.apt-pay-mid{display:flex;flex-direction:column;gap:3px;min-width:0}
.apt-pay-name{font-family:var(--display);font-weight:700;font-size:15px;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.apt-pay-claim{font-size:13.5px;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.apt-pay-claim b{font-size:15px}
.apt-pay-actions{display:flex;flex-direction:column;gap:8px;min-width:120px}
.apt-pay-actions .btn{width:100%}
@media (max-width:700px){
  .apt-pay-card{grid-template-columns:88px minmax(0,1fr);gap:12px;padding:12px}
  .apt-thumb{width:88px;height:88px}
  .apt-pay-actions{grid-column:1 / -1;flex-direction:row}
  .apt-pay-actions .btn{flex:1}
}

/* ---------- V2: dorm bed rows, shared chips, pending charges, prorated ---------- */
.apt-bed-tag{font-size:12px;font-weight:600;color:var(--navy)}
.apt-bill tbody tr.apt-bed-row td.apt-unit{border-left:3px solid var(--info-tint)}
.apt-bill td.apt-shared-beds{text-align:left;font-style:italic;white-space:nowrap;color:var(--muted)}
.apt-bill td.apt-shared-beds svg{vertical-align:-2px;margin-right:6px;color:var(--muted)}
.apt-prorated{margin-top:3px;line-height:1}
.apt-prorated .pill{font-size:10px;padding:1px 7px}
.apt-extras{display:flex;flex-direction:column;gap:3px;margin-bottom:4px;min-width:0}
.apt-charge{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:190px;line-height:1.3}
.apt-charge b{color:var(--orange)}
.apt-charge-desc{color:var(--body)}
.apt-shared-chip{height:24px;padding:0 8px;font-size:11.5px;gap:4px;background:var(--info-tint);border-color:#D9E2EE;color:var(--navy);width:max-content}
.apt-shared-chip b{font-family:var(--display);font-variant-numeric:tabular-nums}
.apt-shared-chip:hover{border-color:var(--navy-l)}
.apt-late-table{max-height:340px}
.apt-late-table td.apt-chk,.apt-late-table th.apt-chk{width:36px;padding-right:0}
.text-orange{color:var(--orange)}

/* ---------- V2: utility split page ---------- */
.apt-util{display:grid;grid-template-columns:minmax(280px,360px) minmax(0,1fr);gap:16px;margin-top:16px;align-items:start}
.apt-util-left,.apt-util-right{min-width:0;display:flex;flex-direction:column;gap:16px}
.apt-util-card{display:flex;flex-direction:column;min-width:0}
.apt-meters{display:flex;flex-direction:column;padding:6px 0 8px}
.apt-meters-grp{display:flex;align-items:center;gap:6px;padding:10px 16px 4px;font-size:12px;color:var(--navy);text-transform:uppercase;letter-spacing:.06em}
.apt-meters-grp b{font-size:12px}
.apt-meter{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;padding:10px 16px;cursor:pointer;border-left:3px solid transparent;min-width:0}
.apt-meter:hover{background:#FBF8F3}
.apt-meter.on{background:var(--info-tint);border-left-color:var(--orange)}
.apt-meter:focus-visible{outline:2px solid var(--navy-l);outline-offset:-2px}
.apt-meter-main{min-width:0}
.apt-meter-name{display:flex;align-items:center;gap:8px;min-width:0}
.apt-meter-name b{font-family:var(--display);color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.apt-meter-sub{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.apt-meter-acts{opacity:.7}
.apt-meter:hover .apt-meter-acts{opacity:1}
.apt-util-wrap{max-height:none;min-height:0}
.apt-util-table{min-width:620px}
.apt-util-table td.apt-unit{max-width:240px}
.apt-util-table .apt-tenant{max-width:220px}
.apt-util-table .apt-in{width:110px}
.apt-alloc{border-top:1px solid var(--line);padding-bottom:6px;transition:background .5s}
.apt-alloc:first-child{border-top:0}
.apt-alloc.flash{background:var(--warn-tint)}
.apt-alloc-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;padding:12px 20px 8px;min-width:0}
.apt-alloc-title{display:flex;align-items:center;gap:8px;min-width:0;font-size:13.5px}
.apt-alloc-title b{font-family:var(--display);color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.apt-alloc-sum{font-size:13px;color:var(--body);white-space:nowrap}
.apt-alloc-sum b{font-size:15px;color:var(--ink)}
.apt-alloc-table{min-width:0}
.apt-alloc-bed{line-height:1.2;margin-top:1px}
.apt-alloc-tag{display:inline-flex;align-items:center;gap:3px;font-size:10.5px;font-weight:600;color:var(--navy);line-height:1.2;margin-top:2px}
.apt-alloc-tag svg{width:11px;height:11px}
.apt-alloc-table tfoot td{border-bottom:0;background:#FCFAF8;font-size:12.5px}
.apt-alloc-table tr.invoiced td{background:#FAFAF9}
.apt-unalloc{display:flex;gap:10px;align-items:flex-start;margin:8px 20px 10px;padding:10px 12px;border-radius:10px;background:var(--orange-tint);color:#9A3412;font-size:13px;border:1px solid #F8C9B5}
.apt-unalloc svg{flex:none;margin-top:2px;color:var(--orange)}
.apt-unalloc b{color:var(--orange)}
/* add / edit shared meter modal */
.apt-method-text{color:var(--navy);background:var(--info-tint);padding:7px 10px;border-radius:8px;margin-top:8px;line-height:1.45}
.apt-members{border:1px solid var(--line);border-radius:10px;max-height:280px;overflow:auto;background:#fff}
.apt-member{display:grid;grid-template-columns:minmax(0,1fr) 90px 150px;align-items:center;gap:10px;padding:7px 12px;border-top:1px solid var(--line);min-width:0}
.apt-member:first-child{border-top:0}
.apt-member.on{background:#FBF8F3}
.apt-member-head{background:#FCFAF8;position:sticky;top:0;z-index:1}
.apt-member .checkbox{height:auto;min-width:0;text-transform:none;letter-spacing:0;font-size:13.5px}
.apt-member .checkbox .box{flex:none}
.apt-member-name{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.apt-member-name b{color:var(--ink)}
.apt-member-meta{text-align:right;white-space:nowrap}
.apt-share-grp{height:34px;background:#fff}
.apt-share-grp .prefix{height:34px;padding:0 9px}
.apt-share-in{height:34px;text-align:right;font-family:var(--display);font-weight:600;font-variant-numeric:tabular-nums;-moz-appearance:textfield;appearance:textfield}
.apt-share-in::-webkit-outer-spin-button,.apt-share-in::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.apt-member-foot{padding:8px 12px;border-top:1px solid var(--line)}
.apt-members-total{margin-top:8px;font-size:13px;color:var(--body)}
.apt-members-total b{font-family:var(--display);font-size:15px;color:var(--ink)}
.apt-members-total.ok b{color:var(--ok)}
.apt-members-total.bad b{color:var(--danger)}
@media (max-width:1000px){.apt-util{grid-template-columns:1fr}}
@media (max-width:700px){
  .apt-member{grid-template-columns:minmax(0,1fr) 120px}
  .apt-member-meta{display:none}
  .apt-alloc-head{padding:12px 16px 8px}
  .apt-alloc-sum{white-space:normal}
  .apt-unalloc{margin:8px 16px 10px}
  .apt-meter{padding:10px 12px}
}
.apt-bed-share{font-size:11px;font-weight:500;color:var(--muted);line-height:1.2;margin-top:2px;white-space:nowrap}
.apt-alloc .table-wrap{max-height:none}
@media (max-width:700px){
  .apt-alloc-table{min-width:0;font-size:12.5px}
  .apt-alloc-table th,.apt-alloc-table td{padding:8px 8px}
  .apt-alloc-table .apt-ell.sm{--ell:110px}
}
