/* RenPro v4 - Complete Styles */

/* Dark Theme (Default) */
:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2d2d2d;
    --bg-elevated: #333333;
    --bg-hover: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-hover: #4f46e5;
    --border-color: #3a3a3a;
    --border-light: #444444;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    --sidebar-width: 260px;
    --header-height: 60px;
    --radius-sm: 2px;
    --radius-md: 2px;
    --radius-lg: 3px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.3);
    --transition: 150ms ease;
}

/* Light Theme */
body.light-theme {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8ed;
    --bg-elevated: #ffffff;
    --bg-hover: #e0e0e5;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #999999;
    --border-color: #d2d2d7;
    --border-light: #e5e5ea;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}

/* Theme Toggle Switch */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.theme-toggle-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.theme-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.theme-switch:hover {
    background: var(--bg-hover);
}

.theme-switch-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition);
}

/* Dark mode (default) - slider on right */
.theme-switch-slider::before {
    content: '🌙';
    font-size: 8px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

body.light-theme .theme-switch {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

body.light-theme .theme-switch-slider {
    left: 18px;
    background: #ffffff;
}

body.light-theme .theme-switch-slider::before {
    content: '☀️';
}

/* Light theme specific overrides */
body.light-theme .sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
}

body.light-theme .card {
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

body.light-theme .modal-content {
    background: var(--bg-secondary);
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.light-theme .btn-secondary {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.light-theme .btn-outline {
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.light-theme .data-table th {
    background: var(--bg-tertiary);
}

/* Dashboard tasks and activity sections */
body.light-theme .task-item,
body.light-theme [style*="background: #2d2d2d"],
body.light-theme [style*="background:#2d2d2d"] {
    background: var(--bg-secondary) !important;
}

body.light-theme .activity-item {
    background: var(--bg-secondary);
}

/* Property owner section and unit details in modals */
body.light-theme .owner-section,
body.light-theme .unit-card,
body.light-theme .unit-details-card,
body.light-theme [style*="background: #1e293b"],
body.light-theme [style*="background:#1e293b"],
body.light-theme [style*="background: #334155"],
body.light-theme [style*="background:#334155"] {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

/* Lease document icons */
body.light-theme .lease-docs-btn,
body.light-theme .doc-icon {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Fix dropdown options */
body.light-theme select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Collapsible sections on dashboard */
body.light-theme .collapsible-content,
body.light-theme .tasks-section,
body.light-theme .activity-section {
    background: var(--bg-secondary);
}

/* Recent activity items */
body.light-theme .recent-activity-item {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

/* Quick action buttons */
body.light-theme .quick-action-btn {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Search input in sidebar */
body.light-theme .sidebar-search input {
    background: var(--bg-primary);
}

/* Form sections with dark backgrounds */
body.light-theme .form-section,
body.light-theme .info-box,
body.light-theme .help-text-box {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

body.light-theme .nav-item:hover,
body.light-theme .nav-item.active {
    background: var(--bg-tertiary);
}

body.light-theme .logo-icon {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Override all inline hardcoded dark backgrounds */
body.light-theme [style*="background: #1f2937"],
body.light-theme [style*="background:#1f2937"],
body.light-theme [style*="background: #374151"],
body.light-theme [style*="background:#374151"],
body.light-theme [style*="background: #2d2d2d"],
body.light-theme [style*="background:#2d2d2d"],
body.light-theme [style*="background: #242424"],
body.light-theme [style*="background:#242424"],
body.light-theme [style*="background: #1a1a1a"],
body.light-theme [style*="background:#1a1a1a"] {
    background: var(--bg-tertiary) !important;
}

/* Override inline white text for light mode - BUT NOT on colored backgrounds */
body.light-theme [style*="color: #fff"]:not(.income-card *):not(.income-card),
body.light-theme [style*="color:#fff"]:not(.income-card *):not(.income-card),
body.light-theme [style*="color: #ffffff"]:not(.income-card *):not(.income-card),
body.light-theme [style*="color:#ffffff"]:not(.income-card *):not(.income-card) {
    color: var(--text-primary) !important;
}

/* Keep white text on income cards (they have colored gradient backgrounds) */
body.light-theme .income-card,
body.light-theme .income-card * {
    color: #ffffff !important;
}

/* Override inline border colors */
body.light-theme [style*="border: 1px solid #374151"],
body.light-theme [style*="border: 1px solid #4b5563"],
body.light-theme [style*="border-top: 1px solid #374151"],
body.light-theme [style*="border-color: #374151"] {
    border-color: var(--border-color) !important;
}

/* Unit config cards in Add Property modal */
body.light-theme .unit-config-card {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color);
}

/* Calendar event modal inputs */
body.light-theme .calendar-event-modal input,
body.light-theme .calendar-event-modal select,
body.light-theme .calendar-event-modal textarea {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Lease file upload/view buttons */
body.light-theme button[style*="background: #374151"],
body.light-theme button[style*="background:#374151"] {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

/* Disabled form inputs in modals (lease tenant/unit) */
body.light-theme input[disabled],
body.light-theme input:disabled {
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
}

/* Confirmation modal backgrounds */
body.light-theme .modal-header[style*="background: linear-gradient"] {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%) !important;
}

/* Keep eviction header dark red in both themes */
body.light-theme .modal-header.eviction-header {
    background: linear-gradient(135deg, #7f1d1d 0%, #450a0a 100%) !important;
}

/* Modal confirmation info boxes */
body.light-theme .modal-body > div[style*="background: #1f2937"] {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color);
}

/* Occupied unit popup buttons */
body.light-theme .occupied-unit-choices button {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Unit rows in property edit modal */
body.light-theme .unit-row[style*="background: #1f2937"] {
    background: var(--bg-tertiary) !important;
}

/* Deactivate/reactivate property modal headers */
body.light-theme .modal-header[style*="background: #ef4444"],
body.light-theme .modal-header[style*="background: #dc2626"] {
    background: #ef4444 !important;
}

body.light-theme .modal-header[style*="background: #22c55e"],
body.light-theme .modal-header[style*="background: #10b981"] {
    background: #22c55e !important;
}

/* Ensure all modal footers have proper borders */
body.light-theme .modal-footer[style*="border-top"] {
    border-color: var(--border-color) !important;
}

/* Upload lease button with dashed border */
body.light-theme button[style*="border: 1px dashed"] {
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

/* Lease document buttons - view (with file) */
body.light-theme .actions button[style*="color: #10b981"] {
    background: var(--bg-tertiary) !important;
}

/* Edit lease disabled inputs */
body.light-theme .form-input[disabled],
body.light-theme input.form-input:disabled {
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
    opacity: 0.8;
}

/* Any remaining inline styles with dark backgrounds */
body.light-theme div[style*="background: #1f2937"],
body.light-theme div[style*="background:#1f2937"] {
    background: var(--bg-tertiary) !important;
}

/* Move out and similar modal headers with gradients */
body.light-theme .modal-header[style*="linear-gradient(135deg, #374151"] {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%) !important;
}

/* Co-tenant and future tenant choice buttons */
body.light-theme button[style*="background: #1f2937"][style*="border: 1px solid #374151"] {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Unit rows in property edit */
body.light-theme div[style*="background: #1f2937"][style*="padding: 8px 12px"] {
    background: var(--bg-tertiary) !important;
}

/* Deactivate property modal info boxes */
body.light-theme .modal-body div[style*="background: #1f2937"][style*="padding: 16px"] {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color);
}

/* Add property notes button and utility buttons */
body.light-theme button[style*="background: #374151"] {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

/* Border separators using #374151 */
body.light-theme div[style*="border-top: 1px solid #374151"] {
    border-color: var(--border-color) !important;
}

/* Contact tenant popup */
body.light-theme .contact-tenant-row {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

/* Calendar event inputs in inline styles */
body.light-theme .modal input[style*="background: #374151"],
body.light-theme .modal select[style*="background: #374151"],
body.light-theme .modal textarea[style*="background: #374151"] {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Labels with #e5e7eb color */
body.light-theme label[style*="color: #e5e7eb"] {
    color: var(--text-secondary) !important;
}

/* Maintenance page light mode fixes */
body.light-theme .filters-row .form-input {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.light-theme .tab-badge {
    background: var(--border-color);
    color: var(--text-secondary);
}

body.light-theme .tab.active .tab-badge {
    background: var(--accent-primary);
    color: white;
}

/* Maintenance detail modal sections */
body.light-theme .modal-body div[style*="background: var(--bg-secondary)"],
body.light-theme .modal-body div[style*="background: var(--bg-tertiary)"] {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color);
}

/* Maintenance table row hover */
body.light-theme .data-table tbody tr:hover {
    background: var(--bg-hover);
}

/* Settings link in modals - white in dark mode, primary in light mode */
.settings-link {
    color: white !important;
    text-decoration: none;
}
.settings-link:hover {
    text-decoration: underline;
}
body.light-theme .settings-link {
    color: var(--accent-primary) !important;
}

/* Hide number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* Money input styling */
.money-input {
    -moz-appearance: textfield;
}
.money-input::-webkit-inner-spin-button,
.money-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0f0f0f 100%);
}

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    width: 56px;
    height: 56px;
    background: var(--accent-primary);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
}

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.login-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.login-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-btn {
    margin-top: 8px;
    padding: 12px;
    font-size: 15px;
}

.login-demo {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.login-demo p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.demo-accounts {
    display: flex;
    gap: 8px;
}

.demo-btn {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.demo-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
}

.logo .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
    border-radius: 8px;
}

.user-info {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-md);
}

.user-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Main Content Header */
.main-content-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.main-content-header .global-search {
    width: 300px;
}

/* Global Search */
.global-search {
    position: relative;
}

.global-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
}

.global-search input::placeholder {
    color: var(--text-muted);
}

.global-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.5;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.search-result-icon {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.search-result-text {
    flex: 1;
}

.search-result-name {
    font-weight: 500;
}

.search-result-type {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-item.active {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary);
    border-radius: 0 2px 2px 0;
}

.nav-item-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0 24px 24px 24px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
}

.page-subtitle {
    color: var(--text-secondary);
    margin-top: 4px;
}

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

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.stat-card.clickable:hover {
    background: var(--bg-tertiary);
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 8px;
}

.stat-icon.blue { background: var(--info-bg); }
.stat-icon.green { background: var(--success-bg); }
.stat-icon.yellow { background: var(--warning-bg); }
.stat-icon.red { background: var(--danger-bg); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.1); }

.stat-value {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: black;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label,
.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
}

.form-control,
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus,
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    cursor: pointer;
}

.form-textarea,
textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

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

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.data-table td {
    color: var(--text-primary);
}

.data-table tr:hover {
    background: var(--bg-tertiary);
}

.data-table .actions {
    display: flex;
    gap: 8px;
}

/* Compact table styling for properties list */
.properties-table td {
    font-size: 13px;
    font-weight: 400;
}

.properties-table td strong {
    font-weight: 500;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Modal */
.modal-overlay,
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 80px 20px 20px;
    backdrop-filter: blur(4px);
}

.modal,
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-lg {
    max-width: 800px;
    max-height: 95vh;
}

.modal-xl {
    max-width: 1000px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    font-size: 18px;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 14px 16px;
}

.modal-footer,
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    margin-top: 0;
    border-top: 1px solid var(--border-color);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: var(--transition);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--accent-primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 9px;
}

.tab.active .tab-badge {
    background: var(--accent-primary);
    color: white;
}

/* Filters Row */
.filters-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.filters-row .form-input {
    width: auto;
    min-width: 140px;
}

/* Sortable table headers */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.data-table th.sortable:hover {
    background: var(--bg-hover);
}

.sort-icon {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.6;
}

/* Maintenance table specific */
.maintenance-table {
    table-layout: fixed;
}

.maintenance-table td {
    padding: 10px 8px;
    vertical-align: middle;
}

.maintenance-table th {
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
}

/* Unpaid indicator dot */
.unpaid-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    flex-shrink: 0;
}

.unassigned-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    flex-shrink: 0;
}

.new-applicant-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.unread-message-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    flex-shrink: 0;
}

/* Extra small button */
.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1.2;
}

.tab-content {
    display: none;
}

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

/* Expandable Sections */
.expandable-section {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
}

.expandable-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: var(--transition);
}

.expandable-header:hover {
    background: var(--bg-hover);
}

.expandable-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
}

.expandable-icon {
    font-size: 14px;
}

.expandable-badge {
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
}

.expandable-arrow {
    transition: transform 0.2s ease;
    display: inline-block;
    font-size: 10px;
}

.expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.expandable-section.open .expandable-content {
    max-height: 5000px;
    transition: max-height 0.5s ease-in;
}

.expandable-body {
    padding: 12px;
}

/* Property Page - Full Page */
.property-page {
    max-width: 1000px;
}

.property-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.property-info h1 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.property-address {
    color: var(--text-secondary);
    font-size: 12px;
}

.property-stats {
    display: flex;
    gap: 16px;
    margin-top: 10px;
}

.property-stat {
    text-align: center;
}

.property-stat-value {
    font-size: 14px;
    font-weight: 600;
}

.property-stat-label {
    font-size: 10px;
    color: var(--text-secondary);
}

/* Unit Row with Tenant */
.unit-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.unit-row:hover {
    background: var(--bg-tertiary);
}

.unit-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.unit-number {
    font-weight: 600;
    min-width: 80px;
}

.unit-details {
    color: var(--text-secondary);
    font-size: 13px;
}

.unit-tenant {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tenant-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--accent-primary);
    border-radius: 20px;
    font-size: 12px;
    color: white;
}

