/* property-management\static\css\style.css */
/* Excel-Modern Hybrid Design for Django Property Management - BRAND UPDATED */
:root {
    /* Brand Colors */
    --brand-pink: #e91e63;
    --brand-pink-dark: #c2185b;
    --brand-pink-light: #f48fb1;
    --brand-pink-pale: #fce4ec;
    --brand-pink-gradient: linear-gradient(135deg, #e91e63 0%, #c2185b 100%);
    --brand-pink-hover: #d81b60;
    
    /* UI Colors */
    --excel-header-bg: #f8f9fa;
    --excel-border: #e5e7eb;
    --excel-grid: #e0e0e0;
    --excel-hover: #f0f7ff;
    
    --primary-blue: #2563eb;
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --error-red: #ef4444;
    
    --info-blue: #3b82f6;
    --info-blue-light: #dbeafe;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, sans-serif;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    
    /* Spacing */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-brand: 0 4px 12px rgba(233, 30, 99, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
    color: #1a1a1a;
    font-size: var(--font-size-base);
    line-height: 1.5;
    min-height: 100vh;
}

/* ===== NAVIGATION ===== */
.navbar {
    background: white;
    border-bottom: 1px solid var(--excel-border);
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-brand .icon-lg {
    color: var(--brand-pink);
    background: var(--brand-pink-pale);
    padding: 8px;
    border-radius: var(--border-radius-sm);
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-brand h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--brand-pink);
    background: linear-gradient(135deg, var(--brand-pink) 0%, var(--brand-pink-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-brand-subtitle {
    margin: 0;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--excel-header-bg);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--excel-border);
    padding: 2px;
}

.nav-link {
    text-decoration: none;
    color: #374151;
    padding: 10px 16px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.nav-link:hover {
    background: white;
    border-color: var(--excel-border);
    color: var(--brand-pink);
}

.nav-link.active {
    background: white;
    color: var(--brand-pink);
    font-weight: 600;
    border: 1px solid var(--excel-border);
    border-bottom: 3px solid var(--brand-pink);
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--brand-pink-gradient);
}

.btn-logout {
    background: #fff;
    color: #374151;
    padding: 4px 11px;
    border-radius: 9999px;
    font-weight: 500;
    font-size: 12px;
    border: 1px solid var(--excel-border);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.btn-logout:hover {
    background: #fff;
    color: var(--brand-pink);
    border-color: var(--brand-pink);
}

/* ===== MAIN CONTAINER ===== */
.container {
    max-width: 100%;
    margin: 20px;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--excel-border);
    min-height: calc(100vh - 120px);
}

/* ===== PAGE HEADERS ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--excel-border);
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--brand-pink-gradient);
    border-radius: 2px;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header h1 i {
    color: var(--brand-pink);
    background: var(--brand-pink-pale);
    padding: 10px;
    border-radius: var(--border-radius-sm);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-actions {
    display: flex;
    gap: 10px;
}

/* ===== SHEET TABS ===== */
.sheet-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--excel-header-bg);
    border: 1px solid var(--excel-border);
    border-radius: 10px 10px 0 0;
    padding: 12px 16px;
    margin: 20px 0 0;
    overflow-x: auto;
}

.sheet-tabs > .btn:first-of-type {
    margin-left: auto;
}

.sheet-tabs .btn {
    flex-shrink: 0;
}

.sheet-tab {
    padding: 12px 24px;
    background: white;
    border: 1px solid var(--excel-border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;
}

.sheet-tab:hover {
    background: #f8f9fa;
    color: var(--brand-pink);
}

.sheet-tab.active {
    background: white;
    border-bottom: 3px solid var(--brand-pink);
    font-weight: 600;
    color: var(--brand-pink);
    z-index: 1;
}

.sheet-tab.active::before {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--brand-pink-gradient);
}

.sheet-content {
    display: none;
    padding: 20px 0;
}

.sheet-content.active {
    display: block;
}

/* Pagination Styles */
.pagination {
    margin: 30px 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.pagination .current {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border-radius: 4px;
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

.pagination a {
    padding: 8px 16px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #007bff;
    text-decoration: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination a:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.pagination a:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius-md);
    padding: 20px;
    border: 1px solid var(--excel-border);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.stat-card:hover {
    border-color: var(--brand-pink);
    box-shadow: var(--shadow-brand);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--brand-pink-gradient);
}

.stat-icon {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--brand-pink);
    width: 36px;
    height: 36px;
    background: var(--brand-pink-pale);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-md);
}

/* Special stat icons for different categories */
.stat-card:nth-child(2) .stat-icon { /* Today's Revenue */
    background: #d1fae5;
    color: var(--success-green);
}

.stat-card:nth-child(3) .stat-icon { /* This Month's Revenue */
    background: #dbeafe;
    color: var(--primary-blue);
}

.stat-card:nth-child(4) .stat-icon { /* Vacant Properties */
    background: #fef3c7;
    color: var(--warning-orange);
}

