/* ====== Relatório por Categoria ====== */
.table-responsive-custom {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 6px;
}

.table-responsive-custom table {
    width: 100%;
    table-layout: fixed;
}

.table-responsive-custom th,
.table-responsive-custom td {
    padding: 4px 6px !important;
    font-size: 0.86rem;
    vertical-align: top;
}

.table-responsive-custom thead th {
    white-space: nowrap;
}

.table-responsive-custom td:not(.sticky-col) {
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
}

.table-responsive-custom th.sticky-col,
.table-responsive-custom td.sticky-col {
    width: 20%;
    min-width: 20%;
    max-width: 20%;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    line-height: 1.25;
}

.table-responsive-custom td.sticky-col {
    background: #fff;
    position: sticky;
    left: 0;
    z-index: 1;
}

.table-responsive-custom thead th.sticky-col {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #343a40;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
}

.table-responsive-custom tfoot td.sticky-col {
    background: #343a40;
    color: #fff;
}

.category-row:hover {
    background-color: #f8f9fa !important;
}

.category-row .sticky-col {
    background-color: inherit;
}

.report-cell-link {
    padding: 0 !important;
    border: 0;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
    text-decoration: underline;
    vertical-align: top;
}

.report-cell-link:hover,
.report-cell-link:focus {
    color: var(--primary-color);
    text-decoration: underline;
}

.report-modal-feedback {
    min-height: 1.5rem;
}

.report-modal-table th,
.report-modal-table td {
    padding: 0.5rem 0.75rem !important;
    white-space: normal !important;
}

.report-modal-table tfoot th,
.report-modal-table tfoot td {
    background: #f8f9fa;
    font-weight: 700;
}

.report-modal-edit-link {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
}

@media (max-width: 1200px) {
    .table-responsive-custom th,
    .table-responsive-custom td {
        font-size: 0.78rem;
        padding: 3px 4px !important;
    }
}

@media print {
    .table-responsive-custom {
        overflow: visible;
    }

    .table-responsive-custom td.sticky-col,
    .table-responsive-custom thead th.sticky-col {
        position: static;
    }
}

/* ====================================================================
   Sistema Financeiro CECB - CSS Principal
   ==================================================================== */

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #7c3aed;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    --bg-color: #f0e8f8;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --text-color: #1e293b;
    --text-muted: #64748b;
    
    --header-height: 60px;
    --sidebar-width: 250px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Layout */
.layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 2rem;
    max-width: 1920px;
    margin: 0 auto;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-color);
}

.user-name small {
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #4a1a6b;
    border-right: 1px solid var(--border-color);
    height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-nav li.nav-section {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.sidebar .nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-link .icon {
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1920px;
}

/* Cards */
.card {
    background: #bf94ff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-cards .card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-icon {
    font-size: 2.5rem;
}

.card-content h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.card-primary { border-left: 4px solid var(--primary-color); }
.card-success { border-left: 4px solid var(--success-color); }
.card-warning { border-left: 4px solid var(--warning-color); }
.card-info { border-left: 4px solid var(--info-color); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-logout {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

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

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--surface-color);
    transition: border-color 0.2s;
}

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

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-error {
    background-color: #fee2e2;
    border-color: var(--danger-color);
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: var(--warning-color);
    color: #92400e;
}

.alert-info {
    background-color: #cffafe;
    border-color: var(--info-color);
    color: #164e63;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow:var(--shadow-sm);
}

.table thead {
    background-color: var(--bg-color);
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background-color: var(--bg-color);
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Auth Pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}

.auth-box {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.auth-header h2 {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.auth-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-form {
    margin-top: 1.5rem;
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
}

.auth-links a:hover {
    text-decoration: underline;
}

.auth-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.auth-footer small {
    color: var(--text-muted);
}

/* Dashboard */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.dashboard-header p {
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* Utilities */
.line-height-1 { line-height: 1 !important; }
.font-weight-800 { font-weight: 800 !important; }

/* ====================================================================
   Sistema Financeiro CECB - Classes Utilitárias e Gerais
   ==================================================================== */

/* SB Admin 2 Border Utilities */
.border-left-primary   { border-left: .3rem solid #4e73df !important; }
.border-left-success   { border-left: .3rem solid #1cc88a !important; }
.border-left-danger    { border-left: .3rem solid #e74a3b !important; }
.border-left-secondary { border-left: .3rem solid #858796 !important; }
.bg-gradient-primary   { background-color: #4e73df; background-image: linear-gradient(180deg,#4e73df 10%,#224abe 100%); }
.text-xs { font-size: 0.75rem; }

/* Responsive Buttons */
.btn-block-sm { width: 100% !important; transition: all 0.2s; }
@media (min-width: 992px) { .btn-block-sm { width: auto !important; } }

/* Intelligent Transaction Highlighting */
tr.adjusted-discount { background-color: rgba(40, 167, 69, 0.1) !important; }  /* Soft Green: Advantage */
tr.adjusted-surcharge { background-color: rgba(220, 53, 69, 0.1) !important; } /* Soft Red: Loss/Surcharge */

/* Financial Legend Classes */
.legend-item {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.legend-advantage {
    background-color: rgba(40, 167, 69, 0.1);
    border-color: rgba(40, 167, 69, 0.2) !important;
}

.legend-loss {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.2) !important;
}

/* General Layout Adjustments (moved from inline layout) */
.layout-body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f6f9; }
.app-container { display: flex; min-height: 100vh; }
.main-content { flex: 1; padding: 20px; overflow-x: hidden; }
.content-wrapper { background: #dcc5ff; padding: 20px; border-radius: 8px; box-shadow: 0 0 10px rgba(0,0,0,0.05); }
.card-shadow-sm { box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: none; margin-bottom: 20px; }
.page-header-standard { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 10px; }

/* Select2 Custom Styling to Match Bootstrap 4 */
.select2-container .select2-selection--single {
    height: calc(1.5em + 0.75rem + 2px) !important;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: normal;
    padding-left: 0;
    color: #495057;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    top: 0;
    right: 0.75rem;
}

/* ====================================================================
   Estilos de Impressão Consolidados
   ==================================================================== */
@media print {
    /* Hide navigational elements */
    .sidebar, .header, .footer, .header-actions, .d-print-none, .no-print, .btn, button, .alert, .filter-form, .select2, select, input[type="date"], form:not(.print-form) {
        display: none !important;
    }

    .d-print-block { display: block !important; }

    body {
        background: white !important;
        font-size: 11pt;
        color: black !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .app-container { display: block !important; }
    .main-content { padding: 0 !important; margin: 0 !important; width: 100% !important; }
    .content-wrapper { box-shadow: none !important; padding: 0 !important; border-radius: 0 !important; }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        margin-bottom: 10px !important;
        page-break-inside: avoid;
    }
    
    .table { font-size: 9pt; }
    .table th, .table td { padding: 4px 6px !important; }
    .badge { border: 1px solid #999 !important; }
    .table-responsive { overflow: visible !important; }
    tr { page-break-inside: avoid; }
}
