:root {
    --primary: #4caf50;
    --primary-dark: #388e3c;
    --navy: #2c3e50;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --danger-bg: #fef2f2;
    --danger: #b91c1c;
    --shadow: 0 10px 40px rgba(44, 62, 80, 0.1);
    --radius: 14px;
    --font: 'Poppins', system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    width: 100%;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 4px 24px rgba(44, 62, 80, 0.06);
}

.site-header__bar {
    border-top: 3px solid var(--primary);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 0;
    gap: 1rem;
    width: 100%;
    min-height: 3.5rem;
}

.logo-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: var(--navy);
    min-width: 0;
    border-radius: 12px;
    padding: 0.2rem 0.35rem 0.2rem 0;
    margin: -0.2rem 0;
    transition: background 0.2s ease;
}

.logo-row:hover {
    text-decoration: none;
    background: rgba(76, 175, 80, 0.06);
}

.logo-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(145deg, #66bb6a 0%, var(--primary) 45%, var(--primary-dark) 100%);
    box-shadow:
        0 4px 16px rgba(56, 142, 60, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-mark-fallback {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.02em;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.logo-text-name {
    font-weight: 700;
    font-size: clamp(0.95rem, 2.5vw, 1.08rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(52vw, 14rem);
}

.logo-text-tag {
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--muted);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(58vw, 16rem);
}

@media (min-width: 480px) {
    .logo-text-name {
        max-width: 18rem;
    }

    .logo-text-tag {
        max-width: 20rem;
    }
}

.nav-desktop {
    display: flex;
    align-items: center;
}

.nav-desktop-list {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0.25rem;
    background: #f1f5f9;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
}

.nav-desktop-list li {
    margin: 0;
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.05rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    color: var(--navy);
    text-decoration: none;
    transition:
        color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.nav-pill:hover {
    color: var(--primary-dark);
    background: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

.nav-pill.is-active {
    color: #fff;
    background: linear-gradient(145deg, #66bb6a, var(--primary-dark));
    box-shadow: 0 2px 12px rgba(56, 142, 60, 0.35);
}

.nav-pill--cta {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid #cbd5e1;
}

.nav-pill--cta:hover {
    border-color: var(--primary);
    background: #fff;
}

.menu-toggle {
    display: none;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--navy);
    box-shadow: 0 1px 3px rgba(44, 62, 80, 0.06);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.menu-toggle:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.menu-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.menu-toggle__icon {
    width: 20px;
    height: 14px;
    position: relative;
    display: block;
}

.menu-toggle__line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition:
        transform 0.25s ease,
        opacity 0.2s ease,
        top 0.25s ease;
}

.menu-toggle__line:nth-child(1) {
    top: 0;
}

.menu-toggle__line:nth-child(2) {
    top: 6px;
}

.menu-toggle__line:nth-child(3) {
    top: 12px;
}

.menu-toggle.is-open .menu-toggle__line:nth-child(1) {
    top: 6px;
    transform: rotate(45deg);
}

.menu-toggle.is-open .menu-toggle__line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.menu-toggle.is-open .menu-toggle__line:nth-child(3) {
    top: 6px;
    transform: rotate(-45deg);
}

.nav-mobile-wrap {
    border-top: 1px solid #e8edf3;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
    animation: navMobileReveal 0.28s ease;
}

.nav-mobile-wrap[hidden] {
    display: none !important;
}

@keyframes navMobileReveal {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 0 1.15rem;
}

.nav-mobile-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: var(--navy);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease;
}

.nav-mobile-link i {
    width: 1.25rem;
    text-align: center;
    color: var(--muted);
    font-size: 1rem;
    transition: color 0.2s ease;
}

.nav-mobile-link:hover {
    background: #fff;
    border-color: #e2e8f0;
    text-decoration: none;
    color: var(--primary-dark);
}

.nav-mobile-link:hover i {
    color: var(--primary-dark);
}

.nav-mobile-link.is-active {
    background: rgba(76, 175, 80, 0.12);
    border-color: rgba(76, 175, 80, 0.35);
    color: var(--primary-dark);
}

.nav-mobile-link.is-active i {
    color: var(--primary-dark);
}

.nav-mobile-link--cta {
    margin-top: 0.25rem;
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.05);
}

.nav-mobile-link--cta:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(56, 142, 60, 0.12);
}

@media (max-width: 768px) {
    .nav-desktop {
        display: none;
    }

    .menu-toggle {
        display: flex;
    }
}

/* Hero */
.hero {
    position: relative;
    min-height: 460px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4.5rem 1.25rem;
    background: linear-gradient(120deg, #2c3e50 0%, #1e3a2f 45%, #2e7d32 100%);
    color: #fff;
    overflow: hidden;
}

.hero--photo {
    background-image:
        linear-gradient(115deg, rgba(44, 62, 80, 0.9) 0%, rgba(30, 58, 47, 0.78) 42%, rgba(46, 125, 50, 0.55) 100%),
        url('https://images.unsplash.com/photo-1545324418-cc1a3fa10c00?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
    pointer-events: none;
}

.hero-kicker {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.9;
}

.hero-lead {
    margin: 0 0 1.75rem;
    font-size: 1.05rem;
    opacity: 0.92;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

.hero-inner {
    position: relative;
    max-width: 720px;
}

.hero h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.75rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}

.btn-hero:hover {
    background: #66bb6a;
    text-decoration: none;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}

.btn-hero--outline {
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.85);
    color: #fff;
    box-shadow: none;
}

.btn-hero--outline:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.stat-chip--link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-chip--link:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 48px rgba(44, 62, 80, 0.16);
}

/* Hero stats strip */
.hero-stats {
    position: relative;
    z-index: 2;
    margin-top: -2.75rem;
    padding: 0 0 3rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
}

.stat-chip {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(44, 62, 80, 0.12);
    padding: 1.1rem 1.2rem;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.75rem;
    row-gap: 0.1rem;
    align-items: center;
    border: 1px solid #eef2f7;
}

.stat-chip-icon {
    grid-row: 1 / span 2;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #e8f5e9;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-chip-num {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.15;
}

.stat-chip-lbl {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
}

.stat-chip-warn .stat-chip-icon {
    background: #fff3e0;
    color: #e65100;
}

.stat-chip-warn .stat-chip-num {
    color: #c62828;
}

@media (max-width: 600px) {
    .hero-stats {
        margin-top: -1.5rem;
    }
}

/* Sections */
.section {
    padding: 4rem 0;
}

.section-alt {
    background: #fff;
}

.defaulter-criterion-label {
    color: var(--primary-dark);
    font-weight: 600;
}

.section-head {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-head h2 {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    color: var(--navy);
}

.section-head p {
    margin: 0;
    color: var(--muted);
    max-width: 42rem;
    margin-inline: auto;
}

/* Cards grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid #eef2f7;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 48px rgba(44, 62, 80, 0.12);
}

.card-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    border: 3px solid #e8f5e9;
    display: block;
}

.card-avatar.ph {
    background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
    color: #555;
    margin-inline: auto;
}

.card h3 {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
    color: var(--navy);
}

.card .role {
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Defaulters */
.card.warn {
    background: var(--danger-bg);
    border-color: #fecaca;
}

.card.warn .due {
    color: var(--danger);
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.badge-warn {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #fee2e2;
    color: var(--danger);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Finance summary */
.finance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    max-width: 900px;
    margin-inline: auto;
}

.fin-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid #eef2f7;
    text-align: center;
}

.fin-card .lbl {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 600;
}

.fin-card .num {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--navy);
    margin-top: 0.35rem;
}

.fin-card.highlight .num {
    color: var(--primary-dark);
}

.progress-bar {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    margin-top: 1.25rem;
    overflow: hidden;
    max-width: 480px;
    margin-inline: auto;
}

.progress-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), #81c784);
}