.tenant-badge.vacant {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.unit-rent {
    font-weight: 600;
    min-width: 100px;
    text-align: right;
}

/* Unit Config Cards (Add Property modal) */
.unit-config-card {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.unit-config-card strong {
    color: var(--text-primary);
}

/* Choice buttons (occupied unit popup, etc) */
.choice-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
}

.choice-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

/* Move-out modal header */
.moveout-modal-header {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

/* Info boxes in modals */
.info-box {
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.info-box.success-box {
    background: var(--success-bg);
    border-color: rgba(34, 197, 94, 0.3);
}

.info-box.info-box-blue {
    background: var(--info-bg);
    border-color: rgba(59, 130, 246, 0.3);
}

.info-box.info-box-danger {
    background: var(--danger-bg);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Messages / Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 400px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
}

.chat-message.incoming {
    background: #3b4a5a;
    color: #e5e7eb;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.outgoing {
    background: #10b981;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.chat-message.outgoing .chat-time {
    color: rgba(255,255,255,0.7);
}

.chat-input-container {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 14px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: var(--accent-primary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

.chat-send-btn:hover {
    background: var(--accent-hover);
}

/* Tenant Portal */
.tenant-portal {
    max-width: 900px;
    margin: 0 auto;
}

.tenant-portal-header {
    text-align: center;
    margin-bottom: 32px;
}

.tenant-portal-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.tenant-portal-header p {
    color: var(--text-secondary);
}

.tenant-portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.portal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.portal-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.portal-card-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    margin-bottom: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

.portal-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.portal-card-desc {
    color: var(--text-secondary);
    font-size: 14px;
}

/* User Management */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.user-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.user-details {
    flex: 1;
}

.user-details h4 {
    font-weight: 600;
    margin-bottom: 2px;
}

.user-details p {
    color: var(--text-secondary);
    font-size: 13px;
}

.user-role-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.user-role-badge.admin {
    background: var(--danger-bg);
    color: var(--danger);
}

.user-role-badge.manager {
    background: var(--info-bg);
    color: var(--info);
}

.user-role-badge.vendor {
    background: var(--warning-bg);
    color: var(--warning);
}

.user-role-badge.tenant {
    background: var(--success-bg);
    color: var(--success);
}

/* Settings Page */
.settings-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
}

.settings-section-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}

.settings-section-title {
    font-size: 13px;
    font-weight: 600;
}

.settings-section-desc {
    color: var(--text-secondary);
    font-size: 11px;
    margin-top: 2px;
}

.settings-section-body {
    padding: 10px 14px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-weight: 500;
    font-size: 12px;
}

.setting-desc {
    color: var(--text-secondary);
    font-size: 10px;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Toggle Switch */
.toggle {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Status Toggle (Active/Inactive slider) */
.status-toggle {
    display: inline-flex;
    background: #2d2d2d;
    border-radius: 4px;
    padding: 2px;
    font-size: 11px;
    font-weight: 500;
}

.status-toggle label {
    padding: 5px 12px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
}

.status-toggle label.inactive-active {
    background: #ef4444;
    color: white;
}

.status-toggle label.active-active {
    background: #10b981;
    color: white;
}

/* Report Cards */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.report-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.report-card:hover {
    border-color: var(--accent-primary);
}

.report-card-icon {
    width: 44px;
    height: 44px;
    background: var(--info-bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

.report-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.report-card-desc {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Eviction Status */
.eviction-banner {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.eviction-banner-icon {
    font-size: 24px;
}

.eviction-banner-text h4 {
    color: var(--danger);
    font-weight: 600;
    margin-bottom: 4px;
}

.eviction-banner-text p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Renewals Section */
.renewal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    margin-bottom: 10px;
}

.renewal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.renewal-tenant {
    font-weight: 600;
    font-size: 13px;
}

.renewal-property {
    color: var(--text-secondary);
    font-size: 13px;
}

.renewal-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin: 8px 0;
}

.renewal-detail-item {
    text-align: center;
}

.renewal-detail-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.renewal-detail-value {
    font-weight: 500;
    font-size: 13px;
}

.renewal-actions {
    display: flex;
    gap: 8px;
}

/* Payment Plan */
.payment-plan-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.payment-plan-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.payment-plan-progress {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.payment-plan-progress-bar {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.payment-schedule {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-schedule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.payment-schedule-item.paid {
    opacity: 0.6;
}

.payment-schedule-item.missed {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Utility Classes */
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 600; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-2 { margin-bottom: 8px; }
.mr-2 { margin-right: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* Mobile Menu Toggle */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.mobile-menu-btn:hover {
    background: var(--bg-tertiary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Dashboard Tile Hover Effects */
.stat-card.clickable {
    cursor: pointer;
}

.stat-card.clickable:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Unit Row Improved - With Status */
.unit-row-enhanced {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    gap: 12px;
}

.unit-row-enhanced:hover {
    background: var(--bg-tertiary);
}

.unit-row-enhanced.expanded {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
}

.unit-main-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.unit-number-col {
    font-weight: 500;
    font-size: 13px;
    min-width: 70px;
}

.unit-tenant-col {
    flex: 1;
    min-width: 0;
}

.unit-tenant-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unit-rent-col {
    font-weight: 500;
    font-size: 13px;
    min-width: 100px;
    text-align: right;
}

.unit-status-col {
    min-width: 120px;
    text-align: center;
}

/* Status Badges */
.status-good {
    background: var(--success-bg);
    color: var(--success);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-delinquent {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-eviction {
    background: var(--danger);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-vacant {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* Expanded Unit Panel */
.unit-expanded-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-top: none;
    padding: 20px;
    display: none;
}

.unit-expanded-panel.active {
    display: block;
}

.unit-panel-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.unit-panel-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: var(--transition);
}

.unit-panel-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.unit-panel-tab.active {
    background: var(--accent-primary);
    color: white;
}

.unit-panel-content {
    min-height: 200px;
}

/* Property Search Bar */
.property-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.property-search-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

.property-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.property-sort-select {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    min-width: 150px;
}

/* Reports Page Improved */
.reports-header {
    margin-bottom: 24px;
}

.reports-filters {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.reports-filters-title {
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.reports-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.report-inline-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.date-range-btns {
    display: flex;
    gap: 8px;
}

.date-range-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.date-range-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.date-range-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Report Export Buttons */
.report-export-btns {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.export-btn {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.export-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Tenant Quick Expand */
.tenant-row-expandable {
    border-bottom: 1px solid var(--border-color);
}

.tenant-row-main {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}

.tenant-row-main:hover {
    background: var(--bg-tertiary);
}

.tenant-expanded-info {
    background: var(--bg-primary);
    padding: 12px 16px;
    display: none;
    border-top: 1px solid var(--border-color);
}

.tenant-expanded-info.active {
    display: block;
}

.tenant-quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.tenant-quick-stat {
    background: var(--bg-secondary);
    padding: 8px 10px;
    border-radius: 2px;
}

.tenant-quick-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.tenant-quick-stat-value {
    font-size: 14px;
    font-weight: 500;
}

.tenant-quick-actions {
    display: flex;
    gap: 8px;
}

/* Maintenance Dropdown Sections */
.maintenance-section {
    margin-bottom: 16px;
}

.maintenance-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 8px;
}

.maintenance-section-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.maintenance-section-count {
    background: var(--accent-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* Back Button */
.back-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding-top: 70px;
    }

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

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

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

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

    .reports-filters-row {
        flex-direction: column;
    }

    .unit-main-info {
        flex-wrap: wrap;
    }

    .unit-rent-col,
    .unit-status-col {
        min-width: auto;
    }

    /* A1: Fix hamburger menu overlapping header text — balanced centering */
    .page-header,
    .page-header > div:first-child,
    .property-header,
    .back-nav {
        padding-left: 52px;
        padding-right: 52px;
    }

    /* A3: Modals full-width on mobile */
    .modal-overlay,
    .modal-backdrop {
        padding: 20px 8px 8px;
        align-items: flex-start;
    }

    .modal,
    .modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 8px;
    }

    /* A4: Table horizontal scroll on mobile */
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* A5: Minimum touch targets */
    .btn-xs {
        min-height: 36px;
        min-width: 36px;
        padding: 8px 12px;
    }

    .btn-sm {
        min-height: 40px;
        padding: 8px 14px;
    }

    .nav-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* A2: Prevent iOS auto-zoom on input focus */
@media (max-width: 768px) {
    input, select, textarea,
    .form-input, .form-select, .form-textarea {
        font-size: 16px !important;
    }
}


/* Photo Grid Styles */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.photo-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.photo-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity var(--transition);
}

.photo-card img:hover {
    opacity: 0.8;
}

.photo-info {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.photo-type {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    display: inline-block;
    width: fit-content;
}

.photo-caption {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-info .btn-danger {
    margin-top: 4px;
    padding: 4px 8px;
    font-size: 11px;
}

/* Photo Preview Overlay */
.photo-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.photo-preview-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    cursor: default;
}

.photo-preview-content img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.photo-preview-caption {
    color: #fff;
    font-size: 14px;
    text-align: center;
    margin: 0;
}


/* ============================================
   DASHBOARD STYLES - UPDATED
   Fixes: Task color visibility, section consistency
   ============================================ */

/* Task Colors - CSS Variables */
:root {
    --task-blue: #3b82f6;
    --task-green: #10b981;
    --task-yellow: #f59e0b;
    --task-orange: #f97316;
    --task-red: #ef4444;
    --task-purple: #8b5cf6;

    --task-blue-bg: rgba(59, 130, 246, 0.08);
    --task-green-bg: rgba(16, 185, 129, 0.08);
    --task-yellow-bg: rgba(245, 158, 11, 0.08);
    --task-orange-bg: rgba(249, 115, 22, 0.08);
    --task-red-bg: rgba(239, 68, 68, 0.08);
    --task-purple-bg: rgba(139, 92, 246, 0.08);
}

/* ============================================
   DASHBOARD SECTIONS - Consistent Styling
   ============================================ */

.dashboard-section {
    background: #ffffff;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.dashboard-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: none;
    background: #f8fafc;
}

.dashboard-section-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.dashboard-section-body {
    padding: 0;
}

/* ============================================
   TASKS SECTION
   ============================================ */

.task-item {
    display: flex;
    align-items: flex-start;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
    transition: background-color 0.2s;
    /* FIXED: 6px left border instead of 4px color bar */
    border-left: 6px solid transparent;
}

.task-item:last-child {
    border-bottom: none;
}

.task-item:hover {
    background-color: #f9fafb;
}

/* Task color classes - 6px left border + subtle background tint */
.task-item.task-color-blue {
    border-left-color: var(--task-blue);
    background: linear-gradient(to right, var(--task-blue-bg) 0%, transparent 30%);
}

.task-item.task-color-green {
    border-left-color: var(--task-green);
    background: linear-gradient(to right, var(--task-green-bg) 0%, transparent 30%);
}

.task-item.task-color-yellow {
    border-left-color: var(--task-yellow);
    background: linear-gradient(to right, var(--task-yellow-bg) 0%, transparent 30%);
}

.task-item.task-color-orange {
    border-left-color: var(--task-orange);
    background: linear-gradient(to right, var(--task-orange-bg) 0%, transparent 30%);
}

.task-item.task-color-red {
    border-left-color: var(--task-red);
    background: linear-gradient(to right, var(--task-red-bg) 0%, transparent 30%);
}

.task-item.task-color-purple {
    border-left-color: var(--task-purple);
    background: linear-gradient(to right, var(--task-purple-bg) 0%, transparent 30%);
}

/* Completed tasks */
.task-item.task-completed {
    opacity: 0.6;
    background-color: #f9fafb !important;
}

.task-item.task-completed .task-title {
    text-decoration: line-through;
}

/* Completed divider */
.completed-divider {
    padding: 10px 20px;
    background: #f3f4f6;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
    color: #6b7280;
}

/* Task content */
.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.task-description {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
}

.task-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #9ca3af;
}

.task-actions {
    margin-left: 12px;
    flex-shrink: 0;
    display: flex;
    gap: 6px;
}

/* ============================================
   ACTIVITY FEED SECTION
   ============================================ */

.activity-item {
    display: flex;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.3s;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background-color: #f9fafb;
}

.activity-item.activity-new {
    background-color: #fef3c7;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.activity-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background-color: #f3f4f6;
    border-radius: 50%;
    margin-right: 14px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    color: var(--text-primary);
    margin-bottom: 4px;
}

.activity-meta {
    font-size: 12px;
    color: #9ca3af;
}

.activity-amount {
    color: #10b981;
    font-weight: 500;
    margin-left: 8px;
}

/* ============================================
   COLOR PICKER (for task modal)
   ============================================ */

.color-picker {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.color-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.color-option.selected {
    border-color: #1f2937;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1f2937;
}

.color-blue { background-color: var(--task-blue); }
.color-green { background-color: var(--task-green); }
.color-yellow { background-color: var(--task-yellow); }
.color-orange { background-color: var(--task-orange); }
.color-red { background-color: var(--task-red); }
.color-purple { background-color: var(--task-purple); }

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}


/* ============================================
   FIX: Text Contrast for Readability
   Task titles and activity text use theme color
   ============================================ */

.task-title {
    color: var(--text-primary) !important;
}

.activity-text {
    color: var(--text-primary) !important;
}


/* ============================================
   FIX: Section Header Text Visibility
   Dashboard section headers need dark text
   ============================================ */

.dashboard-section-header h3 {
    color: var(--text-primary) !important;
    font-weight: 600;
}

.tasks-section .dashboard-section-header h3,
.activity-feed-section .dashboard-section-header h3 {
    color: var(--text-primary) !important;
}


/* ============================================
   Header Layout with Page Title
   ============================================ */

.main-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

#page-title {
    flex-shrink: 0;
}

/* ============================================
   Income Summary Cards
   ============================================ */

.income-summary-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.income-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.income-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.income-card .stat-value {
    font-size: 28px;
}


/* ============================================
   DARK THEME COLLAPSIBLE SECTIONS
   Tasks and Activity Feed sections
   ============================================ */

.dashboard-section.tasks-section,
.dashboard-section.activity-feed-section {
    background: #2d2d2d !important;
    border: 1px solid #3a3a3a !important;
    border-radius: 3px !important;
    overflow: hidden;
}

.dashboard-section.tasks-section .dashboard-section-header,
.dashboard-section.activity-feed-section .dashboard-section-header {
    background: #242424 !important;
    cursor: pointer;
    padding: 12px 16px;
    border-radius: 3px 3px 0 0 !important;
    border-bottom: none !important;
}

.dashboard-section.tasks-section .dashboard-section-header h3,
.dashboard-section.activity-feed-section .dashboard-section-header h3 {
    color: #ffffff !important;
}

.dashboard-section.tasks-section .task-item,
.dashboard-section.activity-feed-section .activity-item {
    background: #2d2d2d !important;
    border-bottom: 1px solid #3a3a3a;
}

.dashboard-section.tasks-section .task-item.task-color-blue,
.dashboard-section.tasks-section .task-item.task-color-green,
.dashboard-section.tasks-section .task-item.task-color-yellow,
.dashboard-section.tasks-section .task-item.task-color-orange,
.dashboard-section.tasks-section .task-item.task-color-red,
.dashboard-section.tasks-section .task-item.task-color-purple {
    background: #2d2d2d !important;
}

.dashboard-section.tasks-section .task-item:hover,
.dashboard-section.activity-feed-section .activity-item:hover {
    background: #3a3a3a !important;
}

/* Collapsed state */
.dashboard-section.collapsed .dashboard-section-body,
.dashboard-section.collapsed .section-body,
.dashboard-section.collapsed #tasks-container,
.dashboard-section.collapsed #activity-container {
    display: none !important;
}

.dashboard-section.collapsed .dashboard-section-header {
    border-radius: 3px !important;
}

.dashboard-section.collapsed .section-toggle-icon {
    transform: rotate(-90deg);
}

.section-toggle-icon {
    transition: transform 0.2s ease;
    display: inline-block;
}

/* Light Theme Overrides for Dashboard Sections */
body.light-theme .dashboard-section.tasks-section,
body.light-theme .dashboard-section.activity-feed-section {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

body.light-theme .dashboard-section.tasks-section .dashboard-section-header,
body.light-theme .dashboard-section.activity-feed-section .dashboard-section-header {
    background: var(--bg-tertiary) !important;
}

body.light-theme .dashboard-section.tasks-section .dashboard-section-header h3,
body.light-theme .dashboard-section.activity-feed-section .dashboard-section-header h3 {
    color: var(--text-primary) !important;
}

body.light-theme .dashboard-section.tasks-section .task-item,
body.light-theme .dashboard-section.activity-feed-section .activity-item {
    background: var(--bg-secondary) !important;
    border-bottom-color: var(--border-color) !important;
}

body.light-theme .dashboard-section.tasks-section .task-item:hover,
body.light-theme .dashboard-section.activity-feed-section .activity-item:hover {
    background: var(--bg-tertiary) !important;
}

/* Property Search Bar */
.property-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.property-search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.property-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.property-search-input::placeholder {
    color: var(--text-muted);
}

.property-filter-status,
.property-sort-select {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    min-width: 160px;
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.property-filter-status:focus,
.property-sort-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.property-filter-status:hover,
.property-sort-select:hover {
    background-color: var(--bg-hover);
}

.property-filter-status option,
.property-sort-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Sidebar Search */
.sidebar-search {
    position: relative;
    padding: 0;
    margin: 12px 0;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.sidebar-search input::placeholder {
    color: var(--text-muted);
}

.sidebar-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 4px;
}

.sidebar-search-results.active {
    display: block;
}

.sidebar-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-search-item:last-child {
    border-bottom: none;
}

.sidebar-search-item:hover {
    background: var(--bg-tertiary);
}

.sidebar-search-icon {
    font-size: 16px;
}

.sidebar-search-text {
    flex: 1;
    min-width: 0;
}

.sidebar-search-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-search-type {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.sidebar-search-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================
   SIDEBAR TIGHTENING - Compact & Clean
   ============================================ */

:root {
    --sidebar-width: 220px;
}

.sidebar {
    width: 220px;
}

.main-content {
    margin-left: 220px;
}

.sidebar-header {
    padding: 14px 16px;
}

.logo {
    gap: 10px;
    font-size: 18px;
    margin-bottom: 12px;
}

.logo .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: 6px;
}

.user-info {
    padding: 10px;
}

.user-name {
    font-size: 13px;
}

.user-role {
    font-size: 11px;
}

/* Sidebar Search */
.sidebar-search {
    padding: 0 12px 12px 12px;
}

.sidebar-search input {
    padding: 8px 10px;
    font-size: 12px;
}

/* Navigation */
.sidebar-nav {
    padding: 8px 0;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-title {
    padding: 6px 16px;
    font-size: 10px;
    letter-spacing: 0.6px;
}

.nav-item {
    gap: 10px;
    padding: 8px 16px;
    font-size: 13px;
}

.nav-item-icon {
    font-size: 14px;
    width: 18px;
}

.nav-badge {
    font-size: 10px;
    padding: 2px 6px;
    min-width: 18px;
}

.sidebar-footer {
    padding: 12px 16px;
}

.logout-btn {
    padding: 8px;
    font-size: 13px;
}

/* Responsive adjustment */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
        transform: translateX(-220px);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* ============================================
   SIDEBAR SEARCH ALIGNMENT FIX v2
   Search is inside .sidebar-header which has padding already
   ============================================ */

.sidebar-search {
    padding: 0;
    margin: 12px 0 0 0;
}

.sidebar-search input {
    width: 100%;
    box-sizing: border-box;
}

.user-info {
    margin-top: 12px;
}

/* Billback tenant list styling */
.billback-tenant-list {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    max-height: 180px;
    overflow-y: auto;
}

.billback-tenant-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 13px;
}

.billback-tenant-item:hover {
    background: var(--bg-tertiary);
}

.billback-tenant-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    flex-shrink: 0;
}

.billback-tenant-item .tenant-name {
    color: var(--text-primary);
    font-weight: 500;
}

.billback-tenant-item .tenant-unit {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: auto;
}

.billback-all-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.billback-all-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.billback-options-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 12px;
}

/* Button spinner for loading state */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Lightbox for document viewing */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-content iframe {
    width: 80vw;
    height: 85vh;
    border: none;
    border-radius: var(--radius-md);
    background: white;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-title {
    color: white;
    font-size: 14px;
    margin-top: 12px;
    opacity: 0.8;
}

.lightbox-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.lightbox-actions a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    font-size: 13px;
    transition: background 0.2s;
}

.lightbox-actions a:hover {
    background: rgba(255,255,255,0.2);
}

/* ============================================
   DELINQUENCY REPORT EXPANDABLE ROWS
   ============================================ */

.delinquency-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border-color);
}

.delinquent-row-expandable {
    background: var(--bg-secondary);
}

.delinquent-row-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.delinquent-row-main:hover {
    background: var(--bg-primary);
}

.delinquent-row-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.del-tenant-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1px;
}

.del-tenant-details {
    font-size: 10px;
    color: var(--text-muted);
}

.delinquent-row-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
}

.delinquent-expanded-info {
    display: none;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.delinquent-expanded-info.active {
    display: block;
}

.delinquent-expanded-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 10px 12px;
}

.delinquent-left-panel,
.delinquent-right-panel {
    display: flex;
    flex-direction: column;
}

.delinquent-left-panel h4,
.delinquent-right-panel h4 {
    margin: 0 0 6px 0;
    padding: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1;
    height: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.delinquent-panel-body {
    flex: 1;
    min-height: 90px;
}

.delinquent-messages {
    height: 90px;
    overflow-y: auto;
    padding-right: 6px;
}

.delinquent-message {
    padding: 2px 0;
    font-size: 11px;
    line-height: 1.4;
}

.delinquent-message .msg-sender {
    font-weight: 600;
    color: var(--accent-primary);
}

.delinquent-message.from-tenant .msg-sender {
    color: var(--success);
}

.delinquent-message .msg-text {
    color: var(--text-primary);
}

.delinquent-message-input {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: auto;
}

.delinquent-message-input .form-input {
    flex: 1;
    padding: 5px 8px;
    font-size: 11px;
    height: 28px;
    box-sizing: border-box;
}

.delinquent-message-input .btn {
    padding: 5px 12px;
    font-size: 11px;
    height: 28px;
    box-sizing: border-box;
    min-width: 60px;
}

.delinquent-quick-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 6px;
}

.delinquent-stat {
    background: var(--bg-secondary);
    padding: 6px 8px;
    border-radius: var(--radius-md);
}

.delinquent-stat-label {
    display: block;
    font-size: 9px;
    color: var(--text-muted);
    margin-bottom: 1px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.delinquent-stat-value {
    font-size: 12px;
    font-weight: 500;
}

.delinquent-actions {
    display: flex;
    gap: 6px;
    margin-top: 0;
}

.delinquent-actions .btn {
    flex: 1;
    padding: 4px 6px;
    font-size: 10px;
    height: 24px;
    white-space: nowrap;
    text-align: center;
}

@media (max-width: 768px) {
    .delinquent-expanded-content {
        grid-template-columns: 1fr;
    }

    .delinquent-row-stats {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
}

/* ============================================
   CALENDAR STYLES
   ============================================ */

.calendar-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calendar-main {
    min-width: 0;
    width: 100%;
}

.calendar-bottom {
    display: grid;
    grid-template-columns: 1fr 250px;
    gap: 20px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.calendar-title {
    font-size: 18px;
    font-weight: 600;
    min-width: 180px;
    text-align: center;
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
}

.calendar-day-header {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    height: 100px;
    max-height: 100px;
    border: 1px solid var(--border-color);
    border-top: none;
    border-left: none;
    padding: 6px;
    position: relative;
    background: var(--bg-secondary);
    transition: background var(--transition);
    overflow: hidden;
}

.calendar-day:nth-child(7n+1) {
    border-left: 1px solid var(--border-color);
}

.calendar-day:nth-child(-n+7) {
    border-top: 1px solid var(--border-color);
}

.calendar-day.empty {
    background: var(--bg-primary);
    pointer-events: none;
}

.calendar-day:not(.empty) {
    cursor: pointer;
}

.calendar-day:not(.empty):hover {
    background: var(--bg-hover);
}

.calendar-day.past {
    opacity: 0.5;
}

.calendar-day.past .calendar-day-number {
    text-decoration: line-through;
    color: var(--text-muted);
}

.calendar-day.today {
    background: rgba(99, 102, 241, 0.1);
}

.calendar-day.today .calendar-day-number {
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-day.has-events:hover {
    background: var(--bg-hover);
}

.calendar-day-number {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.calendar-event {
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: opacity var(--transition);
}

.calendar-event:hover {
    opacity: 0.8;
}

.calendar-event.ptp {
    background: var(--warning-bg);
    color: var(--warning);
    border-left: 2px solid var(--warning);
}

.calendar-event.ptp-overdue {
    background: var(--danger-bg);
    color: var(--danger);
    border-left: 2px solid var(--danger);
}

.calendar-event.lease-expiring {
    background: var(--info-bg);
    color: var(--info);
    border-left: 2px solid var(--info);
}

.calendar-event.task {
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    border-left: 2px solid #a78bfa;
}

.calendar-event.maintenance {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border-left: 2px solid var(--success);
}

.calendar-event.showing {
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
    border-left: 2px solid #14b8a6;
}

.calendar-event.property-showing {
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
    border-left: 2px solid #14b8a6;
}

.calendar-event.more {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-left: none;
    font-style: italic;
}

/* Upcoming Events Sidebar */
.upcoming-events-list {
    max-height: 400px;
    overflow-y: auto;
}

.upcoming-event {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition);
    border-left: 3px solid transparent;
}

.upcoming-event:hover {
    background: var(--bg-hover);
}

.upcoming-event:last-child {
    border-bottom: none;
}

.upcoming-event.ptp {
    border-left-color: var(--warning);
}

.upcoming-event.ptp-overdue {
    border-left-color: var(--danger);
}

.upcoming-event.lease-expiring {
    border-left-color: var(--info);
}

.upcoming-event.task {
    border-left-color: #a78bfa;
}

.upcoming-event.maintenance {
    border-left-color: var(--success);
}

.upcoming-event-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.upcoming-event-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.upcoming-event-desc {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Calendar Legend */
.calendar-legend {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.legend-dot.ptp {
    background: var(--warning);
}

.legend-dot.ptp-overdue {
    background: var(--danger);
}

.legend-dot.lease-expiring {
    background: var(--info);
}

.legend-dot.task {
    background: #a78bfa;
}

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

.legend-dot.showing {
    background: #f472b6;
}

/* Calendar Day View */
.day-view-container {
    max-height: 600px;
    overflow-y: auto;
}

.day-view-all-day {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    padding: 12px 0;
    background: var(--bg-tertiary);
}

.day-view-all-day-label {
    width: 80px;
    flex-shrink: 0;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.day-view-all-day-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-right: 12px;
}

.day-view-hours {
    display: flex;
    flex-direction: column;
}

.day-view-hour-row {
    display: flex;
    min-height: 48px;
    border-bottom: 1px solid var(--border-color);
}

.day-view-hour-row:hover {
    background: var(--bg-hover);
}

.day-view-hour-label {
    width: 80px;
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 11px;
    color: var(--text-muted);
    border-right: 1px solid var(--border-color);
    text-align: right;
}

.day-view-hour-content {
    flex: 1;
    padding: 4px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.day-view-event {
    padding: 6px 10px;
    border-radius: 4px;
    border-left: 3px solid transparent;
    background: var(--bg-tertiary);
}

.day-view-event.ptp {
    background: rgba(245, 158, 11, 0.15);
    border-left-color: var(--warning);
}

.day-view-event.ptp-overdue {
    background: rgba(239, 68, 68, 0.15);
    border-left-color: var(--danger);
}

.day-view-event.lease-expiring {
    background: rgba(59, 130, 246, 0.15);
    border-left-color: var(--info);
}

.day-view-event.task {
    background: rgba(167, 139, 250, 0.15);
    border-left-color: #a78bfa;
}

.day-view-event.maintenance {
    background: rgba(16, 185, 129, 0.15);
    border-left-color: var(--success);
}

.day-view-event.showing {
    background: rgba(244, 114, 182, 0.15);
    border-left-color: #f472b6;
}

/* Week/5-Day View Styles */
.week-view-container {
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
}

.week-view-event {
    border-left: 3px solid var(--border-color);
    background: var(--bg-secondary);
    transition: transform 0.1s;
}

.week-view-event:hover {
    transform: scale(1.02);
    z-index: 10;
}

.week-view-event.ptp {
    background: rgba(251, 191, 36, 0.15);
    border-left-color: #fbbf24;
}

.week-view-event.ptp-overdue {
    background: rgba(239, 68, 68, 0.15);
    border-left-color: #ef4444;
}

.week-view-event.lease-expiring {
    background: rgba(168, 85, 247, 0.15);
    border-left-color: #a855f7;
}

.week-view-event.task {
    background: rgba(59, 130, 246, 0.15);
    border-left-color: #3b82f6;
}

.week-view-event.maintenance {
    background: rgba(249, 115, 22, 0.15);
    border-left-color: #f97316;
}

.week-view-event.showing {
    background: rgba(244, 114, 182, 0.15);
    border-left-color: #f472b6;
}

.week-view-hour-cell:hover {
    background: var(--bg-tertiary);
}

.calendar-sidebar {
    flex-shrink: 0;
}

.calendar-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-header-top {
    display: flex;
    align-items: center;
}

.calendar-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Calendar Responsive */
@media (max-width: 1024px) {
    .calendar-bottom {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .calendar-day {
        min-height: 60px;
        padding: 4px;
    }

    .calendar-event {
        font-size: 8px;
        padding: 1px 2px;
    }

    .calendar-bottom {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   COMPACT PAGE STYLES - Accounting, Reports, Evictions
   ============================================ */

/* Compact card headers */
.card-header {
    padding: 10px 14px;
}

.card-title {
    font-size: 14px;
}

/* Compact filter sections */
.reports-filters {
    margin-bottom: 14px !important;
}

.reports-filters-row {
    gap: 12px;
}

.filter-group {
    gap: 4px;
}

.filter-label {
    font-size: 10px;
}

.form-select {
    padding: 6px 10px;
    font-size: 12px;
}

/* Compact tab buttons */
.tabs {
    gap: 4px;
    margin-bottom: 12px;
}

.tab {
    padding: 6px 12px;
    font-size: 12px;
}

/* Compact data tables */
.data-table th,
.data-table td {
    padding: 8px 10px;
    font-size: 12px;
}

.data-table th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Compact summary boxes */
.card > div[style*="padding: 12px 16px; background"] {
    padding: 8px 12px !important;
    font-size: 12px;
    margin-bottom: 12px !important;
}

/* Evictions page compact */
.eviction-card {
    padding: 12px;
    margin-bottom: 10px;
}

.eviction-header {
    font-size: 13px;
}

.eviction-info {
    font-size: 11px;
}

/* Status badges more readable - red */
.status-badge[style*="background: rgba(239, 68, 68"],
span[style*="background: rgba(239, 68, 68"] {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5 !important;
    font-weight: 500 !important;
}

/* Status text for red statuses - better contrast */
td.text-danger,
span.text-danger,
[style*="color: #ef4444"],
[style*="color:#ef4444"] {
    color: #fca5a5 !important;
}

/* Unpaid maintenance box - contained properly */
.maint-section {
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

/* ============================================
   MOBILE-ONLY FIXES (768px and below)
   ============================================ */
@media (max-width: 768px) {

    /* --- DASHBOARD: Stack quick actions 2x2, full width --- */
    .dashboard-quick-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        overflow-x: visible !important;
    }
    .dashboard-quick-actions .btn {
        white-space: normal !important;
        flex: none !important;
        width: 100% !important;
        text-align: center;
    }

    /* --- DASHBOARD: Stack upcoming + recent activity vertically --- */
    .dashboard-upcoming-row {
        flex-direction: column !important;
    }

    /* --- CALENDAR: Fix nav arrows clipping, show all controls --- */
    .calendar-card-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .calendar-header-top {
        width: 100%;
    }
    .calendar-nav {
        justify-content: center;
        margin-left: 0 !important;
        gap: 8px;
    }
    .calendar-title {
        min-width: auto !important;
        font-size: 16px !important;
    }
    .calendar-header-actions {
        display: flex !important;
        justify-content: center !important;
        flex-wrap: wrap;
        gap: 6px;
    }
    .zoom-controls {
        margin-right: 0 !important;
    }

    /* --- APPLICANTS: Fit status + property dropdowns horizontally --- */
    .applicants-filter-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }
    .applicants-filter-row select {
        flex: 1;
        min-width: 0;
    }

    /* --- TENANTS: Fix status badge clipping --- */
    .tenant-row-main > div {
        flex-wrap: wrap !important;
    }
    .tenant-row-main .status-good,
    .tenant-row-main .status-delinquent,
    .tenant-row-main .status-eviction,
    .tenant-row-main .badge {
        white-space: nowrap;
        font-size: 10px !important;
        padding: 2px 6px !important;
        overflow: visible !important;
    }

    /* --- TENANT DETAIL: Fix expanded row clipping --- */
    .tenant-expanded-info {
        padding: 12px 8px !important;
    }
    .tenant-quick-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    .tenant-quick-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        justify-content: center !important;
    }
    .tenant-quick-actions .btn {
        font-size: 11px !important;
        padding: 6px 10px !important;
        flex: 0 0 auto;
    }

    /* --- RECORD PAYMENT: Fix date field sizing --- */
    .modal .form-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .modal input[type="date"] {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* --- ACCOUNTING: Fix property/month selectors --- */
    .reports-filters-row {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }
    .reports-filters-row .filter-group {
        flex: 1 !important;
        min-width: 0 !important;
    }
    .reports-filters-row .form-select {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* --- LEASE RENEWALS: Center header --- */
    .page-header {
        text-align: center !important;
        align-items: center !important;
    }
    .page-header > div:first-child {
        text-align: center !important;
        width: 100%;
    }
    .page-actions {
        justify-content: center !important;
    }

    /* --- REPORTS: Stack buttons centered, uniform width --- */
    .reports-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100%;
    }
    .reports-row .report-btn {
        width: 100% !important;
        justify-content: center !important;
        box-sizing: border-box;
    }

    /* --- REPORTS: Filters on one line where possible --- */
    .report-inline-filters {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .report-inline-filters .filter-group {
        flex: 1 1 auto;
        min-width: 80px;
    }

    /* --- EVICTIONS: Show mobile cards, hide desktop table --- */
    .eviction-desktop-table {
        display: none !important;
    }
    .eviction-mobile-cards {
        display: block !important;
    }
    .eviction-mobile-card {
        padding: 12px;
        border-bottom: 1px solid var(--border-color);
    }
    .eviction-mobile-card:last-child {
        border-bottom: none;
    }
    .eviction-mobile-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
        margin-top: 10px;
    }
    .eviction-mobile-actions .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        text-align: center;
        font-size: 11px !important;
        padding: 8px 6px !important;
    }

    /* --- MAINTENANCE MODAL: Lock body scroll when modal is open --- */
    .modal-backdrop {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .modal-backdrop .modal-content {
        max-height: none;
        overflow-y: visible;
    }

    /* --- SIDEBAR: Compact nav items, add scroll for small phones --- */
    .sidebar {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar-header {
        padding: 10px 12px !important;
    }
    .logo {
        margin-bottom: 8px !important;
        font-size: 16px !important;
    }
    .user-info {
        padding: 8px !important;
    }
    .user-name {
        font-size: 12px !important;
    }
    .sidebar-search {
        padding: 0 10px 8px !important;
    }
    .sidebar-nav {
        padding: 4px 0 !important;
        flex: 1;
        overflow-y: auto;
    }
    .nav-item {
        padding: 7px 14px !important;
        font-size: 12px !important;
        gap: 8px !important;
        min-height: 36px !important;
    }
    .nav-item-icon {
        font-size: 13px !important;
        width: 16px !important;
    }
    .sidebar-footer {
        padding: 8px 12px !important;
    }
    .logout-btn {
        padding: 6px !important;
        font-size: 12px !important;
    }

    /* --- LISTINGS: 2 tiles per row on mobile --- */
    #listings-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .listing-card {
        font-size: 11px;
    }
    .listing-card img,
    .listing-card .listing-photo-placeholder,
    .listing-card > div:first-child {
        height: 80px !important;
    }
    .listing-card > div:last-child {
        padding: 8px 10px !important;
    }
    .listing-card > div:last-child div[style*="font-size: 16px"] {
        font-size: 13px !important;
    }
    .listing-card > div:last-child div[style*="font-size: 14px"] {
        font-size: 11px !important;
    }

    /* --- LISTINGS: Sort filters don't clip --- */
    .filters-bar {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .filters-bar .form-select {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 12px !important;
    }

    /* --- EDIT LISTING MODAL: Stack photo on top, form below --- */
    #edit-listing-form > div:first-child {
        flex-direction: column !important;
    }
    #edit-listing-form > div:first-child > div:first-child {
        width: 100% !important;
        flex-shrink: unset !important;
    }
    #edit-listing-form > div:first-child > div:first-child #listing-photos-gallery {
        max-height: 200px !important;
    }

    /* --- BILLING: Stat boxes 2x2 grid instead of 4 across --- */
    .billing-stat-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* --- TENANTS PAGE: Fix table header row clipping --- */
    .tenant-table-header {
        display: none !important;
    }

    /* --- MAINTENANCE: 3 filter dropdowns same row, no clip --- */
    .maintenance-filters-row {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .maintenance-filters-row .form-input {
        min-width: 0 !important;
        flex: 1 1 0 !important;
        font-size: 12px !important;
        padding: 8px 6px !important;
    }

    /* --- SIDEBAR: Fix tap targets for settings/logout --- */
    .sidebar .nav-item {
        min-height: 44px !important;
        padding: 10px 14px !important;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
        touch-action: manipulation;
    }
    .sidebar-footer {
        padding: 10px 12px !important;
        flex-shrink: 0;
    }
    .sidebar-footer .logout-btn {
        min-height: 44px !important;
        touch-action: manipulation;
    }

    /* --- HEADER CENTERING: Balanced padding for centered text --- */
    .page-header {
        padding-left: 52px !important;
        padding-right: 52px !important;
        text-align: center !important;
    }
    .page-header > div:first-child {
        padding-left: 0 !important;
        text-align: center !important;
        width: 100%;
    }
}

/* ============================================
   ONBOARDING WIZARD
   ============================================ */

/* Overlay */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* Wizard Card */
.onboarding-wizard {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
}

.onboarding-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    z-index: 1;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.onboarding-close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Progress Dots */
.onboarding-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--border-color);
}
.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-hover);
    transition: all 0.3s ease;
}
.progress-dot.active {
    background: var(--accent-primary);
    width: 24px;
    border-radius: 4px;
}
.progress-dot.completed {
    background: #10b981;
}

/* Step Content */
.onboarding-step {
    padding: 40px 36px 24px;
    animation: onboardingFadeIn 0.35s ease;
}
@keyframes onboardingFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.onboarding-step h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text-primary);
}
.onboarding-step .step-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 28px;
}

/* Form Rows in Wizard */
.onboarding-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.onboarding-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.onboarding-form-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}
.onboarding-form-group input,
.onboarding-form-group select {
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.onboarding-form-group input:focus,
.onboarding-form-group select:focus {
    border-color: var(--accent-primary);
}

/* Team Repeater */
.team-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
    animation: onboardingFadeIn 0.25s ease;
}
.team-row input, .team-row select {
    padding: 9px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.team-row .remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
}
.team-row .remove-btn:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* Theme Cards */
.theme-preview-card {
    flex: 1;
    max-width: 200px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}
.theme-preview-card:hover { border-color: var(--accent-primary); transform: translateY(-2px); }
.theme-preview-card.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.theme-preview-card .preview-box {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    overflow: hidden;
}
.theme-preview-card .preview-bar {
    height: 6px;
    border-radius: 3px;
    opacity: 0.6;
}

/* Import Step */
.import-competitor-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 20px;
}
.import-file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}
.import-file-row:hover { border-color: var(--accent-primary); }
.import-file-row .file-label { font-size: 13px; font-weight: 500; }
.import-file-row .file-actions { display: flex; align-items: center; gap: 10px; }
.import-file-row .template-link {
    font-size: 11px;
    color: var(--accent-primary);
    text-decoration: none;
}
.import-file-row .template-link:hover { text-decoration: underline; }
.import-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}
.import-status.success { background: rgba(16,185,129,0.15); color: #10b981; }
.import-status.error { background: rgba(239,68,68,0.15); color: #ef4444; }

/* Nav Buttons */
.onboarding-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.onboarding-nav .btn { min-width: 100px; }

/* ============================================
   DASHBOARD TOUR SPOTLIGHT
   ============================================ */
.tour-spotlight-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: all;
}
.tour-spotlight-highlight {
    position: absolute;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    border-radius: 8px;
    pointer-events: none;
    transition: all 0.4s ease;
    z-index: 9999;
}
.tour-tooltip {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
    border-radius: 10px;
    padding: 16px 18px;
    max-width: 320px;
    z-index: 10001;
    pointer-events: all;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    animation: onboardingFadeIn 0.3s ease;
}
.tour-tooltip .tour-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-primary);
}
.tour-tooltip .tour-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 14px;
}
.tour-tooltip .tour-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tour-tooltip .tour-counter {
    font-size: 11px;
    color: var(--text-muted);
}
.tour-tooltip .tour-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   SECTION FIRST-VISIT TIPS
   ============================================ */
.section-tip {
    background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(99,102,241,0.04));
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    animation: onboardingFadeIn 0.35s ease;
}
.section-tip-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--accent-primary);
    margin-bottom: 4px;
}
.section-tip-text {
    font-size: 13px;
    color: var(--text-primary);
    margin: 0 0 3px;
}
.section-tip-philosophy {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}
.section-tip-dismiss {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 0 0 0 12px;
    line-height: 1;
}
.section-tip-dismiss:hover { color: var(--text-primary); }

/* ============================================
   GETTING STARTED CHECKLIST
   ============================================ */
.getting-started-checklist {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
    animation: onboardingFadeIn 0.35s ease;
}
.checklist-header {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.checklist-header-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.checklist-header-count {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 12px;
}
.checklist-progress-bar {
    height: 3px;
    background: var(--bg-hover);
}
.checklist-progress-fill {
    height: 100%;
    background: #10b981;
    transition: width 0.4s ease;
    border-radius: 0 3px 3px 0;
}
.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: var(--bg-hover); }
.checklist-item.completed {
    opacity: 0.5;
    text-decoration: line-through;
    cursor: default;
}
.checklist-item .check-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* ============================================
   CONFETTI
   ============================================ */
.confetti-piece {
    position: fixed;
    z-index: 10002;
    pointer-events: none;
    border-radius: 2px;
}
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    75% { opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Summary Card */
.onboarding-summary {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 20px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.onboarding-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}
.onboarding-summary-row .label { color: var(--text-secondary); }
.onboarding-summary-row .value { color: var(--text-primary); font-weight: 600; }

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .onboarding-wizard {
        max-width: 100%;
        margin: 10px;
        max-height: calc(100vh - 20px);
        border-radius: 10px;
    }
    .onboarding-step { padding: 28px 20px 16px; }
    .onboarding-step h2 { font-size: 19px; }
    .onboarding-form-row { grid-template-columns: 1fr; }
    .team-row { grid-template-columns: 1fr; gap: 6px; }
    .theme-preview-card { max-width: 160px; }
    .tour-tooltip { max-width: 280px; left: 10px !important; right: 10px !important; }
}
