:root {
    --primary-color: #198754;
    --primary-light: #28a745;
    --accent-color: #20c997;
    --bg-light: #f8f9fa;
    --text-dark: #212529;
    --text-muted: #6c757d;
    --border-radius: 12px;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0,0,0,0.15);
}

[data-bs-theme="dark"] {
    --primary-color: #2ecc71;
    --primary-light: #27ae60;
    --accent-color: #1abc9c;
    --bg-light: #1a1d23;
    --text-dark: #e9ecef;
    --text-muted: #adb5bd;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0,0,0,0.3);
    --shadow-md: 0 0.5rem 1rem rgba(0,0,0,0.5);
}

* {
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #f5f6fa;
}
[data-bs-theme="dark"] body {
    background-color: #121416;
}

/* Header Style */
.checkout-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.checkout-header h1 {
    color: white;
    font-weight: 600;
    margin: 0;
}

/* El título conserva blanco incluso con el color de marca configurable. */
html body.checkout-page .checkout-header h1 { color:#fff!important; }
html body.checkout-page .checkout-header .checkout-back-link {
 display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;
 padding:8px 12px;border:1px solid rgb(255 255 255 / 55%);border-radius:10px;
 color:#fff!important;background:rgb(255 255 255 / 12%);font-size:14px;
 font-weight:600;line-height:1.3;text-decoration:none;touch-action:manipulation;
}
.checkout-back-link:hover { background:rgb(255 255 255 / 22%)!important; }
.checkout-back-link:focus-visible { outline:3px solid #fff;outline-offset:3px; }

/* Stepper */
.stepper-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    padding: 0 1rem;
}

.stepper-item {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.stepper-item .step-counter {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: white;
    border: 3px solid #d0d0d0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: #adb5bd;
    transition: all 0.3s ease;
    z-index: 1;
    position: relative;
}

.stepper-item .step-counter .bi-check-lg {
    font-size: 1.2rem;
}

.stepper-item.active .step-counter {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 5px rgba(25,135,84,0.15);
}

.stepper-item.completed .step-counter {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.stepper-item.pending .step-counter {
    background: #f0f0f0;
    border-color: #d0d0d0;
    color: #adb5bd;
}

.stepper-item .step-name {
    margin-left: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #adb5bd;
    transition: all 0.3s ease;
}

.stepper-item.active .step-name,
.stepper-item.completed .step-name {
    color: var(--primary-color);
}

.stepper-item.pending .step-name {
    color: #ced4da;
}

.stepper-item .step-line {
    width: 70px;
    height: 3px;
    background: #e0e0e0;
    margin: 0 12px;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.stepper-item.completed .step-line {
    background: var(--primary-color);
}

.stepper-item.pending .step-line {
    background: #e8e8e8;
}

.stepper-item:hover .step-counter {
    transform: scale(1.08);
}
.stepper-item.active:hover .step-counter {
    transform: scale(1);
}

@media (max-width: 576px) {
    .stepper-wrapper { padding: 0 0.5rem; margin: 1.5rem 0; }
    .stepper-item .step-name { display: none; }
    .stepper-item .step-line { width: 28px; margin: 0 6px; }
    .stepper-item .step-counter { width: 36px; height: 36px; font-size: 0.85rem; }
}
@media (max-width: 400px) {
    .stepper-item .step-line { width: 16px; margin: 0 3px; }
    .stepper-item .step-counter { width: 32px; height: 32px; font-size: 0.78rem; }
}

/* Step content containers */
.step-content {
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.step-content.d-none {
    display: none !important;
}
.step-content.fade-in {
    animation: stepFadeIn 0.4s ease forwards;
}
@keyframes stepFadeIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}
.step-content.fade-out {
    animation: stepFadeOut 0.3s ease forwards;
}
@keyframes stepFadeOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-30px); }
}

/* Step navigation */
.step-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e9ecef;
}
.step-navigation .btn {
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}
.step-navigation .btn-outline-secondary:hover {
    background: #e9ecef;
    transform: translateX(-3px);
}
.step-navigation .btn-primary-custom {
    padding: 0.75rem 2rem;
}
#step2 .modern-card,
#step3 .modern-card {
    margin-bottom: 0.25rem;
}
#step2 .modern-card .card-header,
#step3 .modern-card .card-header {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}
#step2 .modern-card .card-body,
#step3 .modern-card .card-body {
    padding: 0.75rem 1rem;
}
#step2 .order-summary,
#step3 .order-summary {
    padding: 0.75rem 1rem;
}
#step2 .order-summary .summary-row,
#step3 .order-summary .summary-row {
    padding: 0.4rem 0;
    font-size: 0.85rem;
}
#step2 .order-summary .summary-row:last-child,
#step3 .order-summary .summary-row:last-child {
    font-size: 1rem;
}
@media (max-width: 576px) {
    .step-navigation {
        flex-direction: column-reverse;
        gap: 10px;
    }
    .step-navigation .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Cards */
.modern-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: none;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
}
[data-bs-theme="dark"] .modern-card {
    background: #1a1d23;
    box-shadow: var(--shadow-sm);
}

