:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172a22;
  background: #f5f7f3;
  font-synthesis: none;
  --muted: #596960;
  --border: #dee6de;
  --green: #245c43;
  --dark: #162d25;
  --lime: #d3efab;
  --white: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button[disabled] { cursor: default; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #377454;
  outline-offset: 3px;
}
button { color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 31px 17px 20px;
  background: var(--dark);
  color: #e9f1e8;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  margin: 0 7px 14px;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
  color: #f3f8f0;
  font-size: 1.15rem;
  font-weight: 720;
  letter-spacing: -.025em;
  line-height: 1.1;
}
.brand-mark {
  display: inline-grid !important;
  place-items: center;
  width: 43px !important;
  height: 43px !important;
  border-radius: 12px;
  background: var(--lime);
  color: #1d422f;
}
.brand-mark canvas { width: 24px; height: 24px; }
.building-address { margin: 0 7px 29px; color: #b8cdbf; font-size: .79rem; line-height: 1.4; }
.navigation { display: grid; gap: 6px; }
.navigation button, .backup-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 45px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  background: transparent;
  color: #c4d5c9;
  font-size: .92rem;
  font-weight: 550;
  white-space: nowrap;
}
.navigation button:hover, .backup-link:hover { background: #213e32; color: #f2f7ef; }
.navigation button[aria-current] { background: #2a4738; border-color: #3a5543; color: var(--lime); font-weight: 680; }
.sidebar :focus-visible { outline-color: var(--lime); }
.sidebar-footer { margin-top: auto; }
.backup-link { width: 100%; }
.sidebar-footer p {
  margin: 13px 3px 0;
  padding: 16px 5px 0;
  border-top: 1px solid #3b5046;
  color: #b8cdbf;
  font-size: .76rem;
  white-space: nowrap;
}
.local-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #a9d68b; }

.main { width: 100%; max-width: 1510px; margin: 0 auto; padding: 33px clamp(22px, 3.2vw, 52px) 48px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 24px; }
h1 { font-size: clamp(1.7rem, 3vw, 2.13rem); font-weight: 760; letter-spacing: -.045em; }
h2 { font-size: 1.22rem; font-weight: 730; letter-spacing: -.026em; }
h3 { font-size: 1.02rem; font-weight: 720; letter-spacing: -.017em; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #244337;
  font-size: .88rem;
  font-weight: 670;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { background: #f0f5ef; border-color: #c4d4c7; }
.btn-primary { background: #285d46; color: white; border-color: #285d46; }
.btn-primary:hover { background: #1e4936; border-color: #1e4936; }
.btn-danger { background: #a23731; color: #fff; border-color: #a23731; }
.btn-danger:hover { background: #862c27; border-color: #862c27; }
.btn-small { min-height: 34px; padding: 6px 9px; }
.icon-button { width: 38px; min-height: 38px; padding: 0; }
[data-icon] { display: inline-flex; flex: 0 0 auto; width: 18px; height: 18px; align-items: center; justify-content: center; }
[data-icon] canvas { width: 100%; height: 100%; display: block; }
.btn [data-icon] { width: 16px; height: 16px; }

.month-banner {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 190px;
  padding: 24px 29px;
  margin-bottom: 19px;
  border: 1px solid #285341;
  border-radius: 15px;
  background: linear-gradient(110deg, #1a3e30 0%, #234b39 54%, #305541 100%);
  color: white;
}
#building-illustration { position: absolute; z-index: -1; right: 0; top: 0; width: 56%; height: 100%; }
.month-text { display: grid; gap: 6px; }
.month-label { color: #d1e5d7; font-size: .89rem; font-weight: 580; }
.month-title { font-size: clamp(2.03rem, 4vw, 2.83rem); letter-spacing: -.05em; line-height: 1.08; font-weight: 730; }
.month-controls { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.month-controls .btn, .month-select select {
  background: #305644;
  color: #f5f9f2;
  border-color: #577661;
  min-height: 36px;
}
.month-controls .btn:hover, .month-select select:hover { background: #3b634e; border-color: #88a78b; }
.month-controls :focus-visible { outline-color: var(--lime); }
.month-select select { height: 36px; width: 154px; color-scheme: dark; }
.month-select [data-icon] { color: #ddeee0; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 23px; }
.metric { min-width: 0; padding: 15px 15px 16px; border: 1px solid var(--border); border-radius: 12px; background: white; }
.metric-header { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; font-weight: 630; }
.metric-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #edf2eb; color: #52705c; flex: 0 0 auto; }
.metric-icon [data-icon] { width: 16px; height: 16px; }
.metric-icon.green { background: #e7f2e3; color: #2e6948; }
.metric-icon.amber { background: #fbf0da; color: #896127; }
.metric strong { display: block; margin-top: 10px; font-size: clamp(1.18rem, 2vw, 1.6rem); font-weight: 755; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric em { color: var(--muted); font-size: .78rem; font-style: normal; font-weight: 620; letter-spacing: 0; }
.metric small { display: block; margin-top: 5px; color: var(--muted); font-size: .78rem; line-height: 1.35; }

.panel { background: white; border: 1px solid var(--border); border-radius: 13px; overflow: clip; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 19px; }
.panel-heading > div:first-child { min-width: 0; }
.panel-heading p { margin-top: 4px; color: var(--muted); font-size: .85rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search { display: flex; position: relative; align-items: center; }
.search [data-icon] { position: absolute; left: 10px; pointer-events: none; color: #64776a; width: 16px; height: 16px; }
input, select { min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid #d5dfd6; border-radius: 8px; background-color: white; color: #23392d; }
input::placeholder { color: #67776c; opacity: 1; }
.search input { width: 170px; padding-left: 32px; font-size: .88rem; }
select { appearance: none; padding-right: 32px; font-size: .88rem; }
.select { display: inline-flex; position: relative; align-items: center; }
.select [data-icon] { position: absolute; right: 9px; width: 15px; height: 15px; pointer-events: none; color: #54705e; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
th { padding: 11px 14px; background: #f0f4ee; color: #526357; font-size: .81rem; font-weight: 680; white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid #e8eee8; vertical-align: middle; }
tr > :first-child { padding-left: 19px; }
tr > :last-child { padding-right: 19px; }
tr:last-child td { padding-bottom: 13px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.actions { text-align: right; white-space: nowrap; }
.resident-cell { display: flex; align-items: center; gap: 10px; }
.avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; background: #eaf1e7; color: #42604c; border-radius: 9px; font-size: .73rem; font-weight: 730; }
.avatar[data-tone="1"] { background: #e6ecf5; color: #415772; }
.avatar[data-tone="2"] { background: #f5ede1; color: #735a36; }
.avatar[data-tone="3"] { background: #eee9f4; color: #655079; }
.person-button, .link-button { border: 0; background: transparent; padding: 0; color: #234e3a; font-weight: 690; text-align: left; }
.person-button:hover, .link-button:hover { text-decoration: underline; }
.subvalue { display: block; color: var(--muted); font-size: .77rem; margin-top: 3px; white-space: normal; }
.balance-due { color: #875223; font-weight: 720; }
.credit { color: #2c684b; font-weight: 690; }
.badge { display: inline-block; border-radius: 6px; padding: 4px 7px; font-size: .75rem; font-weight: 670; white-space: nowrap; background: #eef1ed; color: #58665c; }
.badge.paid { background: #e8f4e5; color: #2e6342; }
.badge.due { background: #f9eddb; color: #7d5422; }
.badge.partial { background: #faf3da; color: #76591c; }
.badge.credit { background: #e7f2f3; color: #265f68; }
.row-button { padding: 4px 0; }
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 31px 18px 34px; color: var(--muted); }
.empty h3 { color: #243f30; }
.empty p { line-height: 1.5; max-width: 48ch; font-size: .93rem; }
.empty .btn { margin-top: 5px; }
.empty-icon { display: inline-grid; place-items: center; width: 43px; height: 43px; border-radius: 12px; background: #eaf2e7; color: #467459; margin-bottom: 3px; }
.empty-icon [data-icon] { width: 23px; height: 23px; }
.loading { padding: 24px 0; color: var(--muted); }

#modal { width: min(calc(100% - 24px), 510px); max-height: calc(100dvh - 28px); padding: 0; border: 1px solid var(--border); border-radius: 15px; color: #172a22; background: #fff; box-shadow: 0 20px 70px #112c2240; }
#modal.wide { width: min(calc(100% - 24px), 720px); }
#modal::backdrop { background: #10251c82; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; padding: 19px 21px 14px; gap: 13px; }
.dialog-heading h2 { font-size: 1.29rem; }
.dialog-heading p { color: var(--muted); margin-top: 5px; font-size: .9rem; line-height: 1.4; }
.dialog-close { background: #f2f5f0; border-color: #e4eae3; width: 33px; min-height: 33px; flex: 0 0 auto; }
.form-body { display: grid; gap: 14px; padding: 4px 21px 18px; }
.form-body label { display: grid; gap: 6px; color: #304b3b; font-size: .88rem; font-weight: 650; }
.form-body input, .form-body select { width: 100%; font-size: 1rem; }
.form-body input[type="file"] { max-width: 100%; font-size: .88rem; }
.form-body .select { display: flex; }
.form-body .hint, .hint { color: var(--muted); font-size: .88rem; font-weight: 400; line-height: 1.48; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { margin: 0 21px 12px; padding: 9px 11px; border-radius: 7px; background: #faeae7; color: #8b302b; font-size: .86rem; line-height: 1.4; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 21px; border-top: 1px solid #e4ebe3; background: #f8faf7; }
.charges-list { display: grid; max-height: 45vh; overflow-y: auto; }
.charge-row { display: grid !important; grid-template-columns: minmax(0, 1fr) clamp(92px, 25vw, 144px); align-items: center; padding: 8px 0; border-bottom: 1px solid #edf1ed; }
.charge-row span { overflow-wrap: anywhere; }
.dialog-note { padding: 0 21px 16px; }
.dialog-table { margin-bottom: 15px; }
.dialog-table th, .dialog-table td { padding: 9px 10px; }
.dialog-table tr > :first-child { padding-left: 21px; }
.dialog-table tr > :last-child { padding-right: 21px; }
.toast { position: fixed; right: 24px; bottom: 23px; z-index: 4; width: max-content; max-width: calc(100% - 48px); padding: 11px 15px; display: flex; align-items: center; gap: 8px; background: #244c39; box-shadow: 0 6px 20px #16342629; color: white; border-radius: 9px; font-size: .91rem; line-height: 1.35; }
.toast.error { background: #8a332c; }

@media (max-width: 1200px) {
  .panel-heading { align-items: flex-start; }
  .panel-heading .toolbar { justify-content: flex-end; }
}
@media (max-width: 1070px) {
  .layout { grid-template-columns: 187px minmax(0, 1fr); }
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .main { padding-right: 23px; padding-left: 23px; }
  .metrics { gap: 9px; }
  .metric { padding-right: 10px; padding-left: 10px; }
  .metric-header { gap: 6px; }
  .metric-icon { width: 25px; height: 25px; }
  th, td { padding-right: 9px; padding-left: 9px; }
  .resident-cell { gap: 7px; }
}
@media (max-width: 850px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 18px 9px; display: grid; grid-template-columns: 1fr auto; gap: 11px 8px; }
  .brand { margin: 0; gap: 9px; font-size: 1rem; line-height: 1.01; }
  .brand-mark { width: 35px !important; height: 35px !important; border-radius: 9px; }
  .brand-mark canvas { width: 20px; height: 20px; }
  .building-address { display: none; }
  .navigation { grid-row: 2; grid-column: 1 / -1; display: flex; gap: 4px; overflow-x: auto; }
  .navigation button, .backup-link { min-height: 39px; }
  .sidebar-footer { margin: 0; }
  .sidebar-footer p { display: none; }
  .main { padding-top: 21px; }
}
@media (max-width: 600px) {
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .navigation button, .backup-link { padding: 0 7px; gap: 5px; font-size: .82rem; }
  .navigation [data-icon], .backup-link [data-icon] { width: 15px; height: 15px; }
  .main { padding: 18px 12px 30px; }
  .page-heading { margin-bottom: 15px; }
  h1 { font-size: 1.51rem; }
  .page-heading .btn { padding-right: 9px; padding-left: 9px; font-size: .79rem; }
  .month-banner { min-height: 157px; margin-bottom: 12px; padding: 18px 15px; }
  #building-illustration { width: 50%; opacity: .63; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 14px; }
  .metric { padding: 11px; }
  .metric strong { margin-top: 6px; }
  .panel-heading { flex-wrap: wrap; padding: 13px; }
  .panel-heading .toolbar { justify-content: flex-start; }
  .search input { width: 145px; }
  tr > :first-child { padding-left: 12px; }
  tr > :last-child { padding-right: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .monthly-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .monthly-table table, .monthly-table tbody { display: block; }
  .monthly-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; border-top: 1px solid #e8eee8; padding: 11px 13px; }
  .monthly-table td { min-width: 0; padding: 0; border: 0; }
  .monthly-table td:first-child { grid-column: 1 / -1; }
  .monthly-table td:last-child { grid-column: 2 / -1; }
  .monthly-table td.num { white-space: normal; text-align: left; overflow-wrap: anywhere; }
  .monthly-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: .75rem; }
  .monthly-table tr:last-child td { padding-bottom: 0; }
}

.review-note { color: var(--muted); min-width: 130px; overflow-wrap: anywhere; }
.date-cell { white-space: nowrap; }
.backup-download, .delete-link { margin-right: auto; }
.delete-link { color: #9a3c34; }

.allocation-context { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 13px; }
.allocation-context p { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.allocation-switch { display: flex; gap: 5px; }
.mode-selected { background: #e8f1e7; border-color: #bed4c1; }
.report-warning { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 13px; padding: 11px 13px; border: 1px solid #e8d6b3; border-radius: 9px; background: #fcf4e3; color: #70491e; font-size: .89rem; line-height: 1.4; }
.allocation-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric .collection-value { font-size: clamp(.91rem, 1.6vw, 1.33rem); letter-spacing: -.025em; }
.allocation-block { margin-bottom: 17px; }
.allocation-note { padding: 0 19px 13px; }
.expense-panel { border-top: 1px solid #e6ede6; }
.expense-panel summary { display: flex; align-items: center; gap: 8px; padding: 12px 19px; cursor: pointer; color: #244b38; font-size: .91rem; font-weight: 650; }
.expense-panel summary::before { content: '+'; display: inline-block; font-size: 1rem; text-align: center; width: 18px; }
.expense-panel[open] summary::before { content: '−'; }
.expense-panel summary strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.expense-panel tbody td { padding-top: 8px; padding-bottom: 8px; }
.allocation-total td { background: #edf4ed; font-weight: 700; }
.allocation-block .badge { margin-top: 4px; }
.expense-edit-group { min-width: 0; }
.expense-edit-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; }
.expense-input { display: grid; grid-template-columns: minmax(0, 1fr) 101px auto 34px; align-items: center; gap: 5px 8px; padding: 6px 0; }
.expense-input + .expense-input { border-top: 1px solid #e8ede8; }
.expense-input .included-input { display: flex; align-items: center; white-space: nowrap; }
.included-input input { min-height: auto; width: auto; accent-color: var(--green); }
.expense-input .expense-label-note { grid-column: 1 / 3; min-height: 32px; font-size: .87rem; }
#modal.unit-dialog { width: min(calc(100% - 24px), 1050px); }
.unit-edit-table { max-height: 57vh; border: 1px solid var(--border); border-radius: 9px; }
.unit-edit-table thead th { position: sticky; top: 0; }
.unit-edit-table td, .unit-edit-table th { padding: 7px; }
.unit-edit-table input, .unit-edit-table select { min-width: 83px; font-size: .9rem; }
.unit-edit-table tr > :first-child { min-width: 150px; }
.unit-edit-table tr > :nth-child(2) { min-width: 155px; }
.statement { padding: 2px 21px 18px; }
.statement-heading { padding-bottom: 14px; border-bottom: 2px solid #3c7353; }
.statement-heading p { color: var(--muted); font-size: .89rem; }
.statement-heading h2 { margin: 5px 0; font-size: 1.42rem; }
.statement-group { margin: 11px 0; }
.statement-group h3 { margin-bottom: 6px; }
.statement-group table th, .statement-group table td { padding: 4px 8px; }
.statement-share { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px; background: #edf4ed; font-size: .85rem; }
.statement-totals, .statement-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 7px 16px; margin: 7px 0; }
.statement-totals strong { color: var(--green); }
.statement-footer { font-size: .89rem; }
.statement .hint { margin-top: 4px; }
#print-area { display: none; }

@media (max-width: 600px) {
  .allocation-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .allocation-metrics .metric:last-child { grid-column: 1 / -1; }
  .expense-input { grid-template-columns: minmax(0, 1fr) 82px auto; }
  .expense-input > [data-field="label"] { grid-column: 1 / -1; }
  .expense-input .expense-label-note { grid-column: 1 / -1; }
  .expense-panel summary { padding-right: 12px; padding-left: 12px; }
}

@media print {
  @page { margin: 14mm; }
  body { min-width: 0; color: #151515; background: #fff; }
  body > :not(#print-area), #modal::backdrop { display: none !important; }
  #print-area { display: block; }
  .statement { padding: 0; }
  .statement-group { break-inside: avoid; }
  .statement table { font-size: .77rem; }
  .statement table th, .statement table td { padding: 2px 6px; color: #171717; }
  .statement-share { border-bottom: 1px solid #557662; }
}

.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 18px; }
.login-panel { width: min(100%, 430px); padding: 25px; }
.login-panel header p { margin-bottom: 5px; color: var(--muted); font-size: .86rem; }
.login-panel h1 { font-size: clamp(1.65rem, 5vw, 2rem); }
.login-panel form { display: grid; gap: 9px; margin-top: 20px; }
.login-panel form label { font-weight: 650; }
.login-panel form button { justify-self: start; margin-top: 4px; }
.login-error { color: #8b302b; font-size: .88rem; }
