/*
 * Abodify theme: palette, light/dark, type, the house-shaped sign-in and the little bits of motion.
 * Loaded AFTER app.css, so it only overrides app.css; it never has to be merged into it.
 *
 * The palette pairs trustworthy blue with warm gold and light green success accents.
 * Re-colour the site by changing the tokens below.
 */

@font-face {
    font-family: "Young Serif";
    src: url("../fonts/young-serif-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@media (pointer: coarse) {
    button, input[type="button"], input[type="submit"], input[type="reset"] { min-height: 44px; }
}
@font-face {
    font-family: "Figtree";
    src: url("../fonts/figtree-latin-wght-normal.woff2") format("woff2");
    font-weight: 300 900;
    font-style: normal;
    font-display: swap;
}

/* ---------- 1. Colours ---------- */

:root {
    color-scheme: light;

    --bg: #f4f8fc;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --text: #172235;
    --muted: #526174;
    --border: #d2deeb;
    --control-border: #808fa5;

    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --btn: #1d4ed8;
    --btn-hover: #1e40af;
    --button-text: #ffffff;
    --focus: #1d4ed8;

    --accent: #d9a521;
    --accent-hover: #b8860b;
    --accent-bg: #fff6dc;
    --accent-text: #342600;
    --accent-ink: #342600;

    --success: #7ccf9b;
    --ok-bg: #e9f8ef;
    --ok-text: #1f7a45;
    --info-bg: #e8efff;
    --info-text: #1e40af;
    --warn-bg: #fff0d7;
    --warn-text: #754100;
    --error-bg: #fde9ec;
    --error-text: #8f1d2c;
    --danger: #b4232f;
    --danger-hover: #8f1d2c;
    --disabled-bg: #e8edf4;
    --disabled-text: #526174;

    --door: #d9a521;
    --door-deep: #b8860b;
    --roof-1: #1d4ed8;
    --roof-2: #1e40af;
    --frame: #16326b;
    --glow: rgba(217, 165, 33, .38);
    --door-shadow: rgba(217, 165, 33, .24);
    --roof-shadow: rgba(23, 34, 53, .2);
    --win-off: #b8c5d6;
    --window-light: #fff0c2;
    --wall: #e8efff;
    --house-shadow: 0 22px 44px -26px rgba(23, 34, 53, .28);

    --radius: 12px;
    --unread: rgba(29, 78, 216, .06);
}

[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0d1726;
    --surface: #152338;
    --surface-2: #1c2e46;
    --text: #edf4ff;
    --muted: #b3c2d7;
    --border: #344860;
    --control-border: #6e829d;

    --primary: #9ac0ff;
    --primary-dark: #bdd4ff;
    --btn: #2d66d2;
    --btn-hover: #1d4ed8;
    --button-text: #ffffff;
    --focus: #f4ce68;

    --accent: #f0c75e;
    --accent-hover: #ffdc7f;
    --accent-bg: #3a311c;
    --accent-text: #fff0c2;
    --accent-ink: #342600;

    --success: #8ed8a8;
    --ok-bg: #153727;
    --ok-text: #a6e2b9;
    --info-bg: #1b3354;
    --info-text: #b7d0ff;
    --warn-bg: #452a14;
    --warn-text: #ffd1a3;
    --error-bg: #401d2a;
    --error-text: #ffb8c4;
    --danger: #c93a47;
    --danger-hover: #a92f3c;
    --disabled-bg: #26384d;
    --disabled-text: #b3c2d7;

    --door: #f0c75e;
    --door-deep: #d4a638;
    --roof-1: #4a86ef;
    --roof-2: #244b94;
    --frame: #0c1625;
    --glow: rgba(240, 199, 94, .68);
    --door-shadow: rgba(240, 199, 94, .28);
    --roof-shadow: rgba(0, 0, 0, .28);
    --win-off: #42556f;
    --window-light: #fff0c2;
    --wall: #1c2e46;
    --house-shadow: 0 24px 50px -24px rgba(0, 0, 0, .8);

    --unread: rgba(154, 192, 255, .08);
}

/* ---------- 2. Type ---------- */

body {
    font-family: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}
h1, h2, .brand {
    font-family: "Young Serif", Georgia, "Times New Roman", serif;
    font-weight: 400;
    letter-spacing: 0;
}
h1 { font-size: clamp(1.7rem, 4.5vw, 2.1rem); }
.hero h1 { font-size: clamp(2rem, 6vw, 2.9rem); line-height: 1.12; }
.hero p { max-width: 54ch; }
.card p, .muted { max-width: 70ch; }
[id] { scroll-margin-top: 76px; }
main.container { padding-top: 1.75rem; padding-bottom: 3rem; }   /* app.css .container shorthand zeroed the top padding */
input[type="checkbox"], input[type="radio"] { accent-color: var(--btn); }

/* ---------- 3. Header, brand, theme toggle ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--text); font-size: 1.5rem; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-mark .roof { fill: var(--roof-1); }
.brand-mark .wall { fill: var(--roof-2); }
.brand-mark .door { fill: var(--door); }
.nav-links { flex-wrap: wrap; justify-content: flex-end; gap: .35rem 1rem; }
.nav { min-height: 60px; height: auto; padding-top: .35rem; padding-bottom: .35rem; gap: .75rem; }

.theme-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    min-width: 44px;
    min-height: 44px;
    flex: none;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--control-border);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
}
.theme-toggle:hover { border-color: var(--primary); }
.theme-toggle svg { width: 20px; height: 20px; grid-area: 1 / 1; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html:not(.js) .theme-toggle { display: none; }

/* ---------- 4. Buttons, forms, status colours ---------- */

.btn, .btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
    display: inline-flex;
    min-width: 0;
    min-height: 44px;
    max-width: 100%;
    align-items: center;
    justify-content: center;
    padding: .6rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    box-sizing: border-box;
    font: inherit;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-align: center;
    text-decoration: none;
    white-space: normal;
    cursor: pointer;
}
.btn, .btn-primary { background: var(--btn); border-color: var(--btn); color: var(--button-text); }
.btn:hover, .btn-primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: var(--button-text); }
.btn-secondary, .btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-secondary:hover, .btn-outline:hover { background: var(--btn); border-color: var(--btn); color: var(--button-text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--button-text); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: var(--button-text); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--unread); color: var(--primary-dark); }
.btn-sm, .btn-small { min-height: 44px; padding: .4rem .8rem; font-size: .9rem; }
.btn-block { display: flex; width: 100%; margin-top: 1rem; }
.link-button { min-height: 44px; max-width: 100%; padding: .35rem .55rem; box-sizing: border-box; white-space: normal; }
.btn:disabled, .btn-primary:disabled, .btn-secondary:disabled, .btn-danger:disabled,
.btn-ghost:disabled, .btn[aria-disabled="true"], .btn-primary[aria-disabled="true"],
.btn-secondary[aria-disabled="true"], .btn-danger[aria-disabled="true"], .btn-ghost[aria-disabled="true"] {
    border-color: var(--control-border);
    background: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: not-allowed;
    transform: none;
}
.btn.is-loading, .btn-primary.is-loading, .btn-secondary.is-loading, .btn-danger.is-loading,
.btn-ghost.is-loading, .btn[aria-busy="true"], button.is-loading { display: inline-flex; align-items: center; gap: .55rem; cursor: wait; }
.btn.is-loading::before, .btn-primary.is-loading::before, .btn-secondary.is-loading::before,
.btn-danger.is-loading::before, .btn-ghost.is-loading::before, .btn[aria-busy="true"]::before,
button.is-loading::before {
    display: inline-block;
    width: .9rem;
    height: .9rem;
    flex: none;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    content: "";
    animation: button-spin .7s linear infinite;
}
@keyframes button-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .btn.is-loading::before, .btn-primary.is-loading::before, .btn-secondary.is-loading::before,
    .btn-danger.is-loading::before, .btn-ghost.is-loading::before, .btn[aria-busy="true"]::before,
    button.is-loading::before { animation: none; }
}
button, input[type="button"], input[type="submit"], input[type="reset"] { max-width: 100%; box-sizing: border-box; }
button:disabled, input:disabled {
    border-color: var(--control-border);
    background: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: not-allowed;
}
.filter-tabs .tab.active { background: var(--btn); border-color: var(--btn); color: var(--button-text); }
.photo-tag { background: var(--accent); color: var(--accent-ink); }
.nav-badge { background: var(--danger); color: var(--button-text); }
.link-button { color: var(--primary); }
a { color: var(--primary); }

