* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;

    background: #f4f6f9;
    color: #172033;

    font-family:
        "Segoe UI",
        Arial,
        sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

.topbar {
    min-height: 88px;

    background: white;

    border-bottom:
        1px solid #e5e9f0;

    padding: 16px 32px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand {
    min-width: 50px;
    width: 50px;
    height: 50px;

    border-radius: 12px;

    background: #155eef;
    color: white;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 21px;
    font-weight: 700;
}

.topbar h1 {
    margin: 0;

    font-size: 22px;
}

.topbar p {
    margin: 4px 0 0;

    color: #667085;

    font-size: 14px;
}

.user-section {
    display: flex;
    align-items: center;

    gap: 12px;
}

.user-info {
    display: flex;
    flex-direction: column;

    text-align: right;
}

.user-info span {
    margin-top: 2px;

    color: #667085;

    font-size: 12px;
}

.container {
    width: 100%;
    max-width: 1400px;

    margin: auto;

    padding: 28px;
}

.stats {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 18px;

    margin-bottom: 22px;
}

.stat-card,
.content-card {
    background: white;

    border:
        1px solid #e4e7ec;

    border-radius: 12px;
}

.stat-card {
    padding: 20px;
}

.stat-card span {
    color: #667085;

    font-size: 13px;
}

.stat-card strong {
    display: block;

    margin-top: 7px;

    font-size: 32px;
}

.stat-card .access-stat {
    font-size: 17px;

    margin-top: 13px;
}

.content-card {
    padding: 24px;
}

.section-heading h2 {
    margin: 0;
}

.section-heading p {
    margin-bottom: 0;

    color: #667085;
}

.building-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(330px, 1fr)
        );

    gap: 18px;

    margin-top: 22px;
}

.building-card {
    border:
        1px solid #e4e7ec;

    border-radius: 12px;

    padding: 19px;
}

.building-title {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 12px;
}

.building-title h3 {
    margin: 0;
}

.building-actions {
    display: flex;

    gap: 7px;
}

.code {
    display: inline-block;

    margin-top: 6px;

    padding: 3px 8px;

    border-radius: 5px;

    background: #f2f4f7;

    color: #475467;

    font-size: 12px;
    font-weight: 600;
}

.status {
    display: inline-block;

    margin-left: 5px;

    padding: 3px 8px;

    border-radius: 5px;

    font-size: 12px;
    font-weight: 600;
}

.status-active {
    background: #ecfdf3;
    color: #027a48;
}

.status-inactive {
    background: #f2f4f7;
    color: #667085;
}

.address {
    min-height: 42px;

    color: #667085;
}

.description {
    color: #667085;

    font-size: 13px;
}

.unit-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    border-top:
        1px solid #e4e7ec;

    margin-top: 18px;
    padding-top: 15px;
}

.unit-list {
    margin-top: 8px;
}

.unit-row {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 10px 0;

    border-bottom:
        1px solid #f0f2f5;
}

.unit-main {
    min-width: 0;
}

.unit-meta {
    margin-top: 3px;

    color: #667085;

    font-size: 12px;
}

.unit-actions {
    flex-shrink: 0;
}

.btn {
    min-height: 40px;

    border: 0;
    border-radius: 8px;

    padding: 9px 14px;

    cursor: pointer;

    font-weight: 600;
}

.btn-primary {
    background: #155eef;
    color: white;
}

.btn-secondary {
    background: #eef2f6;
    color: #344054;
}

.btn-small {
    min-height: 34px;

    padding: 6px 10px;

    font-size: 12px;
}

.notification {
    margin-bottom: 18px;

    padding: 12px 14px;

    border-radius: 8px;

    background: #ecfdf3;
    color: #027a48;
}

.notification.error {
    background: #fef3f2;
    color: #b42318;
}

.empty-state {
    padding: 45px 20px;

    text-align: center;

    color: #667085;
}

.empty-state h3 {
    color: #172033;
}

.hidden {
    display: none !important;
}


/* Dialogs */

dialog {
    width: min(540px, 94vw);

    max-height: 90vh;

    border: 0;
    border-radius: 14px;

    padding: 0;

    overflow-y: auto;

    box-shadow:
        0 20px 60px
        rgba(0, 0, 0, 0.20);
}

dialog::backdrop {
    background:
        rgba(15, 23, 42, 0.55);
}

dialog form {
    padding: 24px;
}

.dialog-header {
    display: flex;

    justify-content: space-between;

    gap: 15px;

    margin-bottom: 20px;
}

.dialog-header h2 {
    margin: 0;
}

.dialog-header p {
    margin: 5px 0 0;

    color: #667085;
}

.close-button {
    width: 36px;
    height: 36px;

    border: 0;
    border-radius: 7px;

    cursor: pointer;

    background: #f2f4f7;
}

label {
    display: block;

    margin-bottom: 15px;

    font-weight: 600;
    font-size: 14px;
}

input,
textarea,
select {
    width: 100%;

    margin-top: 6px;

    padding: 11px;

    border:
        1px solid #d0d5dd;

    border-radius: 7px;

    background: white;

    color: #172033;
}

.checkbox-label {
    display: flex;

    align-items: center;

    gap: 8px;
}

.checkbox-label input {
    width: auto;

    margin: 0;
}

