/* ======================== */
/* Login Screen            */
/* ======================== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1b2538 0%, #2c3e6b 50%, #4361ee 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-screen.hidden {
    display: none;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 400px;
    padding: 40px 36px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 4px;
    font-weight: 800;
}

.login-header p {
    color: var(--secondary);
    font-size: 0.9rem;
}

.login-field {
    margin-bottom: 18px;
}

.login-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: border-color 0.2s;
    outline: none;
}

.login-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
}

.login-error {
    color: var(--danger);
    font-size: 0.85rem;
    min-height: 20px;
    margin-bottom: 8px;
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background: var(--primary-dark);
}

/* Sidebar Logout */
.sidebar-logout {
    padding: 16px 20px;
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.logout-btn {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.08);
    color: var(--sidebar-text);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(230, 57, 70, 0.2);
    color: var(--danger);
    border-color: rgba(230, 57, 70, 0.3);
}

/* ======================== */
/* CSS Variables            */
/* ======================== */
:root {
    --primary: #4361ee;
    --primary-light: #4895ef;
    --primary-dark: #3f37c9;
    --secondary: #6c757d;
    --success: #2dc653;
    --warning: #ff9f1c;
    --danger: #e63946;
    --light: #f8f9fa;
    --dark: #212529;
    --white: #ffffff;
    --bg: #f0f2f5;
    --sidebar-bg: #1b2538;
    --sidebar-text: #a4b0be;
    --sidebar-active: #4361ee;
    --border: #dee2e6;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 10px;
    --radius-sm: 6px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--dark);
    display: flex;
    min-height: 100vh;
}

/* ======================== */
/* Sidebar                 */
/* ======================== */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h2 {
    color: var(--white);
    font-size: 1.3rem;
    letter-spacing: 0.5px;
}

.sidebar-subtitle {
    font-size: 0.75rem;
    color: var(--sidebar-text);
    margin-top: 4px;
}

.nav-menu {
    list-style: none;
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--white);
}

.nav-item.active {
    background: rgba(67,97,238,0.15);
    color: var(--white);
    border-left-color: var(--sidebar-active);
}

.nav-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* ======================== */
/* Main Content            */
/* ======================== */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.top-bar {
    background: var(--white);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h1 {
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
}

.date-display {
    color: var(--secondary);
    font-size: 0.9rem;
}

/* ======================== */
/* Views                   */
/* ======================== */
.view {
    display: none;
    padding: 24px 28px;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.view-header h2 {
    font-size: 1.3rem;
}

/* ======================== */
/* Stats Grid              */
/* ======================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--white);
}

.apartments-icon { background: linear-gradient(135deg, #4361ee, #4895ef); }
.shops-icon { background: linear-gradient(135deg, #f77f00, #fcbf49); }
.houses-icon { background: linear-gradient(135deg, #2dc653, #55d679); }
.due-icon { background: linear-gradient(135deg, #e63946, #ef476f); }
.revenue-icon { background: linear-gradient(135deg, #2dc653, #06d6a0); }
.expenses-icon { background: linear-gradient(135deg, #e63946, #ff6b6b); }

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-info p {
    color: var(--secondary);
    font-size: 0.85rem;
    margin-top: 2px;
}

.stat-card-link {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.14);
}

/* ======================== */
/* Filter Bar Row          */
/* ======================== */
.filter-bar-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.date-range-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.date-range-filter label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
}

.date-range-filter input[type="date"] {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
}

.date-range-filter input[type="date"]:focus {
    border-color: var(--primary);
}

/* ======================== */
/* Dashboard Cards         */
/* ======================== */
.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.dashboard-card h3 {
    margin-bottom: 16px;
    font-size: 1.05rem;
    color: var(--dark);
}

/* ======================== */
/* Tables                  */
/* ======================== */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead {
    background: var(--primary);
    color: var(--white);
}

.data-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.data-table td {
    padding: 11px 14px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: #f0f4ff;
}

/* ======================== */
/* Search Bar              */
/* ======================== */
.search-bar {
    margin-bottom: 16px;
}

.search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: var(--primary);
}

