/* Reports Tab Specific Styling for AMD Construction Pro */

/* --- Main Reports Layout --- */
#reports-tab {
    height: 100dvh;
    width: 100vw;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f4f6fa;
}

.reports-dashboard-layout {
    display: grid;
    grid-template-columns: minmax(300px, 350px) 1fr;
    gap: 0;
    height: 100%;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #f4f6fa;
}

/* --- Left Sidebar --- */
.reports-sidebar {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e1e5e9;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    border-bottom: 1px solid #f1f3f5;
}

.sidebar-title {
    padding: 16px 20px 12px 20px;
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-title i {
    font-size: 12px;
    color: var(--color-primary);
}

/* --- Report Categories --- */
.report-categories {
    padding: 0;
}

.report-category {
    border-bottom: 1px solid #f1f3f5;
}

.category-header {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    background: #fff;
}

.category-header:hover {
    background: #f8f9fa;
}

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

.category-name {
    flex: 1;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.category-toggle {
    font-size: 12px;
    color: #6c757d;
    transition: transform 0.2s ease;
}

.category-header.collapsed .category-toggle {
    transform: rotate(-90deg);
}

.category-reports {
    display: block;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.category-header.collapsed + .category-reports {
    display: none;
}

.report-item {
    padding: 10px 20px 10px 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    border-bottom: 1px solid #e9ecef;
}

.report-item:hover {
    background: #e7f3ff;
    color: var(--color-primary);
}

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

.report-name {
    font-size: 13px;
    color: #495057;
}

.report-item:hover .report-name {
    color: var(--color-primary);
    font-weight: 500;
}

.favorite-btn {
    background: none;
    border: none;
    font-size: 12px;
    color: #dee2e6;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.favorite-btn:hover {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.favorite-btn.active {
    color: #ffc107;
}

/* --- Favorite & Recent Reports --- */
.favorite-reports,
.recent-reports {
    padding: 0 0 10px 0;
}

.favorite-report-item,
.recent-report-item {
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f3f5;
}

.favorite-report-item:hover,
.recent-report-item:hover {
    background: #f8f9fa;
}

.favorite-report-name,
.recent-report-name {
    font-size: 13px;
    color: #495057;
    font-weight: 500;
}

.recent-report-date {
    font-size: 11px;
    color: #6c757d;
    margin-top: 2px;
}

.empty-sidebar-state {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 13px;
    font-style: italic;
}

/* --- Main Content Area --- */
.reports-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f4f6fa;
}

/* --- Reports Header --- */
.reports-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.reports-title-section h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
    color: white;
}

.reports-title-section p {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

.reports-stats {
    display: flex;
    gap: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 20px;
    border-radius: 8px;
    text-align: center;
    min-width: 120px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Report Controls Panel --- */
.report-controls-panel {
    background: white;
    margin: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
    overflow: hidden;
}

.controls-header {
    padding: 20px 24px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

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

.controls-form {
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-separator {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.generate-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

/* --- Quick Reports Section --- */
.quick-reports-section {
    margin: 0 30px 20px 30px;
}

.quick-reports-section h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.quick-reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.quick-report-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e1e5e9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.quick-report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: var(--color-primary);
}

.quick-report-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.quick-report-card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.card-description {
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
    margin-bottom: 16px;
}

.card-action {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-action:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

/* --- Report Display Area --- */
.report-content-area {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 30px;
}

.report-display-area {
    margin: 0 30px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e1e5e9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    text-align: center;
    padding: 60px 40px;
    max-width: 400px;
}

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

.empty-state h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    color: #495057;
}

.empty-state p {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 20px 24px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.modal-body {
    padding: 24px;
    max-height: calc(80vh - 140px);
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
}

.wizard-step h4 {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.wizard-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.wizard-option {
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.wizard-option:hover {
    border-color: var(--color-primary);
    background: rgba(13, 110, 253, 0.05);
}

.wizard-option.selected {
    border-color: var(--color-primary);
    background: rgba(13, 110, 253, 0.1);
}

.option-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.option-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.option-description {
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
}

/* --- Additional Report Content Styles --- */

/* Loading state */
.loading-state {
    text-align: center;
    padding: 60px 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

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

.loading-state h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #495057;
}

.loading-state p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
}

/* Generated report styles */
.generated-report {
    padding: 30px;
    width: 100%;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.report-title h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
}

.report-title p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
}

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

/* Report content */
.report-content {
    width: 100%;
}

.report-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
}

.card-trend {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
}

.card-trend.positive {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.card-trend.negative {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.card-trend.neutral {
    background: rgba(23, 162, 184, 0.1);
    color: #17a2b8;
}

/* Financial table */
.financial-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.financial-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.financial-table thead {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
}

.financial-table th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.financial-table td {
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

.financial-table tbody tr:hover {
    background: #f8f9fa;
}

.financial-table td.positive {
    color: #28a745;
    font-weight: 600;
}

.financial-table td.negative {
    color: #dc3545;
    font-weight: 600;
}

.report-section-block {
    margin-top: 16px;
}

.report-section-title {
    margin: 0 0 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
}

.report-section-table + .report-section-table {
    margin-top: 16px;
}

.report-json {
    margin: 0;
    padding: 16px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    font-size: 12px;
    line-height: 1.45;
    color: #334e68;
    white-space: pre-wrap;
    overflow: auto;
}

/* Chart placeholder */
.report-chart-placeholder {
    background: white;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    margin-top: 20px;
}

.report-chart-placeholder h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #495057;
}

.chart-mock {
    font-size: 16px;
    color: #6c757d;
    font-style: italic;
}

/* Report details */
.report-details {
    padding: 30px;
    width: 100%;
}

.report-details .report-header {
    margin-bottom: 30px;
    text-align: center;
}

.report-details .report-header h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.report-details .report-header p {
    margin: 0;
    font-size: 16px;
    color: #6c757d;
    line-height: 1.5;
}

.preview-placeholder {
    text-align: center;
    padding: 40px;
}

.preview-placeholder h4 {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    color: #495057;
}

.preview-placeholder p {
    margin: 0 0 30px 0;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
}

.preview-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 300px;
    margin: 0 auto;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(13, 110, 253, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(13, 110, 253, 0.1);
}

.feature-item i {
    color: var(--color-primary);
    font-size: 14px;
    width: 16px;
}

.feature-item span {
    font-size: 14px;
    color: #495057;
}

/* Sample report content */
.sample-report-content {
    padding: 40px;
    text-align: center;
}

.sample-report-content h4 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 600;
    color: #495057;
}

.sample-report-content p {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
}

.data-placeholder {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 30px;
    font-size: 16px;
    color: #6c757d;
    font-style: italic;
}

/* Enhanced responsive design for report content */
@media (max-width: 768px) {
    .generated-report {
        padding: 20px;
    }
    
    .report-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .report-summary-cards {
        grid-template-columns: 1fr;
    }
    
    .financial-table {
        font-size: 12px;
    }
    
    .financial-table th,
    .financial-table td {
        padding: 8px 12px;
    }
    
    .report-details {
        padding: 20px;
    }
    
    .preview-features {
        max-width: none;
    }
}

/* Print styles */
@media print {
    .reports-sidebar,
    .report-controls-panel,
    .quick-reports-section,
    .reports-header,
    .report-actions {
        display: none !important;
    }
    
    .reports-dashboard-layout {
        grid-template-columns: 1fr;
    }
    
    .generated-report {
        padding: 0;
    }
    
    .report-content {
        page-break-inside: avoid;
    }
}

/* Accessibility improvements */
.btn:focus,
.form-control:focus,
.report-item:focus,
.quick-report-card:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.report-item:focus,
.favorite-report-item:focus,
.recent-report-item:focus {
    background: rgba(13, 110, 253, 0.1);
    border-radius: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .summary-card {
        border: 2px solid #000;
    }
    
    .financial-table {
        border: 2px solid #000;
    }
    
    .quick-report-card {
        border: 2px solid #000;
    }
}

/* =========================================================
   REPORTS TAB UI REFRESH (SCOPED OVERRIDES)
   Keeps existing HTML/JS IDs intact while improving scaling.
   ========================================================= */
#reports-tab {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 10px;
    box-sizing: border-box;
    background:
        radial-gradient(circle at 8% 6%, rgba(62, 119, 199, 0.10), transparent 42%),
        radial-gradient(circle at 92% 10%, rgba(29, 78, 216, 0.08), transparent 36%),
        #f3f6fb;
}

#reports-tab .reports-dashboard-layout {
    grid-template-columns: clamp(260px, 22vw, 320px) minmax(0, 1fr);
    gap: 12px;
    background: transparent;
    min-height: 0;
}

#reports-tab .reports-sidebar,
#reports-tab .reports-main {
    min-width: 0;
    min-height: 0;
    border: 1px solid #d7e1ef;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(23, 42, 79, 0.08);
    background: #ffffff;
}

#reports-tab .reports-sidebar {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

#reports-tab .sidebar-section {
    border-bottom: 1px solid #edf2f8;
}

#reports-tab .sidebar-section:last-child {
    border-bottom: none;
}

#reports-tab .sidebar-title {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 12px 14px;
    background: linear-gradient(180deg, #f8fbff 0%, #f2f6fb 100%);
    border-bottom: 1px solid #e3ebf5;
    color: #486581;
    font-size: 10px;
    letter-spacing: 0.7px;
}

#reports-tab .report-category {
    border-bottom: 1px solid #eef3f8;
}