.dialog-actions {
    display: flex;

    justify-content: flex-end;

    gap: 10px;

    margin-top: 22px;
}


/* Login */

.login-body {
    min-height: 100vh;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    background: #f4f6f9;
}

.login-shell {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;

    border:
        1px solid #e4e7ec;

    border-radius: 16px;

    padding: 32px;

    box-shadow:
        0 10px 30px
        rgba(15, 23, 42, 0.08);
}

.login-brand {
    width: 58px;
    height: 58px;

    margin-bottom: 20px;

    border-radius: 14px;

    background: #155eef;
    color: white;

    display: flex;

    align-items: center;
    justify-content: center;

    font-size: 22px;
    font-weight: 700;
}

.login-card h1 {
    margin: 0;

    font-size: 24px;
}

.muted {
    color: #667085;
}

.login-button {
    width: 100%;

    margin-top: 8px;
}


/* Tablet */

@media (max-width: 900px) {

    .topbar {
        align-items: flex-start;

        padding: 15px 20px;
    }

    .user-section {
        flex-wrap: wrap;

        justify-content: flex-end;
    }

    .stats {
        grid-template-columns:
            repeat(
                3,
                minmax(0, 1fr)
            );
    }

    .container {
        padding: 20px;
    }
}


/* Mobile */

@media (max-width: 650px) {

    .topbar {
        flex-direction: column;

        align-items: stretch;

        gap: 14px;
    }

    .brand-section {
        width: 100%;
    }

    .brand {
        min-width: 44px;

        width: 44px;
        height: 44px;
    }

    .topbar h1 {
        font-size: 18px;
    }

    .topbar p {
        display: none;
    }

    .user-section {
        width: 100%;

        display: grid;

        grid-template-columns:
            1fr auto;
    }

    .user-info {
        grid-column:
            1 / -1;

        text-align: left;
    }

    .user-section .btn {
        width: 100%;
    }

    .container {
        padding: 14px;
    }

    .stats {
        grid-template-columns:
            1fr 1fr;
    }

    .stats .stat-card:last-child {
        grid-column:
            1 / -1;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card strong {
        font-size: 27px;
    }

    .content-card {
        padding: 16px;
    }

    .building-grid {
        grid-template-columns:
            1fr;
    }

    .building-title {
        flex-direction: column;
    }

    .building-actions {
        width: 100%;
    }

    .building-actions .btn {
        flex: 1;
    }

    .unit-row {
        align-items: flex-start;
    }

    .unit-header {
        align-items: flex-start;
    }

    dialog {
        width: 100vw;
        max-width: 100vw;

        max-height: 92vh;

        margin: auto 0 0;

        border-radius:
            16px 16px 0 0;
    }

    dialog form {
        padding: 20px;
    }

    .dialog-actions {
        display: grid;

        grid-template-columns:
            1fr 1fr;
    }

    .login-card {
        padding: 24px;
    }
}

/* ==========================================================
   STEP 4A.2 - MOBILE APP STYLE NAVIGATION
========================================================== */

.app-nav {
    position: sticky;
    top: 0;
    z-index: 20;

    display: flex;
    justify-content: center;
    gap: 4px;

    padding: 8px 20px;

    background: white;

    border-bottom:
        1px solid #e4e7ec;
}

.nav-button {
    min-width: 130px;

    border: 0;
    border-radius: 8px;

    padding: 10px 18px;

    background: transparent;
    color: #667085;

    cursor: pointer;

    font-weight: 600;
}

.nav-button.active {
    background: #eef4ff;
    color: #155eef;
}


.stats {
    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );
}


.search-row {
    margin-top: 20px;
}

.search-row input {
    max-width: 420px;
}


.tenant-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(300px, 1fr)
        );

    gap: 18px;

    margin-top: 20px;
}


.tenant-card {
    border:
        1px solid #e4e7ec;

    border-radius: 12px;

    padding: 18px;
}


.tenant-card-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 12px;
}


.tenant-card-header h3 {
    margin: 0 0 7px;
}


.detail-list {
    display: grid;
    gap: 12px;

    margin-top: 18px;
}


.detail-list > div {
    display: grid;
    gap: 3px;
}


.detail-list span {
    color: #667085;

    font-size: 12px;
}


.detail-list strong {
    overflow-wrap: anywhere;

    font-size: 14px;
}


.unit-card {
    margin-top: 12px;

    padding: 15px;

    border:
        1px solid #e4e7ec;

    border-radius: 10px;

    background: #fafbfc;
}


.unit-card-top {
    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    gap: 12px;
}


.occupancy-section {
    margin-top: 14px;

    padding-top: 13px;

    border-top:
        1px solid #e4e7ec;
}


.occupancy-heading {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 10px;
}


.status-vacant {
    background: #fff7ed;
    color: #c2410c;
}


.tenant-chips {
    display: flex;
    flex-wrap: wrap;

    gap: 7px;

    margin-top: 10px;
}


.tenant-chip {
    display: inline-block;

    padding: 5px 9px;

    border-radius: 999px;

    background: #f2f4f7;

    color: #344054;

    font-size: 12px;
}


.tenant-chip.primary {
    background: #eef4ff;
    color: #155eef;

    font-weight: 600;
}


.vacant-label {
    color: #667085;

    font-size: 13px;
}