/* ======================== */
/* Payments Filter & Total */
/* ======================== */
.payments-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--dark);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.payments-total-bar {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    font-size: 0.92rem;
}

.payments-breakdown {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--secondary);
    box-shadow: var(--shadow);
}

.payments-breakdown:empty {
    display: none;
}

/* ======================== */
/* Buttons                 */
/* ======================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e6ea;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #c5303c;
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #26a547;
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
}

.btn-icon {
    padding: 6px 10px;
    font-size: 0.85rem;
}

/* ======================== */
/* Forms                   */
/* ======================== */
.tenant-form {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.form-section {
    margin-bottom: 24px;
}

.form-section h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eef2ff;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

/* ======================== */
/* Badges                  */
/* ======================== */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-block;
}

.badge-active {
    background: #d4edda;
    color: #155724;
}

.badge-expired {
    background: #f8d7da;
    color: #721c24;
}

.badge-due-soon {
    background: #fff3cd;
    color: #856404;
}

.badge-overdue {
    background: #f8d7da;
    color: #721c24;
}

.badge-signed {
    background: #d4edda;
    color: #155724;
}

.badge-unsigned {
    background: #fff3cd;
    color: #856404;
}

.badge-version {
    background: #e2e6ea;
    color: #495057;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.badge-renewed {
    background: #d1ecf1;
    color: #0c5460;
    cursor: pointer;
    font-size: 0.72rem;
    margin-left: 4px;
}

.badge-renewed:hover {
    background: #b8daff;
    color: #004085;
}

.badge-apartment {
    background: #e2ecff;
    color: #2b4ea5;
}

.badge-shop {
    background: #ffecd2;
    color: #b86e00;
}

.badge-house {
    background: #d4f5dd;
    color: #1a7a33;
}

/* Action buttons in tables */
.actions-cell {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* ======================== */
/* Modals                  */
/* ======================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-small {
    max-width: 420px;
}

.modal-lease {
    max-width: 850px;
    max-height: 90vh;
}

.modal-receipt {
    max-width: 550px;
    max-height: 90vh;
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.15rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary);
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ======================== */
/* Lease Contract Styles   */
/* ======================== */
.lease-contract {
    font-family: 'Georgia', 'Times New Roman', serif;
    color: #222;
    line-height: 1.7;
    padding: 8px;
}

.lease-contract .lease-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 3px double #222;
    padding-bottom: 20px;
}

