@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --app-bg: #eef2fb;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fbff;
    --app-border: #e4eaf3;
    --app-text: #13213a;
    --app-muted: #6f7b91;
    --app-primary: #4f66ff;
    --app-primary-soft: rgba(79, 102, 255, 0.12);
    --app-success: #18a957;
    --app-success-soft: rgba(24, 169, 87, 0.12);
    --app-danger: #f05252;
    --app-danger-soft: rgba(240, 82, 82, 0.12);
    --app-warning: #f59e0b;
    --app-warning-soft: rgba(245, 158, 11, 0.16);
    --app-owner: #8b5cf6;
    --app-owner-soft: rgba(139, 92, 246, 0.14);
    --app-shadow: 0 16px 44px rgba(18, 28, 45, 0.08);
    --app-shadow-soft: 0 8px 20px rgba(18, 28, 45, 0.06);
    --sidebar-width: 250px;

    /* Semantic aliases used by the shared UI components. */
    --color-primary: var(--app-primary);
    --color-secondary: #64748b;
    --color-success: var(--app-success);
    --color-warning: var(--app-warning);
    --color-danger: var(--app-danger);
    --color-info: #0ea5e9;
    --color-muted: var(--app-muted);
    --color-background: var(--app-bg);
    --surface-card: var(--app-surface);
    --surface-soft: var(--app-surface-soft);
    --border-soft: var(--app-border);
    --text-primary: var(--app-text);
    --text-secondary: var(--app-muted);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: var(--app-shadow-soft);
    --shadow-md: var(--app-shadow);
    --transition-fast: 160ms ease;
    --transition-normal: 240ms ease;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--app-text);
    background:
        radial-gradient(circle at top left, rgba(79, 102, 255, 0.12), transparent 30%),
        linear-gradient(180deg, #f8fbff 0%, var(--app-bg) 100%);
    font-family: "Plus Jakarta Sans", Inter, "Segoe UI", Arial, sans-serif;
}

a {
    text-decoration: none;
}

.app-frame {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0d1730 0%, #101e3c 100%);
    color: #d9e2ff;
    display: flex;
    flex-direction: column;
    padding: 18px 14px 14px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    min-height: 0;
    overflow-y: auto;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 4px 10px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #ffd166;
    background: linear-gradient(180deg, rgba(79, 102, 255, 0.35), rgba(30, 41, 71, 0.5));
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    font-size: 1.25rem;
}

.sidebar-brand-title {
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.1;
    color: #ffffff;
}

.sidebar-brand-subtitle {
    color: rgba(217, 226, 255, 0.7);
    font-size: 0.72rem;
    margin-top: 2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255, 255, 255, 0.82);
    padding: 10px 12px;
    border-radius: 12px;
    transition: all 0.18s ease;
    font-weight: 600;
}

.sidebar-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 0.88rem;
    opacity: 0.95;
}

.sidebar-nav-link:hover,
.sidebar-nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(79, 102, 255, 0.92), rgba(122, 86, 255, 0.92));
    box-shadow: 0 12px 24px rgba(79, 102, 255, 0.25);
}

.sidebar-nav-link-muted {
    opacity: 0.55;
    cursor: default;
    background: transparent !important;
    box-shadow: none !important;
}

.sidebar-profile {
    margin-top: auto;
    padding-top: 10px;
}

.sidebar-profile-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.sidebar-profile-name {
    font-weight: 700;
    color: #fff;
    font-size: 0.84rem;
}

.sidebar-profile-role {
    font-size: 0.68rem;
    color: rgba(217, 226, 255, 0.7);
}

.sidebar-cta {
    margin-top: 10px;
    padding: 12px;
    border-radius: 16px;
    background:
        radial-gradient(circle at top right, rgba(79, 102, 255, 0.36), transparent 45%),
        linear-gradient(180deg, rgba(16, 30, 60, 0.96), rgba(10, 18, 35, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.sidebar-cta-art {
    height: 82px;
    border-radius: 16px;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.16), transparent 25%),
        radial-gradient(circle at 65% 15%, rgba(79, 102, 255, 0.34), transparent 22%),
        linear-gradient(180deg, rgba(22, 37, 74, 0.92), rgba(10, 18, 35, 0.92));
    margin-bottom: 14px;
    position: relative;
}

.sidebar-cta-image {
    display: block;
    width: 100%;
    height: 82px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 12px;
}

.sidebar-cta-art::before {
    content: "";
    position: absolute;
    left: 18%;
    right: 18%;
    bottom: 12px;
    height: 28px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(79, 102, 255, 0.45), rgba(79, 102, 255, 0.08));
    box-shadow: 0 16px 40px rgba(79, 102, 255, 0.14);
}

