/* Apartment CRM · property pages (dashboard, buildings, units, tenants). Prefix: .apt- */

/* One-line text that never wraps a big field to two lines. Set --ell to change the cap. */
.apt-ell{display:block;max-width:var(--ell,260px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.apt-ell.sm{--ell:160px}
.apt-ell.xs{--ell:120px}

/* Two-line cell: main + sub */
.apt-cell{min-width:0}
.apt-cell .apt-sub{display:block;font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:var(--ell,260px)}

/* Dashboard list rows (pending proofs, overdue). Grid, not nested flex: minmax(0,1fr) is what lets a nowrap title ellipsis. */
.apt-list{display:block}
.apt-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 12px;align-items:center;padding:10px 0;border-top:1px solid var(--line);min-width:0;color:inherit;text-decoration:none}
.apt-row:first-child{border-top:0}
a.apt-row:hover .apt-row-title b{color:var(--navy)}
.apt-row-main{min-width:0}
.apt-row-title,.apt-row-sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.apt-row-title{font-size:13.5px;color:var(--ink)}
.apt-row-sub{font-size:12px;color:var(--muted);margin-top:2px}
.apt-row-amt{font-family:var(--display);font-weight:700;font-variant-numeric:tabular-nums;font-size:14px;color:var(--ink);white-space:nowrap;text-align:right}
.apt-row-amt.danger{color:var(--danger)}
.apt-row-actions{grid-column:1 / -1;display:flex;gap:6px;flex-wrap:wrap}
@media (min-width:701px){.apt-row.stack{grid-template-columns:minmax(0,1fr) auto auto}.apt-row.stack .apt-row-actions{grid-column:auto;justify-content:flex-end}}
.apt-more{padding:8px 0 0;font-size:12px;color:var(--muted)}

/* Second KPI strip on the dashboard */
.apt-kpis-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
@media (max-width:420px){.apt-kpis-2{grid-template-columns:1fr}}

/* Proof viewer */
.apt-proof{display:flex;flex-direction:column;align-items:center;gap:12px}
.apt-proof img{max-width:100%;max-height:70vh;border-radius:10px;border:1px solid var(--line);background:var(--field)}
.apt-proof-meta{font-size:12.5px;color:var(--muted);text-align:center}

/* Detail cards (unit / tenant) */
.apt-dl{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:9px 18px;font-size:13px}
.apt-dl dt{color:var(--muted);font-weight:500;white-space:nowrap}
.apt-dl dd{color:var(--ink);font-weight:500;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.apt-dl dd.wrap{white-space:normal;overflow:visible}
.apt-dl dd.num{text-align:left}
.apt-who{display:flex;align-items:center;gap:12px;min-width:0;margin-bottom:12px}
.apt-who .apt-who-name{font-family:var(--display);font-weight:700;font-size:16px;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.apt-who .apt-who-name a{display:block;color:inherit;text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.apt-who .apt-who-name a:hover{color:var(--navy)}
.apt-who .apt-who-sub{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.apt-who > div{min-width:0;flex:1}
.apt-card-foot{display:flex;justify-content:flex-end;gap:8px;margin-top:14px;flex-wrap:wrap}

/* Move-in: hidden new-tenant fields */
.apt-hidden{display:none!important}

/* Tabs inside a card */
.apt-tabs-card .tabs-wrap > .tabs{padding:6px 16px 0}

/* Page title never wraps a 60-char name to two lines */
.apt-page .page-head-left{min-width:0;flex:1 1 320px}
.apt-page .page-title,.apt-page .page-sub{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Phone: header actions become a full-width wrap */
@media (max-width:700px){
  .apt-page .page-header .page-actions{width:100%;flex-wrap:wrap}
  .apt-page .page-header .page-actions .btn{flex:1 1 auto}
  .apt-ell{--ell:180px}
  .apt-ell.sm{--ell:130px}
  .apt-cell .apt-sub{--ell:180px}
}

/* ---- tenant credit ---- */
.apt-credit-chip{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;background:var(--ok-tint,#E7F6EE);color:#166B4A;font-size:11.5px;font-weight:700;white-space:nowrap;font-variant-numeric:tabular-nums}
.apt-credit-chip svg{flex:none}
.text-ok{color:#1D9E6C}
.apt-credit-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}

/* ---- V2: lease rules section inside a form ---- */
.apt-form-sec{grid-column:1 / -1;margin:6px 0 14px;padding-top:14px;border-top:1px solid var(--line)}
.apt-form-sec-title{font-family:var(--display);font-weight:700;font-size:14px;color:var(--ink);margin-bottom:2px}
.apt-lease-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 28px}
.apt-lease-grid > .apt-dl{align-content:start}
.apt-rent-hist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px;font-size:13px}
.apt-rent-hist li{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.apt-rent-hist .btn{margin-top:4px}
@media (max-width:900px){.apt-lease-grid{grid-template-columns:1fr}}

/* ---- V2: dorm units + beds ---- */
.apt-dorm{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.apt-bedocc{min-width:150px}
.apt-bedocc-row{display:flex;align-items:center;gap:8px;min-width:0}
.apt-bedocc-row .progress{flex:1;min-width:50px;max-width:110px}
.apt-bedocc-row span{white-space:nowrap}
.apt-beds{display:flex;flex-direction:column;gap:6px}
.apt-bed{display:grid;grid-template-columns:64px minmax(0,1fr) auto;align-items:center;gap:10px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;min-width:0}
.apt-bed.free{background:var(--field);border-style:dashed}
.apt-bed-no{font-family:var(--display);font-weight:700;color:var(--ink);white-space:nowrap}
.apt-bed-who{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;color:var(--body)}
.apt-bed-who a{color:var(--ink);text-decoration:none}
.apt-bed-who a:hover{color:var(--navy)}
.apt-bed-act{display:flex;gap:4px;flex-wrap:wrap;justify-content:flex-end}
.apt-bed-btn{width:100%;text-align:left;cursor:pointer;font:inherit}
.apt-bed-btn:hover{border-color:var(--navy-l);background:var(--info-tint)}
.apt-bed-btn svg{color:var(--muted)}
@media (max-width:700px){
  .apt-bed{grid-template-columns:56px minmax(0,1fr)}
  .apt-bed-act{grid-column:1 / -1;justify-content:flex-start}
}

/* ---- V2: ID photo ---- */
.apt-id-row{display:flex;align-items:center;gap:14px;min-width:0}
.apt-id-box{width:132px;height:88px;border-radius:10px;border:1px solid var(--line);background:var(--field);display:grid;place-items:center;overflow:hidden;flex:none}
.apt-id-box .apt-id-thumb{width:100%;height:100%;object-fit:cover}
.apt-id-empty{display:flex;flex-direction:column;align-items:center;gap:4px;color:var(--muted);font-size:11.5px;font-weight:600}
.apt-id-btns{display:flex;flex-direction:column;gap:6px;align-items:flex-start}
.apt-contact{display:flex;gap:16px;align-items:flex-start;min-width:0}
.apt-contact > .apt-dl{flex:1;min-width:0}
.apt-id-view{flex:none;display:flex;flex-direction:column;align-items:center;gap:4px;border:0;background:none;padding:0;cursor:zoom-in;color:var(--muted);font:inherit}
.apt-id-view .apt-id-thumb{width:120px;height:80px;object-fit:cover;border-radius:10px;border:1px solid var(--line);background:var(--field)}
.apt-id-view:hover .apt-id-thumb{border-color:var(--navy-l)}
@media (max-width:700px){.apt-contact{flex-direction:column}.apt-id-view{align-self:flex-start;flex-direction:row}}

/* ---- V2: tenant portal card ---- */
.apt-portal .apt-link-row .btn{flex:none}
.apt-portal-btns{justify-content:flex-start}
@media (max-width:700px){.apt-portal-btns .btn{flex:1 1 auto}}