/* Footer */
.site-footer {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.site-footer strong {
    color: var(--navy);
}

/* Residents table (public) */
.table-simple {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid #eef2f7;
}

.table-simple th,
.table-simple td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.table-simple th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--navy);
    font-size: 0.85rem;
}

.table-simple tr:last-child td {
    border-bottom: none;
}

/* Pagination (public site) */
.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid #eef2f7;
    box-shadow: var(--shadow);
    font-size: 0.85rem;
}

.pagination-info {
    color: var(--muted);
}

.pagination-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.pagination-link,
.pagination-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    height: 2.1rem;
    padding: 0 0.45rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.82rem;
}

.pagination-link {
    background: #f8fafc;
    color: var(--navy);
    border: 1px solid #e2e8f0;
    text-decoration: none;
}

.pagination-link:hover {
    background: #e8f5e9;
    border-color: var(--primary);
    color: var(--primary-dark);
    text-decoration: none;
}

.pagination-current {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
}

/* Inner page (e.g. residents list) */
.page-hero {
    padding: 2.5rem 0 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e8f5e9 100%);
    border-bottom: 1px solid #e2e8f0;
}

.page-hero--slim {
    padding-top: 2rem;
}

.page-hero-kicker {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.page-hero-kicker a {
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
}

.page-hero-kicker a:hover {
    text-decoration: underline;
}

.page-hero-title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--navy);
}