#reports-tab .category-header {
    padding: 10px 14px;
    gap: 8px;
    background: #fff;
}

#reports-tab .category-header:hover {
    background: #f7fbff;
}

#reports-tab .category-name {
    font-size: 13px;
    font-weight: 600;
    color: #243b53;
}

#reports-tab .category-toggle {
    color: #829ab1;
}

#reports-tab .category-reports {
    background: #f8fbff;
    border-top: 1px solid #edf2f8;
}

#reports-tab .report-item {
    padding: 8px 10px 8px 34px;
    align-items: flex-start;
    gap: 8px;
    border-bottom: 1px solid #edf2f8;
}

#reports-tab .report-item:hover {
    background: #eef6ff;
}

#reports-tab .report-name {
    min-width: 0;
    font-size: 12px;
    line-height: 1.25;
    color: #334e68;
}

#reports-tab .favorite-btn {
    margin-left: auto;
    color: #c5d2e0;
}

#reports-tab .favorite-btn.active {
    color: #f59e0b;
}

#reports-tab .favorite-report-item,
#reports-tab .recent-report-item {
    padding: 8px 12px;
    border-bottom: 1px solid #eef3f8;
}

#reports-tab .favorite-report-item:hover,
#reports-tab .recent-report-item:hover {
    background: #f7fbff;
}

