/* Smart Property AI landlord layout and subpages.
   Load once after landlord.css in landlord/layout.html.
   Dashboard-specific .spa-ldash-* styles remain in landlord.css. */

.landlord-layout {
    --lp-ink: #183244;
    --lp-muted: #526a7b;
    --lp-primary: #096c83;
    --lp-primary-dark: #064a5d;
    --lp-border: #d6e3e9;
    --lp-surface: #fff;
    --lp-bg: #f3f8fa;
    --lp-soft: #e9f5f7;
    --lp-shadow: 0 10px 30px rgba(16, 49, 67, .08);
    color: var(--lp-ink);
    background: var(--lp-bg);
    min-height: 80vh;
}

.landlord-layout *,
.landlord-layout *::before,
.landlord-layout *::after {
    box-sizing: border-box;
}

.landlord-layout [hidden] {
    display: none !important;
}

.landlord-layout a {
    color: var(--lp-primary-dark);
    text-underline-offset: .18em;
}

.landlord-layout :is(a, button, input, select, textarea):focus-visible {
    outline: 3px solid #f2a72e;
    outline-offset: 3px;
}

/* Shared portal shell */

.landlord-layout__shell {
    width: min(100%, 1600px);
    margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(230px, 270px) minmax(0, 1fr);
    align-items: start;
}

.landlord-layout__sidebar {
    min-height: 100vh;
    padding: 1.2rem;
    background: #fff;
    border-right: 1px solid var(--lp-border);
}

.landlord-layout__sidebar-header,
.landlord-layout__brand,
.landlord-layout__account,
.landlord-layout__page-header,
.landlord-layout__alert {
    display: flex;
    align-items: center;
    gap: .85rem;
}

.landlord-layout__sidebar-header,
.landlord-layout__page-header {
    justify-content: space-between;
}

.landlord-layout__brand {
    text-decoration: none;
    font-weight: 800;
}

.landlord-layout__brand span:last-child,
.landlord-layout__account > div:last-child {
    min-width: 0;
}

.landlord-layout__brand small,
.landlord-layout__account small {
    display: block;
    color: var(--lp-muted);
    font-weight: 500;
    overflow-wrap: anywhere;
}

.landlord-layout__brand-icon,
.landlord-layout__account-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: #fff;
    background: var(--lp-primary-dark);
    font-weight: 800;
}

.landlord-layout__account {
    margin: 1.4rem 0;
    padding: .85rem;
    border: 1px solid var(--lp-border);
    border-radius: 14px;
}

.landlord-layout__navigation {
    display: grid;
    gap: .15rem;
}

.landlord-layout__navigation-label {
    margin: 1.15rem .7rem .35rem;
    color: var(--lp-muted);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.landlord-layout__navigation a {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 42px;
    padding: .55rem .75rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 650;
}

.landlord-layout__navigation a:hover,
.landlord-layout__navigation a.is-active,
.landlord-layout__navigation a[aria-current="page"] {
    color: var(--lp-primary-dark);
    background: var(--lp-soft);
}

.landlord-layout__navigation-count {
    margin-left: auto;
    padding: .05rem .45rem;
    border-radius: 999px;
    color: #fff;
    background: var(--lp-primary-dark);
    font-size: .75rem;
}

.landlord-layout__sidebar-footer {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding: 1rem .7rem;
    border-top: 1px solid var(--lp-border);
}

.landlord-layout__main {
    min-width: 0;
    padding: clamp(1rem, 3vw, 2.5rem);
}

.landlord-layout__page-header {
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1.25rem;
}

.landlord-layout__page-header h1 {
    margin: 0;
    font-size: clamp(1.55rem, 3vw, 2.3rem);
}

.landlord-layout__page-header p {
    margin: .3rem 0 0;
    color: var(--lp-muted);
}

.landlord-layout__eyebrow {
    color: var(--lp-primary-dark) !important;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.landlord-layout__content {
    min-width: 0;
}

.landlord-layout__alert,
.landlord-layout__notice {
    margin: 1rem 0;
    padding: .9rem 1rem;
    border: 1px solid var(--lp-border);
    border-radius: 12px;
    background: #fff;
}

.landlord-layout__alert--success {
    color: #155b42;
    background: #e9f7ef;
}

.landlord-layout__alert--error {
    color: #8b2d40;
    background: #fff0f2;
}

.landlord-layout__alert button {
    margin-left: auto;
    cursor: pointer;
}

.landlord-layout__notice {
    display: flex;
    gap: .7rem;
    color: var(--lp-muted);
}

.landlord-layout__notice p {
    margin: 0;
}

.landlord-layout__navigation-toggle,
.landlord-layout__navigation-close,
.landlord-layout__backdrop {
    display: none;
}

/* Foundations for landlord subpages */

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) {
    color: var(--lp-ink);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__container"],
    [class$="-container"]
) {
    width: min(100%, 1240px);
    margin-inline: auto;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__breadcrumbs"],
    [class$="-breadcrumbs"]
) ol {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    padding: 0;
    margin: 0 0 1.2rem;
    list-style: none;
    font-size: .9rem;
    color: var(--lp-muted);
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__breadcrumbs"],
    [class$="-breadcrumbs"]
) li + li::before {
    content: "/";
    margin-right: .55rem;
    color: #8798a2;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__header"],
    [class$="-header"]
) {
    min-width: 0;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__eyebrow"],
    [class$="-eyebrow"],
    [class$="-section-label"]
) {
    margin: 0 0 .4rem;
    color: var(--lp-primary-dark);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__header"],
    [class$="-header"]
) h1 {
    margin: 0 0 .4rem;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
}

/* Page headers and actions */

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) > :is(
    [class$="__container"],
    [class$="-container"]
) > :is(
    [class$="__header"],
    [class$="-header"]
) {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__header-actions"],
    [class$="-header-actions"],
    [class$="-actions"],
    [class$="__form-actions"],
    [class$="-form-actions"]
) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__button"],
    [class$="-button"],
    [class$="-button-primary"],
    [class$="-button-secondary"],
    [class$="__details-link"],
    [class$="-view-link"],
    [class$="__view-link"]
) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 42px;
    padding: .6rem 1rem;
    border: 1px solid var(--lp-border);
    border-radius: 10px;
    background: #fff;
    color: var(--lp-primary-dark);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__button--primary"],
    [class$="-primary-button"],
    [class$="-button-primary"],
    [class$="-submit-button"]
) {
    color: #fff;
    background: var(--lp-primary);
    border-color: var(--lp-primary);
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__button"],
    [class$="-button"]
):hover {
    border-color: var(--lp-primary);
}

