html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: #f8fafc;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA9IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ================================================
   FACTURACIÓN - ESTILOS GLOBALES (NO SCOPED)
   ================================================ */

#facturacion-app {
    padding-bottom: 40px;
    min-height: 100vh;
    background-color: #f8fafc;
}

.hero-section {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 40px 40px;
    color: white;
    margin-bottom: 30px;
}

.hero-content {
    max-width: 1400px;
    margin: 0 auto;
}

.modern-badge {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    display: inline-block;
}

.main-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 10px 0 8px 0;
    line-height: 1.2;
}

.main-desc {
    opacity: 0.8;
    font-size: 0.95rem;
    margin: 0;
}

.form-body {
    padding: 0 40px 20px 40px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 20px;
}

.ui-card {
    background: white;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 8px 30px rgba(0,0,0,0.06);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ui-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.10);
}

.card-inner {
    padding: 24px;
}

.card-header-icon {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.card-header-icon i {
    font-size: 1.5rem;
    color: #3b82f6;
}

.card-header-icon h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #0f172a;
}

#facturacion-app .input-group-modern {
    margin-bottom: 18px;
}

#facturacion-app .input-group-modern label {
    display: block !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    color: #64748b !important;
    margin-bottom: 6px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
}

#facturacion-app .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#facturacion-app .input-prefix {
    position: absolute;
    left: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #64748b;
    pointer-events: none;
    z-index: 2;
}

#facturacion-app .input-wrapper input {
    padding-left: 38px !important;
}

/* INPUTS - SIN ATRIBUTOS DE SCOPE */
#facturacion-app input#monto-cot.custom-input,
#facturacion-app input#cot-id.custom-input,
#facturacion-app input#fecha-emision.custom-input,
#facturacion-app input#rfc.custom-input {
    display: block !important;
    width: 100% !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 12px 16px !important;
    margin: 0 !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    -webkit-appearance: none !important;
}

#facturacion-app input#monto-cot.custom-input {
    padding-left: 38px !important;
    -moz-appearance: textfield !important;
}

#facturacion-app input#monto-cot.custom-input:focus,
#facturacion-app input#cot-id.custom-input:focus,
#facturacion-app input#fecha-emision.custom-input:focus,
#facturacion-app input#rfc.custom-input:focus {
    border-color: #3b82f6 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
    transform: translateY(-1px);
}

#facturacion-app input::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
}

#facturacion-app input#rfc.custom-input.readonly-input,
#facturacion-app input#rfc.custom-input[disabled] {
    background-color: #f8fafc !important;
    background: #f8fafc !important;
    color: #94a3b8 !important;
    cursor: not-allowed !important;
}

#facturacion-app input[type="number"]::-webkit-inner-spin-button,
#facturacion-app input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    display: none !important;
}

#facturacion-app .helper-text,
#facturacion-app small.helper-text {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
    font-style: italic;
}

#facturacion-app .toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

#facturacion-app .toggle-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
}

#facturacion-app .switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

#facturacion-app .switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

#facturacion-app .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 34px;
}

#facturacion-app .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#facturacion-app .switch input:checked + .slider {
    background-color: #3b82f6;
}

#facturacion-app .switch input:checked + .slider:before {
    transform: translateX(22px);
}

#facturacion-app .sticky-actions {
    position: sticky;
    bottom: 16px;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(12px);
    padding: 14px 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(0,0,0,0.08);
    border-radius: 14px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 100;
    margin-top: 20px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

#facturacion-app .btn-ghost-modern {
    background: transparent !important;
    border: 2px solid #e2e8f0 !important;
    color: #64748b !important;
    padding: 11px 24px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    cursor: pointer !important;
}

#facturacion-app .btn-ghost-modern:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px);
}

#facturacion-app .btn-primary-modern {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    color: white !important;
    padding: 11px 28px !important;
    border-radius: 10px !important;
    border: none !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

#facturacion-app .btn-primary-modern:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.35) !important;
}