#reports-tab .favorite-report-name,
#reports-tab .recent-report-name {
    color: #243b53;
    font-size: 12px;
}

#reports-tab .recent-report-date {
    color: #829ab1;
    font-size: 10px;
}

#reports-tab .reports-main {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
}

#reports-tab .reports-header,
#reports-tab .report-controls-panel {
    margin: 0;
}

#reports-tab .reports-header {
    border: 1px solid #d6e2f1;
    border-radius: 12px;
    background: linear-gradient(135deg, #1f3f78 0%, #2f5ea8 55%, #3d74c4 100%);
    box-shadow: 0 6px 20px rgba(31, 63, 120, 0.16);
    padding: 16px 18px;
    align-items: center;
    min-width: 0;
}

#reports-tab .reports-title-section {
    min-width: 0;
}

#reports-tab .reports-title-section h2 {
    margin-bottom: 4px;
    font-size: clamp(18px, 1.6vw, 22px);
    line-height: 1.15;
}

#reports-tab .reports-title-section p {
    font-size: 12px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.88);
    max-width: 72ch;
}

#reports-tab .reports-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(110px, 1fr));
    gap: 10px;
    min-width: min(100%, 420px);
    width: 100%;
}

#reports-tab .stat-card {
    min-width: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#reports-tab .stat-value {
    font-size: 20px;
    line-height: 1.1;
    margin-bottom: 2px;
}

