* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding: 30px;
    background: linear-gradient(135deg, #1a365d 0%, #2d4a7c 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.subtitle {
    opacity: 0.9;
    font-size: 1.1rem;
}

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.shortcut-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-outline {
    background: white;
    color: #1a365d;
    border: 2px solid #1a365d;
}

.btn-outline:hover {
    background: #1a365d;
    color: white;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.btn-large {
    padding: 16px 40px;
    font-size: 1.1rem;
}

.btn-icon {
    padding: 6px 10px;
    font-size: 1rem;
}

.btn-danger-outline {
    background: white;
    color: #ef4444;
    border: 1px solid #ef4444;
}

.btn-danger-outline:hover {
    background: #fef2f2;
}

.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow-x: auto;
    margin-bottom: 20px;
    min-height: 350px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1450px;
    font-size: 12px;
}

thead {
    background: #1a365d;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

thead th {
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 10px;
    white-space: nowrap;
}

/* Ancho de columnas del generador */
#dataTable th:nth-child(1) { width: 45px; min-width: 45px; } /* # */
#dataTable th:nth-child(2) { min-width: 145px; } /* Fecha */
#dataTable th:nth-child(3) { min-width: 260px; } /* Cuenta a Debitar */
#dataTable th:nth-child(4) { min-width: 300px; } /* Cuenta Beneficiario / Destinatario */
#dataTable th:nth-child(5) { min-width: 120px; } /* Monto */
#dataTable th:nth-child(6) { min-width: 220px; } /* Descripción */
#dataTable th:nth-child(7) { min-width: 140px; } /* ID Beneficiario */
#dataTable th:nth-child(8) { min-width: 240px; } /* Nombre */
#dataTable th:nth-child(9) { min-width: 220px; } /* Email */
#dataTable th:nth-child(10) { min-width: 130px; } /* Ref. Cliente */

thead th small {
    display: block;
    opacity: 0.8;
    font-weight: 400;
    font-size: 9px;
    margin-top: 2px;
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:nth-child(even) {
    background: #f8fafc;
}

tbody tr:hover {
    background: #e2e8f0;
}

tbody td {
    padding: 6px 6px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 10px;
}

table code {
    font-size: 10px;
}

.row-number {
    text-align: center;
    font-weight: 600;
    color: #6b7280;
    width: 40px;
    font-size: 10px;
}

input[type="text"],
input[type="number"],
input[type="date"] {
    width: 100%;
    padding: 6px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 10px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: white;
    font-family: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input.valid {
    border-color: #fbbf24;
    background: #fffbeb;
}

input.invalid {
    border-color: #f97316;
    background: #fff7ed;
    font-weight: 600;
}

select.cell-select {
    width: 100%;
    padding: 6px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 10px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
    color: #333;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

select.cell-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

select.cell-select option {
    padding: 6px;
    font-size: 10px;
}

select.cell-select.placeholder {
    color: #9ca3af;
}

/* === AUTOCOMPLETE === */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-wrapper .cell-dest-search {
    width: 100%;
}

.autocomplete-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 320px;
    width: 100%;
    background: white;
    border: 2px solid #3b82f6;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}

.autocomplete-list.drop-up {
    top: auto;
    bottom: 100%;
    border-top: 2px solid #3b82f6;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 -6px 16px rgba(0,0,0,0.18);
}

.autocomplete-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
}

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

.autocomplete-item:hover {
    background: #eff6ff;
}

.autocomplete-item .ac-name {
    display: block;
    font-weight: 600;
    color: #1a365d;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-item .ac-detail {
    display: block;
    font-size: 9px;
    color: #6b7280;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-message {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    display: none;
}

.status-message.success {
    display: block;
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.status-message.error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-message.info {
    display: block;
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.results-panel {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.results-panel h3 {
    margin-bottom: 16px;
    color: #1a365d;
    font-size: 1.3rem;
}

#resultsContent {
    padding: 16px;
    background: #f0fdf4;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #86efac;
    font-size: 1.1rem;
    text-align: center;
}

/* === MODALS === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

.modal-wide {
    max-width: 850px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal h2 {
    padding: 24px;
    background: #1a365d;
    color: white;
    border-radius: 16px 16px 0 0;
    font-size: 1.3rem;
}

.modal-body {
    padding: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.form-group input[type="text"] {
    font-size: 1rem;
    padding: 12px 14px;
    letter-spacing: 1px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.checkbox-group label:hover {
    background: #f3f4f6;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #1a365d;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-row .flex-1 {
    flex: 1;
}

.form-row .flex-2 {
    flex: 2;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid .form-group:last-child {
    grid-column: 1 / -1;
}

.btn-group-inline {
    display: flex;
    align-items: flex-end;
    padding-bottom: 16px;
}

.btn-group-inline .btn {
    width: 100%;
    justify-content: center;
}

.table-scroll {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 16px;
}

.table-scroll table {
    min-width: unset;
}

.table-scroll thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.empty-msg {
    text-align: center;
    color: #9ca3af;
    padding: 24px;
    font-style: italic;
}

.csv-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    justify-content: center;
}

.modal-footer {
    padding: 20px 24px;
    background: #f9fafb;
    border-radius: 0 0 16px 16px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .toolbar,
    .shortcut-bar {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

.table-actions-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-edit-dest {
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #0284c7;
}

.btn-edit-dest:hover {
    background: #e0f2fe;
}
