@font-face { font-family: Cairo; font-style: normal; font-weight: 400 599; font-display: swap; src: url("assets/Cairo-Regular.ttf") format("truetype"); }
@font-face { font-family: Cairo; font-style: normal; font-weight: 600 900; font-display: swap; src: url("assets/Cairo-Bold.ttf") format("truetype"); }
:root {
    color-scheme: light;
    --canvas: #f5f4ef; --surface: #fff; --ink: #192d46; --muted: #4e6170;
    --line: #dcdedb; --soft: #edf3f3; --accent: #17595e; --accent-dark: #103f45;
    --navy: #192d46; --gold: #e4be80; --sidebar: 15.75rem;
    --radius: 1.05rem; --shadow: 0 4px 16px #192d4608;
    font: 100% Cairo, Tahoma, sans-serif; background: var(--canvas); color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 1.25rem; line-height: 1.5; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, p { margin: 0; }
small { font-size: 1.125rem; }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid #16856a; outline-offset: 3px; }
input, textarea, select {
    width: 100%; min-width: 0; min-height: 3rem; padding: .5rem .7rem;
    color: var(--ink); background: var(--surface); border: 1px solid #8baba0; border-radius: .6rem;
}
input::placeholder { color: #647d75; }
input[disabled], select[disabled] { background: var(--soft); }
input[inputmode="decimal"] { font-variant-numeric: tabular-nums; }
textarea { resize: vertical; }

.skip-link { position: fixed; inset-inline-start: .75rem; inset-block-start: .75rem; z-index: 6; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.sidebar { position: fixed; inset: 0 0 0 auto; z-index: 2; width: var(--sidebar); display: flex; flex-direction: column; overflow-y: auto; padding: 2rem 1rem 1.2rem; color: #f5f6f8; background: var(--navy); }
.brand { display: flex; align-items: center; gap: .8rem; padding: .15rem .3rem 1.5rem; border-bottom: 1px solid #ffffff27; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.43rem; line-height: 1.45; }
.brand small { color: #c7d2de; }
.brand-icon { width: 3rem; height: 3rem; display: flex; align-items: end; justify-content: center; gap: 3px; padding: .68rem .55rem; flex: none; border-radius: .8rem; background: var(--gold); }
.brand-icon i { width: 20%; height: 70%; border: 2px solid var(--navy); border-radius: 5px 5px 0 0; }
.brand-icon i:nth-child(2) { height: 100%; }
.brand-icon i:nth-child(3) { height: 55%; }
.sidebar nav { display: grid; gap: .4rem; margin-top: 1.5rem; }
.sidebar nav a { display: flex; align-items: center; gap: .8rem; min-height: 3.3rem; padding: .45rem .85rem; border-radius: .7rem; color: #dfE7ef; }
.sidebar nav a:hover { background: #ffffff10; }
.sidebar nav a[aria-current] { background: #e6d0a4; color: #232d39; font-weight: 700; }
#navigation-toggle { display: none; }
.nav-symbol, .period-icon { flex: none; width: 1.45rem; height: 1.45rem; background: currentColor; mask: var(--icon) center / contain no-repeat; }
.icon-ledger { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%224%22%20y%3D%223%22%20width%3D%2216%22%20height%3D%2218%22%20rx%3D%222%22%2F%3E%3Cpath%20d%3D%22M8%203v18m3-12h6m-6%204h6%22%2F%3E%3C%2Fsvg%3E"); }
.icon-expenses { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M5%203h14v18l-3-2-4%202-4-2-3%202V3Zm4%205h6m-6%204h6%22%2F%3E%3C%2Fsvg%3E"); }
.icon-units { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%2021h18M5%2021V7l9-4v18m0-12h5v12M8%2010h2m-2%204h2%22%2F%3E%3C%2Fsvg%3E"); }
.icon-admin { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%207h8m5%200h3M4%2017h3m5%200h8%22%2F%3E%3Ccircle%20cx%3D%2214.5%22%20cy%3D%227%22%20r%3D%222.5%22%2F%3E%3Ccircle%20cx%3D%229.5%22%20cy%3D%2217%22%20r%3D%222.5%22%2F%3E%3C%2Fsvg%3E"); }
.icon-report { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4%204v16h17M8%2016v-5m5%205V6m5%2010v-7%22%2F%3E%3C%2Fsvg%3E"); }
.icon-calendar { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.7%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Crect%20x%3D%223%22%20y%3D%225%22%20width%3D%2218%22%20height%3D%2216%22%20rx%3D%223%22%2F%3E%3Cpath%20d%3D%22M7%203v4m10-4v4M3%2010h18%22%2F%3E%3C%2Fsvg%3E"); }
.sidebar-foot { margin-top: auto; border-top: 1px solid #ffffff29; padding: .7rem .35rem 0; }
.sidebar-foot summary { color: #eef3f7; overflow-wrap: anywhere; }
.role-badge { display: inline-block; margin-inline-start: .45rem; padding: .08rem .5rem; border-radius: .45rem; color: #e9f0f7; background: #354962; font-size: 1rem; }
.sidebar-foot .button { margin-block-start: .35rem; }
main { margin-inline-start: var(--sidebar); }
.workspace { max-width: 104rem; margin-inline: auto; padding: clamp(1.5rem, 3vw, 3rem) clamp(1rem, 2.5vw, 3rem) 4rem; }

.work-header, .panel-heading {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem;
}
.work-header { padding-bottom: 1.2rem; border-bottom: 1px solid #ccd1d1; margin-bottom: 1.5rem; }
h1 { font-size: clamp(2rem, 3vw, 3rem); line-height: 1.45; font-weight: 700; }
#page-description { margin-top: .2rem; }
.header-actions, .period-bar, .month-controls, .admin-nav, .row-actions, .heading-group, .chart-key {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
}
.period-bar { flex-wrap: nowrap; gap: 0; border: 1px solid #a6b1b4; border-radius: .8rem; background: var(--surface); padding-inline: .6rem .15rem; }
.period-icon { color: var(--accent); }
.period-bar select, .period-bar input { border: 0; background: transparent; }
.period-bar input { border-radius: 0; border-inline-end: 1px solid var(--line); }

#month-picker { width: 9.25rem; }
#year-picker { width: 6.1rem; text-align: center; font-variant-numeric: tabular-nums; }
.count {
    display: inline-block; background: var(--soft); color: var(--accent-dark);
    padding: .27rem .68rem; border-radius: 2rem; font-size: 1.125rem; white-space: nowrap;
}

.button, .record, .text-button, .month-link {
    min-height: 3rem; padding: .45rem .85rem; border-radius: .65rem; border: 1px solid transparent;
    font-weight: 700; text-align: center;
}
.button { display: inline-flex; align-items: center; justify-content: center; }
.button.primary { color: #fff; background: var(--accent); box-shadow: 0 2px 5px #0d493a25; }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary, .record { color: var(--accent-dark); background: var(--surface); border-color: #aec8bb; }
.button.secondary:hover, .record:hover { background: var(--soft); }
.button.danger, .record.remove { color: #8e272e; background: #fff3f1; border-color: #e8b9b9; }
.button.danger:hover, .record.remove:hover { background: #fae2e1; }
.text-button, .month-link {
    background: none; color: var(--accent-dark); padding-inline: .2rem;
    font-size: 1.125rem; text-decoration: underline; text-underline-offset: .18em;
}

.metrics, .occupancy-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .9rem; margin-bottom: 1rem; }
.metric { position: relative; isolation: isolate; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; box-shadow: var(--shadow); padding: 1.1rem 1.4rem 1.25rem; }
.metric h2 { font-size: 1.15rem; font-weight: 700; color: var(--muted); }
.metric p { font-size: clamp(1.85rem,3.2vw,3.3rem); line-height: 1.4; font-weight: 700; overflow-wrap: anywhere; }
.metric.featured { background: var(--navy); color: #fff; border-color: var(--navy); }
.metric.featured h2, .metric.featured .money-unit { color: #f1d4a1; }
.metric.featured::before { content: ""; z-index: -1; position: absolute; inset: 0 30% 0 0; opacity: .5; background: repeating-radial-gradient(ellipse at 0 145%, transparent 0 14px, #93b6c52b 15px 16px, transparent 17px 24px); }
.metric .money-unit { color: var(--muted); }
.cash-strip { background: #e9eeed; border: 1px solid #d5dfdd; border-radius: .85rem; display: grid; grid-template-columns: 1.15fr 1fr 1fr; margin-bottom: 1.45rem; }
.cash-strip > div { min-width: 0; padding: .7rem 1.15rem; display: grid; gap: .25rem; align-content: center; }
.cash-strip > div + div { border-inline-start: 1px solid #cbd5d3; }
.cash-strip span { color: #40545a; font-size: 1.08rem; }
.cash-strip strong { font-size: 1.35rem; overflow-wrap: anywhere; }
.collection-progress > div { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
progress { appearance: none; accent-color: var(--accent); width: 100%; height: .52rem; border: 0; overflow: hidden; border-radius: 1rem; background: #c7d4d1; }
progress::-webkit-progress-bar { background: #c7d4d1; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 1rem; }
progress::-moz-progress-bar { background: var(--accent); }
.negative { color: #932f34; }
.metric.featured .negative { color: #ffced0; }

.money-unit { font-size: 1.125rem; font-weight: 450; }
bdi { font-variant-numeric: tabular-nums; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { padding: 1rem 1.2rem; }
.heading-group .count { color: var(--navy); background: #e9edf1; font-weight: 700; }
.month-controls .count { background: #eff1eb; color: #495547; }
.panel h2 { font-size: 1.5rem; }
.section-description { margin-bottom: 1rem; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .68rem 1rem; text-align: start; vertical-align: middle; border-top: 1px solid var(--line); }
thead th { font-size: 1.125rem; color: #334e45; background: #edf3ef; font-weight: 700; }
tbody th { font-weight: 500; }
tfoot { background: var(--soft); font-weight: 700; }
#year-months td, tfoot td { font-variant-numeric: tabular-nums; }
.tenant { display: block; font-weight: 750; overflow-wrap: anywhere; }
.details { display: block; color: var(--muted); font-size: 1.125rem; overflow-wrap: anywhere; }

.receipt-table { table-layout: fixed; }
.receipt-table th:first-child { width: 30%; }
#receipt-actions { width: 29%; }
.receipt-table:has(#receipt-actions[hidden]) th:first-child { width: 40%; }

.receipt-table #contracts tr.rent-paid { background: #eaf6ee; box-shadow: inset -.22rem 0 #39805a; }
.receipt-table #contracts tr.rent-late { background: #fff1ef; box-shadow: inset -.22rem 0 #b7545a; }
.tenant-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .6rem; }
.rent-status { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: 1.06rem; }
.rent-status::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; }
.rent-open .rent-status { color: #80561c; }
.rent-paid .rent-status { color: #185d3a; }
.rent-late .rent-status { color: #8f3035; }
.receipt-cell-label { display: none; }
summary { min-height: 3rem; padding-block: .55rem; color: var(--accent-dark); font-size: 1.125rem; font-weight: 700; }
.receipt-details[open] { flex-basis: 100%; }
.receipt-details dl {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .26rem .6rem;
    margin: 0; font-size: 1.125rem; overflow-wrap: anywhere;
}
.receipt-details dt { color: var(--muted); }
.receipt-details dd { margin: 0; white-space: pre-wrap; }
.quick-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; max-width: 23rem; }
.quick-controls input { background: #fff; }
.quick-options, .receipt-options { display: flex; flex-wrap: wrap; gap: 0 .65rem; }
.quick-options .text-button { text-decoration: none; }
.quick-options .text-button:hover { text-decoration: underline; }
.receipt-labeled, .admin-table td { overflow-wrap: anywhere; }
.inline-error, .form-error { color: #8e272e; font-size: 1.125rem; }
.form-error { margin-top: .45rem; padding: .45rem .65rem; border-radius: .5rem; background: #fff1ef; }
.notice {
    position: sticky; inset-block-start: .5rem; z-index: 1; width: fit-content; max-width: 100%;
    margin: 0 0 1rem; padding: .58rem .85rem; border: 1px solid #9ac4af; border-radius: .65rem;
    background: #eff8f2; color: #174934; box-shadow: var(--shadow);
}
.notice.error { color: #8e272e; background: #fff1ef; border-color: #e2aaaa; }
.notice button { margin-inline-start: .5rem; }

.expense-entry-form { margin: 0 1rem 1rem; padding: 1rem; border: 1px solid #d3dfdc; border-radius: .8rem; background: #eff4f1; }
.expense-fields { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto auto; align-items: end; gap: .55rem; }
.expense-fields label { display: grid; gap: .28rem; font-size: 1.125rem; font-weight: 650; }
.expense-entry-form details { border: 0; }
.expense-entry-form details[open] { padding-bottom: .65rem; }
.expense-table th:first-child { min-width: 7rem; }

.units-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; align-items: start; }
.unit-list { list-style: none; margin: 0; padding: 0; }
.unit-list li { display: flex; justify-content: space-between; gap: .5rem; padding: .7rem 1rem; border-top: 1px solid var(--line); }
.unit-status { align-self: start; border-radius: 2rem; padding: .12rem .55rem; background: #edf1ee; color: var(--muted); white-space: nowrap; font-size: 1.125rem; }
.unit-status.rented { background: #deefe2; color: #185d3a; }
.admin-nav { margin-bottom: 1rem; }

.admin-table .tenant-cell { min-width: 8rem; font-weight: 700; overflow-wrap: anywhere; }
.admin-nav { gap: .25rem; width: fit-content; max-width: 100%; background: #e8eae6; border-radius: .8rem; padding: .25rem; }
.admin-nav .button { border-color: transparent; background: transparent; }
.admin-nav .button[aria-current] { color: var(--navy); background: white; box-shadow: 0 1px 4px #182d4526; }

dialog {
    width: min(31rem, calc(100% - 1.5rem)); padding: 1.3rem; background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 65px #06291e55;
}
dialog::backdrop { background: #102b27a6; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: .55rem; }
.dialog-heading h2 { font-size: 1.55rem; }
.close { border: 0; background: var(--soft); color: var(--accent-dark); flex: 0 0 3rem; min-height: 3rem; border-radius: .65rem; font-size: 1.65rem; }
#receipt-context { color: var(--muted); margin: .35rem 0 .6rem; }
dialog label { display: block; margin: .6rem 0 .28rem; font-weight: 700; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .8rem; }
.form-disclosure { border-top: 1px solid var(--line); margin-top: .38rem; }
.form-disclosure > .dialog-actions { margin-top: 0; }
.form-fields { display: grid; gap: .68rem; }
.form-fields label { display: grid; gap: .22rem; margin: 0; font-weight: 650; }
.form-fields fieldset { min-width: 0; padding: .55rem .7rem .7rem; margin: 0; border: 1px solid var(--line); border-radius: .6rem; }
.form-fields fieldset > label + label { margin-top: .5rem; }
.form-fields legend { color: var(--accent); padding-inline: .25rem; font-weight: 700; }
.form-fields > .button { justify-self: start; }
#admin-fields { margin-top: .8rem; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: .35rem .6rem; max-height: 11rem; overflow: auto; }
.choice-grid label { display: flex; align-items: center; min-height: 3rem; gap: .45rem; font-weight: 500; overflow-wrap: anywhere; }
.choice-grid input { width: 1.35rem; height: 1.35rem; min-height: 0; flex: 0 0 auto; accent-color: var(--accent); }

.inline-note { display: grid; gap: .3rem; font-size: 1.125rem; margin: .35rem 0; }
#confirm-detail { margin: .7rem 0 1rem; }
.annual-chart { margin-bottom: 1.2rem; }
.chart-key { gap: 1rem; font-size: 1.075rem; color: var(--muted); }
.chart-key span::before { display: inline-block; content: ""; width: .8rem; height: .8rem; margin-inline-end: .4rem; border-radius: .2rem; background: #aab8c8; }
.chart-key span + span::before { background: var(--accent); }
.annual-bars { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); gap: .25rem; padding: .5rem 1.2rem 1rem; }
.chart-month { background: transparent; border: 0; color: var(--ink); min-width: 0; padding: .2rem; font-size: 1.04rem; }
.chart-month:hover, .chart-month:focus-visible { background: #eef3f4; border-radius: .4rem; }
.chart-pair { display: flex; align-items: end; justify-content: center; gap: .22rem; height: 5rem; margin-bottom: .4rem; border-bottom: 1px solid #a8b5be; background: repeating-linear-gradient(to top, transparent 0 calc(50% - 1px), #e3e7e9 calc(50% - 1px) 50%); }
.chart-pair i { width: min(32%,1rem); background: #aab8c8; border-radius: .25rem .25rem 0 0; }
.chart-pair i + i { background: var(--accent); }
.auth-shell { min-height: 100dvh; display: grid; place-items: center; padding: clamp(.8rem,4vw,3rem); background: #f1f0eb; }
.auth-card { display: grid; grid-template-columns: 1fr 1.15fr; width: min(100%,60rem); box-shadow: 0 18px 70px #172c4314; }
.auth-cover { position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 4rem; min-height: 29rem; padding: 2.5rem; color: white; background: var(--navy); }
.auth-cover p { color: #ebcb96; }
.facade { position: absolute; inset: 12% 8% 20% -20%; z-index: -1; display: flex; align-items: end; justify-content: end; gap: .55rem; transform: skewY(-12deg); opacity: .3; }
.facade i { width: 25%; height: 62%; border: 1px solid #b6cad4; background: repeating-linear-gradient(0deg,transparent 0 13px,#9db8c9 13px 14px,transparent 14px 24px),repeating-linear-gradient(90deg,transparent 0 16px,#9db8c9 16px 17px,transparent 17px 24px); }
.facade i:nth-child(2) { height: 90%; }
.facade i:nth-child(3) { height: 44%; }
.auth-content { align-self: center; padding: clamp(1.25rem,4vw,3rem); }
.auth-content h2 { font-size: 1.75rem; }
#auth-status { color: var(--muted); margin: .5rem 0 1.25rem; }
#auth-status.auth-error { color: #8e272e; }
.auth-content .button { justify-self: stretch; margin-top: .6rem; }
@media (prefers-reduced-motion: no-preference) {
    button, .sidebar nav a, .admin-nav a { transition: background-color .15s ease, box-shadow .15s ease; }
    dialog[open], main .workspace > section:not([hidden]) { animation: reveal .18s ease-out; }
    @keyframes reveal { from { opacity: .6; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
}

@media (max-width: 70rem) {
    :root { --sidebar: 13rem; }
    .workspace { padding-inline: 1.2rem; }
    th, td { padding-inline: .65rem; }
}
@media screen and (max-width: 57rem), screen and (max-width: 64rem) and (max-height: 30rem) {
    .sidebar { position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; width: auto; padding: .65rem .9rem .38rem; }
    .brand { border: 0; padding: 0; }
    .brand small { display: none; }
    .sidebar nav { grid-row: 2; grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .2rem; margin-top: .55rem; }
    .sidebar nav a { flex: 1 1 auto; justify-content: center; padding-inline: .35rem; font-size: 1.125rem; }
    .sidebar nav a[aria-current] { box-shadow: inset 0 -.19rem var(--gold); }
    .nav-symbol { width: 1.15rem; height: 1.15rem; }
    .sidebar-foot { border: 0; margin: 0; padding: 0; }
    .sidebar-foot summary { max-width: 9rem; min-height: 3rem; }
    main { margin: 0; }
    .workspace { padding: 1.1rem .85rem 2.4rem; }
}
@media (max-width: 60rem) {
    .annual-bars { grid-template-columns: repeat(6,minmax(0,1fr)); row-gap: .8rem; }
}
@media (max-width: 48rem) {
    .auth-card { grid-template-columns: 1fr; max-width: 32rem; }
    .auth-cover { min-height: 0; padding: 1.2rem 1.6rem; flex-direction: row; justify-content: flex-start; align-items: center; gap: 1rem; }
    .facade { inset: 0 45% -25% -15%; }
    .metrics, .occupancy-summary { gap: .55rem; }
}
@media (max-width: 54rem) {
    .receipt-table, #contracts { display: block; }
    .receipt-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    #contracts tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: .85rem .8rem; gap: .4rem .65rem; border-top: 1px solid var(--line); }
    #contracts th, #contracts td { display: block; width: auto; padding: 0; border: 0; overflow-wrap: anywhere; }
    #contracts th, .receipt-action { grid-column: 1 / -1; }
    #contracts td[colspan] { grid-column: 1 / -1; }
    .receipt-cell-label { display: block; font-size: 1.125rem; color: var(--muted); }
    .receipt-labeled > div { font-weight: 700; }
    .quick-controls { max-width: none; }
    .quick-options { gap: 0 .7rem; }
}
#jump-ledger { display: none; }
@media (max-width: 43rem) {
    #jump-ledger { display: inline-flex; }
    #month-title { scroll-margin-block-start: 1rem; }
    .work-header { padding-bottom: .8rem; }
    .sidebar { padding: .7rem .75rem .5rem; }
    .sidebar nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .1rem; }
    .sidebar nav:not(:has(#admin-link:not([hidden]))) { grid-template-columns: repeat(4,minmax(0,1fr)); }
    .sidebar nav a { flex-direction: column; gap: .1rem; line-height: 1.35; font-size: 1rem; text-align: center; }
    .metrics { grid-template-columns: 1fr 1fr; }
    .metrics .featured { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
    .cash-strip { grid-template-columns: 1fr 1fr; }
    .cash-strip > div { padding: .65rem .75rem; }
    .cash-strip .collection-progress { grid-column: 1/-1; border-bottom: 1px solid #cbd5d3; }
    .cash-strip > :nth-child(2) { border-inline-start: 0; }
    .cash-strip .collection-progress > div { justify-content: flex-start; }
    .annual-bars { padding-inline: .5rem; }
    .chart-month { font-size: 1rem; }
    .expense-entry-form { margin-inline: .65rem; }
    .chart-key, .rent-status { font-size: 1.05rem; }

    .work-header { gap: .55rem; margin-bottom: .8rem; }
    .header-actions { gap: .42rem; }
    #month-picker { width: 7.35rem; }
    #year-picker { width: 4.85rem; }
    .metric { padding: .62rem .54rem .72rem; }
    .metric p { line-height: 1.25; }
    .metric .money-unit { font-size: 1rem; }
    .panel-heading { padding: .55rem .8rem; }
    .expense-fields { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
    .expense-entry-form { padding-inline: .75rem; }
    .expense-table th, .expense-table td { padding-inline: .48rem; }
    th, td { padding-block: .55rem; }
}
@media (max-width: 24rem) {
    .brand strong { font-size: 1.15rem; }
    .brand-icon { width: 2.25rem; height: 2.25rem; }
    .sidebar-foot summary { max-width: 6.75rem; }
    .header-actions .button { padding-inline: .55rem; }

}


@media screen and (max-width: 43rem) {
    .admin-table, .admin-table tbody, #annual-data table, #year-months, #year-total { display: block; }
    .admin-table thead, #annual-data thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
    .admin-table tr, #annual-data tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem 1rem; padding: .75rem .9rem; border-top: 1px solid var(--line); }
    .admin-table th, .admin-table td, #annual-data th, #annual-data td { padding: 0; border: 0; }
    .admin-table th, #annual-data th { flex-basis: 100%; }
    .admin-table th:empty { display: none; }
    td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 1rem; }
    .admin-table td:has(.row-actions) { margin-inline-start: auto; }
    #annual-data td { flex: 1 1 5rem; overflow-wrap: anywhere; }
}

.period-bar #year-picker { min-width: 6rem; border-inline-start: 1px solid var(--line); border-radius: 0; }
.report-note { padding: .8rem 1rem; }
.report-detail { padding: clamp(.8rem, 2vw, 1.4rem); margin-block: 1rem; }
.report-detail h2 { margin-block-end: .6rem; }
.report-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .85rem; align-items: end; margin-block-end: .8rem; }
.report-form label { display: grid; gap: .3rem; font-weight: 700; }
.report-form p { grid-column: 1 / -1; }
.report-form p:empty { display: none; }
.calendar-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.calendar-month { display: grid; align-content: start; gap: .28rem; text-align: start; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-inline-start: .3rem solid #7a8997; border-radius: .8rem; padding: .75rem; min-width: 0; }
.calendar-month > strong { font-size: 1.3rem; }
.calendar-month > span { font-size: 1.07rem; overflow-wrap: anywhere; }
.calendar-month.paid { background: #eaf6ee; border-inline-start-color: #39805a; }
.calendar-month.partial { background: #fff5da; border-inline-start-color: #a87525; }
.calendar-month.unpaid { background: #fff1ef; border-inline-start-color: #b7545a; }
.calendar-month.future { background: #edf0f2; color: #425563; }
.calendar-month:hover, .calendar-month[aria-expanded="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.report-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: .55rem; margin-block: 1rem; }
.report-facts > div { padding: .6rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--soft); }
.report-facts dt { color: var(--muted); font-size: 1.05rem; }
.report-facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.report-table { table-layout: fixed; overflow-wrap: anywhere; }
.report-table th, .report-table td { vertical-align: top; padding: .6rem; }
.report-table th:first-child { width: 23%; }
.month-breakdown h3 { margin: 1rem 0 .4rem; }
#print-document { display: none; }
body:has(#export-view:not([hidden])) #print-document:not([hidden]) { display: block; margin: 0 max(1rem, 3vw) 2rem; margin-inline-start: calc(var(--sidebar) + max(1rem, 3vw)); padding: clamp(1rem, 3vw, 2rem); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
#print-document header { padding: 1rem; background: var(--navy); color: #fff; border-radius: .6rem; }
#print-document header p:first-child { color: #f1d4a1; }
.print-month { margin-top: 1.5rem; }
@media screen and (max-width: 57rem), screen and (max-width: 64rem) and (max-height: 30rem) {
    body:has(#export-view:not([hidden])) #print-document:not([hidden]) { margin-inline: 1rem; }
    .calendar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media screen and (max-width: 43rem) {
    .sidebar nav, .sidebar nav:not(:has(#admin-link:not([hidden]))) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-table, .report-table tbody { display: block; }
    .report-table thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
    .report-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
    .report-table td { border: 0; }
    .report-table td:has(.row-actions) { grid-column: 1 / -1; }
}
@media screen and (max-width: 20rem), screen and (max-width: 64rem) and (max-height: 30rem) {
    .sidebar { grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .65rem; }
    .sidebar-foot { grid-row: 1; grid-column: 2; }
    #navigation-toggle { display: inline-flex; grid-column: 1 / -1; justify-self: start; }
    .sidebar nav { grid-row: 3; grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr)); margin-top: 0; }
    .sidebar nav:not(:has(#admin-link:not([hidden]))) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr)); }
    #navigation-toggle[aria-expanded="false"] + nav { display: none; }
    .sidebar nav a { flex-direction: row; gap: .35rem; }
}
@media screen and (min-width: 120rem) and (min-height: 53rem) {
    :root { font-size: clamp(1.25rem, 1.04vw, 2rem); }
}
@page {
    size: A4;
    margin: 13mm;
    @bottom-center { content: counter(page) " / " counter(pages); direction: ltr; color: #4e6170; font: 9pt Cairo, sans-serif; }
}
@media print {
    html:has(#export-view:not([hidden])), body:has(#export-view:not([hidden])) { background: #fff; }
    body:has(#export-view:not([hidden])) > :not(#print-document) { display: none !important; }
    body:has(#export-view:not([hidden])) #print-document:not([hidden]) { margin: 0; padding: 0; border: 0; border-radius: 0; }
    #print-document { color: #192d46; font-size: 10pt; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    #print-document h1 { font-size: 21pt; }
    #print-document h2 { font-size: 15pt; margin-block: .45rem; }
    #print-document h3 { font-size: 12pt; }
    #print-document h2, #print-document h3 { break-after: avoid; }
    #print-document .details, #print-document .money-unit, #print-document th, #print-document dt { font-size: 9pt; }
    #print-document .report-facts { grid-template-columns: repeat(5, minmax(0, 1fr)); break-inside: avoid; }
    #print-document td, #print-document th { padding: 3px 6px; }
    #print-document tr { break-inside: avoid; }
    #print-document thead { display: table-header-group; }
    #print-document .report-note { padding: 0; }
    #print-document .print-month + .print-month { break-before: page; }
}