#reports-tab .stat-label {
    font-size: 10px;
    line-height: 1.2;
}

#reports-tab .report-controls-panel {
    border-radius: 12px;
    border: 1px solid #dde7f3;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
    background: #ffffff;
}

#reports-tab .controls-header {
    padding: 12px 14px;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fd 100%);
    border-bottom: 1px solid #e6eef7;
    gap: 10px;
}

#reports-tab .controls-header h3 {
    font-size: 15px;
    color: #1f334d;
}

#reports-tab .controls-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

#reports-tab .controls-form {
    padding: 14px;
    display: grid;
    gap: 12px;
}

#reports-tab .form-row {
    margin: 0;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

#reports-tab .form-group {
    min-width: 0;
}

#reports-tab .form-group.custom-date-inputs {
    grid-column: 1 / -1;
}

#reports-tab .form-group label {
    font-size: 11px;
    margin-bottom: 5px;
    color: #486581;
    letter-spacing: 0.5px;
}

#reports-tab .form-control {
    min-width: 0;
    height: 38px;
    padding: 8px 10px;
    border-radius: 8px;
    border-color: #cfd9e6;
    background: #fff;
}

#reports-tab .form-control:focus {
    border-color: #3d74c4;
    box-shadow: 0 0 0 3px rgba(61, 116, 196, 0.12);
}

#reports-tab .date-inputs {
    gap: 8px;
    min-width: 0;
}

#reports-tab .date-inputs .form-control {
    min-width: 0;
}

#reports-tab .generate-controls {
    margin-top: 0;
    justify-content: flex-end;
    align-items: stretch;
    flex-wrap: wrap;
    width: 100%;
}

#reports-tab .generate-controls .btn {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 12px;
}

#reports-tab .report-content-area {
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
    display: grid;
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    gap: 12px;
}

#reports-tab .quick-reports-section {
    margin: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #dde7f3;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
    padding: 12px;
}

#reports-tab .quick-reports-section h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #1f334d;
    line-height: 1.2;
}

#reports-tab .quick-reports-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    overflow: auto;
    padding-right: 2px;
    align-content: start;
}

#reports-tab .quick-report-card {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #dbe6f3;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

#reports-tab .quick-report-card:hover {
    transform: translateY(-1px);
    border-color: #6ea2ea;
    box-shadow: 0 6px 14px rgba(61, 116, 196, 0.12);
}

#reports-tab .quick-report-card::before {
    height: 3px;
}

#reports-tab .quick-report-card .card-icon {
    font-size: 22px;
    margin-bottom: 8px;
}

#reports-tab .quick-report-card .card-title {
    font-size: 13px;
    margin-bottom: 4px;
    color: #243b53;
}

#reports-tab .quick-report-card .card-description {
    font-size: 11px;
    margin-bottom: 10px;
    line-height: 1.35;
    color: #627d98;
}

#reports-tab .quick-report-card .card-action {
    width: 100%;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 11px;
}

#reports-tab .report-display-area {
    margin: 0;
    min-height: 0;
    height: 100%;
    display: block;
    overflow: auto;
    border-radius: 12px;
    border: 1px solid #dde7f3;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
    background: #fff;
}

#reports-tab .report-display-area > * {
    width: 100%;
    min-width: 0;
}

#reports-tab .empty-state,
#reports-tab .loading-state,
#reports-tab .report-details,
#reports-tab .generated-report {
    width: 100%;
    box-sizing: border-box;
}

#reports-tab .empty-state {
    max-width: none;
    padding: 40px 24px;
}

#reports-tab .empty-state h3 {
    font-size: 18px;
    color: #243b53;
}

#reports-tab .empty-state p {
    font-size: 13px;
    color: #627d98;
}

#reports-tab .report-details {
    padding: 18px;
}

#reports-tab .report-details .report-header {
    text-align: left;
    margin-bottom: 18px;
}

#reports-tab .report-details .report-header h3 {
    font-size: 20px;
    color: #1f334d;
}

