:root {
  --bg: #f5f4ef; --card: #fff; --ink: #1f2a27; --muted: #6b7773; --line: #e3e1d8;
  --green: #2a5242; --green-dark: #1e3b2f; --green-soft: #e6f0ea; --gold: #b08a3e; --gold-soft: #fbf3df;
  --avail: #3d9a6c; --avail-bg: #e4f4ea; --res: #c98a12; --res-bg: #fdf0cf;
  --pay: #2f6fb7; --pay-bg: #dfeafa; --sold: #3b4754; --sold-bg: #e4e7eb;
  --late: #c0392b; --late-bg: #fde5e2; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--green); }
h1 { font-size: 24px; margin: 0; letter-spacing: -.2px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .bold { font-weight: 600; } .num { font-variant-numeric: tabular-nums; }
.late { color: var(--late); } .ok { color: var(--avail); }

#app { display: flex; min-height: 100%; }
#sidebar { width: 248px; background: var(--green-dark); color: #e9e6da; padding: 14px 14px 20px; overflow-y: auto; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex: none; }
.brand { display: block; text-align: center; padding: 0 6px 16px; text-decoration: none; color: inherit; }
.brand img { width: 178px; max-width: 100%; display: block; margin: -14px auto -10px; }
.brand-sub { font-size: 11.5px; opacity: .7; letter-spacing: 1.5px; text-transform: uppercase; }
.new-sale { margin: 0 2px 8px; justify-content: center; font-size: 15px; padding: 11px; }
.side-earlier { display: block; text-align: center; margin: 0 2px 14px; font-size: 12.5px; color: #e9e6da; opacity: .8; text-decoration: none; } .side-earlier:hover { opacity: 1; text-decoration: underline; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: #dfe9e5; text-decoration: none; margin-bottom: 2px; }
#nav a:hover { background: rgba(255,255,255,.08); } #nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
#nav .ico { width: 20px; text-align: center; opacity: .85; }
.side-foot { margin-top: auto; font-size: 12px; opacity: .75; padding: 8px 6px 0; }
#main { flex: 1; padding: 26px 32px 60px; min-width: 0; max-width: 1280px; }
.loading { padding: 60px; color: var(--muted); }
.side-foot .me { font-size: 13px; opacity: 1; margin-bottom: 6px; } .side-foot > div:last-child { margin-top: 12px; }
#sidebar .side-out { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); color: #fff; } #sidebar .side-out:hover { background: rgba(255,255,255,.2); }
#copyLabel { background: #c0392b; color: #fff; text-align: center; font-weight: 600; font-size: 13px; padding: 5px 10px; position: sticky; top: 0; z-index: 50; }
body.labelled #sidebar { top: 28px; height: calc(100vh - 28px); }
body.signed-out #sidebar { display: none; }
body.signed-out #main { max-width: none; padding: 24px 16px; display: flex; align-items: center; justify-content: center; }
.login { width: 100%; max-width: 420px; }
.login img { width: 190px; display: block; margin: 0 auto 14px; border-radius: 16px; }
.login .card { padding: 26px 28px; box-shadow: 0 10px 30px rgba(30,59,47,.08); }
.login h1 { margin-bottom: 4px; } .login p { margin: 0 0 18px; }
.login .btn-lg { width: 100%; justify-content: center; margin-top: 4px; }
.login-err { background: var(--late-bg); color: var(--late); border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; font-size: 14px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .g4 { grid-template-columns: 1fr 1fr; } .g3, .g2 { grid-template-columns: 1fr; } #sidebar { width: 200px; } #main { padding: 20px 18px 60px; } }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #c9c6ba; background: #fbfaf6; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; } .btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; } .btn-gold:hover { background: #9c7223; border-color: #9c7223; }
.btn-danger { color: var(--late); } .btn-danger:hover { background: var(--late-bg); border-color: #efb9b2; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; } .btn-lg { padding: 12px 22px; font-size: 16px; }
.btn[disabled] { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--green); font: inherit; cursor: pointer; text-decoration: underline; }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; border-top: 4px solid var(--line); }
.stat .label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 2px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .value.money { font-size: 22px; } .stat .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat.c-avail { border-top-color: var(--avail); } .stat.c-res { border-top-color: var(--res); } .stat.c-pay { border-top-color: var(--pay); }
.stat.c-sold { border-top-color: var(--sold); } .stat.c-late { border-top-color: var(--late); } .stat.c-gold { border-top-color: var(--gold); } .stat.c-green { border-top-color: var(--green); }
a.stat { text-decoration: none; color: inherit; display: block; } a.stat:hover { box-shadow: 0 2px 10px rgba(0,0,0,.06); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.b-available { background: var(--avail-bg); color: #24714b; } .b-reserved { background: var(--res-bg); color: #8a5d05; }
.b-installment, .b-partial { background: var(--pay-bg); color: #1f528c; } .b-sold, .b-paid { background: #d9eedf; color: #1d6a43; }
.b-overdue, .b-default { background: var(--late-bg); color: #9d2b20; } .b-unpaid { background: #eee9dc; color: #6b5b2e; }
.b-cancelled { background: #e9e9e9; color: #666; } .b-doc { background: var(--gold-soft); color: #7d5a14; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #faf9f5; white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid #efede6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; } .tbl th.right, .tbl td.right { text-align: right; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: #faf9f4; }
.tbl tr.dim td { color: #999; }
.table-wrap { overflow-x: auto; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

.bar { height: 8px; border-radius: 99px; background: #ebe9e0; overflow: hidden; display: flex; min-width: 70px; }
.bar > i { display: block; height: 100%; } .bar.big { height: 14px; }
.seg-sold { background: var(--sold); } .seg-pay { background: var(--pay); } .seg-res { background: var(--res); } .seg-avail { background: var(--avail); } .seg-green { background: var(--green); } .seg-late { background: var(--late); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }

.notice { background: var(--gold-soft); border: 1px solid #ecd9a8; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.notice.red { background: var(--late-bg); border-color: #efb9b2; } .notice.green { background: var(--green-soft); border-color: #c4dcd2; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer; color: var(--muted); }
.tab:hover { border-color: #c9c6ba; } .tab.active { background: var(--green); border-color: var(--green); color: #fff; }
.tab .n { opacity: .75; font-weight: 500; margin-left: 4px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 200px; }

label.f { display: block; margin-bottom: 12px; } label.f > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #44504c; }
label.f small { color: var(--muted); font-weight: 400; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #cfccc0; border-radius: 8px; padding: 8px 10px; width: 100%; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(47,93,80,.35); border-color: var(--green); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 70px; resize: vertical; }
.frow { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.step { display: flex; gap: 14px; margin-bottom: 4px; } .step-n { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.step h2 { margin: 3px 0 2px; } .step p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.choice { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 14px; }
.choice label { border: 2px solid var(--line); border-radius: 11px; padding: 12px 14px; cursor: pointer; display: block; background: #fff; }
.choice label:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.choice input { position: absolute; opacity: 0; } .choice b { display: block; } .choice span { font-size: 13px; color: var(--muted); }
.pay-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr 1fr 1.25fr auto; align-items: end; } .pay-row > button { margin-bottom: 15px; }
details.more { margin: 2px 0 14px; } details.more > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: #44504c; padding: 4px 0 10px; } details.more small { color: var(--muted); font-weight: 400; }
.summary-box { background: #faf9f5; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }

/* lot map */
.map-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; padding: 6px; }
.map-wrap svg { display: block; }
.plan .parcel { fill: #f3f1e8; stroke: #a9a594; stroke-width: 1.2; } .plan .road { fill: #dcd9cd; stroke: #b9b5a4; stroke-width: 1; }
.plan .outside { fill: #ebe9e0; stroke: #c9c5b5; stroke-width: 1; stroke-dasharray: 6 5; }
.plan .boundary { fill: none; stroke: #4c5a55; stroke-width: 3.5; stroke-linejoin: round; }
.plan text { font-family: inherit; pointer-events: none; } .plan .t-road { font-size: 15px; fill: #8a8674; letter-spacing: 1px; } .plan .t-blk { font-size: 19px; fill: #5f6b66; font-weight: 700; }
.plan .t-sub { font-size: 13px; fill: #8a8f8b; }
.plan .blk-click { cursor: pointer; } .plan .blk-click:hover .parcel { fill: #ece9db; }
.plan .lot rect { stroke: #fff; stroke-width: 1.5; cursor: pointer; } .plan .lot:hover rect { stroke: #1f2a27; stroke-width: 2.5; }
.plan .lot text { font-size: 15px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.plan .lot.dimmed { opacity: .18; }
.s-available rect, .tile.s-available { fill: #bfe3cd; background: #bfe3cd; } .s-available text { fill: #1c5a3b; }
.s-reserved rect, .tile.s-reserved { fill: #f6d98b; background: #f6d98b; } .s-reserved text { fill: #6f4b04; }
.s-installment rect, .tile.s-installment { fill: #9cc0ec; background: #9cc0ec; } .s-installment text { fill: #173f6d; }
.s-sold rect, .tile.s-sold { fill: #55626f; background: #55626f; } .s-sold text { fill: #fff; }
.s-overdue rect, .tile.s-overdue { fill: #ee9c92; background: #ee9c92; } .s-overdue text { fill: #7b1d14; }
.tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.tile { width: 62px; border-radius: 8px; padding: 6px 4px; text-align: center; cursor: pointer; border: 2px solid transparent; font-variant-numeric: tabular-nums; }
.tile:hover { border-color: #1f2a27; } .tile b { display: block; font-size: 15px; } .tile small { font-size: 11px; opacity: .8; }
.tile.s-sold { color: #fff; }
#tip { position: fixed; z-index: 60; background: #1f2a27; color: #fff; padding: 7px 11px; border-radius: 8px; font-size: 13px; pointer-events: none; max-width: 260px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }

/* charts */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.chart .bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; border-bottom: 1px solid var(--line); }
.chart .bars i { width: 42%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 0; display: block; }
.chart .m { font-size: 11.5px; color: var(--muted); margin-top: 5px; white-space: nowrap; }

/* modal + toast */
.overlay { position: fixed; inset: 0; background: rgba(25,35,31,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; } .modal-body { padding: 18px 20px; } .modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.x { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1f2a27; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 380px; }
.toast.err { background: var(--late); }

.hero { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.hero h1 { font-size: 26px; } .hero .who { font-size: 17px; margin-top: 2px; }
.filelist { list-style: none; margin: 0; padding: 0; } .filelist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #efede6; } .filelist li:last-child { border: 0; }
.filelist .fi { width: 34px; height: 40px; border-radius: 6px; background: var(--gold-soft); color: #7d5a14; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.filelist .grow { flex: 1; min-width: 0; } .filelist a { font-weight: 600; text-decoration: none; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; } .timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.timeline time { color: var(--muted); font-size: 12px; display: block; }

/* printing (receipts, statements) */
/* phones */
@media (max-width: 720px) {
  #app { display: block; }
  #sidebar { position: static; width: auto; height: auto; padding: 8px 10px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; overflow: visible; }
  body.labelled #sidebar { top: 0; height: auto; }
  .brand { padding: 0; } .brand img { width: 62px; margin: -6px 0; } .brand-sub { display: none; }
  .new-sale { margin: 0 0 0 auto; padding: 8px 12px; } .side-earlier { display: none; }
  .pay-row { grid-template-columns: 1fr 1fr; gap: 0 12px; padding-bottom: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--line); } .pay-row > button { justify-self: start; margin-bottom: 8px; }
  #nav { display: flex; overflow-x: auto; width: 100%; gap: 2px; } #nav a { white-space: nowrap; padding: 8px 10px; margin: 0; }
  .side-foot { width: 100%; display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 0; padding: 4px 2px 0; }
  .side-foot .me { margin: 0; } .side-foot > div:last-child { display: none; }
  #main { padding: 14px 12px 50px; }
  .g4 { grid-template-columns: 1fr 1fr; }
}
#printArea { display: none; }
@media print {
  #app, #modalRoot, #toasts, #tip { display: none !important; }
  #printArea { display: block; font: 12pt/1.4 Georgia, "Times New Roman", serif; color: #000; }
  body { background: #fff; }
  .p-head { text-align: center; margin-bottom: 14pt; } .p-logo { width: 1.45in; height: 1.45in; display: block; margin: 0 auto 6pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; } .p-head h1 { font-size: 16pt; letter-spacing: 1px; } .p-head div { font-size: 10pt; }
  .p-title { text-align: center; font-size: 14pt; font-weight: bold; letter-spacing: 2px; margin: 10pt 0; }
  .p-tbl { width: 100%; border-collapse: collapse; font-size: 10pt; margin: 8pt 0; } .p-tbl th, .p-tbl td { border: .75pt solid #888; padding: 3pt 6pt; text-align: left; } .p-tbl th { background: #eee; }
  .p-tbl .r { text-align: right; } .p-kv td { padding: 2pt 10pt 2pt 0; vertical-align: top; } .p-kv td:first-child { font-weight: bold; white-space: nowrap; }
  .p-sign { margin-top: 40pt; display: flex; justify-content: space-between; } .p-sign div { width: 45%; text-align: center; border-top: .75pt solid #000; padding-top: 3pt; font-size: 10pt; }
  .p-box { border: 1pt solid #000; padding: 14pt 18pt; } .p-note { font-size: 9pt; color: #444; margin-top: 10pt; }
  @page { margin: 0.7in; }
}