.page-hero-lead {
    margin: 0;
    max-width: 40rem;
    color: var(--muted);
    font-size: 1rem;
}

.users-page-toolbar {
    margin-bottom: 1.5rem;
}

.users-page-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.users-search-input-wrap--public {
    position: relative;
    flex: 1 1 220px;
    max-width: 400px;
}

.users-search-input-wrap--public > i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.95rem;
    pointer-events: none;
}

.users-search-input-wrap--public input[type='search'] {
    width: 100%;
    padding: 0.65rem 0.75rem 0.65rem 2.4rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
}

.users-search-input-wrap--public input[type='search']:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.btn-text-link {
    font-weight: 600;
    color: var(--navy);
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-text-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.users-table-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid #eef2f7;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.users-table-card .pagination-bar {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
}

.table-users-directory .th-photo {
    width: 72px;
}

.dir-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e8f5e9;
    display: block;
}

.dir-avatar.ph {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #555;
    font-size: 1rem;
}

.empty-cell {
    text-align: center;
    padding: 2rem 1rem !important;
    color: var(--muted);
}

.users-page-note {
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

.users-cta-section {
    padding: 3rem 0;
}

.users-cta-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.75rem 2rem;
    background: linear-gradient(135deg, #fff 0%, #f1f8f4 100%);
    border: 1px solid #e8f5e9;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.users-cta-title {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
    color: var(--navy);
}

.users-cta-text {
    margin: 0;
    color: var(--muted);
    max-width: 36rem;
}

.home-bottom-cta {
    padding: 2.5rem 0 3rem;
}

.home-bottom-cta-inner {
    display: flex;
    justify-content: center;
    align-items: center;
}

.section-bottom-cta {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.table-users-directory .resident-row-warn td {
    background: var(--danger-bg);
}

.badge-warn--inline {
    margin-top: 0;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Gallery slider (home) */
.section-gallery {
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.gallery-slider {
    position: relative;
    margin-top: 1rem;
    --gallery-gap: 0.85rem;
    --gallery-slide-basis: 20%;
}

@media (max-width: 768px) {
    .gallery-slider {
        --gallery-slide-basis: 66.666%;
        --gallery-gap: 0.7rem;
    }
}

.gallery-viewport {
    position: relative;
    z-index: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    border-radius: calc(var(--radius) + 2px);
    border: 1px solid #eef2f7;
    box-shadow: var(--shadow);
    background: #fff;
    padding: 0.85rem;
    scrollbar-width: none;
}

.gallery-viewport::-webkit-scrollbar {
    display: none;
}

.gallery-track {
    display: flex;
    gap: var(--gallery-gap);
    align-items: stretch;
}

.gallery-slide {
    flex: 0 0 var(--gallery-slide-basis);
    scroll-snap-align: start;
    margin: 0;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    background: #f1f5f9;
    border: 1px solid #e8edf3;
    aspect-ratio: 4 / 3;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.01);
    transition: transform 0.35s ease, filter 0.35s ease;
}

.gallery-slide:hover img {
    transform: scale(1.06);
    filter: saturate(1.05) contrast(1.02);
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(44, 62, 80, 0.16);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--navy);
    transition: transform 0.15s ease, background 0.15s ease;
}

.gallery-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.04);
}