.sidebar-cta-text {
    font-size: 0.74rem;
    line-height: 1.42;
    color: rgba(238, 243, 255, 0.9);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.sidebar-cta-title {
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.sidebar-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 32px;
    margin-top: 12px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.94);
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.72rem;
    text-decoration: none;
    transition: background .2s ease, border-color .2s ease;
}

.sidebar-cta-button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.25);
}

.settings-sidebar-preview-wrap {
    max-width: 260px;
    padding: 8px;
    border-radius: 14px;
    background: #0b1730;
}

.settings-sidebar-preview {
    margin-top: 0;
}

.btn-sidebar {
    border-radius: 14px;
    padding: 9px 12px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-sidebar:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.app-main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    padding: 14px 14px 16px;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.app-topbar-heading {
    flex: 0 0 auto;
    min-width: 0;
}

.app-page-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--app-text);
    line-height: 1.15;
}

.app-page-title.dashboard-title {
    font-size: 1.05rem;
}

.app-page-subtitle {
    margin-top: 4px;
    color: var(--app-muted);
    font-size: 0.72rem;
}

.app-page-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    margin-top: 8px;
    padding: 7px 12px;
    border: 1px solid rgba(79, 102, 255, 0.24);
    border-radius: 10px;
    color: var(--app-primary);
    background: rgba(79, 102, 255, 0.04);
    font-size: 0.74rem;
    font-weight: 700;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.app-page-back:hover {
    color: var(--app-primary);
    background: rgba(79, 102, 255, 0.1);
    border-color: rgba(79, 102, 255, 0.38);
}

.app-page-back i {
    font-size: 0.7rem;
}

.report-toolbar .form-label {
    margin-bottom: 5px;
    font-size: 0.72rem;
    font-weight: 700;
}

.report-chart-wrap {
    position: relative;
    height: 280px;
}

.compact-summary-row {
    align-items: flex-start;
    height: 100%;
    padding: 8px 0;
    border: 0;
}

.compact-summary-row .summary-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 0.82rem;
}

.zone-report-row {
    padding: 12px;
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: var(--app-surface-soft);
}

.zone-report-row .progress {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8edf6;
}

.zone-report-row .progress-bar {
    background: linear-gradient(90deg, var(--app-primary), #7a56ff);
}

.report-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--app-border);
}

.report-list-row:last-child {
    border-bottom: 0;
}

@media print {
    .app-sidebar,
    .app-topbar,
    .report-toolbar,
    .app-page-back,
    .report-export-actions,
    .btn {
        display: none !important;
    }

    .app-main {
        margin-left: 0;
        padding: 0;
    }

    .app-card,
    .summary-panel {
        box-shadow: none;
        break-inside: avoid;
    }
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 290px;
    min-width: 220px;
    padding: 0 12px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(19, 33, 58, 0.08);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--app-shadow-soft);
}

.topbar-search input {
    border: 0;
    outline: none;
    background: transparent;
    width: 100%;
    color: var(--app-text);
}

.topbar-pill,
.topbar-icon {
    height: 36px;
    border: 1px solid rgba(19, 33, 58, 0.08);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--app-shadow-soft);
    border-radius: 12px;
    padding: 0 12px;
    color: var(--app-text);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    flex: 0 0 auto;
}

.topbar-icon {
    width: 36px;
    padding: 0;
    justify-content: center;
    position: relative;
}

.topbar-badge {
    position: absolute;
    top: -6px;
    right: -2px;
    min-width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #ff5f57;
    color: #fff;
    font-size: 0.7rem;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
}

.app-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app-alert {
    border-radius: 16px;
    box-shadow: var(--app-shadow-soft);
}

.dashboard-hero,
.stat-card,
.layout-block {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    box-shadow: var(--app-shadow-soft);
}

.dashboard-hero {
    padding: 16px;
}

.stat-card {
    padding: 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 8px;
    height: 3px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--app-primary), transparent);
    opacity: 0.85;
}