#facturacion-app .btn-primary-modern i {
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 30px 20px;
    }

    .main-title {
        font-size: 1.6rem;
    }

    .form-body {
        padding: 0 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card-inner {
        padding: 20px;
    }

    #facturacion-app .sticky-actions {
        padding: 12px 16px;
        justify-content: center;
        flex-direction: column;
        gap: 8px;
        border-radius: 12px;
        bottom: 12px;
    }

    #facturacion-app .btn-primary-modern,
    #facturacion-app .btn-ghost-modern {
        width: 100%;
        justify-content: center;
        padding: 12px 20px !important;
    }

    .progress-indicator {
        padding: 0 20px;
        margin: 20px auto;
    }

    .step-circle {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }

    .step-line {
        width: 40px;
    }

    .client-form-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .nav-buttons {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .nav-buttons button {
        width: 100%;
    }

    .ticket-summary {
        padding: 14px 16px;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .client-form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-section {
        padding: 35px 30px;
    }

    .main-title {
        font-size: 1.8rem;
    }
}

@media (min-width: 1201px) {
    .client-form-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ================================================
   MULTI-STEP FORM STYLES
   ================================================ */

.progress-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 600px;
    margin: 30px auto;
    padding: 0 40px;
}

.step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    border: 3px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
}

.step-circle.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transform: scale(1.1);
}

.step-circle.completed {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.step-circle.completed::after {
    content: "?";
    position: absolute;
    font-size: 1.1rem;
}

.step-line {
    width: 70px;
    height: 3px;
    background: #e2e8f0;
    transition: all 0.3s ease;
}

.step-line.completed {
    background: #10b981;
}

.form-section {
    animation: fadeInSlide 0.3s ease-out;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateX(15px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ================================================
   ETAPA 2 - DATOS DEL CLIENTE
   ================================================ */

.ticket-summary {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #0ea5e9;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ticket-summary i {
    font-size: 1.6rem;
    color: #0ea5e9;
}

.ticket-summary-content h4 {
    margin: 0 0 6px 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0c4a6e;
}

.ticket-summary-content p {
    margin: 0;
    font-size: 0.85rem;
    color: #0c4a6e;
    opacity: 0.8;
}

.client-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 0;
}

.client-form-grid .full-width {
    grid-column: 1 / -1;
}

.client-form-grid .half-width {
    grid-column: span 1;
}

.client-form-grid .input-group-modern {
    margin-bottom: 0;
}

/* Inputs genéricos para etapa 2 */
#facturacion-app input.custom-input-client {
    display: block !important;
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 11px 14px !important;
    margin: 0 !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    -webkit-appearance: none !important;
}

#facturacion-app input.custom-input-client:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
    transform: translateY(-1px);
}

#facturacion-app input.custom-input-client.readonly-input,
#facturacion-app input.custom-input-client[disabled] {
    background-color: #f8fafc !important;
    color: #94a3b8 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
}

.readonly-badge {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #f1f5f9;
}

.btn-back {
    background: transparent !important;
    border: 2px solid #e2e8f0 !important;
    color: #64748b !important;
    padding: 11px 24px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    cursor: pointer !important;
}

.btn-back:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    transform: translateX(-3px);
}

.mode-indicator {
    display: inline-block;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    padding: 3px 10px;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 10px;
}


/* Select Régimen SAT (único, anti-bootstrap) */
#facturacion-app select.lp-regimen-select {
    display: block !important;
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 11px 44px 11px 14px !important; /* espacio para flecha */
    margin: 0 !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    background-color: #ffffff !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    /* flecha (inline svg) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 18px 18px !important;
}

    #facturacion-app select.lp-regimen-select:focus {
        border-color: #3b82f6 !important;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
        transform: translateY(-1px);
    }

/* ================================================
   ETAPA 3 - USO CFDI Y FACTURACIÓN
   ================================================ */

.uso-cfdi-container {
    max-width: 800px;
    margin: 0 auto;
}

#facturacion-app .input-group-modern select#uso-cfdi-select.custom-select-cfdi {
    display: block !important;
    width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 12px 16px !important;
    margin: 0 !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    color: #1e293b !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    cursor: pointer !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 16px center !important;
    background-size: 16px !important;
    padding-right: 48px !important;
}

#facturacion-app select#uso-cfdi-select.custom-select-cfdi:focus {
    border-color: #3b82f6 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
    transform: translateY(-1px);
}