.lease-contract .lease-header h1 {
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.lease-contract .lease-header p {
    color: #555;
    font-size: 0.9rem;
}

.lease-contract .lease-parties {
    margin-bottom: 25px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.lease-contract .lease-parties h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #333;
}

.lease-contract .party-info {
    margin-bottom: 12px;
    padding-left: 16px;
}

.lease-contract .party-info p {
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.lease-contract .party-info strong {
    display: inline-block;
    min-width: 120px;
}

.lease-contract .lease-article {
    margin-bottom: 22px;
}

.lease-contract .lease-article h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 8px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
}

.lease-contract .lease-article p,
.lease-contract .lease-article ul {
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.lease-contract .lease-article ul {
    padding-left: 24px;
}

.lease-contract .lease-article li {
    margin-bottom: 4px;
}

/* Signature Section */
.lease-signatures {
    margin-top: 30px;
    border-top: 2px solid #222;
    padding-top: 20px;
}

.lease-signatures h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.signature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.signature-block {
    text-align: center;
}

.signature-block label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.signature-canvas {
    border: 2px dashed #aaa;
    border-radius: 6px;
    cursor: crosshair;
    background: #fefefe;
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 300px;
    height: 120px;
    touch-action: none;
}

.signature-canvas.signed {
    border-style: solid;
    border-color: var(--success);
    cursor: default;
}

.signature-actions {
    margin-top: 8px;
}

.signed-date {
    font-size: 0.8rem;
    color: #666;
    margin-top: 6px;
}

.signature-img {
    max-width: 300px;
    width: 100%;
    height: 120px;
    border: 2px solid var(--success);
    border-radius: 6px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    background: #fefefe;
}

/* Lease Acceptance Checkbox */
.lease-acceptance-checkbox {
    margin-top: 20px;
    padding: 14px 16px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.lease-acceptance-checkbox input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.lease-acceptance-checkbox label {
    font-size: 0.88rem;
    line-height: 1.5;
    cursor: pointer;
    color: #333;
}

/* ======================== */
/* Receipt Styles          */
/* ======================== */
.receipt {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    padding: 10px;
}

.receipt-header {
    text-align: center;
    border-bottom: 2px solid #222;
    padding-bottom: 14px;
    margin-bottom: 20px;
}

.receipt-header h2 {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

.receipt-header p {
    font-size: 0.8rem;
    color: #666;
}

.receipt-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.receipt-table td {
    padding: 8px 10px;
    font-size: 0.9rem;
    border-bottom: 1px solid #eee;
}

.receipt-table td:first-child {
    font-weight: 600;
    width: 40%;
    color: #555;
}

.receipt-total {
    text-align: right;
    font-size: 1.15rem;
    font-weight: 700;
    padding: 12px 0;
    border-top: 2px solid #222;
    margin-top: 10px;
}

.receipt-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.8rem;
    color: #888;
}

/* ======================== */
/* Responsive              */
/* ======================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .dashboard-sections {
        grid-template-columns: 1fr;
    }

    .signature-grid {
        grid-template-columns: 1fr;
    }

    .view {
        padding: 16px;
    }

    .top-bar {
        padding: 12px 16px;
    }

    .tenant-form {
        padding: 18px;
    }

    /* Mobile-friendly lease contract modal */
    .modal-lease {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .lease-contract {
        padding: 4px;
        line-height: 1.5;
    }

    .lease-contract .lease-header h1 {
        font-size: 1.1rem;
        letter-spacing: 1px;
    }

    .lease-contract .lease-header p {
        font-size: 0.8rem;
    }

    .lease-contract .lease-parties {
        padding: 10px;
    }

    .lease-contract .party-info strong {
        min-width: 80px;
        font-size: 0.82rem;
    }

    .lease-contract .party-info p {
        font-size: 0.82rem;
    }

    .lease-contract .lease-article h3 {
        font-size: 0.9rem;
    }

    .lease-contract .lease-article p,
    .lease-contract .lease-article ul {
        font-size: 0.82rem;
    }

    .lease-signatures {
        padding: 12px !important;
    }

    .signature-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .signature-canvas,
    .signature-img {
        max-width: 100%;
        height: 100px;
    }

    .modal-body {
        padding: 14px;
    }

    .modal-header {
        padding: 12px 14px;
    }

    .lease-acceptance-checkbox {
        padding: 10px;
    }

    .lease-acceptance-checkbox label {
        font-size: 0.8rem;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .filter-buttons {
        flex-wrap: wrap;
    }

    /* Mobile card layout for tenant tables */
    #view-apartments .data-table thead,
    #view-shops .data-table thead,
    #view-houses .data-table thead {
        display: none;
    }

    #view-apartments .data-table tbody tr,
    #view-shops .data-table tbody tr,
    #view-houses .data-table tbody tr {
        display: block;
        background: var(--white);
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow);
        margin-bottom: 12px;
        padding: 12px 14px;
        border: 1px solid var(--border);
    }

    #view-apartments .data-table tbody td,
    #view-shops .data-table tbody td,
    #view-houses .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #f0f0f0;
        font-size: 0.85rem;
    }

    #view-apartments .data-table tbody td:last-child,
    #view-shops .data-table tbody td:last-child,
    #view-houses .data-table tbody td:last-child {
        border-bottom: none;
        justify-content: flex-start;
        padding-top: 10px;
    }

    #view-apartments .data-table tbody td::before,
    #view-shops .data-table tbody td::before,
    #view-houses .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--dark);
        font-size: 0.82rem;
        min-width: 100px;
    }

    #view-apartments .data-table tfoot td,
    #view-shops .data-table tfoot td,
    #view-houses .data-table tfoot td {
        display: inline-block;
        border-bottom: none;
    }

    /* Mobile card layout for leases table */
    #view-leases .data-table thead {
        display: none;
    }

    #view-leases .data-table tbody tr {
        display: block;
        background: var(--white);
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow);
        margin-bottom: 12px;
        padding: 12px 14px;
        border: 1px solid var(--border);
    }

    #view-leases .data-table tbody td {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #f0f0f0;
        font-size: 0.85rem;
    }

    #view-leases .data-table tbody td:last-child {
        border-bottom: none;
        justify-content: flex-start;
        padding-top: 10px;
    }

    #view-leases .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--dark);
        font-size: 0.82rem;
        min-width: 100px;
    }

    #view-leases .data-table tfoot td {
        display: inline-block;
        border-bottom: none;
    }

    /* Mobile card layout for expenses table */
    #view-expenses .data-table thead {
        display: none;
    }

    #view-expenses .data-table tbody tr {
        display: block;
        background: var(--white);
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow);
        margin-bottom: 12px;
        padding: 12px 14px;
        border: 1px solid var(--border);
    }

    #view-expenses .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #f0f0f0;
        font-size: 0.85rem;
    }

    #view-expenses .data-table tbody td:last-child {
        border-bottom: none;
        justify-content: flex-start;
        padding-top: 10px;
    }

    #view-expenses .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--dark);
        font-size: 0.82rem;
        min-width: 100px;
    }

    #view-expenses .data-table tfoot td {
        display: inline-block;
        border-bottom: none;
    }

    .filter-bar-row {
        flex-direction: column;
        align-items: stretch;
    }

    .date-range-filter {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .search-bar input {
        max-width: 100%;
    }
}