.stat-label {
    color: var(--app-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.stat-value {
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.metric-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    box-shadow: var(--app-shadow-soft);
    padding: 10px;
    min-height: 94px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
}

.metric-card::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 8px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--metric-accent, var(--app-primary)), transparent);
}

.metric-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.metric-icon {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    font-size: 0.86rem;
    color: var(--metric-accent, var(--app-primary));
    background: var(--metric-soft, var(--app-primary-soft));
}

.metric-copy {
    min-width: 0;
}

.metric-label {
    color: var(--app-muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.metric-value {
    font-size: 1.14rem;
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-top: 6px;
}

.metric-sub {
    color: var(--app-muted);
    font-size: 0.68rem;
    margin-top: 2px;
}

.metric-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 18px;
    padding-left: 2px;
    margin-top: auto;
}

.metric-chart span {
    flex: 1 1 0;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--metric-accent, var(--app-primary)), rgba(79, 102, 255, 0.15));
    opacity: 0.9;
}

.metric-chart span:nth-child(1) { height: 5px; }
.metric-chart span:nth-child(2) { height: 10px; }
.metric-chart span:nth-child(3) { height: 8px; }
.metric-chart span:nth-child(4) { height: 16px; }
.metric-chart span:nth-child(5) { height: 12px; }
.metric-chart span:nth-child(6) { height: 22px; }
.metric-chart span:nth-child(7) { height: 18px; }

.metric-blue {
    --metric-accent: var(--app-primary);
    --metric-soft: var(--app-primary-soft);
}

.metric-green {
    --metric-accent: var(--app-success);
    --metric-soft: var(--app-success-soft);
}

.metric-gray {
    --metric-accent: #8f9bb3;
    --metric-soft: rgba(143, 155, 179, 0.14);
}

.metric-purple {
    --metric-accent: var(--app-owner);
    --metric-soft: var(--app-owner-soft);
}

.metric-red {
    --metric-accent: var(--app-danger);
    --metric-soft: var(--app-danger-soft);
}

.layout-block {
    padding: 14px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title h2,
.section-title h3 {
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.section-title h2 {
    font-size: 1.08rem;
}

.section-title h3 {
    font-size: 0.94rem;
}

.section-subtitle {
    color: var(--app-muted);
    font-size: 0.82rem;
}

.legend {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--app-muted);
    font-size: 0.82rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    display: inline-block;
}

.legend-dot.green {
    background: var(--app-success);
}

.legend-dot.red {
    background: var(--app-danger);
}

.legend-dot.gray {
    background: #98a2b3;
}

.legend-dot.purple {
    background: var(--app-owner);
}

.unit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.unit-card {
    border-radius: 16px;
    padding: 12px;
    min-height: 134px;
    border: 1px solid transparent;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
}

.unit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 35px rgba(18, 28, 45, 0.12);
}

.unit-card::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.9;
    pointer-events: none;
}

.unit-card > * {
    position: relative;
    z-index: 1;
}

.unit-title {
    font-weight: 800;
    letter-spacing: -0.02em;
    font-size: 0.98rem;
}

.unit-status {
    font-size: 0.8rem;
    color: var(--app-muted);
    line-height: 1.6;
}

.unit-empty {
    background: #f8fbff;
    border-color: #e8eef7;
}

.status-paid {
    border-color: rgba(24, 169, 87, 0.25);
    background: linear-gradient(180deg, rgba(24, 169, 87, 0.10), rgba(24, 169, 87, 0.04));
}

.status-paid::before {
    background: radial-gradient(circle at top right, rgba(24, 169, 87, 0.12), transparent 48%);
}

.status-unpaid {
    border-color: rgba(240, 82, 82, 0.25);
    background: linear-gradient(180deg, rgba(240, 82, 82, 0.10), rgba(240, 82, 82, 0.04));
}

.status-unpaid::before {
    background: radial-gradient(circle at top right, rgba(240, 82, 82, 0.12), transparent 48%);
}

.status-due-soon {
    border-color: rgba(245, 158, 11, 0.25);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.05));
}

.status-due-soon::before {
    background: radial-gradient(circle at top right, rgba(245, 158, 11, 0.12), transparent 48%);
}