.gallery-nav--prev {
    left: 0.55rem;
}

.gallery-nav--next {
    right: 0.55rem;
}

@media (min-width: 769px) {
    .gallery-nav {
        display: inline-flex;
    }
}

.gallery-note {
    margin: 0.85rem auto 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    max-width: 44rem;
}

/* Residents directory — maintenance summary & links */
.table-users-directory .th-action {
    width: 1%;
    white-space: nowrap;
}

.resident-name-link {
    color: var(--navy);
    font-weight: 600;
    text-decoration: none;
}

.resident-name-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.maint-summary {
    font-size: 0.88rem;
    white-space: nowrap;
}

.maint-summary--muted {
    color: var(--muted);
}

.ms-paid {
    color: #2e7d32;
    font-weight: 600;
}

.ms-due {
    color: #c62828;
    font-weight: 600;
}

.btn-dir-detail {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 600;
    font-size: 0.82rem;
    text-decoration: none;
    border: 1px solid #a5d6a7;
    white-space: nowrap;
}

.btn-dir-detail:hover {
    background: #c8e6c9;
    text-decoration: none;
    color: #0d3d12;
}

.resident-row-clickable:hover td {
    background: #fafdfb;
}

/* Resident maintenance detail (resident.php) */
.page-hero--resident {
    padding: 2rem 0 2.25rem;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(76, 175, 80, 0.18) 0%, transparent 55%),
        radial-gradient(90% 60% at 0% 100%, rgba(44, 62, 80, 0.08) 0%, transparent 50%),
        linear-gradient(165deg, #f8fafc 0%, #eef7f0 42%, #e8f5e9 100%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}

.resident-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.35rem;
}

.resident-hero-kicker {
    margin: 0;
}

.resident-hero-kicker-sep {
    margin: 0 0.35rem;
    color: #cbd5e1;
    font-weight: 400;
}

.resident-hero-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--navy);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.06);
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        color 0.2s ease;
}

.resident-hero-back:hover {
    border-color: var(--primary);
    background: #fff;
    color: var(--primary-dark);
    text-decoration: none;
}

.resident-hero-main {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 1.75rem);
    flex-wrap: wrap;
}

.resident-hero-photo {
    width: clamp(88px, 18vw, 112px);
    height: clamp(88px, 18vw, 112px);
    border-radius: 20px;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid rgba(255, 255, 255, 0.95);
    box-shadow:
        0 12px 32px rgba(56, 142, 60, 0.22),
        0 0 0 1px rgba(76, 175, 80, 0.2);
    background: linear-gradient(145deg, #e8f5e9, #c8e6c9);
}

.resident-hero-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.resident-hero-photo-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    color: var(--primary-dark);
    background: linear-gradient(160deg, #fff 0%, #e8f5e9 100%);
}

.resident-hero-copy {
    min-width: 0;
    flex: 1;
}

.resident-hero-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.45rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.resident-hero-lead {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    color: var(--muted);
    max-width: 36rem;
    line-height: 1.5;
}

.resident-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.resident-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e2e8f0;
}

.resident-meta-pill i {
    color: var(--primary-dark);
    font-size: 0.88rem;
    opacity: 0.9;
}

.resident-meta-pill--link {
    text-decoration: none;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        color 0.2s ease;
}

.resident-meta-pill--link:hover {
    border-color: var(--primary);
    background: #fff;
    color: var(--primary-dark);
    text-decoration: none;
}