/* Summary cards and content panels */

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__summary"],
    [class$="-summary"]
) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .85rem;
    margin: 1.25rem 0;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__summary-card"],
    [class$="-summary-card"],
    [class$="__card"],
    [class$="-card"],
    [class$="__panel"],
    [class$="-panel"],
    [class$="__information-card"],
    [class$="-information-card"]
) {
    min-width: 0;
    padding: clamp(1rem, 2vw, 1.4rem);
    background: var(--lp-surface);
    border: 1px solid var(--lp-border);
    border-radius: 16px;
    box-shadow: var(--lp-shadow);
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__summary-card"],
    [class$="-summary-card"]
) {
    display: grid;
    align-content: center;
    gap: .25rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__summary-card"],
    [class$="-summary-card"]
) > span {
    color: var(--lp-muted);
    font-size: .9rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__summary-card"],
    [class$="-summary-card"]
) strong {
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    color: var(--lp-ink);
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__panel"],
    [class$="-panel"]
) {
    margin-block: 1.2rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__panel-header"],
    [class$="-panel-header"],
    [class$="__card-heading"],
    [class$="-card-header"]
) {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__panel-header"],
    [class$="-panel-header"]
) h2 {
    margin: 0 0 .2rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__panel-header"],
    [class$="-panel-header"]
) p {
    margin: 0;
    color: var(--lp-muted);
}