.tenancy-financials {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 10px;

    margin-top: 13px;
}


.tenancy-financials > div {
    min-width: 0;

    padding: 9px;

    border-radius: 7px;

    background: white;
}


.tenancy-financials span {
    display: block;

    color: #667085;

    font-size: 11px;
}


.tenancy-financials strong {
    display: block;

    margin-top: 3px;

    overflow-wrap: anywhere;

    font-size: 13px;
}


.unit-action-row {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;

    margin-top: 13px;
}


.empty-inline {
    padding: 16px 0;

    color: #667085;

    font-size: 13px;
}


.form-grid {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 14px;
}


.large-dialog {
    width:
        min(760px, 96vw);
}


.dialog-content {
    padding: 24px;
}


.tenant-assignment {
    margin-top: 22px;

    padding-top: 18px;

    border-top:
        1px solid #e4e7ec;
}


.subsection-heading h3 {
    margin: 0;
}


.subsection-heading p {
    margin: 5px 0 14px;

    color: #667085;

    font-size: 13px;
}


.tenant-option {
    display: grid;

    grid-template-columns:
        1fr auto;

    align-items: center;

    gap: 12px;

    padding: 10px;

    border-bottom:
        1px solid #f0f2f5;
}


.tenant-select-label,
.primary-label {
    display: flex;

    align-items: center;

    gap: 8px;

    margin: 0;
}


.tenant-select-label input,
.primary-label input {
    width: auto;

    margin: 0;
}


.history-card {
    margin-bottom: 14px;

    padding: 16px;

    border:
        1px solid #e4e7ec;

    border-radius: 10px;
}


.history-heading {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;
}


.history-actions {
    display: flex;

    justify-content: flex-end;

    margin-top: 12px;
}


/* Tablet */

@media (max-width: 900px) {

    .stats {
        grid-template-columns:
            1fr 1fr;
    }

}


/* Mobile */

@media (max-width: 650px) {

    .app-nav {
        position: sticky;

        bottom: 0;
        top: auto;

        order: 10;

        padding:
            8px 12px
            calc(
                8px
                + env(safe-area-inset-bottom)
            );
    }

    .nav-button {
        flex: 1;

        min-width: 0;
    }

    .section-heading {
        display: grid;

        gap: 12px;
    }

    .section-heading .btn {
        width: 100%;
    }

    .stats {
        grid-template-columns:
            1fr 1fr;

        gap: 10px;
    }

    .tenant-grid {
        grid-template-columns:
            1fr;
    }

    .form-grid {
        grid-template-columns:
            1fr;
    }

    .unit-card-top {
        display: grid;
    }

    .unit-card-top .btn {
        width: 100%;
    }

    .tenancy-financials {
        grid-template-columns:
            1fr;
    }

    .unit-action-row {
        display: grid;

        grid-template-columns:
            1fr 1fr;
    }

    .unit-action-row .btn {
        width: 100%;
    }

    .tenant-option {
        grid-template-columns:
            1fr;
    }

    .primary-label {
        padding-left: 26px;
    }

    .history-heading {
        align-items: flex-start;
    }

    .search-row input {
        max-width: none;
    }

}


/* ==========================================================
   STEP 4B.2 - TENANT ACCOUNT ADMIN
========================================================== */

.tenant-account-section {
    margin-top: 16px;
    padding-top: 14px;

    border-top:
        1px solid #e4e7ec;
}

.tenant-account-heading {
    margin-bottom: 8px;

    color: #667085;

    font-size: 12px;
    font-weight: 600;

    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.account-status-row {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;
}

.account-username {
    display: block;

    margin-top: 5px;

    overflow-wrap: anywhere;

    color: #475467;

    font-size: 12px;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;

    justify-content: flex-end;

    gap: 6px;
}

.account-loading,
.account-error {
    color: #667085;

    font-size: 12px;
}

.account-error {
    color: #b42318;
}

.field-help {
    margin-top: -8px;
    margin-bottom: 15px;

    color: #667085;

    font-size: 12px;
}


/* ==========================================================
   TENANT MY HOME
========================================================== */

.tenant-home-body {
    min-height: 100vh;

    padding-bottom: 80px;

    background: #f4f6f9;
}

.tenant-topbar {
    position: sticky;

    top: 0;
    z-index: 20;

    min-height: 76px;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;

    padding: 13px 22px;

    background: white;

    border-bottom:
        1px solid #e4e7ec;
}

.tenant-topbar h1 {
    margin: 0;

    font-size: 20px;
}

.tenant-topbar p {
    margin: 3px 0 0;

    color: #667085;

    font-size: 12px;
}

.tenant-home-container {
    width: 100%;
    max-width: 850px;

    margin: auto;

    padding: 22px;
}

.tenant-welcome {
    margin-bottom: 20px;
}

.tenant-welcome > span,
.eyebrow {
    color: #667085;

    font-size: 12px;
    font-weight: 600;

    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tenant-welcome h2 {
    margin: 5px 0 3px;

    font-size: 27px;
}

.tenant-welcome p {
    margin: 0;

    color: #667085;
}

.tenant-property-card {
    overflow: hidden;

    border-radius: 16px;

    background: white;

    border:
        1px solid #e4e7ec;
}

.tenant-property-heading {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 12px;

    padding: 22px;
}

.tenant-property-heading h2 {
    margin: 5px 0 4px;

    font-size: 25px;
}

.tenant-property-heading p {
    margin: 0;

    color: #667085;
}

.tenant-money-grid {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 1px;

    background: #e4e7ec;

    border-top:
        1px solid #e4e7ec;

    border-bottom:
        1px solid #e4e7ec;
}

.tenant-money-card {
    padding: 20px;

    background: #fafbfc;
}

.tenant-money-card span {
    color: #667085;

    font-size: 12px;
}

.tenant-money-card strong {
    display: block;

    margin-top: 6px;

    font-size: 23px;
}

.tenant-detail-grid {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 1px;

    background: #e4e7ec;
}

.tenant-detail-grid article {
    min-width: 0;

    padding: 16px;

    background: white;
}

.tenant-detail-grid span {
    display: block;

    color: #667085;

    font-size: 11px;
}

.tenant-detail-grid strong {
    display: block;

    margin-top: 4px;

    overflow-wrap: anywhere;

    font-size: 14px;
}

.full-width-detail {
    grid-column:
        1 / -1;
}

.tenant-section {
    margin-top: 18px;
}

.my-people-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(180px, 1fr)
        );

    gap: 10px;

    margin-top: 18px;
}

