:root {
    --ink: #182338;
    --muted: #68738a;
    --line: #dce4f0;
    --surface: #ffffff;
    --background: #f3f7fd;
    --blue: #2f6df6;
    --blue-dark: #2058d4;
    --green: #20a66a;
    --red: #d64e5d;
    --amber: #c27a12;
    --shadow: 0 18px 55px rgba(37, 61, 108, 0.12);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
}

button, input { font: inherit; }

.auth-page {
    display: grid;
    place-items: center;
    padding: 40px 20px;
    background:
            radial-gradient(circle at 12% 20%, rgba(64, 132, 255, .2), transparent 32%),
            radial-gradient(circle at 88% 80%, rgba(32, 166, 106, .13), transparent 30%),
            #eef4fd;
}

.auth-shell {
    width: min(1080px, 100%);
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    border-radius: 28px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-brand {
    padding: 64px;
    color: white;
    background: linear-gradient(145deg, #163774, #2f6df6 68%, #5191ff);
}

.auth-brand h1 {
    margin: 8px 0 18px;
    font-size: clamp(44px, 6vw, 72px);
    letter-spacing: -.055em;
}

.auth-brand > p:not(.portal-eyebrow) {
    max-width: 460px;
    font-size: 19px;
    line-height: 1.55;
    color: rgba(255, 255, 255, .82);
}

.auth-feature-list {
    display: grid;
    gap: 14px;
    margin-top: 48px;
}

.auth-feature-list span::before {
    content: "✓";
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
}

.auth-card {
    padding: 54px;
}

.auth-card h2 {
    margin: 6px 0 26px;
    font-size: 30px;
    letter-spacing: -.03em;
}

.portal-eyebrow {
    margin: 0;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.auth-brand .portal-eyebrow { color: #bcd3ff; }

.auth-form { display: grid; gap: 18px; }

.auth-form label {
    display: grid;
    gap: 8px;
    color: #35425a;
    font-size: 14px;
    font-weight: 700;
}

.auth-form input {
    width: 100%;
    min-height: 50px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    background: #fbfdff;
}

.auth-form input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(47, 109, 246, .12);
}

.portal-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    color: white;
    background: var(--blue);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: .18s ease;
}

.portal-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.portal-button.ghost { color: var(--ink); background: #edf2fa; }
.portal-button.ghost:hover { background: #dfe8f5; }
.portal-button.small { min-height: 38px; padding: 0 15px; font-size: 14px; }

.portal-alert {
    margin-bottom: 18px;
    padding: 13px 15px;
    border-radius: 11px;
    font-size: 14px;
}

.portal-alert.error { color: #8d2834; background: #ffedf0; }
.portal-alert.success { color: #14673f; background: #eaf8f1; }

.preview-credentials {
    display: grid;
    gap: 5px;
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #fff7df;
    color: #76530f;
    font-size: 14px;
}

.tenant-login-help {
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}

.tenant-login-help h3 { margin: 7px 0 8px; }
.tenant-login-help p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }

.portal-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 0 max(24px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid rgba(220, 228, 240, .85);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(14px);
}

.portal-logo {
    color: var(--ink);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -.04em;
    text-decoration: none;
}

.portal-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 48px 0 70px;
}

.cabinet-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
}

.cabinet-hero h1 {
    margin: 8px 0 8px;
    font-size: clamp(34px, 5vw, 52px);
    letter-spacing: -.045em;
}

.cabinet-hero > div > p:last-child { color: var(--muted); }

.privacy-badge {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 15px;
    border: 1px solid #ccebdd;
    border-radius: 999px;
    color: #176744;
    background: #f1fbf6;
    font-weight: 800;
    white-space: nowrap;
}

.privacy-badge span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(32, 166, 106, .13);
}

.portal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin: 34px 0;
}

.portal-stats article {
    display: grid;
    gap: 8px;
    min-height: 122px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 8px 30px rgba(42, 66, 110, .05);
}

.portal-stats article.attention { border-color: #ffd18b; background: #fffaf0; }
.portal-stats span { color: var(--muted); font-size: 14px; font-weight: 700; }
.portal-stats strong { align-self: end; font-size: 30px; letter-spacing: -.035em; }

.portal-section {
    margin-top: 22px;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 8px 34px rgba(42, 66, 110, .055);
}

.portal-section.muted-section { background: #f9fbfe; }
.portal-section-heading { display: flex; justify-content: space-between; margin-bottom: 22px; }
.portal-section-heading h2 { margin: 6px 0 0; font-size: 27px; letter-spacing: -.03em; }

.lease-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.tenant-lease-card {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, #fbfdff);
}

.lease-card-head { display: flex; justify-content: space-between; gap: 20px; }
.lease-card-head h3 { margin: 9px 0 5px; font-size: 23px; letter-spacing: -.025em; }
.lease-card-head p { margin: 0; color: var(--muted); font-size: 14px; }
.monthly-amount { font-size: 23px; white-space: nowrap; }

.portal-status {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    color: #4d5c74;
    background: #edf2f8;
    font-size: 12px;
    font-weight: 800;
}

.portal-status.active, .portal-status.status-paid { color: #176744; background: #e9f8f1; }
.portal-status.status-new, .portal-status.status-sent { color: #8a5c09; background: #fff3d7; }
.portal-status.status-cancelled { color: #8d2834; background: #ffedf0; }

.lease-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
    margin: 22px 0 0;
}

.lease-details div { padding-top: 12px; border-top: 1px solid #e8eef6; }
.lease-details dt { margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.lease-details dd { margin: 0; font-size: 14px; font-weight: 750; }

.tenant-terms {
    margin-top: 20px;
    padding: 15px;
    border-radius: 12px;
    background: #eef4ff;
}

.tenant-terms p { margin: 6px 0 0; color: #40506b; line-height: 1.5; white-space: pre-line; }

.payable-list { display: grid; gap: 12px; }
.payable-list article {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 20px;
    padding: 15px 17px;
    border: 1px solid #f0d89f;
    border-radius: 14px;
    background: #fffaf0;
}
.payable-list article > div { display: grid; gap: 4px; }
.payable-list article span { color: var(--muted); font-size: 13px; }

.portal-table-wrap { overflow-x: auto; }
.portal-table { width: 100%; border-collapse: collapse; }
.portal-table th, .portal-table td { padding: 14px 12px; border-bottom: 1px solid #e8eef6; text-align: left; white-space: nowrap; }
.portal-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.portal-table tbody tr:last-child td { border-bottom: 0; }

.closed-leases { display: grid; gap: 10px; }
.closed-leases article { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.closed-leases article:last-child { border-bottom: 0; }
.closed-leases span { color: var(--muted); }

.empty-portal { padding: 26px; border: 1px dashed #cbd6e7; border-radius: 14px; color: var(--muted); text-align: center; }

.portal-footer {
    display: flex;
    justify-content: space-between;
    padding: 30px 4px 0;
    color: var(--muted);
    font-size: 13px;
}

.message-card {
    width: min(560px, 100%);
    padding: 46px;
    border-radius: 24px;
    background: white;
    box-shadow: var(--shadow);
}
.message-card h1 { margin: 8px 0 12px; font-size: 34px; letter-spacing: -.035em; }
.message-card > p:not(.portal-eyebrow) { color: var(--muted); line-height: 1.5; }
.message-actions { display: flex; gap: 10px; margin-top: 24px; }

@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { padding: 42px; }
    .auth-feature-list { margin-top: 28px; }
    .auth-card { padding: 42px; }
    .lease-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
    .auth-page { padding: 14px; }
    .auth-brand, .auth-card { padding: 30px 24px; }
    .auth-brand h1 { font-size: 44px; }
    .portal-shell { width: min(100% - 24px, 1180px); padding-top: 30px; }
    .cabinet-hero { display: grid; }
    .privacy-badge { width: fit-content; }
    .portal-stats { grid-template-columns: 1fr; gap: 10px; }
    .portal-stats article { min-height: 96px; }
    .portal-section { padding: 20px 16px; border-radius: 17px; }
    .lease-card-head { display: grid; }
    .lease-details { grid-template-columns: 1fr; }
    .payable-list article { grid-template-columns: 1fr auto; }
    .payable-list .portal-button { grid-column: 1 / -1; }
    .closed-leases article, .portal-footer { display: grid; }
    .message-card { padding: 32px 24px; }
}