#reports-tab .report-details .report-header p {
    font-size: 13px;
    color: #627d98;
}

#reports-tab .preview-placeholder {
    padding: 18px;
    border: 1px dashed #d7e1ef;
    border-radius: 10px;
    background: #f9fbff;
}

#reports-tab .preview-placeholder h4 {
    font-size: 16px;
    color: #243b53;
}

#reports-tab .preview-placeholder p {
    font-size: 12px;
    margin-bottom: 16px;
}

#reports-tab .preview-features {
    max-width: none;
    gap: 8px;
}

#reports-tab .feature-item {
    padding: 8px 10px;
    border-radius: 8px;
}

#reports-tab .feature-item span {
    font-size: 12px;
}

#reports-tab .generated-report {
    padding: 16px;
}

#reports-tab .generated-report .report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

#reports-tab .generated-report .report-title h3 {
    margin: 0 0 4px;
    font-size: 18px;
    color: #1f334d;
}

#reports-tab .generated-report .report-title p {
    margin: 0;
    font-size: 12px;
    color: #627d98;
}

#reports-tab .generated-report .report-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#reports-tab .generated-report .report-actions .btn {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
}

#reports-tab .generated-report .report-content {
    min-width: 0;
}

#reports-tab .report-summary-cards {
    gap: 12px;
    margin-bottom: 16px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

#reports-tab .summary-card {
    padding: 14px;
    border-radius: 10px;
    border: 1px solid #dde7f3;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

#reports-tab .summary-card::before {
    height: 3px;
}

#reports-tab .summary-card .card-title {
    font-size: 10px;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    color: #627d98;
}

#reports-tab .summary-card .card-value {
    font-size: 20px;
    line-height: 1.1;
    margin-bottom: 6px;
    color: #102a43;
}

#reports-tab .summary-card .card-trend {
    font-size: 10px;
    border-radius: 999px;
    padding: 3px 8px;
}

#reports-tab .financial-summary {
    padding: 14px;
    border-radius: 10px;
    border: 1px solid #e2eaf3;
    background: #fbfdff;
}

#reports-tab .report-section-block {
    margin-top: 12px;
}

#reports-tab .report-section-title {
    font-size: 13px;
    margin-bottom: 8px;
    color: #243b53;
}

#reports-tab .financial-table {
    border-radius: 10px;
    box-shadow: none;
    border: 1px solid #e2eaf3;
    overflow: hidden;
}

#reports-tab .financial-table thead {
    background: linear-gradient(135deg, #2f5ea8 0%, #3d74c4 100%);
}

#reports-tab .financial-table th {
    padding: 10px 12px;
    font-size: 11px;
    letter-spacing: 0.4px;
}

#reports-tab .financial-table td {
    padding: 9px 12px;
    font-size: 12px;
    color: #334e68;
    vertical-align: top;
}

#reports-tab .financial-table tbody tr:hover {
    background: #f7fbff;
}

#reports-tab .report-json {
    font-size: 11px;
    line-height: 1.5;
}

#reports-tab .modal {
    z-index: 2000;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(6px);
}

#reports-tab .modal-content {
    width: min(760px, 94vw);
    max-height: min(82vh, 780px);
    border-radius: 14px;
    border: 1px solid #d7e1ef;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.28);
}

#reports-tab .modal-header,
#reports-tab .modal-footer {
    background: #f7faff;
}

#reports-tab .modal-body {
    padding: 18px;
}

#reports-tab .wizard-step h4 {
    font-size: 15px;
    margin-bottom: 14px;
    color: #1f334d;
}

#reports-tab .wizard-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

#reports-tab .wizard-option {
    border-radius: 10px;
    border-color: #d7e1ef;
    padding: 16px 12px;
}

#reports-tab .wizard-option:hover,
#reports-tab .wizard-option.selected {
    border-color: #6ea2ea;
    background: #f2f8ff;
}

#reports-tab .wizard-option .option-icon {
    font-size: 22px;
    margin-bottom: 8px;
}