.my-person-card {
    display: flex;

    align-items: center;

    gap: 11px;

    padding: 12px;

    border:
        1px solid #e4e7ec;

    border-radius: 10px;
}

.person-avatar {
    flex-shrink: 0;

    width: 38px;
    height: 38px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #eef4ff;

    color: #155eef;

    font-weight: 700;
}

.my-person-card strong,
.my-person-card span {
    display: block;
}

.my-person-card span {
    margin-top: 2px;

    color: #667085;

    font-size: 11px;
}

.tenant-notes {
    white-space: pre-wrap;

    color: #475467;
}

.my-history-card {
    margin-top: 14px;

    padding: 16px;

    border:
        1px solid #e4e7ec;

    border-radius: 11px;
}

.my-history-card p {
    margin: 4px 0 0;

    color: #667085;

    font-size: 13px;
}

.tenant-bottom-nav {
    position: fixed;

    left: 50%;
    bottom: 0;

    z-index: 30;

    width: min(850px, 100%);

    transform:
        translateX(-50%);

    display: grid;

    grid-template-columns:
        1fr 1fr;

    padding:
        8px 12px
        calc(
            8px
            + env(
                safe-area-inset-bottom
            )
        );

    background: white;

    border-top:
        1px solid #e4e7ec;
}

.tenant-nav-item {
    min-height: 44px;

    border: 0;

    background: transparent;

    color: #667085;

    cursor: pointer;

    font-weight: 600;
}

.tenant-nav-item.active {
    color: #155eef;
}


@media (max-width: 650px) {

    .account-status-row {
        display: grid;
    }

    .account-actions {
        display: grid;

        grid-template-columns:
            1fr 1fr;

        justify-content: stretch;
    }

    .account-actions .btn {
        width: 100%;
    }

    .tenant-topbar {
        padding: 12px 14px;
    }

    .tenant-topbar .brand {
        min-width: 42px;

        width: 42px;
        height: 42px;
    }

    .tenant-topbar h1 {
        font-size: 18px;
    }

    .tenant-topbar p {
        display: none;
    }

    .tenant-home-container {
        padding: 14px;
    }

    .tenant-welcome h2 {
        font-size: 23px;
    }

    .tenant-property-heading {
        padding: 17px;
    }

    .tenant-property-heading h2 {
        font-size: 21px;
    }

    .tenant-money-grid {
        grid-template-columns:
            1fr;
    }

    .tenant-money-card {
        padding: 16px;
    }

    .tenant-money-card strong {
        font-size: 20px;
    }

    .tenant-detail-grid {
        grid-template-columns:
            1fr 1fr;
    }

    .my-people-grid {
        grid-template-columns:
            1fr;
    }
}


/* ==========================================================
   STEP 5B.1 - FINANCIAL LEDGER
========================================================== */

.financial-ledger-dialog {
    width: 96vw;
    max-width: 1800px;
}


.ledger-summary-grid {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 10px;

    margin-bottom: 18px;
}


.ledger-summary-card {
    padding: 14px;

    border:
        1px solid #e4e7ec;

    border-radius: 10px;

    background: #fafbfc;
}


.ledger-summary-card span {
    color: #667085;

    font-size: 11px;
}


.ledger-summary-card strong {
    display: block;

    margin-top: 5px;

    overflow-wrap: anywhere;

    font-size: 17px;
}


.ledger-admin-actions {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;

    margin-bottom: 15px;
}


.ledger-filter-row {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 10px;

    margin-bottom: 15px;
}


.ledger-filter-row select {
    margin: 0;
}


.ledger-charge-card {
    margin-top: 12px;

    padding: 16px;

    border:
        1px solid #e4e7ec;

    border-radius: 11px;

    background: white;
}


.ledger-charge-heading {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 12px;
}


.ledger-charge-heading p {
    margin:
        5px 0 0;

    color: #667085;

    font-size: 13px;
}


.ledger-charge-title {
    display: flex;
    flex-wrap: wrap;

    align-items: center;

    gap: 7px;
}


