:root { --bg:#f4f6f8; --card:#fff; --ink:#1d2733; --muted:#6b7785; --line:#e2e6ea; --brand:#1f4e79;
  --occ:#2f9e44; --part:#f59f00; --vac:#adb5bd; --recent:#7048e8; --over:#e03131; --high:#e03131; --med:#f76707; --low:#868e96; }
* { box-sizing: border-box; }
body { margin:0; font:14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background:var(--bg); color:var(--ink); }
a { color:var(--brand); text-decoration:none; } a:hover { text-decoration:underline; }
button { font:inherit; cursor:pointer; }
.btn { background:var(--brand); color:#fff; border:0; border-radius:6px; padding:7px 14px; }
.btn.light { background:#fff; color:var(--brand); border:1px solid var(--brand); }
.link { background:none; border:0; color:var(--brand); padding:0; }
input, select, textarea { font:inherit; padding:6px 8px; border:1px solid var(--line); border-radius:6px; background:#fff; color:var(--ink); }
textarea { width:100%; min-height:70px; }
header#top { display:flex; align-items:center; gap:16px; background:var(--brand); color:#fff; padding:8px 16px; flex-wrap:wrap; position:sticky; top:0; z-index:5; }
header .brand { font-size:16px; } header nav { display:flex; gap:4px; flex-wrap:wrap; flex:1; }
header nav a { color:#dbe7f3; padding:5px 10px; border-radius:6px; } header nav a.on { background:rgba(255,255,255,.18); color:#fff; }
header .who { font-size:13px; } header .who .link { color:#fff; text-decoration:underline; margin-left:6px; }
main { padding:16px; max-width:1500px; margin:0 auto; }
.pad { padding:16px; } .muted { color:var(--muted); } .small { font-size:12px; } .right { text-align:right; } .nowrap { white-space:nowrap; }
.card { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:14px; margin-bottom:14px; }
.card h2 { font-size:15px; margin:0 0 10px; } h1 { font-size:20px; margin:0 0 4px; }
.row { display:flex; gap:12px; flex-wrap:wrap; align-items:center; }
.kpis { display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:10px; margin-bottom:14px; }
.kpi { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:10px 12px; }
.kpi .v { font-size:20px; font-weight:700; } .kpi .l { color:var(--muted); font-size:12px; }
.kpi.warn .v { color:var(--med); } .kpi.bad .v { color:var(--high); }
.legend { display:flex; gap:14px; flex-wrap:wrap; font-size:12px; color:var(--muted); margin:6px 0 10px; }
.legend i { display:inline-block; width:12px; height:12px; border-radius:3px; vertical-align:-2px; margin-right:4px; }
.chips { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:10px; }
.chip { border:1px solid var(--line); background:#fff; border-radius:16px; padding:4px 11px; font-size:13px; }
.chip.on { background:var(--brand); color:#fff; border-color:var(--brand); }
.floor { display:flex; gap:10px; align-items:stretch; margin-bottom:8px; }
.floor-label { width:92px; flex:none; font-size:12px; color:var(--muted); padding-top:4px; }
.floor-label b { display:block; color:var(--ink); font-size:14px; }
.tiles { display:grid; grid-template-columns:repeat(auto-fill, minmax(64px, 1fr)); gap:5px; flex:1; }
.tile { position:relative; border-radius:7px; padding:6px 5px 5px; min-height:52px; color:#fff; font-weight:600; font-size:13px; border:2px solid transparent; text-align:left; }
.tile .beds { display:flex; gap:3px; margin-top:5px; } .tile .beds span { width:9px; height:9px; border-radius:50%; border:1.5px solid rgba(255,255,255,.9); }
.tile .beds span.f { background:#fff; } .tile .t { font-size:10px; font-weight:400; opacity:.9; display:block; }
.tile.occupied { background:var(--occ); } .tile.partial { background:var(--part); } .tile.vacant { background:var(--vac); }
.tile.recent { background:var(--recent); } .tile.over { background:var(--over); }
.tile.p-high { border-color:#fff; box-shadow:0 0 0 4px var(--high), 0 0 10px 2px rgba(224,49,49,.55); z-index:1; } .tile.p-med { border-color:#fff; box-shadow:0 0 0 4px var(--med); z-index:1; }
.tile .badge { position:absolute; top:-9px; right:-9px; display:flex; gap:2px; align-items:center; z-index:2; }
.tile .pflag { display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:22px; padding:0 5px; border-radius:11px;
  font-size:13px; font-weight:800; color:#fff; border:2px solid #fff; box-shadow:0 1px 3px rgba(0,0,0,.35); }
.tile .pflag.high { background:var(--high); } .tile .pflag.med { background:var(--med); }
.tiles { padding:10px 10px 4px 4px; gap:9px; }
.tile.dim { opacity:.25; }
table { border-collapse:collapse; width:100%; } th, td { padding:6px 8px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
th { font-size:12px; color:var(--muted); font-weight:600; background:#fafbfc; position:sticky; top:0; }
th.sort { cursor:pointer; } tr.click { cursor:pointer; } tr.click:hover td { background:#f1f5fa; }
td.n, th.n { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.scroll { overflow:auto; max-height:70vh; }
.flag { display:flex; gap:6px; padding:3px 0; } .flag .dot { width:8px; height:8px; border-radius:50%; margin-top:6px; flex:none; }
.dot.high { background:var(--high); } .dot.med { background:var(--med); } .dot.low { background:var(--low); }
.pill { display:inline-block; font-size:11px; padding:1px 7px; border-radius:10px; background:#e7f0f9; color:var(--brand); margin-left:4px; }
.pill.red { background:#ffe3e3; color:#c92a2a; } .pill.orange { background:#fff0db; color:#d9480f; } .pill.grey { background:#eceff1; color:#495057; } .pill.green { background:#e6f6ea; color:#2b8a3e; }
.tenant { border:1px solid var(--line); border-radius:8px; padding:10px; margin-bottom:8px; }
.grid2 { display:grid; grid-template-columns:repeat(auto-fit, minmax(150px, 1fr)); gap:4px 14px; font-size:13px; }
.grid2 .k { color:var(--muted); font-size:11px; display:block; }
.comment { border-left:3px solid var(--line); padding:4px 10px; margin:8px 0; } .comment .meta { font-size:11px; color:var(--muted); }
.comment.collection { border-color:var(--brand); }
#drawer { position:fixed; inset:0; z-index:20; } .drawer-bg { position:absolute; inset:0; background:rgba(0,0,0,.35); }
.drawer-panel { position:absolute; right:0; top:0; bottom:0; width:min(680px, 100%); background:var(--bg); overflow:auto; padding:16px; box-shadow:-4px 0 20px rgba(0,0,0,.2); }
.drawer-panel .close { position:sticky; top:0; float:right; font-size:26px; border:0; background:none; line-height:1; }
.login { max-width:340px; margin:12vh auto; } .login input { width:100%; margin-bottom:10px; } .err { color:var(--high); }
.form-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:8px; } .form-grid label { font-size:12px; color:var(--muted); display:block; }
.form-grid input, .form-grid select { width:100%; }
.cm { display:inline-block; min-width:15px; padding:0 4px; border-radius:8px; background:#fff; color:var(--brand); font-size:10px; text-align:center; line-height:15px; }
@media (max-width:640px) { header#top { position:static; gap:6px; padding:6px 10px; } header nav { flex-wrap:nowrap; overflow-x:auto; order:3; flex:0 0 100%; }
  header nav a { white-space:nowrap; padding:4px 8px; } header .who { margin-left:auto; } main { padding:10px; } .floor { flex-direction:column; gap:4px; } .floor-label { width:auto; }
  .tiles { grid-template-columns:repeat(auto-fill, minmax(54px, 1fr)); } .hide-sm { display:none; } }
/* Owing report (2026-11-13): colour bands by arrears ÷ rent, print-friendly */
.report .rep-head { display:flex; justify-content:space-between; align-items:flex-end; border-bottom:3px solid var(--brand); padding-bottom:8px; margin-bottom:12px; }
.report .rep-brand { font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:var(--brand); font-weight:700; }
.report h1 { font-size:22px; }
table.rep tr.b3 td { background:#fff5f5; } table.rep tr.b2 td { background:#fff8ef; } table.rep tr.b1 td { background:#fffdf0; }
table.rep tr.b3 td:first-child { box-shadow:inset 4px 0 0 #e03131; } table.rep tr.b2 td:first-child { box-shadow:inset 4px 0 0 #f76707; } table.rep tr.b1 td:first-child { box-shadow:inset 4px 0 0 #f2c94c; }
table.rep tfoot td { font-weight:600; border-top:2px solid var(--line); background:#fafbfc; }
.rep-group h2 { display:flex; align-items:center; gap:8px; } .sw { width:12px; height:12px; border-radius:3px; display:inline-block; }
.sw.b3 { background:#e03131; } .sw.b2 { background:#f76707; } .sw.b1 { background:#f2c94c; }
@media print {
  @page { size:A4 landscape; margin:10mm; }
  body { background:#fff; font-size:11px; } header#top, .no-print, #drawer { display:none !important; }
  main { padding:0; max-width:none; } .card { border:0; padding:0; margin-bottom:10px; break-inside:auto; }
  .kpi { border:1px solid #ccc; } th { position:static; background:#eee !important; }
  table.rep tr { break-inside:avoid; } * { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
}
/* Dashboard charts (2026-11-13) */
.charts { display:grid; grid-template-columns:repeat(auto-fit, minmax(420px, 1fr)); gap:14px; }
.card.chart { margin:0; } .card.chart.wide { grid-column:1 / -1; }
svg.viz { width:100%; height:auto; display:block; overflow:visible; }
svg.viz .lbl { font-size:12px; fill:var(--muted); } svg.viz .val { font-size:12px; fill:var(--ink); font-weight:600; } svg.viz .big { font-size:16px; font-weight:700; fill:var(--ink); }
svg.viz .axis { stroke:var(--line); stroke-width:1; } svg.viz .grid { stroke:#eef1f4; stroke-width:1; }
svg.viz .mark { outline:none; } svg.viz .mark:hover rect:not([fill=transparent]), svg.viz .mark:hover path, svg.viz .mark:focus path { opacity:.8; }
svg.viz .mark.link { cursor:pointer; }
.donut { display:flex; gap:16px; align-items:center; flex-wrap:wrap; } .dleg { list-style:none; margin:0; padding:0; font-size:13px; }
.dleg li { margin:4px 0; } .dleg i, .legend i, .kd { display:inline-block; width:11px; height:11px; border-radius:3px; margin-right:6px; vertical-align:-1px; }
.kd { margin-left:8px; }
#viztip { position:fixed; z-index:50; background:#fff; border:1px solid var(--line); border-radius:8px; padding:6px 9px; font-size:12px; box-shadow:0 4px 14px rgba(0,0,0,.12); pointer-events:none; max-width:280px; }
#viztip b { display:block; font-size:13px; }
@media (max-width:640px) { .charts { grid-template-columns:1fr; } }
.drillable { cursor:pointer; } .kpi.drillable:hover { border-color:var(--brand); box-shadow:0 0 0 1px var(--brand) inset; }
.dleg li.drillable:hover { text-decoration:underline; }
.lflag { display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; border-radius:9px; color:#fff; font-weight:800; font-size:11px; vertical-align:-3px; }
.lflag.high { background:var(--high); } .lflag.med { background:var(--med); }
.pbar { display:inline-block; width:60px; height:8px; background:#eceff1; border-radius:4px; vertical-align:middle; overflow:hidden; } .pbar i { display:block; height:100%; border-radius:4px; }

/* Sync now button (header) */
header .syncbtn { background:rgba(255,255,255,.15); color:#fff; border:1px solid rgba(255,255,255,.4); border-radius:6px; padding:4px 10px; font:inherit; font-size:13px; cursor:pointer; margin-right:8px; }
header .syncbtn:disabled { opacity:.7; cursor:wait; } header .syncbtn.spin::first-letter { display:inline-block; }
#synctoast { position:fixed; right:16px; bottom:16px; background:#1f2d3d; color:#fff; padding:10px 14px; border-radius:8px; font-size:13px; z-index:50; max-width:340px; box-shadow:0 4px 14px rgba(0,0,0,.25); }

/* Owing report: one block per tenant type (NSFAS, PD, PA, NA, Standard) */
.type-blocks { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:10px; margin-bottom:14px; }
.type-block { display:block; background:#fff; border:1px solid var(--line, #dee2e6); border-left:5px solid var(--brand, #1f4e79); border-radius:10px; padding:10px 12px; color:inherit; text-decoration:none; }
.type-block:hover { box-shadow:0 2px 8px rgba(0,0,0,.1); } .type-block .tb-name { font-weight:700; font-size:15px; }
.type-block .tb-v { font-size:20px; font-weight:700; margin:2px 0; } .type-block .tb-l { font-size:12px; color:#6c757d; }
.rep-group { scroll-margin-top:90px; }
@media print { .type-blocks { grid-template-columns:repeat(5, 1fr); } .type-block { break-inside:avoid; } }

/* Collections this month: dial + two-colour bars (green collected, red still to collect) */
.cbar { position:relative; height:14px; background:#f1c0c0; border-radius:7px; overflow:hidden; min-width:80px; }
.cbar .cb-got { position:absolute; left:0; top:0; bottom:0; background:#2f9e44; border-radius:7px 0 0 7px; }
.tb-coll { margin-top:6px; } .tb-coll .cbar { height:10px; margin-bottom:3px; }
.coll-wrap { display:flex; gap:24px; align-items:center; flex-wrap:wrap; } .coll-dial { text-align:center; min-width:190px; }
.coll-tbl { flex:1; min-width:300px; border-collapse:collapse; } .coll-tbl td { padding:6px 8px; } .coll-tbl .cb-cell { width:50%; }
.coll-tbl .coll-total td { border-top:2px solid #dee2e6; } .okc { color:#2f9e44; } .badc { color:#f1c0c0; }
@media print { .coll-card { break-inside:avoid; } .cbar, .cb-got { -webkit-print-color-adjust:exact; print-color-adjust:exact; } }