.resident-detail-section {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

.resident-detail-container {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.resident-dashboard {
    background: var(--card);
    border-radius: calc(var(--radius) + 2px);
    border: 1px solid #e8edf3;
    box-shadow: 0 8px 40px rgba(44, 62, 80, 0.08);
    padding: 1.35rem 1.35rem 1.25rem;
}

.resident-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.resident-stat-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.15rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid #eef2f7;
    background: #fff;
    transition: box-shadow 0.2s ease;
}

.resident-stat-card:hover {
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.06);
}

.resident-stat--ok {
    border-color: #c8e6c9;
    background: linear-gradient(145deg, #fff 0%, #f4fbf6 100%);
}

.resident-stat--warn {
    border-color: #ffccbc;
    background: linear-gradient(145deg, #fff 0%, #fffaf8 100%);
}

.resident-stat--neutral {
    border-color: #e2e8f0;
    background: linear-gradient(145deg, #fff 0%, #f8fafc 100%);
}

.resident-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: #e8f5e9;
    color: #2e7d32;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.resident-stat--warn .resident-stat-icon {
    background: #fff3e0;
    color: #e65100;
}

.resident-stat--neutral .resident-stat-icon {
    background: #eceff1;
    color: #546e7a;
}

.resident-stat-body {
    min-width: 0;
}

.resident-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 700;
}

.resident-stat-value {
    font-size: clamp(1.65rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--navy);
    line-height: 1.1;
    margin-top: 0.15rem;
    font-variant-numeric: tabular-nums;
}

.resident-stat-sub {
    font-size: 0.84rem;
    color: var(--muted);
    margin-top: 0.35rem;
    line-height: 1.35;
}

.resident-stat-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.95rem 1.15rem;
    border-radius: 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.45;
}

.resident-stat-banner--ok {
    background: rgba(232, 245, 233, 0.65);
    border-color: #c8e6c9;
}

.resident-stat-banner--warn {
    background: rgba(255, 243, 224, 0.55);
    border-color: #ffccbc;
}

.resident-stat-banner__icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-size: 0.95rem;
}

.resident-stat-banner--warn .resident-stat-banner__icon {
    color: #e65100;
    background: rgba(255, 255, 255, 0.9);
}

.resident-stat-banner__text {
    min-width: 0;
}

.resident-stat-banner__sep {
    margin: 0 0.2rem;
    color: #94a3b8;
    font-weight: 400;
}

.text-warn {
    color: #bf360c;
    font-weight: 600;
}

.text-ok {
    color: #2e7d32;
    font-weight: 600;
}

.resident-history-card {
    background: var(--card);
    border-radius: calc(var(--radius) + 2px);
    border: 1px solid #e8edf3;
    box-shadow: 0 8px 40px rgba(44, 62, 80, 0.08);
    overflow: hidden;
}

.resident-history-head {
    padding: 1.35rem 1.5rem 1rem;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.resident-history-title {
    margin: 0 0 0.4rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.02em;
}

.resident-history-hint {
    margin: 0;
    font-size: 0.86rem;
    color: var(--muted);
    max-width: 42rem;
    line-height: 1.5;
}

.resident-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.resident-history-card .table-resident-maint.table-simple {
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: transparent;
}

.table-resident-maint {
    min-width: 100%;
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.table-resident-maint thead th {
    text-align: left;
    padding: 0.85rem 1.25rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--muted);
    background: #f8fafc;
    border-bottom: 1px solid #e8edf3;
    white-space: nowrap;
}

.table-resident-maint tbody td {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table-resident-maint tbody tr:last-child td {
    border-bottom: none;
}

.table-resident-maint tbody tr:hover td {
    background: #fbfcfd;
}

.resident-maint-row--due td {
    background: rgba(255, 248, 247, 0.55);
}

.resident-maint-row--due:hover td {
    background: rgba(255, 243, 241, 0.85);
}

.resident-maint-month {
    font-weight: 600;
    color: var(--navy);
}

.resident-maint-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text);
}

.resident-maint-date {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 0.88rem;
}

.maint-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.maint-badge--paid {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
}

.maint-badge--due {
    background: #ffebee;
    color: #b71c1c;
    border: 1px solid #ffcdd2;
}