.ledger-period {
    padding: 3px 7px;

    border-radius: 5px;

    background: #f2f4f7;

    color: #475467;

    font-size: 11px;
}


.status-unpaid {
    background: #fff7ed;
    color: #c2410c;
}


.status-overdue {
    background: #fef3f2;
    color: #b42318;
}


.ledger-charge-main {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 10px;

    margin-top: 14px;
}


.ledger-charge-main > div,
.ledger-payment-details > div {
    padding: 10px;

    border-radius: 8px;

    background: #f8fafc;
}


.ledger-charge-main span,
.ledger-payment-details span {
    display: block;

    color: #667085;

    font-size: 11px;
}


.ledger-charge-main strong,
.ledger-payment-details strong {
    display: block;

    margin-top: 3px;

    overflow-wrap: anywhere;

    font-size: 14px;
}


.ledger-charge-amount strong {
    font-size: 20px;
}


.ledger-payment-details {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 8px;

    margin-top: 10px;
}


.ledger-notes {
    margin-top: 10px;

    padding: 10px;

    border-radius: 8px;

    background: #f8fafc;

    color: #475467;

    font-size: 13px;

    white-space: pre-wrap;
}


.ledger-charge-actions {
    display: flex;
    flex-wrap: wrap;

    justify-content: flex-end;

    gap: 7px;

    margin-top: 13px;
}


.btn-danger {
    background: #fef3f2;
    color: #b42318;
}


.payment-warning {
    margin-top: 5px;

    padding: 10px;

    border-radius: 8px;

    background: #fff7ed;

    color: #9a3412;

    font-size: 12px;
}


@media (max-width: 750px) {

    .ledger-summary-grid {
        grid-template-columns:
            1fr 1fr;
    }

}


@media (max-width: 650px) {

    .financial-ledger-dialog {
        width: 100vw;
        max-width: 100vw;
    }

    .ledger-admin-actions {
        display: grid;

        grid-template-columns:
            1fr 1fr;
    }

    .ledger-admin-actions .btn {
        width: 100%;
    }

    .ledger-filter-row {
        grid-template-columns:
            1fr;
    }

    .ledger-charge-main {
        grid-template-columns:
            1fr 1fr;
    }

    .ledger-payment-details {
        grid-template-columns:
            1fr;
    }

    .ledger-charge-actions {
        display: grid;

        grid-template-columns:
            1fr 1fr;
    }

    .ledger-charge-actions .btn {
        width: 100%;
    }

}


/* ==========================================================
   STEP 5B.2 - TENANT FINANCIAL UI
========================================================== */

.my-financial-summary {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 10px;

    margin-top: 18px;
}


.my-financial-summary-card {
    min-width: 0;

    padding: 14px;

    border:
        1px solid #e4e7ec;

    border-radius: 10px;

    background: #fafbfc;
}


.my-financial-summary-card span {
    display: block;

    color: #667085;

    font-size: 11px;
}


.my-financial-summary-card strong {
    display: block;

    margin-top: 5px;

    overflow-wrap: anywhere;

    font-size: 18px;
}


.my-financial-summary-card small {
    display: block;

    margin-top: 4px;

    color: #667085;

    font-size: 10px;
}


.my-charge-tabs {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            1fr
        );

    gap: 6px;

    margin-top: 18px;

    padding: 4px;

    border-radius: 9px;

    background: #f2f4f7;
}


.my-charge-tab {
    min-height: 38px;

    border: 0;

    border-radius: 7px;

    background: transparent;

    color: #667085;

    cursor: pointer;

    font-weight: 600;
}


.my-charge-tab.active {
    background: white;

    color: #155eef;

    box-shadow:
        0 1px 2px
        rgba(
            16,
            24,
            40,
            0.08
        );
}


.my-charge-card {
    margin-top: 12px;

    padding: 15px;

    border:
        1px solid #e4e7ec;

    border-radius: 11px;

    background: white;
}


.my-charge-heading {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 12px;
}


.my-charge-heading > div {
    min-width: 0;
}


.my-charge-heading strong {
    font-size: 15px;
}


.my-charge-heading p {
    margin:
        5px 0 0;

    color: #667085;

    font-size: 12px;
}


.my-charge-period {
    display: inline-block;

    margin-left: 5px;

    padding: 3px 6px;

    border-radius: 5px;

    background: #f2f4f7;

    color: #475467;

    font-size: 10px;
}


.my-charge-financials {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 8px;

    margin-top: 13px;
}


.my-charge-financials > div,
.my-charge-payment > div {
    min-width: 0;

    padding: 10px;

    border-radius: 8px;

    background: #f8fafc;
}


.my-charge-financials span,
.my-charge-payment span {
    display: block;

    color: #667085;

    font-size: 10px;
}


.my-charge-financials strong,
.my-charge-payment strong {
    display: block;

    margin-top: 3px;

    overflow-wrap: anywhere;

    font-size: 13px;
}


.my-charge-financials > div:first-child strong {
    font-size: 18px;
}


.my-charge-payment {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 8px;

    margin-top: 8px;
}


.my-charge-notes {
    margin-top: 8px;

    padding: 10px;

    border-radius: 8px;

    background: #f8fafc;

    color: #475467;

    font-size: 12px;

    white-space: pre-wrap;
}