/* ======================== */
/* Print Styles            */
/* ======================== */
@media print {
    body,
    body * {
        visibility: hidden;
    }

    /* Lease Print */
    #leaseContractModal.active,
    #leaseContractModal.active .modal-lease,
    #leaseContractModal.active .modal-lease * {
        visibility: visible;
    }

    #leaseContractModal.active {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        display: block;
        background: none;
    }

    #leaseContractModal.active .modal-lease {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: none;
        height: auto;
        box-shadow: none;
        border-radius: 0;
        overflow: visible;
        margin: 0;
    }

    /* Receipt Print */
    #receiptModal.active,
    #receiptModal.active .modal-receipt,
    #receiptModal.active .modal-receipt * {
        visibility: visible;
    }

    #receiptModal.active {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        display: block;
        background: none;
    }

    #receiptModal.active .modal-receipt {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: none;
        height: auto;
        box-shadow: none;
        border-radius: 0;
        overflow: visible;
        margin: 0;
    }

    /* Tenant Receipt Print */
    #tenantReceiptModal.active,
    #tenantReceiptModal.active .modal-receipt,
    #tenantReceiptModal.active .modal-receipt * {
        visibility: visible;
    }

    #tenantReceiptModal.active {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        display: block;
        background: none;
    }

    #tenantReceiptModal.active .modal-receipt {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: none;
        height: auto;
        box-shadow: none;
        border-radius: 0;
        overflow: visible;
        margin: 0;
    }

    .no-print {
        display: none !important;
    }

    .lease-acceptance-checkbox {
        display: none !important;
    }

    .modal-footer {
        display: none !important;
    }

    .modal-lease .modal-body,
    .modal-receipt .modal-body {
        padding: 20px;
    }

    .lease-contract {
        font-size: 11pt;
    }

    .lease-signatures {
        page-break-inside: avoid;
    }

    .signature-canvas {
        border-style: solid;
    }

    .signature-img {
        max-width: 250px;
        height: 100px;
    }
}

/* ======================== */
/* Utility                 */
/* ======================== */
.text-center { text-align: center; }
.text-muted { color: var(--secondary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--secondary);
    font-size: 0.95rem;
}