.modern-card:hover {
    box-shadow: var(--shadow-md);
}

.modern-card .card-header {
    background: white;
    border-bottom: 2px solid var(--bg-light);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
}
[data-bs-theme="dark"] .modern-card .card-header {
    background: #1a1d23;
    border-bottom-color: #2a2d33;
}

.modern-card .card-body {
    padding: 1.5rem;
}

/* Product Items */
.product-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.product-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}
[data-bs-theme="dark"] .product-item:hover {
    background: #25282e;
}

.product-item .product-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
}

.product-item .product-info {
    flex: 1;
    margin-left: 0.6rem;
}

.product-item .product-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.1rem;
    font-size: 0.9rem;
}

.product-item .product-price {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
}

.product-item .product-quantity {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.product-item .quantity-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--secondary-color);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
[data-bs-theme="dark"] .product-item .quantity-btn {
    background: #2a2d33;
    border-color: #495057;
    color: var(--text-dark);
}

.product-item .quantity-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.product-item .quantity-input {
    width: 40px;
    text-align: center;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.15rem;
    font-size: 0.85rem;
}
[data-bs-theme="dark"] .product-item .quantity-input {
    background: #2a2d33;
    border-color: #495057;
    color: var(--text-dark);
}

.product-item .delete-btn {
    color: #dc3545;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.product-item .delete-btn:hover {
    transform: scale(1.2);
}

/* Collapse toggle */
.collapse-toggle .collapse-chevron {
    transition: transform 0.3s ease;
    display: inline-block;
}
.collapse-toggle[aria-expanded="true"] .collapse-chevron {
    transform: rotate(180deg);
}

/* Order Summary */
.order-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}
[data-bs-theme="dark"] .order-summary {
    background: linear-gradient(135deg, #1a1d23 0%, #25282e 100%);
}

.order-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #dee2e6;
}
[data-bs-theme="dark"] .order-summary .summary-row {
    border-bottom-color: #2a2d33;
}