@media (max-width: 750px) {

    .my-financial-summary {
        grid-template-columns:
            1fr 1fr;
    }

}


@media (max-width: 650px) {

    .my-financial-summary {
        grid-template-columns:
            1fr 1fr;
    }

    .my-financial-summary-card {
        padding: 12px;
    }

    .my-financial-summary-card strong {
        font-size: 16px;
    }

    .my-charge-payment {
        grid-template-columns:
            1fr;
    }

}


/* ==========================================================
   STEP 6A.2B.5 - BILLING SCHEDULE
========================================================== */

.billing-preview-dialog {
    width: min(900px, 96vw);
}

.billing-rule-box {
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    background: #f8fafc;
}

.billing-rule-box > strong {
    display: block;
    margin-bottom: 10px;
}

.billing-rule-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.billing-rule-grid > div {
    padding: 9px;
    border-radius: 7px;
    background: white;
}

.billing-rule-grid span,
.billing-preview-summary span {
    display: block;
    color: #667085;
    font-size: 10px;
}

.billing-rule-grid b {
    display: block;
    margin-top: 3px;
    font-size: 12px;
}

.billing-preview-summary {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.billing-preview-summary article {
    padding: 13px;
    border: 1px solid #e4e7ec;
    border-radius: 9px;
    background: white;
}

.billing-preview-summary strong {
    display: block;
    margin-top: 4px;
    font-size: 17px;
}

.billing-preview-warning {
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 8px;
    background: #fef3f2;
    color: #b42318;
    white-space: pre-wrap;
}

.billing-month-card {
    margin-top: 12px;
    overflow: hidden;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    background: white;
}

.billing-month-heading {
    padding: 10px 13px;
    border-bottom: 1px solid #e4e7ec;
    background: #f8fafc;
}

.billing-month-heading h3 {
    margin: 0;
    font-size: 14px;
}

.billing-preview-row {
    display: grid;
    grid-template-columns:
        minmax(170px, 2fr)
        minmax(100px, 1fr)
        minmax(180px, 1.5fr);
    gap: 12px;
    align-items: center;
    padding: 13px;
    border-bottom: 1px solid #f2f4f7;
}

.billing-preview-row:last-child {
    border-bottom: 0;
}

.billing-preview-row p {
    margin: 4px 0 0;
    color: #667085;
    font-size: 11px;
}

.billing-prorated-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 2px 6px;
    border-radius: 5px;
    background: #eff8ff;
    color: #175cd3;
    font-size: 9px;
    font-weight: 700;
}

.billing-preview-amount {
    text-align: right;
}

.billing-preview-amount strong {
    font-size: 16px;
}

.billing-preview-dates {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #475467;
    font-size: 11px;
}

.billing-days {
    grid-column: 1 / -1;
    color: #667085;
    font-size: 10px;
}

@media (max-width: 750px) {

    .billing-rule-grid {
        grid-template-columns: 1fr 1fr;
    }

    .billing-preview-row {
        grid-template-columns: 1fr 1fr;
    }

    .billing-preview-dates {
        grid-column: 1 / -1;
    }
}

@media (max-width: 550px) {

    .billing-preview-dialog {
        width: 100vw;
        max-width: 100vw;
    }

    .billing-preview-summary {
        grid-template-columns: 1fr;
    }

    .billing-preview-row {
        grid-template-columns: 1fr;
    }

    .billing-preview-amount {
        text-align: left;
    }

    .billing-preview-dates {
        grid-column: auto;
    }
}


/* ==========================================================
   STEP 6B.1 - BILLING UX
========================================================== */

.billing-timing {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
    margin-top: 7px;
    color: #667085;
    font-size: 10px;
}

.billing-timing span {
    white-space: nowrap;
}

.billing-timing b {
    color: #475467;
}

.billing-source-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 5px;
    background: #ecfdf3;
    color: #027a48;
    font-size: 9px;
    font-weight: 700;
}

.billing-source-manual {
    background: #f2f4f7;
    color: #475467;
}