#facturacion-app select#uso-cfdi-select.custom-select-cfdi option {
    padding: 12px !important;
    font-size: 0.9rem !important;
    color: #1e293b !important;
    background: #ffffff !important;
}

    #facturacion-app select#uso-cfdi-select.custom-select-cfdi option:hover,
    #facturacion-app select#uso-cfdi-select.custom-select-cfdi option:checked {
        background: #f1f5f9 !important;
        color: #0f172a !important;
    }

.cfdi-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid #f1f5f9;
}

#facturacion-app .btn-facturar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    padding: 13px 32px !important;
    border-radius: 12px !important;
    border: none !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 1;
    justify-content: center;
}

    #facturacion-app .btn-facturar:hover:not(:disabled) {
        background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
        transform: translateY(-2px);
        box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4) !important;
    }

    #facturacion-app .btn-facturar:disabled {
        opacity: 0.6;
        cursor: not-allowed !important;
        transform: none !important;
        background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%) !important;
    }

    #facturacion-app .btn-facturar i {
        font-size: 1.3rem;
    }

@media (max-width: 768px) {
    .uso-cfdi-container {
        padding: 0;
    }

    .cfdi-actions {
        flex-direction: column-reverse;
        gap: 12px;
    }

        .cfdi-actions button {
            width: 100%;
        }

    #facturacion-app select#uso-cfdi-select.custom-select-cfdi {
        font-size: 0.9rem !important;
        height: 46px !important;
        padding: 10px 14px !important;
        padding-right: 44px !important;
    }

    #facturacion-app .btn-facturar {
        padding: 14px 24px !important;
        font-size: 0.95rem !important;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .uso-cfdi-container {
        max-width: 700px;
    }
}

.fx-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.fx-overlay-card {
    background: #fff;
    padding: 18px 22px;
    border-radius: 14px;
    min-width: 220px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.fx-spinner {
    width: 34px;
    height: 34px;
    border: 4px solid rgba(0,0,0,.15);
    border-top-color: rgba(0,0,0,.65);
    border-radius: 50%;
    animation: fxspin 0.9s linear infinite;
    margin: 0 auto;
}

@keyframes fxspin {
    to {
        transform: rotate(360deg);
    }
}


/* PDF Y XML CSS */
/* =========================
   LP Descargas - Modern UI
   Scoped: #lp-descargas-modal
   ========================= */

/* Backdrop (igual idea, un poco más suave + blur si el navegador puede) */
#lp-descargas-backdrop.lp-descargas-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.58);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2147483000;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    #lp-descargas-backdrop.lp-descargas-backdrop {
        background: rgba(0,0,0,.45);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
    }
}

/* Modal */
#lp-descargas-modal.lp-descargas-modal {
    width: min(920px, 92vw);
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
    border-radius: 18px;
    padding: 18px 18px 14px;
    box-shadow: 0 24px 70px rgba(0,0,0,.38);
    position: relative;
    border: 1px solid rgba(0,0,0,.06);
}

/* Close */
#lp-descargas-modal .lp-descargas-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: 0;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    opacity: .72;
    padding: 6px 10px;
    border-radius: 10px;
}

    #lp-descargas-modal .lp-descargas-close:hover {
        opacity: 1;
        background: rgba(0,0,0,.05);
    }

/* Title */
#lp-descargas-modal .lp-descargas-title {
    text-align: center;
    font-weight: 800;
    font-size: 22px;
    margin: 6px 0 16px;
    letter-spacing: -0.2px;
}

/* =========================================================
   LP Cards - Port 1:1 del pricing example (adaptado)
   Scoped a #lp-descargas-modal
   ========================================================= */

#lp-descargas-modal .lp-descargas-grid.lp-dl-grid {
    margin-top: 0.8rem;
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Button reset */
#lp-descargas-modal .lp-descargas-card.lp-dl-card {
    width: 17.5rem;
    cursor: pointer;
    border: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    text-align: left;
    font: inherit;
    color: inherit;
}

/* Variantes (colores exactos del ejemplo) */
#lp-descargas-modal .lp-dl-card--xml {
    --lp-accent: #6824d6;
    --lp-shadow-accent: 5px 18px 13px hsl(263deg 71% 49% / 43%);
}

#lp-descargas-modal .lp-dl-card--pdf {
    --lp-accent: #4ccda7;
    --lp-shadow-accent: 5px 18px 13px hsl(162deg 56% 55% / 43%);
}