.status-vacant {
    border-color: rgba(148, 163, 184, 0.24);
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.9), rgba(226, 232, 240, 0.7));
}

.status-vacant::before {
    background: radial-gradient(circle at top right, rgba(148, 163, 184, 0.18), transparent 48%);
}

.status-owner {
    border-color: rgba(139, 92, 246, 0.25);
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.12), rgba(139, 92, 246, 0.05));
}

.status-owner::before {
    background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.16), transparent 48%);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.72fr) minmax(320px, 0.82fr);
    gap: 16px;
    align-items: start;
}

.panel-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.summary-panel,
.reminder-panel {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 20px;
    box-shadow: var(--app-shadow-soft);
    padding: 16px;
}

.summary-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--app-border);
}

.summary-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.summary-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    flex: 0 0 auto;
}

.summary-icon.green {
    color: var(--app-success);
    background: var(--app-success-soft);
}

.summary-icon.red {
    color: var(--app-danger);
    background: var(--app-danger-soft);
}

.summary-icon.blue {
    color: var(--app-primary);
    background: var(--app-primary-soft);
}

.summary-icon.purple {
    color: var(--app-owner);
    background: var(--app-owner-soft);
}

.summary-title {
    color: var(--app-muted);
    font-size: 0.78rem;
}

.summary-value {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 2px;
}

.summary-meta {
    color: var(--app-muted);
    font-size: 0.76rem;
    margin-top: 4px;
}

.reminder-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reminder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: var(--app-surface-soft);
}

.reminder-icon {
    width: 32px;
    height: 32px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--app-primary-soft);
    color: var(--app-primary);
    flex: 0 0 auto;
}

.reminder-title {
    font-weight: 700;
    font-size: 0.72rem;
}

.reminder-subtitle {
    color: var(--app-muted);
    font-size: 0.66rem;
    margin-top: 2px;
}

.recent-payments-card {
    margin-top: 10px;
}

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

.recent-payment-card {
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #fbfcff);
    padding: 10px;
    min-height: 98px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--app-shadow-soft);
}

.recent-payment-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-payment-icon {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--app-success-soft);
    color: var(--app-success);
    flex: 0 0 auto;
}

.recent-payment-name {
    font-weight: 700;
    font-size: 0.72rem;
    line-height: 1.25;
}

.recent-payment-month {
    color: var(--app-muted);
    font-size: 0.64rem;
}

.recent-payment-meta {
    margin-top: auto;
    font-weight: 800;
    font-size: 0.68rem;
}

.recent-payment-footer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--app-success);
    font-size: 0.88rem;
    font-weight: 700;
}

.dot-success {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--app-success);
}

.page-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 12px;
}

.app-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 16px;
    box-shadow: var(--app-shadow-soft);
    padding: 12px;
}

.app-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.app-card-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 800;
}

.app-card-subtitle {
    color: var(--app-muted);
    margin-top: 6px;
    font-size: 0.72rem;
}

.table-responsive {
    border-radius: 18px;
}

.table-responsive .table {
    margin-bottom: 0;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    color: var(--app-muted);
    font-size: 0.85rem;
    font-weight: 700;
    border-bottom: 1px solid var(--app-border) !important;
}

.table tbody td {
    vertical-align: middle;
}

.form-control,
.form-select,
textarea.form-control {
    border-radius: 14px;
    border-color: #d8e1ef;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    border-color: rgba(79, 102, 255, 0.42);
    box-shadow: 0 0 0 0.18rem rgba(79, 102, 255, 0.12);
}

.btn {
    border-radius: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, #4f66ff, #6a5cff);
    border: 0;
}

.btn-outline-primary {
    border-color: rgba(79, 102, 255, 0.2);
    color: var(--app-primary);
}

.btn-outline-primary:hover {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.action-icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    flex: 0 0 auto;
}

.action-icon-btn i {
    font-size: 0.82rem;
    line-height: 1;
}

.badge {
    border-radius: 999px;
    font-weight: 700;
}

.page-toolbar {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    box-shadow: var(--app-shadow-soft);
    padding: 10px;
}

.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
}

.filter-bar .filter-field {
    min-width: 180px;
    flex: 1 1 180px;
}