.ledger-operational-summary {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.ledger-operational-summary article {
    padding: 12px;
    border: 1px solid #e4e7ec;
    border-radius: 9px;
    background: white;
}

.ledger-operational-summary span {
    display: block;
    color: #667085;
    font-size: 10px;
}

.ledger-operational-summary strong {
    display: block;
    margin-top: 4px;
    font-size: 16px;
}

@media (max-width: 650px) {

    .ledger-operational-summary {
        grid-template-columns:
            1fr 1fr;
    }

    .billing-timing {
        flex-direction: column;
        gap: 3px;
    }

    .billing-timing span {
        white-space: normal;
    }
}


/* ==========================================================
   PAYMENT HISTORY + REVERSAL
========================================================== */

.payment-history-dialog {
    width: min(760px, calc(100vw - 24px));
}

.payment-warning {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(180, 50, 50, 0.08);
}

.payment-history-item {
    border: 1px solid var(--border-color, #d9dde5);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.payment-history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.payment-history-status {
    font-size: 0.85rem;
    font-weight: 600;
}

.payment-history-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.payment-history-grid > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.payment-history-grid span {
    font-size: 0.8rem;
    opacity: 0.75;
}

.payment-history-reversal {
    margin-top: 14px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(180, 50, 50, 0.08);
}

.payment-history-reversal p {
    margin: 6px 0;
}

@media (max-width: 700px) {

    .payment-history-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {

    .payment-history-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   TENANT PAYMENT HISTORY
========================================================== */

.my-payment-history-dialog {
    width: min(720px, calc(100vw - 24px));
}

.my-charge-history-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.my-payment-history-item {
    border: 1px solid var(--border-color, #d9dde5);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.my-payment-history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.my-payment-history-heading span {
    font-size: 0.85rem;
    font-weight: 600;
}

.my-payment-history-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.my-payment-history-grid > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.my-payment-history-grid span {
    font-size: 0.8rem;
    opacity: 0.75;
}

.my-payment-history-reversal {
    margin-top: 14px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(180, 50, 50, 0.08);
}

.my-payment-history-reversal p {
    margin: 6px 0 0;
}

@media (max-width: 520px) {

    .my-payment-history-grid {
        grid-template-columns: 1fr;
    }

    .my-charge-history-actions {
        justify-content: stretch;
    }

    .my-charge-history-actions button {
        width: 100%;
    }
}


/* ==========================================================
   RECEIPT DOWNLOAD ACTIONS
========================================================== */

.payment-history-actions,
.my-payment-history-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.payment-history-actions button,
.my-payment-history-actions button {
    min-width: 190px;
}

@media (max-width: 520px) {

    .payment-history-actions,
    .my-payment-history-actions {
        justify-content: stretch;
    }

    .payment-history-actions button,
    .my-payment-history-actions button {
        width: 100%;
        min-width: 0;
    }
}



/* ==========================================================
   STEP 7B.2E.2 - ADMIN FINANCIAL STATEMENT
========================================================== */

.ledger-statement-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}


.admin-statement-dialog {
    width: min(
        1100px,
        96vw
    );

    max-height: 92vh;
}


.admin-statement-dialog .dialog-content {
    max-height: 86vh;
    overflow-y: auto;
}


.admin-statement-date-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 12px;

    margin-bottom: 14px;
}


.admin-statement-date-grid label {
    display: grid;
    gap: 6px;

    color: #475467;

    font-size: 13px;
    font-weight: 600;
}


.admin-statement-date-grid input {
    margin: 0;
}


.admin-statement-actions {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;

    margin-bottom: 18px;
}


.admin-statement-summary {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 10px;

    margin-bottom: 16px;
}


.admin-statement-summary article {
    padding: 12px;

    border:
        1px solid #e4e7ec;

    border-radius: 9px;

    background: #f8fafc;
}


.admin-statement-summary span {
    display: block;

    color: #667085;

    font-size: 11px;
}


.admin-statement-summary strong {
    display: block;

    margin-top: 4px;

    overflow-wrap: anywhere;

    font-size: 16px;
}


.admin-statement-identity {
    display: flex;

    flex-wrap: wrap;

    justify-content: space-between;

    gap: 8px;

    margin-bottom: 12px;

    color: #475467;
}


.admin-statement-table-wrap {
    width: 100%;

    overflow-x: auto;

    border:
        1px solid #e4e7ec;

    border-radius: 9px;
}


.admin-statement-table {
    width: 100%;

    min-width: 850px;

    border-collapse: collapse;
}


.admin-statement-table th,
.admin-statement-table td {
    padding: 10px;

    border-bottom:
        1px solid #eaecf0;

    text-align: left;

    vertical-align: top;

    font-size: 12px;
}


.admin-statement-table th {
    background: #f8fafc;

    color: #475467;

    font-weight: 700;
}


.admin-statement-table td {
    overflow-wrap: anywhere;
}


.admin-statement-table .money-cell {
    white-space: nowrap;

    text-align: right;
}


.admin-statement-table tbody tr:last-child td {
    border-bottom: 0;
}


@media (max-width: 700px) {

    .admin-statement-dialog {
        width: 100vw;
        max-width: 100vw;
    }


    .admin-statement-date-grid {
        grid-template-columns:
            1fr;
    }


    .admin-statement-summary {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .admin-statement-actions .btn,
    .ledger-statement-actions .btn {
        width: 100%;
    }

}



/* STEP 7B.3C.2C - COMPACT MONTHLY FINANCIAL TABLE */

.ledger-monthly-summary {
    margin-top: 20px;
}

.ledger-monthly-summary-list {
    width: 100%;
}

.ledger-monthly-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #dfe5ec;
    border-radius: 12px;
    background: #ffffff;
}

.ledger-monthly-table {
    width: 100%;
    min-width: 1120px;
    border-collapse: collapse;
    font-size: 14px;
}

.ledger-monthly-table th,
.ledger-monthly-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #e8edf3;
    vertical-align: middle;
    white-space: nowrap;
}

.ledger-monthly-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f5f7fa;
    color: #344054;
    font-weight: 700;
    text-align: left;
}

.ledger-monthly-table .money-column {
    text-align: right;
}

.ledger-monthly-table .month-column {
    min-width: 100px;
}

.ledger-monthly-table .actions-column {
    text-align: center;
}

.ledger-month-row.status-overdue {
    background: #fff4f2;
}

.ledger-month-row.status-unpaid {
    background: #fff9eb;
}

.ledger-month-row.status-paid {
    background: #f0fdf4;
}

.ledger-month-row.status-overdue:hover {
    background: #ffe9e5;
}

.ledger-month-row.status-unpaid:hover {
    background: #fff3cf;
}

.ledger-month-row.status-paid:hover {
    background: #e4f9ea;
}

.ledger-month-row .outstanding-column {
    font-weight: 700;
}

.ledger-month-row.status-overdue .outstanding-column {
    color: #b42318;
}

.ledger-month-row.status-unpaid .outstanding-column {
    color: #b54708;
}

.ledger-month-row.status-paid .paid-column {
    color: #067647;
    font-weight: 700;
}

.ledger-month-detail-row > td {
    padding: 0 !important;
    background: #f8fafc;
}

.ledger-month-charge-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ledger-month-charge-table th,
.ledger-month-charge-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #e7ebf0;
}