#reports-tab .wizard-option .option-title {
    font-size: 14px;
    margin-bottom: 6px;
}

#reports-tab .wizard-option .option-description {
    font-size: 12px;
    line-height: 1.35;
    color: #627d98;
}

@media (max-width: 1450px) {
    #reports-tab .reports-header {
        flex-direction: column;
        align-items: stretch;
    }

    #reports-tab .reports-stats {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        min-width: 0;
    }

    #reports-tab .report-content-area {
        grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    }
}

@media (max-width: 1180px) {
    #reports-tab .report-content-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }

    #reports-tab .quick-reports-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #reports-tab .quick-reports-section {
        max-height: 320px;
    }
}

@media (max-width: 980px) {
    #reports-tab {
        padding: 8px;
    }

    #reports-tab .reports-dashboard-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(220px, auto) minmax(0, 1fr);
    }

    #reports-tab .reports-sidebar {
        max-height: 300px;
    }

    #reports-tab .reports-main {
        padding: 10px;
        gap: 10px;
    }

    #reports-tab .controls-actions {
        width: 100%;
        justify-content: flex-start;
    }

    #reports-tab .generate-controls {
        justify-content: stretch;
    }

    #reports-tab .generate-controls .btn {
        flex: 1 1 180px;
    }
}

@media (max-width: 700px) {
    #reports-tab .reports-header {
        padding: 12px;
    }

    #reports-tab .reports-title-section h2 {
        font-size: 18px;
    }

    #reports-tab .reports-title-section p {
        font-size: 12px;
    }

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

    #reports-tab .controls-header {
        flex-direction: column;
        align-items: flex-start;
    }

    #reports-tab .controls-actions {
        width: 100%;
    }

    #reports-tab .controls-actions .btn {
        flex: 1 1 auto;
    }

    #reports-tab .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #reports-tab .date-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    #reports-tab .date-separator {
        align-self: center;
    }

    #reports-tab .quick-reports-grid {
        grid-template-columns: 1fr;
    }

    #reports-tab .wizard-options {
        grid-template-columns: 1fr;
    }

    #reports-tab .generated-report {
        padding: 12px;
    }

    #reports-tab .generated-report .report-header {
        flex-direction: column;
        align-items: stretch;
    }

    #reports-tab .generated-report .report-actions {
        justify-content: stretch;
    }

    #reports-tab .generated-report .report-actions .btn {
        flex: 1 1 100%;
    }

    #reports-tab .financial-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* =========================================================
   REPORTS TAB SCALE + MODERNIZATION POLISH (SCOPED, SAFE)
   Additive layer: preserves existing IDs/classes and JS hooks.
   ========================================================= */
#reports-tab {
    container-type: inline-size;
    padding: clamp(8px, 1vw, 14px);
}

#reports-tab .reports-dashboard-layout {
    height: 100%;
    max-height: 100%;
    align-items: stretch;
    grid-template-columns: clamp(260px, 22vw, 320px) minmax(0, 1fr);
    gap: clamp(10px, 1vw, 14px);
}

#reports-tab .reports-sidebar,
#reports-tab .reports-main,
#reports-tab .report-controls-panel,
#reports-tab .quick-reports-section,
#reports-tab .report-display-area {
    border-radius: 14px;
}

#reports-tab .reports-sidebar,
#reports-tab .reports-main {
    box-shadow:
        0 10px 24px rgba(15, 23, 42, 0.06),
        0 2px 6px rgba(15, 23, 42, 0.03);
}

#reports-tab .reports-main {
    gap: clamp(10px, 1vw, 14px);
    padding: clamp(10px, 1vw, 14px);
}

#reports-tab .reports-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 42%);
    gap: 14px;
    align-items: start;
    padding: clamp(14px, 1.4vw, 18px);
}

#reports-tab .reports-title-section p {
    max-width: 68ch;
}

#reports-tab .reports-stats {
    align-self: stretch;
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
    gap: 10px;
}

#reports-tab .stat-card {
    min-height: 76px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#reports-tab .report-controls-panel {
    overflow: hidden;
}

