/* ===== RESET AND BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 16px;
}

/* ===== HEADER STYLES ===== */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.header p {
    font-size: 1rem;
    color: #86868b;
    font-weight: 400;
}

/* ===== CLIENT INFO STYLES ===== */
.client-info {
    background: white;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.06);
    border: 1px solid #f2f2f7;
    margin-bottom: 24px;
    /* Sticky effect only on desktop */
    position: static;
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

/* Desktop-only sticky effect */
@media (min-width: 769px) {
    .client-info {
        position: sticky;
        top: 0;
        z-index: 100;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
    }
}

.client-info.sticky {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.98);
}

.client-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 12px;
}

.client-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detail-label {
    font-weight: 500;
    color: #86868b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-value {
    font-weight: 600;
    color: #1d1d1f;
    font-size: 0.95rem;
}

/* ===== STATS SUMMARY ===== */
.stats-summary {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #f0f0f0;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 0.75rem;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-paid { color: #34c759; }
.stat-pending { color: #ff9500; }
.stat-overdue { color: #ff3b30; }
.stat-fines { color: #ff3b30; }

/* ===== INVOICES SECTION ===== */
.invoices-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 6px;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1d1d1f;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-count {
    background: #86868b;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.section-overdue .section-count { background: #ff3b30; }
.section-pending .section-count { background: #ff9500; }
.section-paid .section-count { background: #34c759; }
.section-upcoming .section-count { background: #ff6b35; }

.invoices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1rem;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .invoices-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Para pantallas grandes, máximo 3 columnas */
@media (min-width: 1400px) {
    .invoices-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===== INVOICE CARD STYLES ===== */
.invoice-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #f2f2f7;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.invoice-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1.5rem rgba(255, 107, 53, 0.15);
    border-color: #ff6b35;
}

.invoice-card.overdue {
    border-left: 4px solid #ff3b30;
    background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
}

.invoice-card.overdue.due-today {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, #fff 0%, #fffbf0 100%);
}

.invoice-card.pending {
    border-left: 4px solid #ff9500;
    background: linear-gradient(135deg, #fff 0%, #fffaf5 100%);
}

.invoice-card.upcoming {
    border-left: 4px solid #ff6b35;
    background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
}

.invoice-card.paid {
    border-left: 4px solid #ff6b35;
    background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.invoice-number {
    font-size: 1rem;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 2px;
}

.invoice-week {
    font-size: 0.8rem;
    color: #86868b;
    font-weight: 500;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.status-paid {
    background: #34c759;
    color: white;
}

.status-pending {
    background: #ff9500;
    color: white;
}

.status-overdue {
    background: #ff3b30;
    color: white;
}

.status-upcoming {
    background: #ff6b35;
    color: white;
}

.due-today .status-overdue {
    background: #f59e0b;
    color: white;
}

/* ===== INVOICE DETAILS ===== */
.invoice-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.invoice-detail {
    text-align: center;
    padding: 6px;
    background: #f9f9f9;
    border-radius: 6px;
}

.invoice-detail-label {
    font-size: 0.7rem;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.invoice-detail-value {
    font-weight: 600;
    color: #1d1d1f;
    font-size: 0.85rem;
}

.amount-highlight {
    color: #ff6b35 !important;
    font-size: 1rem !important;
}

.overdue-highlight {
    color: #ff3b30 !important;
}

.invoice-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 12px;
    flex-wrap: wrap;
}

/* ===== PAYMENT CARD STYLES ===== */
.payment-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #f2f2f7;
    border-left: 4px solid #ff6b35;
    background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.payment-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1.5rem rgba(255, 107, 53, 0.15);
    border-color: #ff6b35;
}

.payment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.payment-reference {
    font-size: 1rem;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 2px;
}

.payment-source {
    font-size: 0.8rem;
    color: #86868b;
    font-weight: 500;
}

.payment-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.payment-detail {
    text-align: center;
    padding: 6px;
    background: #f9f9f9;
    border-radius: 6px;
}

.payment-detail-label {
    font-size: 0.7rem;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.payment-detail-value {
    font-weight: 600;
    color: #1d1d1f;
    font-size: 0.85rem;
}

.payment-amount-highlight {
    color: #ff6b35 !important;
    font-size: 1rem !important;
}

.payment-description {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 8px;
    margin: 12px 0;
}

.payment-description-label {
    font-size: 0.7rem;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.payment-description-text {
    font-size: 0.8rem;
    color: #1d1d1f;
    line-height: 1.3;
}

/* ===== BANK BADGES ===== */
.bank-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.bank-bac {
    background: #1e40af;
    color: white;
}

.bank-bn {
    background: #dc2626;
    color: white;
}

.bank-huberbn {
    background: #059669;
    color: white;
}

.manual-payment-badge {
    background: #17a2b8;
    color: white;
}

/* ===== ASSIGNED PAYMENT CARDS ===== */
.assigned-payment-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #f2f2f7;
    border-left: 4px solid #ff6b35;
    background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.assigned-payment-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1.5rem rgba(255, 107, 53, 0.15);
    border-color: #ff6b35;
}

/* ===== BUTTON STYLES ===== */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: #ff6b35;
    color: white;
}

.btn-primary:hover {
    background: #e55a2b;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f2f2f7;
    color: #1d1d1f;
}

.btn-secondary:hover {
    background: #e8e8ed;
}

.btn-success {
    background: #34c759;
    color: white;
}

.btn-success:hover {
    background: #248a3d;
}

.btn-danger {
    background: #ff3b30;
    color: white;
}

.btn-danger:hover {
    background: #d70015;
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, #ff9500 0%, #cc7a00 100%);
    color: white;
    font-weight: 500;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #cc7a00 0%, #b8690c 100%);
    transform: translateY(-1px);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #25d366 0%, #1da851 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-whatsapp:hover {
    background: linear-gradient(135deg, #1da851 0%, #17a047 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.btn-whatsapp:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-whatsapp:hover:before {
    left: 100%;
}

.btn-download {
    background: #6c757d;
    color: white;
}

.btn-download:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-assign {
    background: #ff6b35;
    color: white;
    font-size: 10px;
    padding: 4px 8px;
}

.btn-assign:hover {
    background: #e55a2b;
}

.btn-unassign {
    background: #ff9500;
    color: white;
    font-size: 10px;
    padding: 4px 8px;
}

.btn-unassign:hover {
    background: #cc7a00;
}

.btn-receipt {
    background: #8e44ad;
    color: white;
    font-size: 10px;
    padding: 4px 8px;
}

.btn-receipt:hover {
    background: #6c3483;
}

.btn-print {
    background: #34c759;
    color: white;
    font-size: 11px;
    padding: 5px 10px;
}

.btn-print:hover {
    background: #248a3d;
}

.btn-large {
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 12px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== ACTIONS SECTION ===== */
.actions-section {
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.receipt-actions,
.payment-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 12px;
    flex-wrap: wrap;
}

/* ===== NAVIGATION ===== */
.navigation {
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== EMPTY SECTION ===== */
.empty-section {
    text-align: center;
    padding: 40px;
    color: #86868b;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ===== LOADING STATES ===== */
.loading {
    text-align: center;
    padding: 60px;
    color: #86868b;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f2f2f7;
    border-top: 3px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 300px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f2f2f7;
    border-top: 4px solid #25d366;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

/* ===== ERROR STATE ===== */
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: #ff3b30;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 32px;
}

.error-state h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 2000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 400px;
    word-wrap: break-word;
}

.toast.success { background: #34c759; }
.toast.error { background: #ff3b30; }
.toast.warning { background: #ff9500; }
.toast.show { transform: translateX(0); }

/* ===== MODAL STYLES ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 0 24px;
    border-bottom: 1px solid #f2f2f7;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    color: #86868b;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f2f2f7;
    color: #1d1d1f;
}

.modal-body {
    padding: 0 24px 24px 24px;
}

/* ===== FORM STYLES ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #f2f2f7;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #f2f2f7;
}

.form-group input[type="number"] {
    -moz-appearance: textfield;
}

.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    background: #f9f9f9 !important;
    color: #86868b !important;
    cursor: not-allowed;
}

/* ===== RECEIPT STYLES ===== */
.receipt-modal {
    max-width: 1000px !important;
    width: 98% !important;
}

.receipt-container {
    background: white;
    padding: 20px;
    font-family: 'Arial', sans-serif;
    line-height: 1.3;
    color: #333;
    min-height: auto;
    max-height: 85vh;
    overflow-y: auto;
}

.receipt-header {
    margin-bottom: 20px;
    border-bottom: 2px solid #34c759;
    padding-bottom: 15px;
}

.receipt-header-content {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 24px;
}

.company-logo {
    width: 140px;
    height: 91px; /* Proporción original del logo 2550:1650 = 1.545:1 */
    max-width: 140px;
    max-height: 91px;
    object-fit: contain;
    flex-shrink: 0;
    align-self: flex-start;
    opacity: 1;
}

.receipt-header-text {
    flex: 1;
    text-align: center;
}

.company-name {
    font-size: 1.8rem;
    font-weight: bold;
    color: #1d1d1f;
    margin-bottom: 5px;
}

.company-details {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 8px;
    line-height: 1.3;
}

.receipt-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #34c759;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 8px 0;
}

.receipt-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.info-section h4 {
    font-size: 1.1rem;
    color: #1d1d1f;
    margin-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

.info-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.info-label {
    font-weight: 600;
    color: #555;
    min-width: 120px;
}

.info-value {
    color: #333;
    text-align: right;
    flex: 1;
}

.receipt-amount {
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 10px;
    margin: 20px 0;
    border: 2px solid #34c759;
}

.amount-label {
    font-size: 1rem;
    color: #666;
    margin-bottom: 5px;
}

.amount-value {
    font-size: 2.2rem;
    font-weight: bold;
    color: #34c759;
    margin-bottom: 8px;
}

.amount-words {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    text-transform: uppercase;
}

.receipt-footer {
    margin-top: 25px;
    text-align: center;
    color: #888;
    font-size: 0.8rem;
    border-top: 1px solid #e0e0e0;
    padding-top: 15px;
}

.signature-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin: 25px 0 15px 0;
}

.signature-box {
    text-align: center;
}

.signature-line {
    border-bottom: 1px solid #333;
    height: 35px;
    margin-bottom: 8px;
}

.signature-label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.invoice-info-compact,
.description-compact,
.observations-compact {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #ff6b35;
}

.invoice-info-compact h4,
.description-compact h4,
.observations-compact h4 {
    margin-bottom: 8px;
    color: #555;
    font-size: 1rem;
}

.invoice-info-compact .info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    font-size: 0.85rem;
}

.observations-compact {
    border-left-color: #ffc107;
    background: #fffbf0;
}

.receipt-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 15px 24px;
    margin: 0;
    border-top: 1px solid #f2f2f7;
    background: #f9f9f9;
    border-radius: 0 0 16px 16px;
    flex-wrap: wrap;
}

.receipt-actions-left {
    display: flex;
    gap: 8px;
    flex: 1;
}

.receipt-actions-right {
    display: flex;
    gap: 8px;
}

/* ===== ASSIGNMENT MODALS ===== */
.invoice-option,
.payment-option {
    border: 2px solid #f2f2f7;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.invoice-option:hover,
.payment-option:hover {
    border-color: #ff6b35;
    background: #f8f9ff;
    transform: translateY(-1px);
}

.invoice-option.selected,
.payment-option.selected {
    border-color: #ff6b35;
    background: #fff3e0;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.15);
}

.invoice-option-header,
.payment-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.payment-option.exact-match {
    border-color: #34c759;
    background: #f0fff4;
}

.payment-option.exact-match:hover {
    border-color: #34c759;
    background: #e6ffe6;
}

.payment-option.exact-match.selected {
    border-color: #34c759;
    background: #d4edda;
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.15);
}

/* ===== PAYMENT DISTRIBUTION STYLES ===== */
.distribution-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.distribution-item:hover {
    border-color: #ff6b35;
    background: #fff8f0;
}

.distribution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.distribution-info {
    flex: 1;
}

.invoice-title {
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.invoice-details-text {
    font-size: 0.85rem;
    color: #666;
}

.amount-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.amount-input {
    width: 120px;
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: right;
}

.amount-input:focus {
    outline: none;
    border-color: #ff6b35;
}

.currency-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.total-summary {
    background: #fff3e0;
    border: 2px solid #ff6b35;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 500;
}

.summary-row:last-child {
    margin-bottom: 0;
    padding-top: 8px;
    border-top: 1px solid #ff6b35;
    font-weight: 600;
}

.warning-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: #856404;
}

.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: #721c24;
}

/* ===== PAYMENT DATE STYLES ===== */
.payment-date {
    font-size: 0.8rem;
    color: #059669;
    font-weight: 600;
    margin-top: 6px;
}

/* ===== MEDIA QUERIES ===== */
@media print {
    body * {
        visibility: hidden;
    }

    .receipt-container,
    .receipt-container * {
        visibility: visible;
    }

    .receipt-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100% !important;
        height: auto !important;
        padding: 15px !important;
        box-shadow: none !important;
        background: white !important;
        font-size: 12px !important;
    }

    .modal-overlay,
    .modal-header,
    .form-actions,
    .receipt-modal-actions {
        display: none !important;
    }

    .receipt-header-content {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        gap: 20px !important;
    }
    
    .company-logo {
        width: 120px !important;
        height: 78px !important; /* Proporción original del logo */
        max-width: 120px !important;
        max-height: 78px !important;
        object-fit: contain !important;
        flex-shrink: 0 !important;
        align-self: flex-start !important;
        opacity: 1 !important;
    }

    .receipt-header-text {
        flex: 1 !important;
        text-align: center !important;
    }

    .company-name {
        font-size: 1.4rem !important;
    }

    .receipt-title {
        font-size: 1.1rem !important;
    }

    .receipt-info {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 15px;
    }

    .info-section h4 {
        font-size: 0.95rem !important;
    }

    .info-line {
        font-size: 0.8rem !important;
        margin-bottom: 4px !important;
    }

    .receipt-amount {
        padding: 18px !important;
        margin: 15px 0 !important;
    }

    .amount-value {
        font-size: 1.8rem !important;
    }

    .amount-words {
        font-size: 0.85rem !important;
    }

    .signature-section {
        grid-template-columns: 1fr 1fr;
        gap: 50px;
        margin: 20px 0 10px 0;
    }

    .signature-line {
        height: 25px !important;
    }

    .receipt-footer {
        margin-top: 15px !important;
        font-size: 0.75rem !important;
    }

    .invoice-info-compact,
    .description-compact,
    .observations-compact {
        margin: 10px 0;
        padding: 10px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .client-details {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .invoice-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .payment-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .client-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .invoice-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .section-header small {
        font-size: 0.75rem !important;
    }

    .invoice-actions {
        justify-content: center;
        gap: 4px;
    }

    .invoice-actions .btn {
        flex: 1;
        min-width: 65px;
        padding: 6px 4px;
        font-size: 10px;
    }

    .payment-card,
    .assigned-payment-card,
    .invoice-card {
        padding: 12px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .invoice-option-header,
    .payment-option-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .receipt-modal {
        width: 98% !important;
        max-width: none !important;
    }

    .receipt-container {
        padding: 15px !important;
    }

    .receipt-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .signature-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .receipt-header-content {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        text-align: center;
    }
    
    .company-logo {
        width: 100px;
        height: 65px; /* Proporción original del logo */
        max-width: 100px;
        max-height: 65px;
        object-fit: contain;
        align-self: center;
        opacity: 1;
    }

    .receipt-header-text {
        text-align: center;
    }

    .company-name {
        font-size: 1.5rem;
    }

    .amount-value {
        font-size: 1.8rem;
    }

    .receipt-modal-actions {
        flex-direction: column;
        gap: 12px;
    }

    .receipt-actions-left,
    .receipt-actions-right {
        width: 100%;
        justify-content: center;
    }

    .distribution-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .amount-input-container {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ===== ESTILOS PARA TABS EN MODALES ===== */
.modal-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #ff6b35;
    background: #f8f9fa;
}

.tab-btn.active {
    color: #ff6b35;
    border-bottom-color: #ff6b35;
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== BOTÓN VOLVER AL INICIO ===== */
.home-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.home-button:hover {
    background: #e55a2b;
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(255, 107, 53, 0.4);
}

.home-button:active {
    transform: scale(0.95);
}

/* Responsive para el botón de inicio */
@media (max-width: 768px) {
    .home-button {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* ===== ESTILOS PARA FILTRADO VISUAL ===== */
.invoice-card.filtered {
    opacity: 0.3;
    transform: scale(0.95);
    filter: grayscale(50%);
    transition: all 0.3s ease;
}

.invoice-card.highlight {
    background: linear-gradient(135deg, #fff3e0 0%, #fff8f0 100%);
    border: 2px solid #ff6b35;
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.2);
    transform: scale(1.02);
    transition: all 0.3s ease;
}

.payment-card.filtered {
    opacity: 0.3;
    transform: scale(0.95);
    filter: grayscale(50%);
    transition: all 0.3s ease;
}

.payment-card.highlight {
    background: linear-gradient(135deg, #fff3e0 0%, #fff8f0 100%);
    border: 2px solid #ff6b35;
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.2);
    transform: scale(1.02);
    transition: all 0.3s ease;
}

.search-highlight {
    background: #ffeb3b;
    color: #000;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
    animation: highlightPulse 0.6s ease;
}

@keyframes highlightPulse {
    0% { background: #ffeb3b; }
    50% { background: #fff176; }
    100% { background: #ffeb3b; }
}

/* ===== ESTILOS PARA BARRAS DE BÚSQUEDA ===== */
.search-container {
    margin: 16px 0;
    position: relative;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e5e5e7;
    border-radius: 12px;
    padding: 8px 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-box:focus-within {
    border-color: #ff6b35;
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.15);
    transform: translateY(-1px);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #1d1d1f;
    background: transparent;
    padding: 8px 0;
}

.search-input::placeholder {
    color: #86868b;
    font-style: italic;
}

.search-clear {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    background: #f2f2f7;
    color: #86868b;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.search-clear:hover {
    background: #ff3b30;
    color: white;
    transform: scale(1.1);
}

.search-results {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 12px;
    color: #86868b;
    border-left: 3px solid #ff6b35;
    display: none;
}

.search-results.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilos para elementos filtrados */
.invoice-card.filtered {
    opacity: 0.6;
    transform: scale(0.98);
    transition: all 0.3s ease;
}

.invoice-card.filtered.hidden {
    display: none;
}

.invoice-card.highlight {
    background: linear-gradient(135deg, #fff 0%, #fff3e0 100%);
    border-color: #ff6b35;
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.2);
    transform: scale(1.02);
}

/* Indicador de búsqueda activa */
.search-active .search-box {
    background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
    border-color: #ff6b35;
}

.search-active .section-title::after {
    content: " 🔍";
    font-size: 0.8em;
    color: #ff6b35;
}

/* Responsive para búsqueda */
@media (max-width: 768px) {
    .search-box {
        padding: 6px 12px;
    }
    
    .search-input {
        font-size: 13px;
        padding: 6px 0;
    }
    
    .search-clear {
        padding: 3px 6px;
        font-size: 11px;
    }
}

/* ===== ESTILOS PARA PAGOS MANUALES ===== */
.manual-payment {
    border-left: 4px solid #17a2b8 !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.manual-payment .payment-bank {
    color: #17a2b8;
    font-weight: 600;
}

.manual-payment.assigned {
    border-left-color: #ff6b35 !important;
    background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
}

.manual-payment.assigned .payment-bank {
    color: #ff6b35;
}

.manual-payment .payment-actions .btn-assign {
    background-color: #17a2b8;
    border-color: #17a2b8;
}

.manual-payment .payment-actions .btn-assign:hover {
    background-color: #138496;
    border-color: #138496;
}

.manual-payment .payment-actions .btn-unassign {
    background-color: #6c757d;
    border-color: #6c757d;
}

.manual-payment .payment-actions .btn-unassign:hover {
    background-color: #5a6268;
    border-color: #5a6268;
}