/* Search, filters, forms and tables */

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__toolbar"],
    [class$="-toolbar"]
) {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .9rem;
    margin: 1.2rem 0;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__search"],
    [class$="-search"]
) {
    flex: 1 1 250px;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__filter"],
    [class$="-filter"]
) {
    flex: 0 1 190px;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 700;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select,
    textarea
) {
    width: 100%;
    min-height: 44px;
    padding: .65rem .8rem;
    border: 1px solid #b7cbd4;
    border-radius: 9px;
    background: #fff;
    color: var(--lp-ink);
    font: inherit;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) textarea {
    min-height: 120px;
    resize: vertical;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__form-grid"],
    [class$="-form-grid"]
) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__form-group"],
    [class$="-form-group"],
    [class$="-form-field"],
    [class$="-field"]
) {
    min-width: 0;
    margin-bottom: 1rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__table-wrapper"],
    [class$="-table-wrapper"]
) {
    overflow-x: auto;
    width: 100%;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(th, td) {
    padding: .85rem;
    border-bottom: 1px solid var(--lp-border);
    text-align: left;
    vertical-align: top;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) th {
    color: var(--lp-muted);
    background: #f5fafb;
    font-size: .82rem;
}

/* Lists, details, notices and states */

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__grid"],
    [class$="-information-grid"],
    [class$="-connection-grid"],
    [class$="-status-guide-grid"]
) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__layout"],
    [class$="-layout"]
) {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr);
    gap: 1rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__list"],
    [class$="-list"]
) {
    display: grid;
    gap: .85rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__metadata"],
    [class$="-metadata"],
    [class$="__facts"],
    [class$="-details"],
    [class$="-account-list"]
) {
    display: grid;
    gap: .75rem;
    margin: 1rem 0;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__metadata"],
    [class$="-metadata"],
    [class$="__facts"],
    [class$="-details"],
    [class$="-account-list"]
) > div {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) dt {
    color: var(--lp-muted);
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) dd {
    margin: 0;
    font-weight: 650;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__notice"],
    [class$="-notice"],
    [class$="-privacy-notice"]
) {
    display: flex;
    gap: .75rem;
    margin: 1.25rem 0;
    padding: 1rem;
    border: 1px solid #b8dce4;
    border-radius: 12px;
    background: #edf8fa;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__notice"],
    [class$="-notice"]
) p {
    margin: 0;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__alert"],
    [class$="-alert"]
) {
    margin: 1rem 0;
    padding: .9rem 1rem;
    border: 1px solid;
    border-radius: 10px;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__alert--success"],
    [class$="-alert--success"]
) {
    color: #155b42;
    background: #e9f7ef;
    border-color: #a4d8bf;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__alert--error"],
    [class$="-alert--error"]
) {
    color: #8b2d40;
    background: #fff0f2;
    border-color: #e7b2bd;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__empty-state"],
    [class$="-empty-state"],
    [class$="__filter-empty"],
    [class$="-filter-empty"]
) {
    padding: 2rem 1rem;
    border: 1px dashed #b6cbd5;
    border-radius: 14px;
    background: #f8fcfd;
    text-align: center;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__status"],
    [class$="-status"],
    [class$="__badge"],
    [class$="-badge"],
    [class$="__priority"],
    [class$="-priority"]
) {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: .2rem .6rem;
    border-radius: 999px;
    background: #e7f3f6;
    color: #07566a;
    font-size: .8rem;
    font-weight: 750;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="--open"],
    [class$="--pending"],
    [class$="--warning"]
) {
    --lp-status-color: #775000;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="--completed"],
    [class$="--paid"],
    [class$="--active"],
    [class$="--approved"],
    [class$="--resolved"]
) {
    --lp-status-color: #11613e;
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__status"],
    [class$="-status"],
    [class$="__badge"],
    [class$="-badge"]
) {
    color: var(--lp-status-color, #07566a);
}

.landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
    [class$="__visually-hidden"],
    [class$="-visually-hidden"]
) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Shared Jinja macros */

.landlord-layout .spa-lshared__empty-state {
    padding: 2rem 1rem;
    border: 1px dashed var(--lp-border);
    border-radius: 14px;
    background: #f8fcfd;
    text-align: center;
}

.landlord-layout .spa-lshared__empty-icon {
    font-size: 2rem;
}

.landlord-layout .spa-lshared__field-error {
    color: #8b2d40;
    font-size: .9rem;
}

.landlord-layout .spa-lshared__unavailable {
    color: var(--lp-muted);
}

.landlord-layout .spa-lshared__money {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

/* Complaint detail */

.landlord-layout .spa-lcomplaint-detail__grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(230px, 1fr);
    gap: 1rem;
}

.landlord-layout .spa-lcomplaint-detail__description {
    white-space: pre-wrap;
}

.landlord-layout .spa-lcomplaint-detail__badge[data-status="resolved"] {
    color: #11613e;
    background: #e5f5eb;
}

.landlord-layout .spa-lcomplaint-detail__badge[data-status="open"] {
    color: #775000;
    background: #fff3d9;
}

/* Smaller screens */

@media (max-width: 980px) {
    .landlord-layout__shell {
        grid-template-columns: 1fr;
    }

    .landlord-layout__sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 80;
        width: min(85vw, 300px);
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 15px 0 40px rgba(0, 0, 0, .14);
    }

    .landlord-layout__sidebar.is-open,
    .landlord-layout[data-navigation-open="true"] .landlord-layout__sidebar {
        transform: translateX(0);
    }

    .landlord-layout__navigation-toggle,
    .landlord-layout__navigation-close {
        display: inline-flex;
        align-items: center;
        gap: .5rem;
        padding: .55rem .8rem;
        border: 1px solid var(--lp-border);
        border-radius: 9px;
        background: #fff;
        color: var(--lp-ink);
        cursor: pointer;
    }

    .landlord-layout__navigation-toggle {
        margin: .8rem 1rem 0;
    }

    .landlord-layout__backdrop:not([hidden]) {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 70;
        width: 100%;
        border: 0;
        background: rgba(13, 35, 47, .58);
    }
}

@media (max-width: 680px) {
    .landlord-layout__main {
        padding: 1rem;
    }

    .landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
        [class$="__layout"],
        [class$="-layout"],
        [class$="__form-grid"],
        [class$="-form-grid"]
    ),
    .landlord-layout .spa-lcomplaint-detail__grid {
        grid-template-columns: 1fr;
    }

    .landlord-layout__content > .spa-lpage:not(.spa-ldash-page) :is(
        [class$="__filter"],
        [class$="-filter"]
    ) {
        flex: 1 1 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .landlord-layout__sidebar {
        transition: none;
    }
}