.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    background-color: #1a53f0;
    min-height: 100vh;
    width: 240px;
    flex: 0 0 240px;
    color: white;
    padding-top: 20px;
    transition: width 0.2s ease, flex-basis 0.2s ease;
}

.sidebar-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 14px 16px;
}

.sidebar-logo {
    display: block;
    width: 138px;
    height: 40px;
    object-fit: contain;
}

.sidebar-toggle {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    background: transparent;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar a {
    color: white;
    text-decoration: none;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.sidebar a i {
    width: 20px;
    text-align: center;
}

.sidebar a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

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

.sidebar-group-header {
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-submenu {
    display: flex;
    flex-direction: column;
    background-color: rgba(0, 0, 0, 0.2);
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-submenu-item {
    padding-left: 45px !important;
    font-size: 0.9rem;
    opacity: 0.9;
}

.sidebar-submenu-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.sidebar-submenu-item.active {
    background-color: rgba(255, 255, 255, 0.25);
}

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

body.sidebar-collapsed .sidebar {
    width: 64px;
    flex-basis: 64px;
}

body.sidebar-collapsed .sidebar-logo,
body.sidebar-collapsed .sidebar a span {
    display: none;
}

body.sidebar-collapsed .sidebar-title {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}

body.sidebar-collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar a {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}

.main-content {
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background-color: white;
    border-bottom: 1px solid #eee;
}

.table th {
    background-color: #f8f9fa;
    font-size: 0.9rem;
}

.table tr.deposit-row:hover {
    cursor: pointer;
    background-color: #f8f9fa;
}

.table tr.deposit-row.selected {
    background-color: #e3f2fd !important;
}

.table-wrapper {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    overflow-x: auto;
}

.reconciliation-table {
    max-height: calc(100vh - 230px);
}

.reconciliation-workbench {
    min-height: 360px;
}

.statement-selector-bar {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.statement-select {
    min-width: min(620px, 70vw);
}

.reconciliation-subtabs {
    display: inline-flex;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.reconciliation-subtab {
    border: 0;
    border-right: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    padding: 7px 12px;
    font-size: 0.9rem;
}

.reconciliation-subtab:last-child {
    border-right: 0;
}

.reconciliation-subtab.active {
    background: #1a53f0;
    color: #fff;
}

.reconciliation-toolbar {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.reconciliation-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.reconciliation-pane {
    min-width: 0;
}

.reconciliation-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.reconciliation-table-wrapper {
    max-height: calc(100vh - 350px);
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.reconciliation-data-table {
    min-width: 920px;
    font-size: 0.82rem;
}

.reconciliation-data-table thead th {
    background: #eef1f4;
    border-bottom: 1px solid #cfd6de;
    color: #495057;
    font-weight: 700;
    white-space: nowrap;
}

.reconciliation-data-table td,
.reconciliation-data-table th {
    border-color: #e6e9ed;
    vertical-align: middle;
}

.reconciliation-row {
    cursor: pointer;
}

.reconciliation-row:hover {
    background: #f8faff;
}

.reconciliation-row.selected {
    background: #eef3ff;
    outline: 2px solid #8aa8ff;
    outline-offset: -2px;
}

.selection-cell {
    width: 34px;
    min-width: 34px;
    text-align: center;
}

.movement-check {
    width: 22px;
    height: 22px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1a53f0;
    font-size: 0.75rem;
    flex: 0 0 auto;
}

.text-truncate-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-table-cell {
    padding: 20px !important;
    color: #6c757d;
    text-align: center;
    background: #f8f9fa;
}

.statement-chronology {
    margin-top: 12px;
}

.chronology-table-wrapper {
    max-height: 280px;
}

.chronology-data-table {
    min-width: 1180px;
}

.contacts-table {
    max-height: calc(100vh - 285px);
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

#depositSidebar {
    position: fixed;
    top: 0;
    right: -380px;
    width: 380px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 12px;
    font-size: 0.85rem;
}

#depositSidebar.open {
    right: 0;
}

.sidebar-section-title {
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 3px;
    margin: 8px 0 6px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.file-preview {
    width: 100%;
    min-height: 140px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    margin-bottom: 4px;
    padding: 8px;
    background: #f8f9fa;
    flex-direction: column;
    align-items: stretch !important;
    justify-content: flex-start !important;
}

.deposit-preview-image {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 3px;
}

.deposit-preview-pdf {
    width: 100%;
    height: 280px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 3px;
}

.file-preview-meta {
    width: 100%;
    margin-top: 4px;
    font-size: 0.75rem;
}

.file-preview-meta .fw-semibold {
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.file-preview-meta a {
    font-size: 0.7rem;
}

.upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.upload-preview-card {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px;
    min-width: 0;
    background: #fff;
}

.upload-preview-thumb,
.upload-preview-icon {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 4px;
    background: #f8f9fa;
}

.upload-preview-thumb {
    display: block;
    object-fit: cover;
}

.upload-preview-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc3545;
    font-size: 1.8rem;
}

.upload-preview-name {
    margin-top: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.field-row {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    gap: 4px;
}

.field-label {
    width: 85px;
    font-size: 0.75rem;
    color: #6c757d;
    flex-shrink: 0;
}

.field-value {
    flex: 1;
}

.field-value input,
.field-value textarea,
.field-value select {
    width: 100%;
    font-size: 0.8rem;
    padding: 3px 6px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    line-height: 1.3;
}

.field-value textarea {
    resize: vertical;
    min-height: 40px;
}

.status-selects-hidden {
    display: none;
}

.status-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.status-overview-card {
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    padding: 10px;
}

.status-overview-card-wide {
    grid-column: 1 / -1;
}

.status-overview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.status-overview-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #52606d;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.status-overview-copy {
    font-size: 0.76rem;
    line-height: 1.4;
    color: #52606d;
}

.general-status-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.general-status-detail {
    font-size: 0.73rem;
    color: #6b7280;
    line-height: 1.3;
}

.status-chip-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.status-chip {
    border: 1px solid #d0dae7;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    padding: 8px 12px;
    transition: all 0.15s ease;
}

.status-chip:hover:not(:disabled) {
    border-color: #1a53f0;
    color: #1a53f0;
    background: #f3f7ff;
}

.status-chip:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status-chip.is-active {
    border-color: #1a53f0;
    background: #1a53f0;
    color: #fff;
    box-shadow: 0 8px 16px rgba(26, 83, 240, 0.16);
}

.ai-label {
    font-size: 0.65rem;
    color: #adb5bd;
    margin-left: 3px;
    display: block;
    margin-top: 1px;
}

/* Estilos compactos para botones en sidebar */
#depositSidebar .btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
    height: auto;
    line-height: 1.3;
}

#depositSidebar .btn {
    font-size: 0.8rem;
}

.badge-PENDING {
    background-color: #6c757d;
}

.badge-VALIDATED_PENDING {
    background-color: #0d6efd;
}

.badge-ASSIGNED {
    background-color: #6610f2;
}

.badge-APPROVED {
    background-color: #198754;
}

.badge-OK {
    background-color: #198754;
}

.badge-TO_CHANGE {
    background-color: #d63384;
}

.badge-EDITED {
    background-color: #0d6efd;
}

.badge-IMPUTED {
    background-color: #0f5132;
}

.badge-CANCELLED {
    background-color: #dc3545;
}

.badge-DUPLICATED {
    background-color: #fd7e14;
}

.badge-NEEDS_REVIEW {
    background-color: #d63384;
}

.badge-NO_REFERENCE {
    background-color: #e83e8c;
}

.status-action-cell {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.deposit-line-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.deposit-line-actions .btn {
    align-items: center;
    display: inline-flex;
    height: 28px;
    justify-content: center;
    padding: 0;
    width: 28px;
}

.btn-impute-payment {
    white-space: nowrap;
}

.badge-ENVIADO_CALIPSO {
    background-color: #0f5132;
}

.badge-RECIBO_GENERADO {
    background-color: #212529;
}

.badge-RECONCILED,
.badge-MATCHED {
    background-color: #0f5132;
}

.badge-OPEN {
    background-color: #6c757d;
}

.badge-NEEDS_REVIEW {
    background-color: #d63384;
}

.badge-IGNORED {
    background-color: #495057;
}

.badge-DEPOSITO {
    background-color: #0d6efd;
}

.badge-TRANSFERENCIA {
    background-color: #198754;
}

.badge-ECHEQ {
    background-color: #6610f2;
}

.badge-CONVENIO {
    background-color: #fd7e14;
}

.badge-ownership-CONVENIO {
    background-color: #fd7e14;
}

.badge-ownership-PROPIO {
    background-color: #6c757d;
}

.upload-drop-zone {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upload-drop-zone:hover,
.upload-drop-zone.dragover {
    border-color: #1a53f0;
    background: #f0f4ff;
}

.progress-list {
    list-style: none;
    padding: 0;
    margin-top: 12px;
}

.progress-list li {
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    height: 16px;
}

.view-tabs {
    display: inline-flex;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.view-tab {
    border: 0;
    background: #fff;
    color: #495057;
    padding: 7px 12px;
    font-size: 0.9rem;
}

.view-tab.active {
    background: #1a53f0;
    color: #fff;
}

.panel-block {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    background: #fff;
}

@media (max-width: 768px) {
    .status-overview-grid {
        grid-template-columns: 1fr;
    }

    .status-overview-card-wide {
        grid-column: auto;
    }
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

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

.overlay.show {
    display: block;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a53f0 0%, #1540c4 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    padding: 20px;
}

.login-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    width: 100%;
    max-width: 1200px;
    align-items: center;
}

.login-left {
    display: flex;
    flex-direction: column;
    gap: 0;
    color: white;
    align-items: center;
    justify-content: center;
}

.login-branding {
    text-align: center;
}

.logo-container {
    margin-bottom: 24px;
}

.logo-image {
    width: 240px;
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

.app-subtitle {
    font-size: 18px;
    margin: 0;
    opacity: 0.9;
    font-weight: 300;
    color: white;
}

.login-right {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 48px;
    width: 100%;
    max-width: 420px;
}

.login-card-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-card-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 8px;
}

.login-card-header p {
    font-size: 14px;
    color: #6c757d;
    margin: 0;
}

.form-group {
    margin-bottom: 24px;
}

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

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 14px;
    color: #adb5bd;
    font-size: 16px;
    pointer-events: none;
    transition: color 0.3s ease;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px 12px 44px;
    font-size: 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1a53f0;
    box-shadow: 0 0 0 3px rgba(26, 83, 240, 0.1);
}

.form-group input:focus ~ i,
.form-group select:focus ~ i {
    color: #1a53f0;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #1a53f0 0%, #1540c4 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(26, 83, 240, 0.35);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
    color: #adb5bd;
    font-size: 13px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 16px);
    height: 1px;
    background-color: #e0e0e0;
}

.login-divider::before {
    left: 0;
}

.login-divider::after {
    right: 0;
}

.login-footer {
    text-align: center;
    font-size: 14px;
    color: #6c757d;
}

.link-primary {
    color: #1a53f0;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.link-primary:hover {
    color: #1540c4;
    text-decoration: underline;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@media (max-width: 768px) {
    .login-wrapper {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .login-left {
        gap: 0;
    }

    .login-branding {
        margin-bottom: 30px;
        text-align: center;
    }

    .login-card {
        padding: 32px;
        max-width: 100%;
    }

    .logo-image {
        width: 180px;
        height: auto;
    }
}

@media (max-width: 992px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        min-height: auto;
        width: 100%;
        flex-basis: auto;
    }

    #depositSidebar {
        width: 100%;
        right: -100%;
        padding: 12px;
        font-size: 0.85rem;
    }

    .reconciliation-toolbar,
    .reconciliation-grid {
        grid-template-columns: 1fr;
    }

    .reconciliation-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .statement-selector-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .statement-select {
        min-width: 100%;
    }

    .reconciliation-table-wrapper {
        max-height: none;
    }
}

/* Reduce padding between all columns */
.table tbody td,
.table thead th {
    padding-left: 0.08rem !important;
    padding-right: 0.08rem !important;
}

/* Give more space to Actions column */
.table tbody td:last-child,
.table thead th:last-child {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

/* Compact buttons in actions column */
.btn-xs {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.85rem !important;
}