.management-backlink {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem .9rem;
    margin: 0 0 .75rem;
}
.management-backlink-action {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: .35rem .65rem;
    border-radius: 8px;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}
.management-backlink-action:hover { background: var(--unread); }
.management-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem;
    margin: 0;
    padding: 0;
    color: var(--muted);
    font-size: .9rem;
    list-style: none;
}
.management-breadcrumbs li + li::before {
    content: "/";
    margin: 0 .35rem 0 .1rem;
    color: var(--muted);
}
.management-breadcrumbs a { text-decoration: none; }
.tenant-list-heading, .tenant-list .admin-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1.4fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
}
.tenant-list-heading {
    padding: 0 .9rem .45rem;
    color: var(--muted);
    font-size: .9rem;
}
.tenant-unit-cell { overflow-wrap: anywhere; }
.tenant-unit-fields, .tenant-movein-fields {
    min-width: 0;
    margin: 1rem 0;
    padding: .8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.tenant-unit-fields legend, .tenant-movein-fields legend { padding: 0 .35rem; font-weight: 700; }
.tenant-unit-status .stack { margin-top: 1rem; }
.receipt-page .management-backlink { max-width: 680px; margin: 0 auto .75rem; }
.badge-unpaid { background: var(--warn-bg); color: var(--warn-text); }
.badge-neutral { background: var(--border); color: var(--text); }
.rent-status { white-space: nowrap; }
.quick-payment { min-width: 150px; }
.quick-payment > summary { min-height: 44px; display: inline-flex; align-items: center; list-style: none; }
.quick-payment > summary::-webkit-details-marker { display: none; }
.quick-payment-form { min-width: 230px; padding: .75rem; margin-top: .5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.quick-payment-form label { margin-top: .55rem; }
.charge-status-note { display: block; margin-top: .3rem; padding: .35rem .5rem; border-left: 3px solid var(--door); color: var(--muted); background: var(--unread); overflow-wrap: anywhere; }
.tenant-charge-list { display: flex; flex-direction: column; }
.tenant-charge-row { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-top: 1px solid var(--border); }
.tenant-charge-row:first-child { border-top: 0; }
.tenant-charge-row p { margin: .2rem 0; }
.rent-month-form > div { flex: 1 1 180px; }
.rent-month-form select { min-width: 0; }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
select, textarea, input[type="number"], input[type="url"],
input[type="date"], input[type="month"], input[type="search"], .stack textarea {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--control-border);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:disabled, select:disabled { background: var(--disabled-bg); color: var(--disabled-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }

.cookie-banner {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    backdrop-filter: blur(14px);
}
.cookie-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: .85rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1rem;
}
.cookie-banner p {
    margin: 0;
    color: var(--text);
    font-weight: 600;
}
.cookie-banner-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .6rem;
}
.cookie-banner a {
    font-weight: 600;
}
@media (max-width: 540px) {
    .cookie-banner-inner {
        align-items: flex-start;
        flex-direction: column;
    }
    .cookie-banner-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.card, .property-card, .auth-card { border-color: var(--border); }
.grid > .card, .grid > article.card { margin-top: 0; }   /* app.css stacks .card + .card, which staggered the three home cards */
.property-card:hover { border-color: var(--primary); }

/* ---------- 5. The house: login, register and password pages ---------- */

.house {
    --eave: clamp(8px, 2.5vw, 22px);
    --h: clamp(88px, 23vw, 124px);
    max-width: 460px;
    margin: 1.5rem auto 1rem;
}
.house-roof {
    position: relative;
    height: var(--h);
    margin-inline: calc(var(--eave) * -1);
}
.house-roof::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        repeating-linear-gradient(0deg, rgba(0, 0, 0, .13) 0 1px, transparent 1px 13px),
        linear-gradient(160deg, var(--roof-1), var(--roof-2));
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.house-roof::after {          /* shadow the eaves throw on the wall */
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -7px;
    height: 7px;
    z-index: 3;
    background: linear-gradient(var(--roof-shadow), transparent);
    pointer-events: none;
}
.chimney {
    position: absolute;
    left: 67%;
    top: calc(var(--h) * .32 - 36px);
    width: clamp(16px, 4.6vw, 24px);
    height: 48px;
    z-index: 0;
    background: var(--roof-2);
    border-radius: 3px 3px 0 0;
    box-shadow: inset 0 4px 0 rgba(255, 255, 255, .16);
}
.attic {
    position: absolute;
    left: 50%;
    top: calc(var(--h) * .44);
    width: clamp(34px, 9.5vw, 46px);
    aspect-ratio: 1;
    transform: translateX(-50%);
    z-index: 2;
    border: 4px solid var(--frame);
    border-radius: 50%;
    background: radial-gradient(circle at 50% 45%, var(--window-light), var(--door));
    box-shadow: 0 0 20px 5px var(--glow);
}
.attic::before, .attic::after { content: ""; position: absolute; background: var(--frame); }
.attic::before { left: 50%; top: 0; bottom: 0; width: 3px; transform: translateX(-50%); }
.attic::after { top: 50%; left: 0; right: 0; height: 3px; transform: translateY(-50%); }

.house-body {
    position: relative;
    z-index: 2;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 14px 14px;
    padding: 1.6rem clamp(1.1rem, 5vw, 1.9rem) 1.75rem;
    box-shadow: var(--house-shadow);
}
.house-body h1 { text-align: center; margin: .25rem 0 .35rem; }
.house-body > p.muted { text-align: center; margin-inline: auto; }
.house-body form { margin-top: .75rem; }
.house-foot { margin: 1.25rem 0 0; text-align: center; }

/* The submit button is the front door: blue panels and a warm gold knob. */
.btn-door {
    position: relative;
    display: block;
    width: 100%;
    min-height: 48px;
    max-width: 100%;
    margin-top: 1.5rem;
    padding: .85rem 3rem .85rem 1rem;
    border: 2px solid var(--primary-dark);
    border-radius: 30px 30px 8px 8px;
    background: linear-gradient(var(--btn), var(--btn-hover));
    color: var(--button-text);
    font: inherit;
    font-weight: 800;
    letter-spacing: .01em;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.btn-door::after {
    content: "";
    position: absolute;
    right: 20px;
    top: 50%;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    border-radius: 50%;
    background: var(--door-deep);
    box-shadow: 0 0 0 3px var(--door-shadow);
}
.btn-door:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 8px 18px -10px var(--primary-dark); }
.btn-door:hover::after { background: var(--accent-hover); }
.btn-door:disabled, .btn-door[aria-busy="true"] { border-color: var(--control-border); background: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; }
.btn-door:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.btn-door:active { transform: translateY(1px); }

/* ---------- 6. Home page street ---------- */

.skyline { margin: 2.25rem 0 .5rem; }
.skyline svg { display: block; width: 100%; height: auto; overflow: visible; }
.sk-ground { stroke: var(--border); stroke-width: 3; stroke-linecap: round; }
.sk-wall { fill: var(--wall); }
.sk-roof-a { fill: var(--roof-1); }
.sk-roof-b { fill: var(--roof-2); }
.sk-door { fill: var(--door); }
.sk-win { fill: var(--door); }
.sk-win.off { fill: var(--win-off); }
[data-theme="dark"] .sk-win:not(.off) { filter: drop-shadow(0 0 5px var(--glow)); }

/* ---------- 7. Motion (only for people who have not asked for less) ---------- */

@media (prefers-reduced-motion: no-preference) {
    .house-roof { animation: roof-settle .55s cubic-bezier(.2, .8, .25, 1) both; }
    .attic { animation: lights-on .9s .45s ease-out both; }
    .sk-win:not(.off) { animation: win-on .55s ease-out both; animation-delay: calc(.5s + var(--i, 0) * 110ms); }

    .btn, .theme-toggle, .property-card, .tab { transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease; }
    .btn:active { transform: translateY(1px); }
    .property-card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -22px rgba(23, 34, 53, .28); }
    .theme-toggle svg { transition: transform .35s ease; }
    .theme-toggle:active svg { transform: rotate(40deg) scale(.9); }

    .theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
        transition: background-color .3s ease, color .3s ease, border-color .3s ease, fill .3s ease, box-shadow .3s ease !important;
    }
}
@keyframes roof-settle { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes lights-on {
    0%   { filter: brightness(.4) saturate(.5); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
    55%  { filter: brightness(1.25); }
    100% { filter: none; box-shadow: 0 0 20px 5px var(--glow); }
}
@keyframes win-on { from { fill: var(--win-off); filter: none; } to { fill: var(--door); } }

@media print {
    .theme-toggle, .skyline, .management-backlink { display: none !important; }
}
@media (max-width: 760px) {
    .tenant-list-heading { display: none; }
    .tenant-list .admin-row { grid-template-columns: 46px minmax(0, 1fr); }
    .tenant-list .tenant-unit-cell, .tenant-list .admin-row-action { grid-column: 2; }
    .tenant-unit-cell { margin-top: -.5rem; }
    .tenant-charge-row { flex-direction: column; }
    .quick-payment-form { min-width: min(230px, calc(100vw - 3rem)); }
}

/* ---------- 8. Authenticated application shell ---------- */

.app-shell, .app-main, .app-content { min-width: 0; }
.app-shell { min-height: 100vh; width: 100%; }
.app-main { display: flex; flex-direction: column; min-height: 100vh; }
.app-content.container {
    flex: 1;
    width: 100%;
    max-width: 1440px;
    padding: 1.5rem clamp(12px, 2.4vw, 36px) 3rem;
}
.app-footer .container { max-width: 1440px; }
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.app-topbar-inner {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 68px;
    max-width: 1600px;
    margin: 0 auto;
    padding: .5rem 1rem;
}
.sidebar-toggle, .sidebar-close, .sidebar-collapse, .topbar-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
}
.sidebar-toggle:hover, .sidebar-close:hover, .sidebar-collapse:hover, .topbar-icon-button:hover { border-color: var(--primary); }
.sidebar-toggle .nav-icon, .sidebar-close .nav-icon, .sidebar-collapse .nav-icon, .topbar-icon-button .nav-icon { width: 21px; height: 21px; }
.app-topbar-brand, .sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    flex: none;
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
}
.app-topbar-brand { font-size: 1.25rem; }
.app-topbar-brand .brand-mark { width: 26px; height: 26px; }
.app-page-title {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    color: var(--muted);
    font-size: .95rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-topbar-actions { display: flex; align-items: center; gap: .5rem; flex: none; }
.app-topbar-actions .theme-toggle { width: 44px; height: 44px; }
.notification-menu, .account-menu { position: relative; }
.notification-menu > summary, .account-menu > summary { list-style: none; cursor: pointer; }
.notification-menu > summary::-webkit-details-marker, .account-menu > summary::-webkit-details-marker { display: none; }
.topbar-icon-button { position: relative; }
.topbar-notification-badge, .sidebar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 20px;
    padding: 0 .3rem;
    border: 2px solid var(--surface);
    border-radius: 99px;
    background: var(--danger);
    color: var(--button-text);
    font-size: .72rem;
    font-weight: 800;
    line-height: 1;
}
.topbar-notification-badge { position: absolute; top: -4px; right: -5px; }
.notification-popover, .account-popover {
    position: absolute;
    top: calc(100% + .6rem);
    right: 0;
    z-index: 70;
    width: min(360px, calc(100vw - 24px));
    max-height: min(70vh, 560px);
    overflow: auto;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 16px 40px rgba(13, 23, 38, .2);
}
.notification-popover-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.notification-popover-heading h2 { margin: 0; font-size: 1.15rem; }
.notification-popover-heading form, .account-popover form { margin: 0; }
.notification-popover .notif-list { margin-top: .75rem; }
.notification-popover .muted { margin: .75rem 0 0; }
.account-menu > summary {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-height: 44px;
    padding: .15rem .4rem;
    border: 1px solid transparent;
    border-radius: 10px;
}
.account-menu[open] > summary, .account-menu > summary:hover { border-color: var(--border); }
.account-menu-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.role-badge { display: inline-block; padding: .1rem .45rem; border-radius: 99px; background: var(--unread); color: var(--primary); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.user-avatar {
    display: inline-grid;
    width: 34px;
    height: 34px;
    flex: none;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--unread);
    color: var(--primary);
    font-size: .9rem;
    font-weight: 800;
}
.account-popover { width: min(260px, calc(100vw - 24px)); }
.account-popover > a, .account-popover button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: .45rem .55rem;
    border-radius: 7px;
    color: var(--text);
    font: inherit;
    font-weight: 650;
    text-align: left;
    text-decoration: none;
}
.account-popover > a:hover, .account-popover button:hover { background: var(--unread); }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    display: flex;
    width: min(84vw, 300px);
    max-width: calc(100vw - 48px);
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 18px 48px rgba(13, 23, 38, .22);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
}
.app-sidebar.is-open { transform: translateX(0); visibility: visible; transition: transform .22s ease, visibility 0s; }
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(13, 23, 38, .58);
    cursor: pointer;
}
html.sidebar-drawer-open, html.sidebar-drawer-open body { overflow: hidden; }
.sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: .65rem .8rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand { min-width: 0; font-size: 1.35rem; }
.sidebar-brand .brand-mark { width: 28px; height: 28px; }
.sidebar-close { display: inline-flex; }
.sidebar-collapse { display: none; }
.sidebar-scroll { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: .75rem .65rem; }
.sidebar-navigation { display: flex; flex-direction: column; gap: 1rem; }
.sidebar-group-heading {
    margin: 0 0 .35rem;
    padding: 0 .65rem;
    color: var(--muted);
    font-family: inherit;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.sidebar-group ul { display: grid; gap: .15rem; margin: 0; padding: 0; list-style: none; }
.sidebar-link {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    gap: .75rem;
    padding: .5rem .65rem;
    border-left: 3px solid transparent;
    border-radius: 8px;
    color: var(--text);
    font-weight: 650;
    line-height: 1.25;
    text-decoration: none;
}
.sidebar-link:hover { background: var(--unread); color: var(--primary); }
.sidebar-link.is-active {
    border-left-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
    color: var(--primary);
    font-weight: 800;
}
.sidebar-link .nav-icon { width: 20px; height: 20px; flex: none; }
.sidebar-link-label { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.sidebar-badge { min-width: 22px; min-height: 22px; border: 0; }
.sidebar-lock { display: inline-flex; color: var(--muted); }
.sidebar-lock .nav-icon { width: 16px; height: 16px; }
.sidebar-locked-notice {
    margin: .4rem .3rem 0;
    padding: .8rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--unread);
    color: var(--text);
    font-size: .9rem;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .75rem;
    border-top: 1px solid var(--border);
}
.sidebar-user-details { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: .2rem; }
.sidebar-user-details strong { overflow: hidden; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-details .role-badge { width: fit-content; }
.sidebar-logout-form { margin: 0; }
.sidebar-logout {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .4rem .55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.sidebar-logout:hover { border-color: var(--primary); color: var(--primary); }
.sidebar-logout .nav-icon { width: 18px; height: 18px; flex: none; }
.public-content { min-width: 0; }

@media (max-width: 767px) {
    .app-topbar-inner { gap: .4rem; min-height: 62px; padding: .45rem .5rem; }
    .sidebar-toggle { order: 1; }
    .app-topbar-brand { order: 2; }
    .app-topbar-actions { order: 3; }
    .app-topbar-brand { gap: .3rem; font-size: 1.13rem; }
    .app-topbar-brand .brand-mark { width: 23px; height: 23px; }
    .app-page-title { display: block; order: 4; flex: 1 0 100%; padding-left: 2px; font-size: .82rem; }
    .app-topbar-actions { gap: .25rem; margin-left: auto; }
    .app-topbar-actions .theme-toggle, .topbar-icon-button { width: 44px; height: 44px; }
    .account-menu > summary { width: 44px; justify-content: center; padding: 0; }
    .account-menu-name, .account-menu-role { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
    .account-menu .user-avatar { width: 32px; height: 32px; }
    .app-content.container { padding-top: 1.15rem; }
    .app-footer .footer-compact-row { align-items: flex-start; }
}
@media (max-width: 360px) {
    .app-topbar-inner { gap: .25rem; padding-right: .4rem; padding-left: .4rem; }
    .app-topbar-brand { font-size: 1.02rem; }
    .app-topbar-brand .brand-mark { width: 21px; height: 21px; }
    .app-topbar-actions { gap: .15rem; }
}
@media (min-width: 1024px) {
    .app-shell { display: block; }
    .app-sidebar {
        width: 264px;
        max-width: none;
        transform: none;
        visibility: visible;
        box-shadow: none;
        transition: width .18s ease;
    }
    .sidebar-backdrop, .sidebar-toggle, .sidebar-close { display: none; }
    .sidebar-collapse { display: inline-flex; }
    .app-main { width: calc(100% - 264px); margin-left: 264px; transition: width .18s ease, margin-left .18s ease; }
    .sidebar-brand-row { padding-right: .6rem; }
    .sidebar-scroll { padding: .9rem .7rem; }
    .sidebar-user { padding: .8rem .65rem; }
    .sidebar-collapsed .app-sidebar { width: 76px; }
    .sidebar-collapsed .app-main { width: calc(100% - 76px); margin-left: 76px; }
    .sidebar-collapsed .sidebar-brand-row { justify-content: center; padding: .65rem .25rem; }
    .sidebar-collapsed .sidebar-brand-name,
    .sidebar-collapsed .sidebar-group-heading,
    .sidebar-collapsed .sidebar-link-label,
    .sidebar-collapsed .sidebar-user-details { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
    .sidebar-collapsed .sidebar-close { display: none; }
    .sidebar-collapsed .sidebar-collapse { transform: rotate(180deg); }
    .sidebar-collapsed .sidebar-link { justify-content: center; gap: 0; padding: .5rem .35rem; }
    .sidebar-collapsed .sidebar-lock { position: absolute; top: 1px; right: 1px; }
    .sidebar-collapsed .sidebar-lock .nav-icon { width: 13px; height: 13px; }
    .sidebar-collapsed .sidebar-badge { position: absolute; top: 1px; right: 1px; min-width: 17px; min-height: 17px; padding: 0 .2rem; font-size: .64rem; }
    .sidebar-collapsed .sidebar-user { flex-direction: column; padding: .7rem .2rem; }
    .sidebar-collapsed .sidebar-logout-form { width: 100%; }
    .sidebar-collapsed .sidebar-logout { width: 100%; padding: .4rem .2rem; }
}
@media (max-width: 1023px) {
    html:not(.js) .app-shell { display: flex; flex-direction: column; }
    html:not(.js) .app-sidebar {
        position: relative;
        inset: auto;
        width: 100%;
        max-width: none;
        max-height: 45vh;
        transform: none;
        visibility: visible;
        box-shadow: none;
    }
    html:not(.js) .sidebar-toggle, html:not(.js) .sidebar-close, html:not(.js) .sidebar-backdrop { display: none; }
    html:not(.js) .app-main { width: 100%; margin-left: 0; }
}
@media print {
    .app-sidebar, .app-topbar, .sidebar-backdrop { display: none !important; }
    .app-main { width: 100% !important; margin: 0 !important; }
    .app-content.container { max-width: none; padding: 0; }
}

@keyframes home-section-enter {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
@supports (animation-timeline: view()) {
    .home-reveal {
        animation: home-section-enter .55s both;
        animation-timeline: view();
        animation-range: entry 0% entry 30%;
    }
}
@media (prefers-reduced-motion: reduce) {
    .home-reveal { animation: none !important; opacity: 1; transform: none; }
    .home-property-card:hover, .home-benefit:hover { transform: none; }
}