/* Rent Roll V2 — layout and comments modal */

.rr-v2-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem;
}

.rr-v2-header {
    margin-bottom: 1.25rem;
}

.rr-v2-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.rr-v2-subtitle {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.rr-v2-meta {
    font-size: 0.8rem;
    color: #6c757d;
}

.rr-v2-filters .card-body {
    padding: 1rem;
}

.rr-v2-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
    display: block;
}

/* Summary bar */
.rr-v2-summary {
    margin-bottom: 1.5rem;
}

.rr-v2-summary-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: stretch;
}

.rr-v2-summary-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    min-width: 100px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #dee2e6;
}

.rr-v2-summary-card .rr-v2-summary-value {
    font-variant-numeric: tabular-nums;
}

.rr-v2-summary-card--clickable {
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

.rr-v2-summary-card--clickable:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.rr-v2-summary-card--active {
    box-shadow: 0 0 0 2px #0d6efd;
    border-color: #0d6efd;
}

.rr-v2-summary-card--partial-arrears {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-color: #ef9a9a;
}

.rr-v2-summary-card--full-arrears {
    background: linear-gradient(135deg, #ffcdd2 0%, #ef9a9a 100%);
    border-color: #e57373;
}

.rr-v2-summary-card--partial-arrears .rr-v2-summary-sub,
.rr-v2-summary-card--full-arrears .rr-v2-summary-sub {
    color: #c62828;
}

.rr-v2-summary-card--not-paid {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border-color: #ffca28;
}

.rr-v2-summary-card--not-paid .rr-v2-summary-sub {
    color: #f57f17;
}

/* Export for WhatsApp */
.rr-v2-export-section {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}
.rr-v2-export-section .card-body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.rr-v2-export-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
}

.rr-v2-export-btn {
    font-size: 0.8rem;
}

.rr-v2-export-feedback {
    font-size: 0.85rem;
    color: #28a745;
    opacity: 0;
    transition: opacity 0.2s;
}

.rr-v2-export-feedback--visible {
    opacity: 1;
}

.rr-v2-summary-card--vacant {
    background: linear-gradient(135deg, #b0bec5 0%, #90a4ae 100%);
    border-color: #78909c;
}

.rr-v2-summary-card--vacant .rr-v2-summary-value,
.rr-v2-summary-card--vacant .rr-v2-summary-label {
    color: #fff;
}

.rr-v2-summary-card--vacant .rr-v2-summary-sub {
    color: rgba(255, 255, 255, 0.85);
}


.rr-v2-summary-card--vacant-process {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #ffb74d;
}

.rr-v2-summary-card--pop-received {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #81c784;
}

.rr-v2-summary-card--physically-vacant {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #64b5f6;
}

.rr-v2-summary-card--physically-vacant .rr-v2-summary-sub {
    color: #1565c0;
}

.rr-v2-summary-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #212529;
}

.rr-v2-summary-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.rr-v2-summary-sub {
    display: block;
    font-size: 0.75rem;
    color: #495057;
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.rr-v2-loading-more {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #e7f1ff;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #0d6efd;
}

.rr-v2-agent-section {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.rr-v2-agent-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    margin-right: 0.25rem;
}

.rr-v2-agent-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.rr-v2-agent-chip {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.rr-v2-agent-chip:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.rr-v2-agent-chip--active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* Table */
.rr-v2-table-section {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow: hidden;
}

.rr-v2-data {
    padding: 0;
}

.rr-v2-table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.rr-v2-table th {
    background: #f1f3f5;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.rr-v2-table td {
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
    padding: 0.4rem 0.5rem;
}

.rr-v2-table th:first-child,
.rr-v2-table td:first-child {
    max-width: 90px;
    min-width: 70px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rr-v2-unit-link {
    font-size: 0.8rem;
}

.rr-v2-row-arrears {
    background-color: #ffebee;
}

/* Cumulative arrears (running rent balance for the current lease, all months combined) */
.rr-v2-cum-arrears {
    color: #c62828;
    font-weight: 600;
}

.rr-v2-cum-credit {
    color: #2e7d32;
    font-weight: 600;
}

.rr-v2-row-vacant {
    background-color: #b0bec5;
}

.rr-v2-vacant-duration {
    display: inline-block;
    background: #616161;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    margin-left: 0.35rem;
    font-weight: 600;
}

.rr-v2-vacant-duration.rr-v2-never-occupied {
    background: #78909c;
    font-style: italic;
}

/* Duplicate unit (same flat appears more than once) — highlight for review */
.rr-v2-row-duplicate {
    background-color: #e8e0f0 !important;
    border-left: 3px solid #7b1fa2;
}
.rr-v2-row-duplicate td {
    color: #4a148c;
}

.rr-v2-payment-flag {
    max-width: 130px;
    font-size: 0.75rem;
    padding: 0.2rem 0.35rem;
    height: auto;
}

.rr-v2-comments-cell {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    align-items: flex-start;
}

.rr-v2-comments-btn {
    font-size: 0.8rem;
}

.rr-v2-comments-latest {
    font-size: 0.7rem;
    color: #6c757d;
    white-space: nowrap;
}

/* Comments modal — ensure on top and clickable (above Bootstrap backdrop) */
#commentsModal.modal {
    z-index: 1060 !important;
}

#commentsModal .modal-dialog {
    max-width: 560px;
    z-index: 1061;
    position: relative;
}

#commentsModal .modal-content {
    position: relative;
    z-index: 1061;
}

#commentsModal .modal-body,
#commentsModal .modal-header,
#commentsModal input,
#commentsModal textarea,
#commentsModal button,
#commentsModal label {
    pointer-events: auto;
}

/* Comments modal */

.rr-v2-comments-modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.rr-v2-comments-header {
    background: linear-gradient(135deg, #4a69bd 0%, #3c5aa6 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
    padding: 1rem 1.25rem;
    border: none;
}

.rr-v2-comments-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.rr-v2-comments-unit {
    opacity: 0.9;
    font-size: 0.85rem;
}

.rr-v2-comments-close {
    color: #fff;
    opacity: 0.9;
    text-shadow: none;
}

.rr-v2-comments-close:hover {
    color: #fff;
    opacity: 1;
}

.rr-v2-comments-body {
    padding: 1.25rem;
}

.rr-v2-comments-timeline {
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 1.25rem;
    padding-right: 0.5rem;
}

.rr-v2-comments-loading {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.rr-v2-comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rr-v2-comment-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border-left: 3px solid #4a69bd;
}

.rr-v2-comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.35rem;
}

.rr-v2-comment-meta strong {
    font-size: 0.9rem;
    color: #212529;
}

.rr-v2-comment-meta time {
    font-size: 0.75rem;
    color: #6c757d;
}

.rr-v2-comment-text {
    font-size: 0.9rem;
    color: #495057;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.rr-v2-comment-files {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e9ecef;
}

.rr-v2-comment-file {
    display: inline-block;
    font-size: 0.8rem;
    color: #4a69bd;
    margin-right: 0.75rem;
    text-decoration: none;
}

.rr-v2-comment-file:hover {
    text-decoration: underline;
}

.rr-v2-comments-empty {
    text-align: center;
    padding: 2rem;
    color: #adb5bd;
}

.rr-v2-comments-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.rr-v2-comments-add {
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
}

.rr-v2-comments-add-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.35rem;
    display: block;
}

.rr-v2-comments-textarea {
    border-radius: 8px;
    resize: vertical;
    min-height: 80px;
}

.rr-v2-comments-add-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.rr-v2-comments-files {
    font-size: 0.8rem;
    color: #6c757d;
}