/* Outer (fondo gris + footer abajo) */
#lp-descargas-modal .lp-dl-outer {
    background: #ebecee;
    position: relative;
    height: 23.438rem; /* ~375px */
    border-radius: 0.625rem;
    display: flex;
    align-items: flex-end;
    padding: 1.25rem;
    transition: 0.3s ease-in-out;
}

/* Inner flotante (offset como el ejemplo) */
#lp-descargas-modal .lp-dl-inner {
    background: #fff;
    position: absolute;
    bottom: 3.75rem; /* deja el footer visible */
    right: 1.25rem; /* offset a la derecha */
    left: 0; /* “se asoma” un poco */
    height: 90%;
    border-radius: 0.625rem;
    padding: 1.875rem 2.188rem;
    display: flex;
    flex-direction: column;
}

/* Icono */
#lp-descargas-modal .lp-dl-icon {
    display: flex;
    align-items: flex-start;
}

    #lp-descargas-modal .lp-dl-icon svg {
        width: 2.188rem;
        margin-left: -0.188em;
        color: var(--lp-accent);
    }

/* Título */
#lp-descargas-modal .lp-dl-title {
    text-transform: capitalize;
    font-weight: 800;
    font-size: 1rem;
    display: inline-block;
    margin-top: 0.313em;
    margin-bottom: 0.55em;
    color: var(--lp-accent);
}

/* Sub + separador (simula la línea del precio del ejemplo) */
#lp-descargas-modal .lp-dl-sub {
    position: relative;
    font-size: 0.95rem;
    color: #0f172a;
    opacity: .78;
    padding-bottom: 1.4rem;
    margin-bottom: 1.2rem;
}

    #lp-descargas-modal .lp-dl-sub::after {
        position: absolute;
        content: "";
        left: 0;
        bottom: 0;
        display: block;
        background: #f5f5f5;
        height: 0.125rem;
        width: 100%;
    }

/* Lista abajo */
#lp-descargas-modal .lp-dl-list {
    margin: 0;
    padding: 0;
    list-style: none;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.5rem;
    color: #0f172a;
}

/* Footer CTA (como <a>) */
#lp-descargas-modal .lp-dl-cta {
    display: flex;
    align-items: center;
    text-transform: capitalize;
    font-weight: 800;
    color: var(--lp-accent);
    user-select: none;
}

    #lp-descargas-modal .lp-dl-cta svg {
        margin-left: 0.375em;
        width: 1.125rem;
        color: currentColor;
    }

/* Active (igual que el ejemplo: outer se pinta + sombra de color) */
#lp-descargas-modal .lp-descargas-card.lp-dl-card.lp-is-active .lp-dl-outer,
#lp-descargas-modal .lp-descargas-card.lp-dl-card:hover .lp-dl-outer {
    background: var(--lp-accent);
    box-shadow: var(--lp-shadow-accent);
    transform: translateY(-4px);
}

/* CTA blanco cuando está activo */
#lp-descargas-modal .lp-descargas-card.lp-dl-card.lp-is-active .lp-dl-cta,
#lp-descargas-modal .lp-descargas-card.lp-dl-card:hover .lp-dl-cta {
    color: #fff;
}

/* Accesibilidad */
#lp-descargas-modal .lp-descargas-card.lp-dl-card:focus-visible {
    outline: 3px solid rgba(37, 140, 251, .35);
    outline-offset: 10px;
    border-radius: 0.625rem;
}

/* Disabled */
#lp-descargas-modal .lp-descargas-card.lp-dl-card:disabled {
    cursor: not-allowed;
    opacity: .75;
}

    #lp-descargas-modal .lp-descargas-card.lp-dl-card:disabled .lp-dl-outer {
        transform: none;
        box-shadow: none;
    }

    #lp-descargas-modal .lp-descargas-card.lp-dl-card:disabled .lp-dl-cta {
        color: rgba(15,23,42,.45);
    }

/* Responsive */
@media (max-width: 680px) {
    #lp-descargas-modal .lp-descargas-grid.lp-dl-grid {
        gap: 1.2rem;
    }

    #lp-descargas-modal .lp-descargas-card.lp-dl-card {
        width: min(100%, 22rem);
    }
}





/* =========================
   PDF Preview (mejorado)
   ========================= */