.empty-state {
    border: 1px dashed #d5ddea;
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(241, 245, 249, 0.92));
    border-radius: 20px;
    padding: 28px;
    text-align: center;
    color: var(--app-muted);
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
    background: var(--app-primary-soft);
    color: var(--app-primary);
    font-size: 1.15rem;
}

.empty-state-title {
    color: var(--app-text);
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.empty-state-text {
    margin: 0 auto;
    max-width: 380px;
    line-height: 1.65;
}

.table-empty-cell {
    padding: 0 !important;
    background: transparent !important;
}

.table-empty-state {
    margin: 10px 0;
    padding: 22px 18px;
}

.table-empty-state .empty-state-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 12px;
}

.table-empty-state .empty-state-title {
    font-size: 1rem;
}

.table-empty-state .empty-state-text {
    max-width: 420px;
    font-size: 0.92rem;
}

.modal-backdrop {
    background-color: rgba(15, 23, 42, 0.14);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.modal-backdrop.show {
    opacity: 1;
}

/* Keep the tenant form compact while allowing only its body to scroll. */
.tenant-modal-dialog {
    width: calc(100% - 2rem);
    max-width: 900px;
    max-height: calc(100vh - 1rem);
}

.tenant-modal-content {
    max-height: calc(100vh - 1rem);
}

.tenant-modal-content .modal-header,
.tenant-modal-content .modal-footer {
    flex: 0 0 auto;
    padding: 0.75rem 1rem;
}

.tenant-modal-body {
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    overscroll-behavior: contain;
}

.tenant-modal-body .row {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 0.65rem;
}

.tenant-modal-body textarea.form-control {
    min-height: 68px;
    height: 68px;
}

@media (max-width: 767.98px) {
    .tenant-modal-dialog {
        width: calc(100% - 1rem);
        max-width: none;
        margin: 0.5rem auto;
    }

    .tenant-modal-content {
        max-height: calc(100vh - 1rem);
    }

    .tenant-modal-body .col-md-6 {
        width: 100%;
    }
}

.navbar {
    display: none;
}

@media (max-width: 1199.98px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

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

    .recent-payments-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .app-frame {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
        left: auto;
        bottom: auto;
        height: auto;
        overflow-y: visible;
    }

    .app-main {
        margin-left: 0;
        padding: 18px;
    }

    .app-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .topbar-search {
        min-width: 0;
        flex: 1 1 100%;
    }
}

@media (min-width: 992px) {
    body {
        font-size: 0.9rem;
    }

    .app-main {
        padding: 14px 14px 18px;
    }

    .app-topbar {
        margin-bottom: 12px;
        gap: 10px;
    }

    .app-content {
        gap: 12px;
    }

    .app-page-title {
        font-size: 1rem;
    }

    .app-page-title.dashboard-title {
        font-size: 1.06rem;
    }

    .app-page-subtitle {
        margin-top: 4px;
        font-size: 0.72rem;
    }

    .topbar-search {
        flex-basis: 290px;
        min-width: 220px;
        height: 36px;
        padding: 0 12px;
        font-size: 0.82rem;
    }

    .topbar-pill,
    .topbar-icon {
        height: 36px;
        border-radius: 12px;
        padding: 0 12px;
        font-size: 0.8rem;
    }

    .topbar-icon {
        width: 36px;
    }

    .dashboard-hero,
    .layout-block,
    .summary-panel,
    .reminder-panel,
    .app-card {
        border-radius: 16px;
    }

    .dashboard-hero {
        padding: 16px;
    }

    .layout-block,
    .app-card {
        padding: 12px;
    }

    .summary-panel,
    .reminder-panel {
        padding: 12px;
    }

    .section-title {
        margin-bottom: 10px;
    }

    .section-title h2,
    .section-title h3 {
        line-height: 1.08;
    }

    .section-title h2 {
        font-size: 0.9rem;
    }

    .section-title h3 {
        font-size: 0.82rem;
    }

    .dashboard-grid {
        gap: 12px;
    }

    .panel-stack {
        gap: 12px;
    }

    .page-grid {
        gap: 12px;
    }

    .dashboard-metrics {
        gap: 8px;
    }

    .metric-card {
        padding: 10px;
        min-height: 92px;
        border-radius: 14px;
    }

    .metric-icon {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }

    .metric-value {
        font-size: 1.12rem;
    }

    .metric-sub {
        margin-top: 2px;
        font-size: 0.68rem;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.22rem;
    }

    .recent-payments-card {
        margin-top: 10px;
    }

    .recent-payments-strip {
        gap: 8px;
    }

    .recent-payment-card {
        padding: 10px;
        min-height: 96px;
        border-radius: 14px;
    }

    .empty-state {
        padding: 18px;
    }

    .page-toolbar {
        padding: 10px;
    }

    .dashboard-grid > section > .section-title h2 {
        font-size: 18px;
        line-height: 1.05;
    }

    .summary-panel .section-title h2 {
        font-size: 16px;
        line-height: 1.05;
        white-space: nowrap;
    }

    .summary-panel .section-title > div {
        min-width: 0;
    }
}

@media (max-width: 767.98px) {
    .dashboard-hero,
    .layout-block,
    .summary-panel,
    .reminder-panel,
    .app-card {
        padding: 18px;
        border-radius: 20px;
    }

    .stat-value {
        font-size: 1.65rem;
    }

    .sidebar-nav {
        overflow-x: auto;
        flex-direction: row;
        padding-bottom: 6px;
    }

    .sidebar-nav-link {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .filter-bar .filter-field {
        min-width: 100%;
    }

    .dashboard-metrics {
        grid-template-columns: 1fr;
    }

    .recent-payments-strip {
        grid-template-columns: 1fr;
    }
}

/* Shared UI foundation for the staged SaaS visual refresh. */
.ui-btn {
    align-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    display: inline-flex;
    font-weight: 600;
    gap: 8px;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.ui-btn:hover {
    transform: translateY(-1px);
}

.ui-btn:focus-visible,
.ui-icon-btn:focus-visible,
.ui-filter:focus-within {
    outline: 3px solid color-mix(in srgb, var(--color-primary) 22%, transparent);
    outline-offset: 2px;
}

.ui-btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.ui-btn-primary:hover {
    background: color-mix(in srgb, var(--color-primary) 88%, #111827);
    color: #fff;
}

.ui-btn-secondary,
.ui-btn-ghost {
    background: var(--surface-card);
    border-color: var(--border-soft);
    color: var(--text-primary);
}

.ui-btn-secondary:hover,
.ui-btn-ghost:hover {
    background: var(--surface-soft);
    color: var(--color-primary);
}

.ui-btn-danger {
    background: #fff5f5;
    border-color: #ffd8d8;
    color: var(--color-danger);
}

.ui-btn-sm {
    min-height: 34px;
    padding: 6px 10px;
}

.ui-icon-btn {
    align-items: center;
    background: var(--surface-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    color: var(--color-primary);
    display: inline-flex;
    height: 38px;
    justify-content: center;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    width: 38px;
}

.ui-icon-btn:hover {
    background: var(--app-primary-soft);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.ui-badge {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    display: inline-flex;
    font-size: .76rem;
    font-weight: 600;
    gap: 5px;
    line-height: 1;
    padding: 7px 10px;
    white-space: nowrap;
}

.ui-badge-active,
.ui-badge-paid,
.ui-badge-occupied {
    background: var(--app-success-soft);
    border-color: rgba(24, 169, 87, .14);
    color: #08783b;
}

.ui-badge-partial,
.ui-badge-pending {
    background: var(--app-warning-soft);
    border-color: rgba(245, 158, 11, .18);
    color: #a45a00;
}

.ui-badge-unpaid,
.ui-badge-absconded {
    background: var(--app-danger-soft);
    border-color: rgba(240, 82, 82, .16);
    color: #b42323;
}

.ui-badge-empty,
.ui-badge-void,
.ui-badge-exited {
    background: #f1f4f8;
    border-color: #e0e6ee;
    color: #5e6b80;
}

.ui-badge-owner {
    background: var(--app-owner-soft);
    border-color: rgba(139, 92, 246, .16);
    color: #7041d3;
}

.ui-row-partial {
    background: rgba(245, 158, 11, .045);
}

.ui-row-exited {
    background: rgba(100, 116, 139, .035);
}

.ui-row-absconded {
    background: rgba(240, 82, 82, .055);
    box-shadow: inset 3px 0 0 var(--color-danger);
}

.tenant-row-absconded {
    background: rgba(240, 82, 82, .055);
    box-shadow: inset 4px 0 0 var(--color-danger);
}

.tenant-row-completed {
    background: rgba(100, 116, 139, .035);
}

.tenant-row-absconded:hover,
.tenant-row-completed:hover {
    background: rgba(240, 82, 82, .085);
}

.ui-table-card {
    background: var(--surface-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

.ui-table-card .table-responsive {
    margin: 0;
}

.ui-table-card .table {
    margin-bottom: 0;
}

.ui-table-card .table thead th {
    background: var(--surface-soft);
    font-size: .76rem;
    letter-spacing: .02em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.ui-table-card .table tbody tr {
    transition: background-color var(--transition-fast);
}

.ui-table-card .table tbody tr:hover {
    background: #fbfcff;
}

.ui-filter {
    align-items: center;
    background: var(--surface-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    display: flex;
    min-height: 42px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ui-filter input,
.ui-filter select {
    background: transparent;
    border: 0;
    min-height: 40px;
}

.ui-filter input:focus,
.ui-filter select:focus {
    box-shadow: none;
}

.ui-action-menu {
    min-width: 190px;
    padding: 6px;
}

.ui-action-menu .dropdown-item {
    align-items: center;
    border-radius: var(--radius-sm);
    display: flex;
    gap: 9px;
    min-height: 38px;
    padding: 8px 10px;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.ui-action-menu .dropdown-item:hover,
.ui-action-menu .dropdown-item:focus {
    background: var(--app-primary-soft);
    color: var(--color-primary);
}

.ui-action-menu .dropdown-divider {
    border-color: var(--border-soft);
    margin: 5px 0;
}

.ui-empty-state {
    align-items: center;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    min-height: 190px;
    padding: 28px;
    text-align: center;
}

.ui-empty-state-icon {
    align-items: center;
    background: var(--app-primary-soft);
    border-radius: 16px;
    color: var(--color-primary);
    display: inline-flex;
    font-size: 1.25rem;
    height: 48px;
    justify-content: center;
    width: 48px;
}

.ui-empty-state-title {
    color: var(--text-primary);
    font-weight: 700;
}

.ui-form-control {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    min-height: 42px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ui-form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--app-primary-soft);
}

.app-content .form-control,
.app-content .form-select {
    border-color: var(--border-soft);
    border-radius: var(--radius-md);
    min-height: 42px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.app-content .form-control:focus,
.app-content .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--app-primary-soft);
}

.app-content .btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.app-content .btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.app-card-head,
.section-title {
    gap: 14px;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dt-search input,
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dt-length select {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    min-height: 38px;
    padding: 6px 10px;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dt-search input:focus,
.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dt-length select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--app-primary-soft);
    outline: 0;
}

.dataTables_wrapper .pagination .page-link {
    border-color: var(--border-soft);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    margin: 0 2px;
}

.dataTables_wrapper .pagination .page-item.active .page-link {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.app-topbar {
    gap: 24px;
}

.app-page-title {
    font-size: clamp(1.35rem, 1.7vw, 1.85rem);
    letter-spacing: -.025em;
}

.app-page-subtitle {
    font-size: .92rem;
}

.topbar-actions {
    flex-wrap: nowrap;
    min-width: 0;
}

@media (max-width: 991.98px) {
    .app-topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .topbar-actions {
        max-width: 100%;
        width: 100%;
    }

    .app-page-title {
        font-size: 1.35rem;
    }
}

.ui-modal .modal-content {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.ui-modal .modal-header,
.ui-modal .modal-footer {
    background: var(--surface-card);
    border-color: var(--border-soft);
    padding: 16px 20px;
}

.ui-modal .modal-body {
    max-height: min(68vh, 680px);
    overflow-y: auto;
    padding: 20px;
}

.auth-page {
    min-height: calc(100vh - 90px);
    padding: 36px 16px;
}

.auth-card {
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-md);
    padding: 34px;
}

.auth-brand-mark {
    align-items: center;
    background: var(--app-primary-soft);
    border-radius: 16px;
    color: var(--color-primary);
    display: inline-flex;
    font-size: 1.35rem;
    height: 52px;
    justify-content: center;
    margin-bottom: 18px;
    width: 52px;
}

@media (max-width: 767.98px) {
    .ui-table-card .table thead th {
        position: static;
    }

    .ui-modal .modal-body {
        max-height: 62vh;
        padding: 16px;
    }

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