.order-summary .summary-row:last-child {
    border-bottom: none;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.order-summary .discount-badge {
    background: var(--accent-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.order-summary .cupon-row {
    color: var(--bs-success);
}

.order-summary .cupon-badge {
    background: var(--bs-success);
}

[data-bs-theme="dark"] .order-summary .cupon-row {
    color: #75b798;
}

/* Form Controls */
.form-floating > label {
    color: var(--text-muted);
}

.form-control, .form-select {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background: #2a2d33;
    border-color: #495057;
    color: var(--text-dark);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.15);
}

.form-control.is-invalid, .form-select.is-invalid {
    border-color: #dc3545;
}

/* Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border: none;
    border-radius: 8px;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(25, 135, 84, 0.3);
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 135, 84, 0.4);
}

.btn-primary-custom:active {
    transform: translateY(0);
}

/* Icons */
.icon-box {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(25, 135, 84, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.6rem;
    font-size: 0.85rem;
}

/* Modal */
.modern-modal .modal-content {
    border: none;
    border-radius: var(--border-radius);
}
[data-bs-theme="dark"] .modern-modal .modal-content {
    background: #1a1d23;
    color: var(--text-dark);
}

.modern-modal .modal-header {
    border-bottom: none;
}

.modern-modal .modal-footer {
    border-top: none;
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* User Info */
.user-info-card {
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.05) 0%, rgba(32, 201, 151, 0.1) 100%);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.user-info-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
}

.user-info-item i {
    color: var(--primary-color);
    margin-right: 0.75rem;
}

/* Empty Cart */
.empty-cart {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-cart i {
    font-size: 5rem;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: 6px;
}
[data-bs-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #2a2d33 25%, #3a3d43 50%, #2a2d33 75%);
    background-size: 200% 100%;
}
@keyframes skeletonPulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-product-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    background: var(--bg-light);
}
.skeleton-product-item .skeleton-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    flex-shrink: 0;
}
.skeleton-product-item .skeleton-text {
    flex: 1;
    margin-left: 1rem;
}
.skeleton-product-item .skeleton-text .skeleton-line {
    height: 14px;
    margin-bottom: 8px;
    width: 60%;
}
.skeleton-product-item .skeleton-text .skeleton-line.short {
    width: 35%;
}
.skeleton-product-item .skeleton-qty {
    width: 120px;
    height: 35px;
    border-radius: 6px;
    flex-shrink: 0;
}
.skeleton-product-item .skeleton-price {
    width: 80px;
    height: 24px;
    border-radius: 6px;
    margin-left: 1rem;
    flex-shrink: 0;
}

/* Skeleton for checkout forms */
.skeleton-form-group {
    margin-bottom: 1rem;
}
.skeleton-form-group .skeleton-label {
    height: 14px;
    width: 30%;
    margin-bottom: 6px;
}
.skeleton-form-group .skeleton-input {
    height: 50px;
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .product-item {
        flex-wrap: wrap;
    }
    
    .product-item .product-info {
        margin-left: 0;
        margin-top: 1rem;
        flex: 100%;
    }
    
    .product-item .product-quantity {
        margin-top: 0.5rem;
    }
}

/* Mobile-first refinements (checkout/cart mobile layout) */
@media (max-width: 575.98px) {
    .pay-grid {
        grid-template-columns: 1fr;
    }
    .pay-card {
        min-height: 0;
        padding: 0.7rem 0.85rem;
        gap: 0.65rem;
    }
    .pay-logo {
        width: 36px;
        height: 36px;
    }
    .order-summary {
        padding: 1rem;
    }
    .order-summary .summary-row {
        font-size: 0.9rem;
        gap: 1rem;
    }
    .order-summary .summary-row:last-child {
        font-size: 1.1rem;
    }
    .product-item {
        padding: 0.5rem 0.6rem;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    .product-item .product-image {
        width: 48px;
        height: 48px;
    }
    .product-item .product-info {
        margin-left: 0;
        flex: 1 1 100%;
    }
    .product-item .product-quantity {
        width: 100%;
        justify-content: space-between;
    }
    .step-navigation .btn {
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
        white-space: normal;
    }
    .modern-card .card-header {
        padding: 0.9rem 1rem;
    }
    .modern-card .card-body {
        padding: 1rem;
    }
}

/* Touch-friendly hit areas (mobile) */
@media (pointer: coarse) {
    .stepper-item .step-counter {
        width: 44px;
        height: 44px;
    }
    .quantity-btn {
        width: 32px;
        height: 32px;
    }
}

/* Toast custom styles */
.toast-container {
    font-family: 'Poppins', sans-serif;
}

.bg-success {
    background-color: var(--primary-color) !important;
}

.bg-danger {
    background-color: #dc3545 !important;
}

.toast {
    min-width: 250px;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
}

.toast-header {
    border-radius: 8px 8px 0 0;
}

.toast-body {
    background: white;
    border-radius: 0 0 8px 8px;
    padding: 1rem;
}

/* Dark mode toggle button */
.dark-mode-toggle {
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.dark-mode-toggle:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
}
.dark-mode-toggle:active {
    transform: scale(0.95);
}
.dark-mode-toggle i {
    font-size: 1.1rem;
}
[data-bs-theme="dark"] .dark-mode-toggle {
    background: rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.15);
}

/* Coupon quick-apply buttons */
.coupon-quick {
    background: #ff7900;
    border: 1px solid #d65f00;
    color: #241200;
    font-weight: 700;
    font-size: 0.8rem;
    min-height: 36px;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}
.coupon-quick:hover, .coupon-quick:focus-visible {
    background: #e86a00;
    border-color: #923e00;
    color: #1c0d00;
}
.coupon-quick:focus-visible {
    outline: 3px solid #ff7900;
    outline-offset: 3px;
}

/* Sticky sidebar for step 2 */
.sticky-sidebar {
    position: sticky;
    top: 1.5rem;
}
@media (max-width: 991.98px) {
    .sticky-sidebar {
        position: static;
    }
}

/* Payment method cards */
.pay-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}
.pay-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    background: #fff;
}
[data-bs-theme="dark"] .pay-card {
    background: #1a1d23;
    border-color: #2d323b;
}
.pay-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-sm);
}
.pay-card.selected {
    border-color: var(--primary-color);
    background: rgba(25, 135, 84, 0.06);
    box-shadow: var(--shadow-sm);
}
.pay-card .pay-logo {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #f1f3f7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--text-muted);
    overflow: hidden;
}
[data-bs-theme="dark"] .pay-card .pay-logo {
    background: #262b33;
}
.pay-card .pay-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}
.pay-card .pay-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.pay-card .pay-info strong {
    font-size: 0.95rem;
    color: var(--text-dark);
}
.pay-card .pay-info small {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.pay-card .pay-check {
    font-size: 1.3rem;
    color: #cbd5e1;
    transition: color 0.2s ease, transform 0.2s ease;
}
.pay-card.selected .pay-check {
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Smaller summary for sidebar */
.sticky-sidebar .order-summary {
    padding: 1rem;
}
.sticky-sidebar .order-summary .summary-row {
    padding: 0.5rem 0;
    font-size: 0.9rem;
}
.sticky-sidebar .order-summary .summary-row:last-child {
    font-size: 1.1rem;
}

/* Carrito compacto, sin alturas forzadas ni solapamientos en pantallas bajas. */
body.checkout-page{margin:0;padding:0;min-height:100dvh}
.checkout-page .checkout-header{padding:16px 0;margin-bottom:20px}
.checkout-page .checkout-header h1{font-size:clamp(21px,2.3vw,28px);margin:0;line-height:1.3}
.checkout-page .empty-cart{padding:clamp(24px,5vh,48px) 16px}
.checkout-page .empty-cart i{font-size:clamp(40px,7vw,64px)}
.checkout-page .empty-cart h3{font-size:22px}
.checkout-page .sticky-sidebar{top:16px}
@media(max-width:767px){.checkout-page .checkout-header .row{gap:12px}.checkout-page .checkout-header{padding:12px 0;margin-bottom:16px}.checkout-page .container{padding-left:12px;padding-right:12px}}
@media(max-height:700px){.checkout-page .sticky-sidebar{position:static}}

/* Resumen compacto: identidad a la izquierda, contacto a la derecha. */
.checkout-client-summary .card-body { padding: 12px 16px; }
.checkout-client-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.checkout-client-identity, .checkout-client-contact { min-width: 0; overflow-wrap: anywhere; }
.checkout-client-identity h2 { margin: 0 0 8px; }
.checkout-client-contact { display: grid; gap: 6px; }
.checkout-client-hint { margin-top: 8px; }
#step2 > .row { --bs-gutter-y: 10px; }
@media (max-width: 360px) {
    .checkout-client-summary .card-body { padding: 12px; }
    .checkout-client-grid { column-gap: 8px; }
}

/* Productos del carrito: distribución compacta y controles táctiles. */
#step1 { max-width: 1080px; margin-inline: auto; }
#step1 .modern-card { border: 1px solid #e1e7e5; box-shadow: 0 4px 18px rgb(24 52 41 / 7%); margin-bottom: 14px; }
#step1 .card-header { gap: 8px; padding: 14px 16px; flex-wrap: wrap; }
#step1 .card-header .icon-box { width: 30px; height: 30px; font-size: 16px; flex-shrink: 0; }
#step1 .cart-heading { flex: 1; font-size: 15px; line-height: 1.3; }
#step1 .card-header .btn { margin: 0!important; min-height: 36px; }
#step1 #cartItemCount { font-size: 11px; white-space: nowrap; }
#step1 .card-body { padding: 12px 16px; }
#step1 .product-item { display: grid; grid-template-columns: 60px minmax(0,1fr) minmax(110px,auto) auto 40px; grid-template-areas: 'image info subtotal quantity remove'; align-items: center; gap: 12px; padding: 12px; margin: 0 0 10px; border: 1px solid #e2e8e5; border-radius: 12px; background: #fff; transform: none; }
#step1 .product-item:hover { transform: none; background: #f8fbf9; }
#step1 .product-image { grid-area: image; width: 60px; height: 60px; object-fit: contain; background: #f5f6f7; }
#step1 .product-info { grid-area: info; min-width: 0; margin: 0; width: auto; }
#step1 .product-name { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; white-space: normal; }
#step1 .product-info .product-price { font-size: 13px; margin-top: 4px; }
#step1 .cart-line-total { grid-area: subtotal; min-width: 0; text-align: right; }
#step1 .cart-line-total small { display: block; color: var(--text-muted); font-size: 11px; }
#step1 .cart-line-total .product-price { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#step1 .product-quantity { grid-area: quantity; display: flex; justify-content: flex-end; gap: 0; margin: 0; width: auto; }
#step1 .quantity-btn { width: 38px; height: 40px; border: 1px solid #dce4df; border-radius: 8px; background: #f6f8f7; color: var(--text-dark); }
#step1 .quantity-input { width: 44px; height: 40px; border: 0; background: transparent; font-size: 16px; font-weight: 600; padding: 0; appearance: textfield; }
#step1 .quantity-input::-webkit-inner-spin-button, #step1 .quantity-input::-webkit-outer-spin-button { appearance: none; margin: 0; }
#step1 .cart-remove { grid-area: remove; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #fee2e2; border-radius: 9px; background: #fff4f4; color: #c93547; padding: 0; }
#step1 button:focus-visible, #step1 a:focus-visible { outline: 3px solid var(--primary-color); outline-offset: 3px; }
#step1 .cart-total { display: flex; align-items: baseline; justify-content: flex-end; gap: 12px; border-top: 1px solid #e1e7e5; padding: 16px 0 4px; margin-top: 12px; }
#step1 .cart-step-actions { padding: 0 0 18px; }
#step1 .cart-step-actions .btn { min-height: 46px; padding: 10px 24px; }
#step1 .cart-keep-shopping { color: var(--primary-color); font-size: 14px; font-weight: 500; text-decoration: none; }
[data-bs-theme="dark"] #step1 .product-item { background: #1d242b; border-color: #39444b; }
[data-bs-theme="dark"] #step1 .quantity-btn { background: #29323a; border-color: #49545b; }
[data-bs-theme="dark"] #step1 .cart-remove { background: #3b252c; border-color: #69404a; color: #ffabb7; }
@media (max-width: 767px) {
 #step1 .card-body { padding: 10px; }
 #step1 .card-header { padding: 12px 10px; gap: 6px; }
 #step1 .cart-heading { font-size: 13px; }
 #step1 .card-header .icon-box { display: none; }
 #step1 .card-header .btn { font-size: 12px; padding: 4px 7px; }
 #step1 .product-item { grid-template-columns: 40px minmax(0,1fr) auto; grid-template-areas: 'image info info' 'remove subtotal quantity'; gap: 10px 8px; padding: 10px; }
 #step1 .product-image { width: 40px; height: 44px; }
 #step1 .product-name { font-size: 13px; }
 #step1 .cart-line-total { text-align: right; }
 #step1 .cart-line-total .product-price { font-size: 14px; }
 #step1 .cart-line-total small { display: none; }
 #step1 .quantity-btn { width: 34px; }
 #step1 .quantity-input { width: 36px; }
 #step1 .cart-remove { width: 36px; }
 #step1 .cart-total { padding: 12px 2px 4px; }
 #step1 .cart-step-actions .btn { padding-inline: 16px; }
 #step1 .cart-keep-shopping { font-size: 12px; }
}
@media (max-width: 359px) {
 #step1 .product-item { gap: 8px 5px; padding: 8px; }
 #step1 .quantity-btn { width: 30px; }
 #step1 .quantity-input { width: 30px; }
 #step1 .cart-line-total .product-price { font-size: 12px; }
 #step1 #cartItemCount { font-size: 10px; }
}
/* Tipografía de lectura nítida para descripciones e importes del carrito. */
#step1, #step1 * { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

/* Checkout compacto: más espacio útil sin reducir los controles de cantidad. */
.checkout-page .checkout-header { padding: 10px 0; margin-bottom: 8px; }
.checkout-page .checkout-header h1 { font-size: clamp(19px, 2.2vw, 25px); line-height: 1.2; }
.checkout-page .stepper-wrapper { margin: 10px 0 14px; padding-block: 0; }
.checkout-page .stepper-item { min-height: 40px; }
.checkout-page .stepper-item .step-counter { width: 34px; height: 34px; border-width: 2px; font-size: 13px; }
@media (max-width: 767px) {
 .checkout-page .checkout-header { padding: 8px 0; margin-bottom: 4px; }
 .checkout-page .checkout-header .row { row-gap: 4px; }
 .checkout-page .checkout-header h1 { font-size: 19px; line-height: 1.2; }
 .checkout-page .checkout-header .dark-mode-toggle { min-height: 32px; padding: 4px 10px; font-size: 12px; border-width: 1px; }
 .checkout-page .checkout-header a { font-size: 12px; line-height: 1.3; }
 .checkout-page .stepper-wrapper { margin: 6px 0 10px; }
 .checkout-page .stepper-item { min-height: 40px; }
 .checkout-page .stepper-item .step-counter { width: 30px; height: 30px; font-size: 12px; }
 .checkout-page .stepper-item.active .step-counter { box-shadow: 0 0 0 3px rgb(25 135 84 / 15%); }
 #step1 .card-header { padding-block: 8px; }
 #step1 .card-header .btn { min-height: 32px; }
 #step1 .card-body { padding: 8px; }
 #step1 .product-item { padding: 8px; row-gap: 4px; margin-bottom: 7px; }
 #step1 .product-name { line-height: 1.3; }
 #step1 .product-info .product-price { margin-top: 2px; line-height: 1.3; }
 #step1 .product-image { height: 38px; }
 #step1 .quantity-btn, #step1 .quantity-input, #step1 .cart-remove { height: 40px; }
 #step1 .cart-total { margin-top: 8px; padding-top: 8px; }
 #step1 .modern-card { margin-bottom: 10px; }
 #step1 .cart-step-actions { padding-bottom: 12px; }
}

/* Cabecera visible y texto legible al cambiar de etapa. */
.checkout-page .checkout-header { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: 12px; }
.checkout-page .checkout-header h1 { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: clamp(22px, 2.4vw, 28px); line-height: 1.25; font-weight: 650; }
#step1 .cart-line-total .product-price { font-size: 18px; font-weight: 750; line-height: 1.25; letter-spacing: -.02em; }
@media (max-width: 767px) {
 .checkout-page .checkout-header .row { row-gap: 7px; }
 .checkout-page .checkout-header a { font-size: 13px; }
 .checkout-page .checkout-header .dark-mode-toggle { font-size: 13px; }
 #step1 .cart-line-total .product-price { font-size: clamp(16px, 4.6vw, 18px); }
}
@media (prefers-reduced-motion: reduce) {
 .checkout-page .step-content { animation: none; transition: none; }
}

/* Etapas identificadas y total centrado, con importes junto a la cantidad. */
.checkout-page .stepper-wrapper { justify-content: center; gap: 0; }
.checkout-page .stepper-item .step-name { display: block; margin-left: 7px; white-space: nowrap; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
#step1 .cart-total { justify-content: center; gap: 10px; }
#step1 .cart-total .text-muted { margin-right: 0!important; }
@media (max-width: 767px) {
 .checkout-page .stepper-item .step-name { font-size: 12px; margin-left: 5px; }
 .checkout-page .stepper-item .step-line { width: clamp(12px, 6vw, 36px); margin-inline: 7px; }
 #step1 .product-item { grid-template-columns: 40px minmax(0,1fr) auto; }
 #step1 .cart-line-total { align-self: center; padding-right: 2px; }
}
@media (max-width: 359px) {
 .checkout-page .stepper-item .step-name { font-size: 11px; margin-left: 4px; }
 .checkout-page .stepper-item .step-line { width: 10px; margin-inline: 4px; }
 .checkout-page .stepper-item .step-counter { width: 28px; height: 28px; }
}

/* Acción del carrito accesible incluso con cuatro o más renglones visibles. */
@media (max-width: 767px) {
 .checkout-page #step1 { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
 /* Un transform de la animación crea un contenedor para los elementos fixed. */
 .checkout-page #step1.fade-in { animation: none; transform: none; }
 .checkout-page #step1 .cart-step-actions {
  position: fixed;
  z-index: 1030;
  inset-inline: 0;
  bottom: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px max(12px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px))!important;
  border-top: 1px solid #dce6e0!important;
  border-radius: 16px 16px 0 0;
  background: #fff!important;
  box-shadow: 0 -4px 18px rgb(24 52 41 / 10%);
 }
 .checkout-page #step1 .cart-step-actions > div { max-width: 720px; margin-inline: auto; min-width: 0; }
 .checkout-page #step1 .cart-step-actions .btn { flex-shrink: 0; min-height: 48px; margin: 0; line-height: 1.25; }
 .checkout-page #step1 .cart-keep-shopping { min-width: 0; line-height: 1.4; }
 [data-bs-theme="dark"] .checkout-page #step1 .cart-step-actions { background: #1a1d23!important; border-color: #39444b!important; }
}

/* Límites por dispositivo y resumen único junto a la acción de avanzar. */
#step1 [hidden] { display: none!important; }
#step1 .cart-checkout-bar { display: grid!important; grid-template-columns: minmax(0,1fr) auto; gap: 8px 16px; align-items: center; }
#step1 .cart-footer-total { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap:2px; color: var(--text-dark); }
#step1 .cart-footer-total > span { font-size: 12px; font-weight:600; color: var(--text-muted); }
#step1 .cart-footer-total strong { color: var(--primary-color); font-family:system-ui,-apple-system,"Segoe UI",sans-serif; font-size: clamp(22px, 3vw, 28px); line-height: 1.2; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#step1 .cart-checkout-bar .btn { grid-column: 2; grid-row: 1; }
#step1 .cart-checkout-bar .cart-keep-shopping { grid-column:1/-1;display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:8px 12px;border:1px solid var(--border-color,#dce6e0);border-radius:10px;background:var(--bg-light,#f8f9fa);color:var(--text-dark);font-size:14px;font-weight:600;text-align:center;text-decoration:none;touch-action:manipulation; }
#step1 .cart-keep-shopping:hover { border-color:var(--primary-color); }
#step1 .cart-keep-shopping:focus-visible { outline:3px solid var(--primary-color);outline-offset:2px; }
@media (max-width: 767px) {
 #step1:not(.cart-expanded) .cart-extra-mobile { display: none!important; }
 .checkout-page #step1 { padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px)); }
 #step1 .cart-footer-total { align-items: flex-start; }
 #step1 .cart-footer-total strong { font-size: clamp(22px, 5.4vw, 26px); }
 #step1 .cart-checkout-bar .btn { padding-inline: 16px; }
}
@media (min-width: 768px) { #step1:not(.cart-expanded) .cart-extra-desktop { display: none!important; } }

/* Aviso de retiro configurable, visible sólo para la forma de retiro seleccionada. */
.checkout-retirement-notice[hidden]{display:none!important}
.checkout-retirement-notice:not([hidden]){display:flex;align-items:flex-start;gap:12px;min-width:0;margin:0 0 16px;padding:20px;border:1px solid #fdba74;border-left:4px solid #f97316;border-radius:14px;background:#fff7ed;color:#9a3412;box-shadow:0 2px 8px rgba(124,45,18,.04)}
.checkout-retirement-notice>i{font-size:22px;line-height:1.3;flex-shrink:0}
.checkout-retirement-notice strong{display:block;margin-bottom:7px;font-size:15px}
.checkout-retirement-notice p{margin:0;font-size:clamp(15px,1.2vw,18px);font-weight:600;line-height:1.6;white-space:pre-line;overflow-wrap:anywhere}
[data-bs-theme="dark"] .checkout-retirement-notice{background:#34251b;border-color:#c77625;color:#ffdfba}
@media(max-width:767px){.checkout-retirement-notice:not([hidden]){gap:10px;padding:14px;margin-bottom:12px}.checkout-retirement-notice p{font-size:15px;line-height:1.5}}

/* Paso 2: navegación siempre accesible y espacio real debajo del contenido. */
.checkout-date-trigger{display:flex;align-items:center;justify-content:space-between;text-align:left;gap:8px}
.checkout-date-trigger>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.checkout-date-trigger>i{color:var(--primary-color);flex-shrink:0}
@media(max-width:991px){
 #step2{padding-bottom:var(--checkout-step2-footer-space,calc(108px + env(safe-area-inset-bottom,0px)))}
 #step2.fade-in{animation:none!important;transform:none!important}
 .checkout-page #step2 .checkout-step2-actions{
  position:fixed;inset-inline:0;bottom:0;z-index:1030;width:100%;margin:0;
  display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);gap:12px;
  padding:10px max(12px,env(safe-area-inset-right,0px)) calc(12px + env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px));
  border-top:1px solid #dce6e0;border-radius:16px 16px 0 0;background:#fff;
  box-shadow:0 -4px 18px rgb(24 52 41 / 9%);
 }
 #step2 .checkout-step2-actions .btn{min-height:48px;margin:0;font-size:15px;line-height:1.25;padding:10px 14px;white-space:nowrap}
 #step2 :is(input,select,textarea,.checkout-date-trigger){scroll-margin-block:20px calc(var(--checkout-step2-footer-space,108px) + 16px)}
 #step2 .modern-card{margin-bottom:0}
 #step2 .modern-card .card-header{padding:6px 10px;font-size:14px;gap:6px}
 #step2 .card-header .icon-box{width:24px;height:24px;font-size:14px;flex-shrink:0;margin-right:0}
 #step2 .modern-card .card-body{padding:8px 10px}
 #step2 > .row{--bs-gutter-y:6px}
 #step2 > .row.mt-2{margin-top:0!important}
 #step2 .row.g-3{--bs-gutter-x:8px;--bs-gutter-y:6px}
 #step2 .sticky-sidebar:empty{display:none}
 #step2 > .row > .col-lg-5:has(>.sticky-sidebar:empty){display:none}
 #step2 .form-floating>.form-control,#step2 .form-floating>.form-select{height:50px;min-height:50px;font-size:15px;line-height:1.3}
 #step2 .form-floating>.form-control:not(:placeholder-shown),#step2 .form-floating>.form-select{padding-top:23px;padding-bottom:7px}
 #step2 .form-floating>.checkout-date-trigger{padding:23px 12px 7px}
 #step2 .form-floating>label{font-size:14px;padding-inline:12px}
 #step2 .order-summary{padding:6px 8px}
 #step2 .order-summary .summary-row{font-size:14px;padding-block:4px}
 #step2 .summary-row[data-role="total"]{font-size:18px}
 #step2 .checkout-client-summary .card-body{padding:8px 10px}
 #step2 .checkout-client-grid{gap:6px}
 #step2 .checkout-client-identity h2{margin-bottom:4px}
 #step2 .checkout-client-contact{gap:3px}
 #step2 .checkout-client-hint{margin-top:4px;font-size:12px}
 [data-bs-theme="dark"] .checkout-page #step2 .checkout-step2-actions{background:#1a1d23;border-color:#39444b}
 [data-bs-theme="dark"] .checkout-page #step2 .checkout-step2-actions .btn-outline-secondary{color:#dfebe4;border-color:#708d7d;background:transparent}
}
@media(max-width:767px){
 #step2 .checkout-guest-info .col-md-6{width:50%}
 #step2 .row.g-3>.col-md-6:has(#id-forma-entrega),
 #step2 .row.g-3>.col-md-6:has(#id-fecha-envio){width:50%;min-width:0}
 #step2 .form-floating:has(#id-forma-entrega)>label,
 #step2 .form-floating:has(#id-fecha-envio)>label{font-size:12px;padding-inline:8px}
 #step2 #id-forma-entrega{padding-left:8px;padding-right:26px;font-size:13px}
 #step2 .form-floating>.checkout-date-trigger{padding-inline:8px;font-size:14px}
 #step2 .order-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 6px}
 #step2 .order-summary .summary-row{flex-direction:column;align-items:flex-start;gap:3px;border-bottom:0;font-size:12px;min-width:0}
 #step2 .order-summary .summary-row>span:last-child{font-size:14px;overflow-wrap:anywhere}
 #step2 .order-summary .discount-badge{font-size:10px;margin-left:2px;padding:2px 4px;white-space:nowrap}
 #step2 .order-summary .summary-row[data-role="descuento"]>span:first-child{white-space:nowrap}
 #step2 .order-summary .summary-row[data-role="cupon"],
 #step2 .order-summary .summary-row[data-role="total"]{grid-column:1/-1;flex-direction:row;align-items:center;border-top:1px solid #dce6e0;margin-top:4px;padding-top:6px}
 #step2 .order-summary .summary-row[data-role="total"],
 #step2 .order-summary .summary-row[data-role="total"]>span:last-child{font-size:18px}
 #step2 #couponSection:has(#codigoCupon){display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;align-items:center}
 #step2 #couponSection>.form-label{grid-column:1;grid-row:1;margin-bottom:0!important;font-size:12px}
 #step2 #couponSection>.input-group{grid-column:1/-1;grid-row:2}
 #step2 #couponSection>[role="group"]{grid-column:2;grid-row:1;margin-top:0!important;justify-content:flex-end}
 #step2 #mensajeCupon{grid-column:1/-1;margin-top:0!important}
 #step2 #mensajeCupon:empty{display:none}
}

/* Calendario propio: un toque selecciona el día y cierra, sin Aceptar. */
.checkout-date-dialog{
 box-sizing:border-box;width:min(370px,calc(100vw - 24px));max-width:calc(100vw - 24px);
 max-height:calc(100dvh - 24px);margin:auto;padding:16px;border:1px solid #dbe7e1;
 border-radius:20px;background:#fff;color:#18312a;box-shadow:0 24px 80px rgb(15 23 42 / 25%);
 font-family:system-ui,-apple-system,"Segoe UI",sans-serif;overflow:auto;
}
.checkout-date-dialog::backdrop{background:rgb(15 23 42 / 45%)}
.checkout-calendar-header{display:grid;grid-template-columns:40px minmax(0,1fr) 40px 36px;gap:4px;align-items:center}
.checkout-calendar-header h2{margin:0;font-size:17px;font-weight:700;text-align:center;text-transform:capitalize}
.checkout-date-dialog button{font:inherit;border:0;cursor:pointer;touch-action:manipulation}
.checkout-calendar-header button{width:36px;height:40px;border-radius:10px;background:#edf5f0;color:#14543b;font-size:25px}
.checkout-date-dialog #checkoutDateHint{margin:10px 0 12px;font-size:13px;color:#52665e;text-align:center}
.checkout-date-dialog table{width:100%;table-layout:fixed;border-collapse:separate;border-spacing:2px}
.checkout-date-dialog th{padding:7px 0;font-size:12px;font-weight:600;color:#607368;text-align:center}
.checkout-date-dialog td{padding:0;text-align:center}
.checkout-date-dialog td button{width:100%;min-height:40px;padding:4px 0;border-radius:10px;background:transparent;color:#18312a;font-size:15px;font-weight:500}
.checkout-date-dialog td button.is-outside{color:#5b6c62}
.checkout-date-dialog td button[aria-current="date"]{box-shadow:inset 0 0 0 1px #16a36b;font-weight:700}
.checkout-date-dialog td button.is-selected{background:#147b50;color:#fff;font-weight:700}
.checkout-date-dialog button:focus-visible{outline:3px solid #318bda;outline-offset:1px}
.checkout-date-dialog button:hover{filter:brightness(.95)}
.checkout-date-dialog button:disabled{opacity:.4;cursor:default}
.checkout-calendar-actions{display:flex;justify-content:space-between;gap:12px;border-top:1px solid #e1e9e4;padding-top:12px;margin-top:10px}
.checkout-calendar-actions button{min-height:42px;padding:8px 14px;border-radius:10px;background:#edf5f0;color:#14543b;font-size:14px;font-weight:600}
[data-bs-theme="dark"] .checkout-date-dialog{background:#1d2722;border-color:#435b4d;color:#e9f5ee}
[data-bs-theme="dark"] .checkout-date-dialog :is(#checkoutDateHint,th){color:#b1c6ba}
[data-bs-theme="dark"] .checkout-date-dialog td button{color:#e9f5ee}
[data-bs-theme="dark"] .checkout-date-dialog td button.is-outside{color:#91a79b}
[data-bs-theme="dark"] .checkout-date-dialog td button.is-selected{background:#147b50;color:#fff}
[data-bs-theme="dark"] :is(.checkout-calendar-header,.checkout-calendar-actions) button{background:#304539;color:#e5f5ec}
@media(max-height:500px){.checkout-date-dialog{padding:10px}.checkout-date-dialog td button{min-height:32px}.checkout-date-dialog #checkoutDateHint{margin-block:5px}}