.ledger-month-charge-table thead th {
    background: #eef2f6;
    position: static;
}

.ledger-month-charge-row.compact-overdue {
    background: #fff7f5;
}

.ledger-month-charge-row.compact-unpaid {
    background: #fffbeb;
}

.ledger-month-charge-row.compact-paid {
    background: #f3fcf6;
}

.ledger-compact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.ledger-compact-actions .btn {
    margin: 0;
}

.ledger-month-charge-empty {
    padding: 16px;
    color: #667085;
}

@media (max-width: 900px) {

    .ledger-monthly-table {
        min-width: 1050px;
    }

    .ledger-monthly-table th,
    .ledger-monthly-table td {
        padding: 9px 8px;
    }
}


/* ==========================================================
   STEP 7B.3F.2C.4 - RENT STATUS DASHBOARD REFINEMENT
========================================================== */

.rent-status-summary {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 14px;

    margin-top: 20px;
}

.rent-status-summary-card {
    min-width: 0;

    padding: 16px;

    border:
        1px solid #e4e7ec;

    border-radius: 12px;

    background: #ffffff;
}

.rent-status-summary-card span {
    display: block;

    margin-bottom: 6px;

    color: #667085;

    font-size: 13px;
    font-weight: 600;
}

.rent-status-summary-card strong {
    display: block;

    color: #101828;

    font-size: 24px;
    line-height: 1.2;
}

.rent-status-summary-paid {
    background: #ecfdf3;
    border-color: #abefc6;
}

.rent-status-summary-grace {
    background: #fffaeb;
    border-color: #fedf89;
}

.rent-status-summary-action {
    background: #fef3f2;
    border-color: #fecdca;
}

.rent-status-overall-heading {
    text-align: center !important;
}

@media (max-width: 900px) {

    .rent-status-summary {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }
}

@media (max-width: 520px) {

    .rent-status-summary {
        grid-template-columns:
            1fr 1fr;
    }
}


/* ==========================================================
   STEP 7B.3F.2B - RENT STATUS DASHBOARD
========================================================== */

.rent-status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;

    margin-top: 20px;
    margin-bottom: 18px;
}

.rent-status-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    color: #475467;
    font-size: 13px;
    font-weight: 600;
}

.rent-status-legend-dot {
    width: 12px;
    height: 12px;

    display: inline-block;

    border-radius: 999px;
}

.rent-status-table-wrapper {
    width: 100%;

    overflow-x: auto;

    border:
        1px solid #e4e7ec;

    border-radius: 12px;

    background: #ffffff;
}

.rent-status-table {
    width: 100%;
    min-width: 850px;

    border-collapse: collapse;
}

.rent-status-table th,
.rent-status-table td {
    padding: 14px 16px;

    border-bottom:
        1px solid #eaecf0;

    text-align: left;
    vertical-align: middle;
}

.rent-status-table thead th {
    background: #f9fafb;

    color: #475467;

    font-size: 13px;
    font-weight: 700;

    white-space: nowrap;
}

.rent-status-table tbody tr:last-child td {
    border-bottom: 0;
}

.rent-status-table tbody tr:hover {
    background: #fcfcfd;
}

.rent-status-month-heading,
.rent-status-cell {
    text-align: center !important;
}

.rent-status-badge {
    min-width: 112px;

    border: 1px solid transparent;
    border-radius: 999px;

    padding: 8px 12px;

    font: inherit;
    font-size: 13px;
    font-weight: 700;

    cursor: default;
}

.rent-status-clickable {
    cursor: pointer;
}

.rent-status-clickable:hover {
    filter: brightness(0.97);
}

.rent-status-paid {
    background: #ecfdf3;
    border-color: #abefc6;
    color: #067647;
}

.rent-status-grace {
    background: #fffaeb;
    border-color: #fedf89;
    color: #b54708;
}

.rent-status-overdue {
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}

.rent-status-neutral {
    background: #f2f4f7;
    border-color: #d0d5dd;
    color: #475467;
}

.rent-status-tenant {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rent-status-tenant small {
    color: #98a2b3;
}

.rent-status-message {
    padding: 24px;

    border:
        1px dashed #d0d5dd;

    border-radius: 10px;

    color: #667085;

    text-align: center;
}

@media (max-width: 650px) {

    .app-nav {
        justify-content: flex-start;

        overflow-x: auto;
    }

    .nav-button {
        flex: 0 0 auto;
    }

    .rent-status-table {
        min-width: 760px;
    }
}