#reports-tab .controls-form {
    gap: 14px;
}

#reports-tab .form-row:last-child .form-group:last-child {
    display: flex;
    align-items: flex-end;
}

#reports-tab .generate-controls {
    gap: 8px;
}

#reports-tab .generate-controls .btn {
    border-radius: 10px;
}

#reports-tab .report-content-area {
    grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
    gap: clamp(10px, 1vw, 14px);
    align-items: stretch;
}

#reports-tab .quick-reports-section {
    padding: 14px;
    position: relative;
    min-height: 0;
}

#reports-tab .quick-reports-section h3 {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    padding-bottom: 8px;
}

#reports-tab .quick-reports-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
}

#reports-tab .quick-report-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "icon title"
        "icon desc"
        "action action";
    column-gap: 10px;
    row-gap: 4px;
    align-items: start;
    padding: 12px 12px 10px;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

#reports-tab .quick-report-card .card-icon {
    grid-area: icon;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(180deg, #f2f7ff 0%, #e8f1ff 100%);
    color: #2f5ea8;
    margin: 0;
}

#reports-tab .quick-report-card .card-icon i {
    font-size: 16px;
    line-height: 1;
}

#reports-tab .quick-report-card .card-title {
    grid-area: title;
    margin: 0;
}

#reports-tab .quick-report-card .card-description {
    grid-area: desc;
    margin: 0 0 4px;
}

#reports-tab .quick-report-card .card-action {
    grid-area: action;
    justify-self: stretch;
}

#reports-tab .report-display-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    scrollbar-gutter: stable both-edges;
}

#reports-tab .report-display-area > * {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
}

#reports-tab .empty-state,
#reports-tab .loading-state,
#reports-tab .report-details,
#reports-tab .generated-report {
    min-width: 0;
}

#reports-tab .empty-state {
    min-height: 100%;
    display: grid;
    place-content: center;
    gap: 10px;
    text-align: center;
}

#reports-tab .empty-state-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 2px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #eef4ff 0%, #e2edff 100%);
    color: #2f5ea8;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

#reports-tab .empty-state-icon i {
    font-size: 22px;
}

#reports-tab .generated-report .report-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
    padding: 2px 0 10px;
    margin: -2px 0 14px;
    border-bottom: 1px solid #edf2f8;
}

#reports-tab .generated-report .report-content {
    display: grid;
    gap: 14px;
    min-width: 0;
}

#reports-tab .report-summary-cards {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

#reports-tab .summary-card {
    min-height: 106px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#reports-tab .financial-summary,
#reports-tab .report-section-block {
    width: 100%;
    min-width: 0;
}

#reports-tab .financial-table {
    width: 100%;
    table-layout: auto;
}

#reports-tab .financial-table th,
#reports-tab .financial-table td {
    white-space: normal;
    word-break: break-word;
}

#reports-tab .report-json {
    overflow: auto;
    max-width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
}

#reports-tab .wizard-option .option-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #eef4ff;
    color: #2f5ea8;
    margin-inline: auto;
}

#reports-tab .wizard-option .option-icon i {
    font-size: 18px;
    line-height: 1;
}

@media (max-width: 1360px) {
    #reports-tab .reports-header {
        grid-template-columns: 1fr;
    }

    #reports-tab .reports-stats {
        width: 100%;
        min-width: 0;
    }

    #reports-tab .report-content-area {
        grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
    }
}

@media (max-width: 1120px) {
    #reports-tab .report-content-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }

    #reports-tab .quick-reports-section {
        max-height: 330px;
    }

    #reports-tab .quick-reports-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 820px) {
    #reports-tab .reports-dashboard-layout {
        grid-template-columns: 1fr;
    }

    #reports-tab .reports-sidebar {
        max-height: 300px;
    }

    #reports-tab .controls-form {
        gap: 10px;
    }

    #reports-tab .generate-controls {
        width: 100%;
    }

    #reports-tab .generate-controls .btn {
        flex: 1 1 100%;
    }

    #reports-tab .report-summary-cards {
        grid-template-columns: 1fr;
    }
}
