:root {
  color-scheme: light;
  font-family: "Aptos", "Segoe UI", sans-serif;
  color: #20352c;
  background: #f6f7f2;
  --ink: #1d332a;
  --muted: #596b60;
  --green: #1c513f;
  --deep: #14382e;
  --line: #e3e8df;
  --paper: #fff;
  --accent: #cde7a6;
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid #669164; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
svg { display: block; flex-shrink: 0; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 244px; background: var(--deep); color: #ecf3ed; padding: 27px 17px 20px; display: flex; flex-direction: column; z-index: 2; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 7px 32px; width: fit-content; }
.brand > span { font-size: 23px; font-weight: 750; line-height: 1; letter-spacing: -.55px; }
.brand small { display: block; font-size: 9px; margin-top: 6px; color: #bfd0c4; letter-spacing: .16em; }
.workspace { display: flex; align-items: center; gap: 10px; border: 1px solid #3b594d; border-radius: 13px; padding: 11px; background: #1c4236; margin-bottom: 33px; }
.workspace-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #31564a; color: #d9e7d8; }
.workspace strong, .workspace small, .sidebar-footer small { display: block; }
.workspace strong { font-size: 13px; }
.workspace small, .sidebar-footer small { color: #b7c9bf; font-size: 11px; margin-top: 3px; }
.nav-label { color: #b1c4ba; margin: 0 11px 10px; font-size: 10px; font-weight: 750; letter-spacing: .14em; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 9px; color: #d3e0d7; font-weight: 600; font-size: 14px; transition: background .18s, color .18s; }
.sidebar nav a svg { width: 18px; height: 18px; }
.sidebar nav a:hover { background: #244a3d; }
.sidebar nav a[aria-current] { background: var(--accent); color: #15382e; font-weight: 750; }
.sidebar-footer { display: flex; align-items: start; gap: 9px; margin-top: auto; padding: 17px 8px 1px; border-top: 1px solid #3c594e; font-size: 12px; font-weight: 650; }
.live-dot { width: 7px; height: 7px; border-radius: 100%; background: #c9e49d; margin-top: 4px; }
.shell { margin-left: 244px; }
.topbar { height: 66px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 35px; font-size: 13px; background: #fafbf7; }
.breadcrumb { color: var(--muted); }
.breadcrumb span { margin: 0 8px; color: #89958b; }
.breadcrumb b { color: var(--ink); }
.today { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
.today svg { width: 16px; }
main { width: min(100%, 1480px); margin: 0 auto; padding: 33px 35px 48px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.kicker { font-size: 10px; letter-spacing: .15em; font-weight: 800; color: #476c57; line-height: 1.4; }
h1 { font-size: clamp(32px, 4vw, 49px); line-height: 1.03; letter-spacing: -.055em; margin: 7px 0 10px; font-weight: 780; }
.page-heading > div > p:last-child { font-size: 14px; line-height: 1.45; color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 14px; border: 1px solid transparent; border-radius: 8px; white-space: nowrap; font-size: 13px; font-weight: 700; transition: background .18s, transform .18s; }
.button svg { width: 17px; height: 17px; }
.button:active { transform: translateY(1px); }
.primary { background: var(--green); color: #fff; }
.primary:hover { background: #133d30; }
.secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.secondary:hover { background: #f2f5ef; }
.metrics { display: grid; grid-template-columns: 1.22fr repeat(3, 1fr); gap: 13px; margin-bottom: 16px; }
.metric { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); padding: 13px 15px 15px; display: grid; gap: 6px; align-content: space-between; }
.metric > div { display: flex; justify-content: space-between; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: #3e5a4a; }
.metric-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; background: #edf3eb; color: #3f6f58; flex-shrink: 0; }
.metric-icon svg { width: 16px; height: 16px; }
.metric > strong { font-size: clamp(18px, 2.2vw, 31px); letter-spacing: -.055em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.metric > small { font-size: 11px; color: var(--muted); }
.metric.featured { background: #1b4739; border-color: #1b4739; color: #f4faef; }
.featured > div, .featured > small { color: #d4e4d8; }
.featured .metric-icon { background: #315d4d; color: var(--accent); }
.insights { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 17px 11px; }
h2 { font-size: 20px; font-weight: 760; letter-spacing: -.035em; line-height: 1.16; margin-top: 4px; }
.period { border: 1px solid var(--line); background: #f7f9f4; color: var(--muted); border-radius: 7px; padding: 5px 8px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.chart { width: 100%; height: 228px; padding: 0 16px; }
.chart-grid path { stroke: #e8ede6; }
.chart text { fill: #607166; font: 12px "Aptos", "Segoe UI", sans-serif; }
.bar-in { fill: #2d654f; }
.bar-out { fill: #b8d58b; }
.chart-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; padding: 0 17px 15px; color: #41594b; font-size: 11px; }
.chart-legend span, .status-lines span { display: flex; align-items: center; gap: 7px; }
.chart-legend i, .dot { display: inline-block; width: 8px; height: 8px; border-radius: 3px; background: #2d654f; }
.chart-legend span:nth-child(2) i { background: #b8d58b; }
.chart-legend small { margin-left: auto; font-size: inherit; color: var(--muted); }
.donut { display: grid; place-items: center; position: relative; width: 143px; height: 143px; margin: 4px auto 8px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { stroke-width: 10; fill: none; }
.donut-base, .dot.clear { stroke: #e2ebde; background: #e2ebde; }
.donut-late, .dot.due { stroke: #2d654f; background: #2d654f; }
.donut-ahead, .dot.ahead { stroke: #b8d58b; background: #b8d58b; }
.donut > div { position: absolute; text-align: center; }
.donut strong { display: block; font-size: 30px; line-height: 1; letter-spacing: -.045em; }
.donut small { font-size: 11px; color: var(--muted); }
.status-lines { display: grid; gap: 0; padding: 0 17px 12px; font-size: 12px; color: #465d50; }
.status-lines span { padding: 5px 0; border-top: 1px solid #eef1ec; }
.status-lines b { margin-left: auto; color: var(--ink); }
.text-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 750; color: #255b45; border: 0; padding: 0; background: transparent; text-align: left; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.text-link svg { width: 15px; height: 15px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
th { background: #f8faf6; color: #536b5c; font-size: 11px; font-weight: 750; border-block: 1px solid #edf0eb; white-space: nowrap; }
td, th { padding: 10px 13px; }
td:first-child, th:first-child { padding-left: 17px; }
td:last-child, th:last-child { padding-right: 17px; }
td { border-bottom: 1px solid #edf0eb; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbf8; }
.row-button { border: 0; padding: 0; text-align: left; background: transparent; color: var(--ink); display: flex; align-items: center; gap: 9px; }
.row-button strong { display: block; font-weight: 750; }
.row-button:hover strong { text-decoration: underline; }
.row-button small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.table-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: #edf3e9; color: #42765e; flex-shrink: 0; }
.table-icon.out { background: #f5efea; color: #82583d; }
.table-icon svg { width: 16px; height: 16px; }
.date-cell { color: var(--muted); white-space: nowrap; }
.tag, .badge { display: inline-flex; align-items: center; gap: 6px; background: #eff3ed; border-radius: 6px; padding: 5px 7px; color: #405a4a; font-size: 11px; white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.due { color: #854224; background: #f8ebe3; }
.badge.ahead { color: #37582c; background: #e9f3df; }
.align-end { text-align: right; }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 750; }
.amount.in { color: #245e45; }
.amount.out { color: #694736; }
.toolbar { display: flex; align-items: stretch; gap: 9px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #fafbf8; }
.search svg { width: 16px; }
.search input { min-width: 0; width: 190px; padding: 8px 0; border: 0; background: transparent; font-size: 12px; }
.toolbar select { border: 1px solid var(--line); border-radius: 8px; background: #fafbf8; color: var(--ink); padding: 7px; font-size: 12px; }
.browse .panel-head { padding-bottom: 15px; }
.apartment-browser > .panel-head { padding: 0 0 15px; }
.apartment-directory { overflow: hidden; }
.lot-rows { margin: 0; padding: 0; list-style: none; }
.lot-row { display: grid; grid-template-columns: minmax(145px, 1fr) minmax(115px, 1.55fr) 110px 95px 18px; gap: 12px; align-items: center; padding: 9px 15px; }
.lot-row-heading { background: #eef3eb; color: var(--muted); font-size: 11px; font-weight: 750; }
.lot-open { width: 100%; background: var(--paper); color: var(--ink); border: 0; border-top: 1px solid var(--line); text-align: left; font-size: 13px; }
.lot-open:hover { background: #f7faf4; }
.lot-open:focus-visible { outline-offset: -2px; }
.lot-ident { display: flex; align-items: center; gap: 8px; }
.lot-ident small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.lot-owner { overflow-wrap: anywhere; }
.lot-due, .lot-row-heading span:nth-child(4) { text-align: right; }
.lot-arrow { color: var(--green); }
.lot-arrow svg { width: 17px; height: 17px; }
.contact-name small { color: var(--muted); font-size: 11px; }
.contact-name strong { font-size: 13px; font-weight: 750; }
.contact-channels { display: grid; gap: 5px; font-size: 12px; }
.contact-channels > * { display: flex; align-items: center; gap: 7px; min-width: 0; overflow-wrap: anywhere; }
.contact-channels svg, .contact-edit svg { width: 15px; height: 15px; }
.contact-channels a { color: #255b45; font-weight: 650; }
.contact-channels a:hover { text-decoration: underline; }
.missing-contact { color: var(--muted); }
.lot-contacts { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.lot-contacts li { padding: 9px 10px; border-radius: 8px; border: 1px solid #edf0ea; background: #f8faf6; }
.contact-name { display: flex; align-items: start; justify-content: space-between; gap: 8px; margin-bottom: 6px; overflow-wrap: anywhere; }
.contact-name small { display: block; margin-top: 2px; }
.contact-edit { flex-shrink: 0; background: var(--paper); }
.lot-address-book { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.lot-address-book .detail-section { flex-wrap: wrap; }
.current-owner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; }
.current-owner strong, .current-owner small { display: block; }
.current-owner strong { font-size: 16px; margin: 3px 0; overflow-wrap: anywhere; }
.current-owner small { font-size: 12px; color: var(--muted); }
.empty, .loading { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty svg { margin: 0 auto 8px; }
.loading span { display: block; height: 40px; margin: 9px 0; border-radius: 9px; background: #e9eee5; }
dialog { border: 1px solid var(--line); width: min(100% - 28px, 620px); max-height: 90dvh; border-radius: 18px; background: white; color: var(--ink); padding: 22px; box-shadow: 0 18px 80px #17382930; }
dialog::backdrop { background: #162d26a6; }
#details { width: min(100% - 28px, 760px); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 17px; }
.dialog-head h2 { font-size: 27px; }
.icon-button { background: #f4f7f2; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); padding: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid label { display: grid; gap: 5px; font-weight: 700; font-size: 13px; min-width: 0; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { min-width: 0; background: #fbfcfa; color: var(--ink); border: 1px solid #dce4da; padding: 9px; border-radius: 7px; font-weight: 400; }
.form-grid textarea { resize: vertical; }
.form-grid input[readonly] { background: #eef4e9; font-weight: 700; }
.tariff-quote { padding: 8px 10px; border-radius: 7px; background: #eef4e9; color: #355444; font-size: 12px; }
.muted { color: var(--muted); font-size: 12px; margin-top: 12px; }
#form-error, .form-error { color: #9d3829; font-size: 13px; margin-top: 7px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 15px; }
.detail-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 17px 28px; padding: 13px; background: #f0f5ed; border-radius: 10px; margin-bottom: 12px; }
.detail-summary small, .detail-summary strong { display: block; }
.detail-summary small { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.detail-summary strong { font-size: 18px; }
.lot-payment-action { margin-left: auto; }
.detail-section { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 18px 0 9px; }
.detail-section h3, .breakdown h3 { font-size: 15px; }
.metadata { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 13px; }
.metadata dd { margin: 0; }
.metadata dt { color: var(--muted); }
.source-note, .breakdown { background: #f7f9f4; border: 1px solid var(--line); padding: 11px; border-radius: 8px; margin-top: 10px; font-size: 13px; }
.breakdown summary { cursor: pointer; font-weight: 700; }
.breakdown p { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); }
.revisions { display: grid; gap: 9px; padding: 0; margin: 0; list-style: none; }
.revisions li { border: 1px solid var(--line); border-radius: 9px; padding: 12px; overflow-wrap: anywhere; }
.revisions time { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.revisions li > p { margin-bottom: 10px; font-weight: 650; font-size: 13px; }
.revision-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.undo-link { margin-top: 10px; }
.revisions tbody th { font-weight: 650; }
.revisions table td { min-width: 105px; }
.revisions table tr:last-child th { border-bottom: 0; }
.toast { position: fixed; z-index: 3; bottom: 20px; right: 20px; display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 9px; background: var(--deep); color: #fff; font-weight: 650; }
@media (max-width: 1150px) {
  .sidebar { width: 204px; }
  .shell { margin-left: 204px; }
  .topbar, main { padding-left: 22px; padding-right: 22px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .sidebar { position: static; width: 100%; padding: 13px 15px; }
  .brand { margin: 0 0 12px; }
  .brand img { width: 35px; height: 35px; }
  .brand > span { font-size: 19px; }
  .workspace, .nav-label, .sidebar-footer { display: none; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar nav a { padding: 8px 9px; font-size: 12px; white-space: nowrap; gap: 5px; }
  .sidebar nav a svg { width: 15px; height: 15px; }
  .shell { margin-left: 0; }
  .topbar { height: 46px; }
  .breadcrumb { display: none; }
  main { padding-top: 22px; }
}
@media (max-width: 600px) {
  .topbar, main { padding-left: 14px; padding-right: 14px; }
  .page-heading, .browse .panel-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .page-heading { margin-bottom: 17px; }
  .insights { grid-template-columns: 1fr; }
  .metrics { gap: 8px; }
  .metric { padding: 10px; }
  .metric > div { font-size: 11px; }
  .chart { height: auto; }
  .ledger table { min-width: 545px; }
  .toolbar { width: 100%; }
  .search { flex: 1; min-width: 0; }
  .search input { width: 100%; }
  .toolbar select { max-width: 45%; }
  .lot-row-heading { display: none; }
  .lot-open { grid-template-columns: minmax(0, 1fr) auto 17px; gap: 5px 8px; padding: 9px 11px; }
  .lot-ident { grid-area: 1 / 1; }
  .lot-owner { grid-area: 2 / 1; font-size: 12px; color: var(--muted); }
  .lot-status { grid-area: 2 / 2; justify-self: end; }
  .lot-due { grid-area: 1 / 2; }
  .lot-arrow { grid-area: 1 / 3 / 3; }
  .lot-rows li:first-child .lot-open { border-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

.report-header { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 14px; padding: 22px; }
.report-header h1 { font-size: clamp(26px, 4vw, 38px); margin: 7px 0; }
.report-header div > p:last-child { color: var(--muted); font-size: 13px; }
.report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.report-actions label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; }
.report-actions input { accent-color: var(--green); }
.report-totals { display: flex; flex-wrap: wrap; gap: 14px 30px; padding: 12px 22px; margin: 0; background: #eef4e9; }
.report-totals dt { color: var(--muted); font-size: 12px; }
.report-totals dd { margin: 3px 0 0; font-size: 18px; font-weight: 750; }
.report-table tbody th { background: transparent; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); font-size: inherit; }
.report-table tbody .report-building > * { background: #f0f4ee; border-block: 1px solid var(--line); font-size: 12px; }
.report-building span { color: var(--muted); font-weight: 400; }
.report-owner { overflow-wrap: anywhere; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.logout-button { min-height: 32px; padding: 5px 9px; }
.auth-page { min-height: 100dvh; display: grid; place-items: center; }
.auth-shell { width: min(100%, 490px); padding: 20px; }
.auth-card { padding: clamp(20px, 5vw, 34px); }
.auth-residence { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 750; color: var(--green); }
.auth-card h1 { font-size: clamp(26px, 5vw, 36px); margin: 16px 0 8px; }
.auth-form { grid-template-columns: 1fr; margin-top: 20px; }
.auth-form .primary { margin-top: 3px; }
.auth-description:empty, .auth-error:empty { display: none; }

@page payment-report {
  size: A4 portrait;
  margin: 12mm;
}
@media print {
  body:has(.payment-report) { background: #fff; min-height: 0; }
  body:has(.payment-report) :is(.sidebar, .topbar, dialog, .toast, .report-actions) { display: none !important; }
  body:has(.payment-report) .shell { margin: 0; }
  body:has(.payment-report) main { width: auto; padding: 0; }
  .payment-report { page: payment-report; border: 0; border-radius: 0; color: #172e25; }
  .payment-report .report-header { padding: 0 0 4mm; }
  .payment-report h1 { font-size: 21pt; }
  .payment-report .report-totals { padding: 2mm 0; margin-bottom: 3mm; border-block: 1px solid #a7b5ab; }
  .payment-report .report-totals dd { font-size: 12pt; }
  .payment-report .report-table { overflow: visible; }
  .payment-report table { font-size: 9pt; }
  .payment-report :is(td, th) { padding: 1.5mm 1.7mm; }
  .payment-report thead th { font-size: 8.5pt; white-space: normal; }
  .payment-report tbody { break-inside: avoid; }
  .payment-report tr { break-inside: avoid; }
  .payment-report .report-building > * { border-top: 1px solid #a7b5ab; }
  .payment-report .badge { padding: 0; color: inherit; background: transparent; font-size: inherit; }
  .payment-report .badge i { display: none; }
}