.stat-card:nth-child(5) .stat-icon { /* Occupied Properties */
    background: #fce7f3;
    color: var(--brand-pink);
}

.stat-value {
    font-size: clamp(0.95rem, 2.2vw + 0.8rem, 1.75rem);
    font-weight: 700;
    color: #1f2937;
    margin: 4px 0;
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}

.stat-label {
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--excel-border);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--excel-header-bg);
    padding: 16px 24px;
    border-bottom: 1px solid var(--excel-border);
    font-weight: 600;
    color: #374151;
    font-size: var(--font-size-base);
    position: relative;
    padding-left: 16px;
}

.card-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--brand-pink-gradient);
}

/* ===== TABLES ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.data-table thead {
    background: var(--excel-header-bg);
    border-bottom: 2px solid var(--excel-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-right: 1px solid var(--excel-border);
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
}

.data-table th:last-child {
    border-right: none;
}

.data-table td {
    padding: 12px;
    border-right: 1px solid var(--excel-grid);
    border-bottom: 1px solid var(--excel-grid);
    vertical-align: middle;
}

.data-table td:last-child {
    border-right: none;
}

.data-table tbody tr {
    background: white;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.data-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.data-table tbody tr:hover {
    background: linear-gradient(90deg, var(--brand-pink-pale) 0%, transparent 100%);
    border-left-color: var(--brand-pink);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: var(--font-size-sm);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--excel-border);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    background: white;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-pink);
    box-shadow: 0 0 0 3px var(--brand-pink-pale);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Filter-bar grouping: separates "scope" filters (branch/landlord — narrow
   WHICH records) from "period" filters (month/year/date range — narrow
   WHEN) and search, so it's clear which controls interact with which.
   Use: a small uppercase label above each logical group, groups separated
   by a hairline divider. */
.filter-group + .filter-group {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}
.filter-group-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
    display: block;
    margin-bottom: 6px;
}
.filter-group-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* Cluster: sits several small filter-groups (Scope/Filter/Search) side by
   side with a vertical divider instead of each stacking as its own
   full-width row — keeps compact selects from wasting a whole row each.
   A group that follows a cluster (e.g. Landlord, which needs full width
   for its picker) still gets the usual horizontal divider above it. */