#lp-descargas-modal .lp-descargas-preview {
    margin-top: 16px;
    border-top: 1px solid rgba(0,0,0,.08);
    padding-top: 14px;
}

/* Acciones: sticky dentro del contenedor para desktop/mobile */
#lp-descargas-modal .lp-descargas-preview-actions {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 8px;
    margin: 0 0 10px;
    border-radius: 12px;
    background: rgba(255,255,255,.86);
    border: 1px solid rgba(0,0,0,.06);
    box-shadow: 0 10px 20px rgba(0,0,0,.08);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    #lp-descargas-modal .lp-descargas-preview-actions {
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
    }
}

@media (max-width: 680px) {
    #lp-descargas-modal .lp-descargas-preview-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* Iframe: sigue tu idea pero más “panel” */
#lp-pdf-preview.lp-descargas-iframe {
    width: 100%;
    border: 1px solid rgba(0,0,0,.10);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(0,0,0,.10);
    height: min(70vh, 780px);
}

/* Mobile: usar dvh si existe para evitar saltos por barras del navegador */
@media (max-width: 680px) {
    #lp-pdf-preview.lp-descargas-iframe {
        height: 76vh; /* fallback */
    }

    @supports (height: 1dvh) {
        #lp-pdf-preview.lp-descargas-iframe {
            height: 76dvh;
        }
    }

    #lp-descargas-backdrop.lp-descargas-backdrop {
        align-items: flex-start;
        padding-top: 10px;
    }

    #lp-descargas-modal.lp-descargas-modal {
        max-height: 94vh;
        overflow: auto;
    }

    @supports (height: 1dvh) {
        #lp-descargas-modal.lp-descargas-modal {
            max-height: 94dvh;
        }
    }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    #lp-descargas-modal .lp-dl-outer {
        transition: none;
    }
}

#lp-descargas-preview.lp-preview-flash {
    animation: lpPreviewFlash 1.1s ease;
}

@keyframes lpPreviewFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 116, 217, .00);
    }

    30% {
        box-shadow: 0 0 0 6px rgba(0, 116, 217, .18);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 116, 217, .00);
    }
}

/* =========================
   Layout 2 columnas (desktop)
   ========================= */

#lp-descargas-modal .lp-descargas-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

/* Desktop: SOLO si hay preview (lp-has-right) */
@media (min-width: 900px) {

    /* Si hay preview, el modal puede crecer un poco para que el PDF respire */
    #lp-descargas-modal.lp-has-preview {
        width: min(1240px, 96vw);
    }

    /* Dos columnas SOLO cuando hay preview */
    #lp-descargas-modal .lp-descargas-layout.lp-has-right {
        grid-template-columns: 430px 1fr;
        align-items: start;
    }

    /* Evita que el modal sea una página entera: scroll interno */
    #lp-descargas-modal.lp-descargas-modal {
        max-height: 90vh;
        overflow: hidden;
    }

    /* Columna izquierda scrolleable SOLO cuando hay preview */
    #lp-descargas-modal .lp-descargas-layout.lp-has-right .lp-descargas-left {
        max-height: 86vh;
        overflow: auto;
        padding-right: 10px;
    }

    /* Columna derecha scrolleable + separador SOLO cuando hay preview */
    #lp-descargas-modal .lp-descargas-layout.lp-has-right .lp-descargas-right {
        max-height: 86vh;
        overflow: auto;
        border-left: 1px solid rgba(0,0,0,.08);
        padding-left: 16px;
    }

    /* En desktop el preview ya no va “abajo”, así que quitamos borde superior */
    #lp-descargas-modal .lp-descargas-layout.lp-has-right .lp-descargas-preview {
        margin-top: 0;
        border-top: 0;
        padding-top: 0;
    }

    /* Cards en columna cuando hay preview */
    #lp-descargas-modal .lp-descargas-layout.lp-has-right .lp-descargas-grid.lp-dl-grid {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 2rem;
    }

    #lp-descargas-modal .lp-descargas-layout.lp-has-right .lp-descargas-card.lp-dl-card {
        width: 100%;
        max-width: 380px;
    }

    /* Iframe con alto más “panel” en desktop */
    #lp-descargas-modal .lp-descargas-layout.lp-has-right #lp-pdf-preview.lp-descargas-iframe {
        height: clamp(520px, 74vh, 820px);
    }
}