.filter-groups-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}
.filter-groups-cluster > .filter-group {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.filter-groups-cluster > .filter-group + .filter-group {
    padding-left: 20px;
    border-left: 1px solid #f3f4f6;
}
.filter-groups-cluster + .filter-group {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

/* ===== BUTTONS (compact outline pills) ===== */
.btn,
a.btn,
button.btn,
input.btn[type="submit"],
input.btn[type="button"] {
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    border: 1px solid #d1d5db;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #fff;
    background-color: #fff;
    color: #374151;
    text-decoration: none;
    box-shadow: none;
    white-space: nowrap;
    vertical-align: middle;
}

.btn:hover,
a.btn:hover,
button.btn:hover,
.btn:focus,
a.btn:focus,
button.btn:focus,
.btn:focus-visible,
a.btn:focus-visible,
button.btn:focus-visible,
input.btn[type="submit"]:hover,
input.btn[type="submit"]:focus {
    background: #fff !important;
    background-color: #fff !important;
    box-shadow: none;
}

.btn:active {
    transform: none;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: #fff;
    color: var(--brand-pink);
    border-color: #f8bbd0;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:focus-visible {
    background: #fff !important;
    background-color: #fff !important;
    color: var(--brand-pink);
    border-color: var(--brand-pink);
}

.btn-success {
    background: #fff;
    color: #047857;
    border-color: #bbf7d0;
}

.btn-success:hover,
.btn-success:focus,
.btn-success:focus-visible {
    background: #fff !important;
    background-color: #fff !important;
    color: #047857;
    border-color: #10b981;
}

.btn-secondary {
    background: #fff;
    color: #4b5563;
    border-color: #d1d5db;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:focus-visible {
    background: #fff !important;
    background-color: #fff !important;
    color: #374151;
    border-color: #6b7280;
}

.btn-danger {
    background: #fff;
    color: #dc2626;
    border-color: #fecaca;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:focus-visible {
    background: #fff !important;
    background-color: #fff !important;
    color: #b91c1c;
    border-color: #ef4444;
}

.btn-warning {
    background: #fff;
    color: #b45309;
    border-color: #fde68a;
}

.btn-warning:hover,
.btn-warning:focus,
.btn-warning:focus-visible {
    background: #fff !important;
    background-color: #fff !important;
    color: #92400e;
    border-color: #f59e0b;
}

.btn-info {
    background: #fff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.btn-info:hover,
.btn-info:focus,
.btn-info:focus-visible {
    background: #fff !important;
    background-color: #fff !important;
    color: #1d4ed8;
    border-color: #3b82f6;
}

.btn-outline-primary {
    background: #fff;
    color: var(--brand-pink);
    border-color: #f8bbd0;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:focus-visible {
    background: #fff !important;
    background-color: #fff !important;
    color: var(--brand-pink);
    border-color: var(--brand-pink);
}

.btn-outline-secondary {
    background: #fff;
    color: #4b5563;
    border-color: #d1d5db;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:focus-visible {
    background: #fff !important;
    background-color: #fff !important;
    color: #374151;
    border-color: #6b7280;
}

.btn-outline-danger {
    background: #fff;
    color: var(--error-red);
    border-color: #fecaca;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus,
.btn-outline-danger:focus-visible {
    background: #fff !important;
    background-color: #fff !important;
    color: #b91c1c;
    border-color: #ef4444;
}

.btn-icon {
    padding: 4px 10px;
    gap: 4px;
}

.btn-icon i {
    font-size: 11px;
}

.btn-sm,
a.btn-sm,
button.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    gap: 5px;
    font-weight: 500;
}

.btn-sm.btn-icon {
    padding: 3px 8px;
}

.btn-lg {
    padding: 6px 14px;
    font-size: 13px;
    gap: 6px;
}

.pagination .btn {
    min-width: 2.5rem;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
    border-color: #10b981;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
    border-color: #3b82f6;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #ef4444;
}

.badge-primary {
    background: var(--brand-pink-pale);
    color: var(--brand-pink-dark);
    border-color: var(--brand-pink);
}

/* ===== INFO BUTTON ===== */
.info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    vertical-align: middle;
    transition: color 0.15s;
}
.info-btn:hover, .info-btn-active { color: #1976d2; }
.info-panel {
    font-size: 13px;
    color: #6b7280;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 6px;
    line-height: 1.5;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-stack {
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 14px 13px 16px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.13), 0 1px 4px rgba(0,0,0,.08);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.45;
    position: relative;
    overflow: hidden;
    animation: toast-in 0.28s cubic-bezier(.22,.61,.36,1) both;
}

.toast-item.toast-out {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(100%) scale(.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); max-height: 120px; margin-bottom: 0; }
    to   { opacity: 0; transform: translateX(100%); max-height: 0; margin-bottom: -10px; }
}

.toast-success { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.toast-error, .toast-danger { background: #fff1f2; color: #9f1239; border: 1px solid #fda4af; }
.toast-warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
.toast-info { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; }

.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-success .toast-icon { color: #10b981; }
.toast-error .toast-icon, .toast-danger .toast-icon { color: #f43f5e; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info .toast-icon { color: #3b82f6; }

.toast-msg { flex: 1; }

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 0 0 6px;
    color: inherit;
    opacity: 0.5;
    transition: opacity .15s;
    margin-top: -1px;
}
.toast-close:hover { opacity: 1; }

.toast-progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    border-radius: 0 0 10px 10px;
}
.toast-success .toast-progress { background: #10b981; }
.toast-error .toast-progress, .toast-danger .toast-progress { background: #f43f5e; }
.toast-warning .toast-progress { background: #f59e0b; }
.toast-info .toast-progress { background: #3b82f6; }

@keyframes toast-progress-shrink {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}
.toast-progress-run {
    animation: toast-progress-shrink linear both;
}

/* Legacy inline alert (used within page content, not as toast) */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    font-size: 13.5px;
}
.alert-success { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.alert-info { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.alert-primary { background: var(--brand-pink-pale); color: var(--brand-pink-dark); border-color: var(--brand-pink); }
.alert .close-btn {
    margin-left: auto; flex-shrink: 0; background: none; border: none;
    cursor: pointer; font-size: 16px; color: inherit; opacity: .6;
}
.alert .close-btn:hover { opacity: 1; }

/* ===== CUSTOM HEADER STYLES ===== */
.tenant-list-header,
.all-properties-header,
.properties-list-header,
.landlord-list-header {
    padding: 16px 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f5 100%);
    border-bottom: 2px solid #e9ecef;
    position: relative;
}

.tenant-list-header::before,
.all-properties-header::before,
.properties-list-header::before,
.landlord-list-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--brand-pink-gradient);
}

.tenant-list-header-content,
.all-properties-header-content,
.properties-list-header-content,
.landlord-list-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.tenant-list-header-title,
.all-properties-header-title,
.properties-list-header-title,
.landlord-list-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.tenant-list-header-title i,
.all-properties-header-title i,
.properties-list-header-title i,
.landlord-list-header-title i {
    font-size: 20px;
    color: var(--brand-pink);
    background: var(--brand-pink-pale);
    padding: 10px;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tenant-list-header-title h3,
.all-properties-header-title h3,
.properties-list-header-title h3,
.landlord-list-header-title h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.tenant-count,
.filter-count,
.properties-count,
.landlord-count {
    background: var(--brand-pink-pale);
    color: var(--brand-pink);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(233, 30, 99, 0.2);
}

/* ===== ACTION BUTTONS CONTAINERS ===== */
.tenant-list-header-actions,
.all-properties-header-actions,
.properties-list-header-actions,
.landlord-list-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 4px 0;
}

/* ===== SEARCH BOX ===== */
.search-box {
    position: relative;
    min-width: 250px;
    max-width: 400px;
    flex-grow: 1;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
    font-size: 14px;
}

.search-input {
    width: 100%;
    padding: 6px 12px 6px 34px;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    font-size: 12px;
    background: white;
    transition: all 0.2s;
    color: #4a5568;
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--brand-pink);
    box-shadow: 0 0 0 3px var(--brand-pink-pale);
}

.search-input::placeholder {
    color: #a0aec0;
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    padding: 2px 0;
}

/* ===== ACTION CARDS ===== */
.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.action-card:hover {
    border-color: var(--brand-pink);
    box-shadow: var(--shadow-brand);
    transform: translateY(-2px);
    color: var(--brand-pink);
}

.action-card i {
    color: var(--brand-pink);
    margin-bottom: 15px;
}

.action-card h4 {
    margin: 10px 0;
    font-size: 18px;
    font-weight: 600;
}

.action-card p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* ===== UTILITY CLASSES ===== */
.icon {
    width: 16px;
    height: 16px;
}

.icon-lg {
    width: 20px;
    height: 20px;
}

.text-center { text-align: center; }
.text-muted { color: #6b7280; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }

/* ===== LOADING STATES ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--brand-pink-pale);
    border-top: 3px solid var(--brand-pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ===== FORM VALIDATION ===== */
.is-valid {
    border-color: var(--success-green) !important;
    background-color: rgba(16, 185, 129, 0.1) !important;
}

.is-invalid {
    border-color: var(--error-red) !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .tenant-list-header-content,
    .all-properties-header-content,
    .properties-list-header-content,
    .landlord-list-header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .search-box {
        min-width: 100%;
        max-width: 100%;
    }
    
    .action-buttons {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 16px;
    }
    
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 12px;
    }
    
    .nav-links {
        flex-wrap: wrap;
        margin-top: 12px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .sheet-tab {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .btn-icon {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .tenant-list-header-title,
    .all-properties-header-title,
    .properties-list-header-title,
    .landlord-list-header-title {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-icon {
        width: 100%;
        justify-content: center;
    }
    
    .stat-value {
        font-size: clamp(0.85rem, 4vw, 1.25rem);
    }
}

/* ===== MODAL STYLES ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-width: 800px;
}

.modal-header {
    background: var(--excel-header-bg);
    padding: 20px;
    border-bottom: 1px solid var(--excel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding-left: 24px;
}

.modal-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--brand-pink-gradient);
}

.modal-header h3 {
    margin: 0;
    color: var(--brand-pink);
}

.modal-header .close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
}

.modal-header .close:hover {
    color: var(--brand-pink);
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.mark-left-row {
    margin-bottom: 8px;
    font-size: 14px;
}
.text-danger { color: var(--error-red); }
.text-warning { color: var(--warning-orange); }
.font-weight-bold { font-weight: 600; }

/* Search box with clear button - clean professional layout */
.tenant-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 14px;
    pointer-events: none;
}

.search-input-wrapper .search-input {
    width: 100%;
    padding: 8px 36px 8px 38px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-wrapper .search-input:focus {
    outline: none;
    border-color: var(--brand-pink);
    box-shadow: 0 0 0 2px var(--brand-pink-pale);
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

.search-clear-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.search-clear-btn:active {
    background: #d1d5db;
}

.search-submit-btn {
    flex-shrink: 0;
}

/* ===== LANDLORD LIVE SEARCH BAR (shared) ===== */
.pm-landlord-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.pm-landlord-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.pm-landlord-search-field {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.pm-landlord-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 11px;
    width: 14px;
    text-align: center;
    pointer-events: none;
    z-index: 1;
}

.pm-landlord-search-input {
    width: 100%;
    padding: 6px 28px 6px 32px;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    font-size: 12px;
    line-height: 1.35;
    background: #fff;
    color: #374151;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.pm-landlord-search--no-icon .pm-landlord-search-input {
    padding-left: 11px;
}

.pm-landlord-search--compact .pm-landlord-search-input {
    padding-top: 5px;
    padding-bottom: 5px;
    font-size: 11px;
}

.pm-landlord-search--compact:not(.pm-landlord-search--no-icon) .pm-landlord-search-input {
    padding-left: 30px;
    padding-right: 26px;
}

.pm-landlord-search--compact:not(.pm-landlord-search--no-icon) .pm-landlord-search-icon {
    left: 9px;
    font-size: 10px;
}

.pm-landlord-search--compact.pm-landlord-search--no-icon .pm-landlord-search-input {
    padding-left: 10px;
    padding-right: 26px;
}

.pm-landlord-search-input:focus {
    outline: none;
    border-color: var(--brand-pink);
    box-shadow: 0 0 0 2px var(--brand-pink-pale);
}

.pm-landlord-search-input::placeholder {
    color: #a0aec0;
}

.pm-landlord-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: background 0.15s ease, color 0.15s ease;
}

.pm-landlord-search-clear:hover {
    background: #e5e7eb;
    color: #374151;
}

.pm-landlord-search-submit {
    flex-shrink: 0;
}

.landlord-picker-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.landlord-picker-block label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.landlord-picker-block select[multiple],
.landlord-picker-block select[size] {
    min-width: 280px;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-size: 11px;
    line-height: 1.35;
}

.landlord-picker-block select[size] {
    height: auto;
    max-height: calc(4 * var(--landlord-live-row-h, 1.75rem) + 2px);
    overflow-y: auto;
    padding: 0;
}

.landlord-picker-block select[size] option {
    padding: 5px 10px;
    font-size: 11px;
}

/* Scrollable landlord pick lists (max 4 rows visible) */
:root {
    --landlord-live-row-h: 1.75rem;
}

.landlord-live-list,
.landlord-sidebar-list.landlord-live-list {
    margin-top: 6px;
    max-height: calc(4 * var(--landlord-live-row-h));
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

/* Losses report: full-height scrollable landlord picker */
.landlord-sidebar-list.landlord-live-list.landlord-sidebar-list--full {
    max-height: none;
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
}

.landlord-live-row,
.landlord-sidebar-list .landlord-link.landlord-live-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: var(--landlord-live-row-h);
    padding: 4px 10px;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
    color: #374151;
    font-size: 11px;
    line-height: 1.35;
    box-sizing: border-box;
}

.landlord-live-row:last-child,
.landlord-sidebar-list .landlord-link.landlord-live-row:last-child {
    border-bottom: none;
}

.landlord-live-row:hover,
.landlord-sidebar-list .landlord-link.landlord-live-row:hover {
    background: #fdf2f8;
}

.landlord-live-row.is-active,
.landlord-sidebar-list .landlord-link.landlord-live-row.is-active {
    background: #fce4ec;
    border-left: 3px solid #e91e63;
    padding-left: 7px;
    font-weight: 600;
}

.landlord-live-row .ll-code {
    font-weight: 600;
    color: #be185d;
    flex-shrink: 0;
    font-size: 11px;
}

.landlord-live-row .ll-name {
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    flex: 1;
}

.landlord-live-row .ll-warn {
    flex-shrink: 0;
    font-size: 10px;
    color: #dc2626;
    margin-left: 4px;
}

.landlord-live-row.has-shortfall .ll-name {
    color: #dc2626;
}

.landlord-live-empty {
    padding: 8px 10px;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
}

.landlord-sidebar-search {
    margin-bottom: 8px;
}

.landlord-toolbar-landlord .pm-landlord-search {
    margin-bottom: 6px;
}

.landlord-sidebar-search-bar,
.landlord-list-search {
    width: 100%;
}

.landlord-sidebar-search-bar .pm-landlord-search-field {
    min-width: 0;
}

.landlord-list-search.search-box {
    min-width: 220px;
    max-width: 420px;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-pink);
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .page-actions,
    .btn:not(.no-print) {
        display: none !important;
    }
    
    .container {
        margin: 0;
        padding: 0;
        box-shadow: none;
        border: none;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===== APP SHELL (sidebar layout) ===== */
:root {
    --pm-sidebar-w-collapsed: 12px;
    --pm-sidebar-w-expanded: 220px;
    --pm-sidebar-w: var(--pm-sidebar-w-collapsed);
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
    padding-top: 56px;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 16px;
    background: #fff;
    border-bottom: 1px solid var(--excel-border);
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
}

.app-sidebar-toggle {
    border: 1px solid var(--excel-border);
    background: #f9fafb;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: var(--brand-pink);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.app-sidebar-toggle i {
    font-size: 18px;
    line-height: 1;
    color: inherit;
}

/* Closed drawer: show bars; open drawer: show collapse chevron */
.app-sidebar-toggle .pm-nav-icon-open {
    display: none !important;
}

html.pm-nav-open .app-sidebar-toggle .pm-nav-icon-open {
    display: block !important;
}

html.pm-nav-open .app-sidebar-toggle .pm-nav-icon-closed {
    display: none !important;
}

.app-sidebar-toggle:hover {
    background: #fff;
    border-color: var(--brand-pink-light);
    color: var(--brand-pink);
}

.app-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-topbar-brand > i {
    color: var(--brand-pink);
    font-size: 20px;
}

.app-topbar-title {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-topbar-sub {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

.app-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-topbar-link {
    font-size: 13px;
    color: #4b5563;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
}

.app-topbar-link:hover {
    background: #f3f4f6;
    color: var(--brand-pink);
}

.app-body {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.app-sidebar-backdrop {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.38);
    z-index: 240;
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

html.pm-nav-expanded .app-sidebar-backdrop,
html.pm-nav-open .app-sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-sidebar {
    flex: 0 0 var(--pm-sidebar-w-collapsed);
    width: var(--pm-sidebar-w-collapsed);
    min-width: var(--pm-sidebar-w-collapsed);
    position: relative;
    z-index: 260;
    align-self: stretch;
    cursor: pointer;
}

/* Thin hover strip — no nav icons when collapsed */
.app-sidebar-rail {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: linear-gradient(180deg, #fce7f3 0%, #fbcfe8 48%, #f9a8d4 100%);
    border-right: 2px solid var(--brand-pink);
    box-shadow: inset -3px 0 8px rgba(190, 24, 93, 0.12);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.app-sidebar-rail::after {
    content: '\203A';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-pink);
    line-height: 1;
    opacity: 0.85;
}

.app-sidebar:hover .app-sidebar-rail,
html.pm-nav-expanded .app-sidebar-rail,
html.pm-nav-open .app-sidebar-rail {
    background: linear-gradient(180deg, #fdf2f8 0%, #fce7f3 100%);
    box-shadow: inset -4px 0 12px rgba(190, 24, 93, 0.18);
}

html.pm-nav-expanded .app-sidebar-rail,
html.pm-nav-open .app-sidebar-rail {
    opacity: 0;
    pointer-events: none;
}

.app-sidebar-flyout {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #fafafa 0%, #f3f4f6 100%);
    border-right: none;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease, box-shadow 0.2s ease;
    z-index: 1;
}

html.pm-nav-expanded .app-sidebar-flyout,
html.pm-nav-open .app-sidebar-flyout {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: var(--pm-sidebar-w-expanded);
    max-width: min(var(--pm-sidebar-w-expanded), 86vw);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    border-right: 1px solid var(--excel-border);
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.14);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 32px;
    box-sizing: border-box;
}

.app-side-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
}

.app-main-shell {
    flex: 1 1 auto;
    min-width: 0;
    width: 0;
    overflow-x: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
}

@media (max-width: 900px) {
    html.pm-nav-expanded .app-sidebar-flyout,
    html.pm-nav-open .app-sidebar-flyout {
        max-width: min(var(--pm-sidebar-w-expanded), 78vw);
    }
}

.app-main-shell > .container {
    margin: 16px;
    max-width: 100%;
    box-sizing: border-box;
}

.app-main-shell .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.app-side-nav {
    padding: 10px 0 40px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.app-side-nav-section {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 14px 12px 5px;
}

.app-side-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin: 0 6px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    border: 1px solid transparent;
}

.app-side-nav-link i {
    width: 18px;
    text-align: center;
    color: #6b7280;
    flex-shrink: 0;
    font-size: 14px;
}

.app-side-nav-link:hover {
    background: #fff;
    border-color: var(--excel-border);
    color: var(--brand-pink);
}

.app-side-nav-link.active {
    background: #fff;
    border-color: var(--excel-border);
    color: var(--brand-pink);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.app-side-nav-link.active i {
    color: var(--brand-pink);
}

/* Sidebar: trap scroll inside nav when not at edges */
.app-sidebar {
    overscroll-behavior: contain;
}


/* Table row actions (kebab menu) */
.row-actions-wrap {
    position: relative;
    display: inline-block;
}

.row-actions-trigger {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 2px solid #e5e7eb;
    border-radius: 9999px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.row-actions-trigger:hover,
.row-actions-trigger[aria-expanded="true"] {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.row-actions-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 200;
    min-width: 190px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 4px 0;
}

.row-actions-panel[hidden] {
    display: none !important;
}

.row-actions-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    box-sizing: border-box;
}

.row-actions-item:hover {
    background: #f8fafc;
    color: var(--brand-pink);
}

.row-actions-item.text-danger {
    color: #dc2626;
}

.row-actions-item.text-danger:hover {
    background: #fef2f2;
}

.row-actions-divider {
    height: 1px;
    margin: 4px 0;
    background: #e5e7eb;
}

.table-actions-col {
    width: 48px;
    text-align: center;
    white-space: nowrap;
}

.acct-mask::before {
    content: "********";
    letter-spacing: 0.02em;
    color: #9ca3af;
}

.tenant-month-summary {
    display: block;
    font-size: 12px;
    line-height: 1.5;
    color: #374151;
}

.tenant-month-summary .tms-item {
    white-space: nowrap;
}

.tenant-month-summary .tms-item strong {
    font-weight: 700;
    color: #111827;
}

.tenant-month-summary .tms-partial strong { color: #2563eb; }
.tenant-month-summary .tms-arrear strong { color: #dc2626; }

.tenant-month-summary .tms-sep {
    color: #cbd5e1;
    margin: 0 3px;
}

.tenant-month-summary .tms-due {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
}

/* ── Landlord list table ──────────────────────────────────────────────── */
#landlordsTable.landlords-table {
    table-layout: fixed;
    width: 100%;
    min-width: 480px; /* prevents full collapse on tiny screens */
}

#landlordsTable .ll-col-code       { width: 6%; min-width: 56px; }
#landlordsTable .ll-col-name       { width: 16%; min-width: 110px; }
#landlordsTable .ll-col-contact    { width: 12%; }
#landlordsTable .ll-col-branch     { width: 8%; }
#landlordsTable .ll-col-commission { width: 7%; }
#landlordsTable .ll-col-properties { width: 5%; min-width: 44px; }
#landlordsTable .ll-col-tenants-month { width: 22%; min-width: 160px; }
#landlordsTable .ll-col-status     { width: 7%; min-width: 66px; }
#landlordsTable .ll-col-payment    { width: 12%; }
#landlordsTable .ll-col-actions    { width: 4%; min-width: 40px; }

/* Tenant stats — new pill design */
#landlordsTable td.ll-col-tenants-month { vertical-align: middle; }

/* Payment cell */
#landlordsTable .ll-payment-cell {
    font-size: 11px;
    line-height: 1.35;
    vertical-align: top;
}

#landlordsTable .ll-payment-chip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}
#landlordsTable .ll-payment-chip:last-child { margin-bottom: 0; }
#landlordsTable .ll-payment-chip i {
    width: 12px;
    font-size: 10px;
    color: #6b7280;
    flex-shrink: 0;
}
#landlordsTable .ll-payment-chip span { word-break: break-word; }
#landlordsTable .ll-payment-empty { font-size: 11px; }

/* Row hover highlight */
#landlordsTable tbody tr:hover td { background: #f8fafc; }

.cell-compact {
    font-size: 12px;
    line-height: 1.35;
    max-width: 140px;
}

.badge-compact {
    font-size: 10px;
    padding: 2px 6px;
}

.row-actions-form {
    margin: 0;
    padding: 0;
}

.col-actions {
    width: 48px;
    text-align: right;
    white-space: nowrap;
}

.data-table-compact td,
.data-table-compact th {
    vertical-align: middle;
}

.list-toolbar-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.list-toolbar-search {
    flex: 1 1 220px;
    min-width: 180px;
    max-width: 360px;
}

.list-toolbar-select {
    width: auto;
    min-width: 140px;
}

/* Main dashboard — chart layout */
.dash-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.dash-kpi {
    background: #fff;
    border: 1px solid var(--excel-border);
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}

.dash-kpi-warn {
    border-left: 3px solid #ef4444;
}

.dash-kpi-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    margin-bottom: 4px;
}

.dash-kpi-value {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

/* Compact chart grid (main dashboard) */
.dash-grid-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.dash-mini-card {
    background: #fff;
    border: 1px solid var(--excel-border);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
    min-height: 0;
}

.dash-mini-card h3 {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.dash-mini-wide {
    grid-column: span 2;
    min-height: 200px;
}

.dash-mini-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 2px;
}

.dash-mini-head h3 {
    margin: 0;
}

.dash-mini-hint {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
}

.dash-mini-split {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.dash-mini-card .dash-mini-split {
    min-height: 96px;
}

.dash-mini-split-bar {
    align-items: flex-start;
}

.dash-apex {
    flex-shrink: 0;
    overflow: hidden;
}

.dash-apex-area {
    width: 100%;
    min-height: 172px;
    height: 172px;
}

.dash-apex-collections-trend {
    width: 100% !important;
    min-height: 200px;
    height: 200px !important;
    flex: 1;
    min-width: 0;
}

.dash-mini-wide .dash-mini-head {
    margin-bottom: 4px;
}

.dash-mini-wide {
    display: flex;
    flex-direction: column;
}

.dash-apex-ring {
    width: 92px;
    height: 92px;
}

.dash-apex-bar {
    width: 88px;
    height: 88px;
}

.dash-apex-hbar {
    flex: 1;
    min-width: 0;
    min-height: 72px;
    max-height: 72px;
}

.dash-mini-stats {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 0;
}

.dash-mini-stats li {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    font-size: 10px;
    color: #64748b;
    line-height: 1.4;
    padding: 2px 0;
    white-space: nowrap;
}

.dash-mini-card h3 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-mini-stats li strong {
    color: #1e293b;
    font-weight: 600;
    font-size: 12px;
}

.dash-mini-stats-total {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #f1f5f9;
}

.dash-rent-stats {
    flex: 1;
    min-width: 0;
}

.dash-rent-stats li {
    white-space: normal;
    line-height: 1.35;
}

.dash-rent-stats li strong {
    display: block;
    font-size: 11px;
    margin-top: 2px;
    word-break: break-word;
}

.dash-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
}

.dash-dot-teal { background: #14b8a6; }
.dash-dot-sky { background: #0ea5e9; }
.dash-dot-violet { background: #8b5cf6; }
.dash-dot-amber { background: #f59e0b; }
.dash-dot-rose { background: #f43f5e; }
.dash-dot-slate { background: #cbd5e1; }

.dash-mini-stats li > span:first-child {
    display: inline-flex;
    align-items: center;
}

@media (max-width: 1100px) {
    .dash-grid-compact { grid-template-columns: 1fr 1fr; }
    .dash-mini-wide { grid-column: span 2; }
}

@media (max-width: 640px) {
    .dash-grid-compact { grid-template-columns: 1fr; }
    .dash-mini-wide { grid-column: span 1; }
}

/* KPI cluster cards (list pages, revenue, reports — no charts) */
.kpi-cluster-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid var(--excel-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 700px) {
    .kpi-cluster-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
    .kpi-cluster-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .kpi-cluster-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .kpi-cluster-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.kpi-cluster-grid--2 > .kpi-cluster-card { border-bottom: none; }
.kpi-cluster-grid--2 > .kpi-cluster-card:nth-child(2n) { border-right: none; }
@media (max-width: 699px) {
    .kpi-cluster-grid--2 > .kpi-cluster-card:nth-child(2n) { border-right: none; }
    .kpi-cluster-grid--2 > .kpi-cluster-card:last-child { border-bottom: none; }
}

.kpi-cluster-card {
    padding: 16px 18px 14px;
    border-right: 1px solid #e8ecf0;
    border-bottom: 1px solid #e8ecf0;
    min-width: 0;
    background: #fff;
    position: relative;
}

.kpi-cluster-card--accent-good::before,
.kpi-cluster-card--accent-warn::before,
.kpi-cluster-card--accent-info::before,
.kpi-cluster-card--accent-neutral::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.kpi-cluster-card--accent-good::before { background: #10b981; }
.kpi-cluster-card--accent-warn::before { background: #ef4444; }
.kpi-cluster-card--accent-info::before { background: #3b82f6; }
.kpi-cluster-card--accent-neutral::before { background: #94a3b8; }

.kpi-cluster-card--accent-good,
.kpi-cluster-card--accent-warn,
.kpi-cluster-card--accent-info,
.kpi-cluster-card--accent-neutral {
    padding-left: 18px;
}

.kpi-cluster-grid > .kpi-cluster-card:nth-child(2n) { border-right: none; }
.kpi-cluster-grid--3 > .kpi-cluster-card:nth-child(2n) { border-right: 1px solid #e8ecf0; }
.kpi-cluster-grid--3 > .kpi-cluster-card:nth-child(3n) { border-right: none; }
.kpi-cluster-grid--4 > .kpi-cluster-card:nth-child(2n) { border-right: 1px solid #e8ecf0; }
.kpi-cluster-grid--4 > .kpi-cluster-card:nth-child(4n) { border-right: none; }
.kpi-cluster-grid--5 > .kpi-cluster-card:nth-child(2n) { border-right: 1px solid #e8ecf0; }
.kpi-cluster-grid--5 > .kpi-cluster-card:nth-child(5n) { border-right: none; }

@media (min-width: 900px) {
    .kpi-cluster-grid > .kpi-cluster-card:nth-last-child(-n+2) { border-bottom: none; }
    .kpi-cluster-grid--3 > .kpi-cluster-card:nth-last-child(-n+3) { border-bottom: none; }
    .kpi-cluster-grid--4 > .kpi-cluster-card:nth-last-child(-n+4) { border-bottom: none; }
    .kpi-cluster-grid--5 > .kpi-cluster-card:nth-last-child(-n+5) { border-bottom: none; }
}

.kpi-cluster-card--warn { background: #fffbfb; }

.kpi-cluster-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.kpi-cluster-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    line-height: 1.35;
}

.kpi-cluster-vars {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.kpi-cluster-var-block {
    text-align: right;
}

.kpi-cluster-var {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    padding: 2px 6px;
    border-radius: 4px;
}

.kpi-cluster-var--good { color: #047857; background: #ecfdf5; }
.kpi-cluster-var--warn { color: #92400e; background: #fef3c7; }
.kpi-cluster-var--bad { color: #b91c1c; background: #fee2e2; }
.kpi-cluster-var--neutral { color: #475569; background: #f1f5f9; }

.kpi-cluster-var-lbl {
    display: block;
    font-size: 9px;
    color: #9ca3af;
    margin-top: 2px;
    line-height: 1.2;
}

.kpi-cluster-main {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.kpi-cluster-value {
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    line-height: 1.15;
    word-break: break-word;
}

.kpi-cluster-suffix {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.kpi-cluster-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.kpi-cluster-sub-val {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.25;
}

.kpi-cluster-sub-lbl {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-top: 3px;
    line-height: 1.3;
}

.tenant-month-cell .badge {
    font-size: 11px;
}

.tenant-balance-cell {
    min-width: 110px;
    font-size: 13px;
    font-weight: 600;
}

.filter-hint {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 12px;
    line-height: 1.5;
}

.month-summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.month-summary-chip {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
}

.month-summary-chip strong {
    font-weight: 600;
}