/* ============================================
   NUEVA DEVOLUCION VIEW
   ============================================ */

.view-nueva-devolucion {
    display: none;
}

/* Progress Steps */
.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    padding: 0 20px;
    position: relative;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.progress-step.active .step-circle {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
    animation: stepBounce 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) 0.55s both;
}

@keyframes stepBounce {
    0% { transform: scale(0.8); }
    40% { transform: scale(1.25); }
    60% { transform: scale(0.9); }
    80% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.progress-step.completed .step-circle {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
}

.step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    max-width: 80px;
}

.progress-step.active .step-label {
    color: var(--primary-green);
}

/* MEJORA 4: Summary modal override */
.modal-overlay .modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    justify-content: flex-end;
}
.modal-overlay .btn-secondary {
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
}
.modal-overlay .btn-primary-action {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    background: var(--primary-green);
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Form Steps */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
}

.step-card {
    background: white;
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}
#step1 .step-card,
#step2 .step-card {
    border-radius: 0;
}

.step-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.step-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-label.required::after {
    content: ' *';
    color: #F44336;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px rgba(124, 179, 66, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-secondary,
.btn-primary-action {
    flex: 1;
    padding: 16px 24px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary {
    background: white;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-main);
    border-color: var(--primary-green);
    color: var(--primary-green);
}

.btn-primary-action {
    background: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
}

.btn-primary-action:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-primary-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.success-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* ============================================
   STEP ACTIONS TOP
   ============================================ */

.step-actions-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.step-counter {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-top-action {
    padding: 10px 16px;
    border-radius: 12px;
    border: 2px solid;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 14px;
}

.btn-top-action svg {
    flex-shrink: 0;
}

.btn-cancel {
    background: white;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-cancel:hover,
/* El "Cancelar" de los modales, con el mismo efecto que el del asistente */
.btn-secondary[data-accion="cancelar"]:hover,
#confirmCancel:hover {
    background: #FFF5F5;
    border-color: #F44336;
    color: #F44336;
}

/* Mismo color que "Nueva devolución": marca el paso siguiente */
.btn-next {
    background: var(--cta);
    border-color: var(--cta);
    color: white;
}

.btn-next:hover {
    background: var(--cta-dark);
    border-color: var(--cta-dark);
}

.btn-send {
    background: #1976D2;
    border-color: #1976D2;
    color: white;
}
.btn-send:hover {
    background: #1565C0;
    border-color: #1565C0;
}

/* ============================================
   CLIENT SELECTOR
   ============================================ */

.client-selector-wrapper {
    display: flex;
}

.client-select-container {
    flex: 1;
    position: relative;
}

.client-search-input {
    width: 100%;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.input-with-button .client-search-input {
    border-radius: 12px 0 0 12px;
    border-right: none;
}

.client-search-input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px rgba(124, 179, 66, 0.1);
}

.client-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    z-index: 100;
    display: none !important;
    height: 0 !important;
    border: none !important;
    box-shadow: none !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

.client-dropdown.open {
    display: block !important;
    height: auto !important;
    max-height: 300px;
    border: 2px solid var(--border-color) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    visibility: visible !important;
    -webkit-overflow-scrolling: touch;
}

.dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

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

.dropdown-item:hover {
    background: var(--bg-main);
}

.dropdown-item.selected,
.dropdown-item.highlighted {
    background: rgba(124, 179, 66, 0.1);
    border-left: 4px solid var(--primary-green);
}

.dropdown-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.dropdown-item-main strong {
    font-size: 14px;
    color: var(--text-primary);
}

.dropdown-code {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 600;
}

.dropdown-item-sub {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.dropdown-item-sub svg {
    flex-shrink: 0;
}

/* ============================================
   STEP 1 EMPTY STATE
   ============================================ */

.step1-empty-state {
    background: var(--bg-card);
    border: none;
    border-radius: 0;
    padding: 44px 20px;
    margin-top: 16px;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
}

.step1-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--bg-main);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    margin-bottom: 14px;
}

.step1-empty-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.step1-empty-subtitle {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   SELECTED CLIENT DISPLAY (Paso 1)
   ============================================ */

.selected-client {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 18px;
    margin-top: 16px;
}

.selected-client-top {
    margin-bottom: 14px;
}

.selected-client-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.selected-client-subtitle {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.selected-client-list {
    background: transparent;
    border-radius: 12px;
    overflow: hidden !important;
}

.selected-client-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px dashed rgba(124, 179, 66, 0.18);
}

.selected-client-row:first-child {
    border-top: none;
}

.selected-client-row-icon {
    width: 22px;
    color: var(--primary-green);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selected-client-row-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    word-break: break-word;
}

.selected-client-row-text.strong {
    font-weight: 800;
}

.selected-client-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.btn-change-client {
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-dark));
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(124, 179, 66, 0.18);
}

.btn-change-client:hover {
    background: linear-gradient(135deg, var(--primary-dark), #33691E);
}

/* ============================================
   MANUAL ENTRY FULLSCREEN VIEW
   ============================================ */

.manual-entry-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-main);
    z-index: 9000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.manual-entry-view.active {
    display: flex !important;
    animation: entraDerecha 0.3s ease;
}

/* Sin deslizamiento cuando se abre con el foco ya puesto (ver
   openManualProductView): si no, el cursor viaja con la pantalla */
.manual-entry-view.active.sin-animacion {
    animation: none;
}

.manual-entry-header {
    background: white;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-soft);
}

.manual-entry-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    text-align: center;
    flex: 1;
}

.btn-back {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bg-main);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: var(--border-color);
}

.manual-entry-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.manual-entry-content {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

/* Lot photo row layout */
.lot-photo-row {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.lot-photo-slot {
    flex: 1;
    min-height: 180px;
}

.lot-photo-slot .photo-upload-label {
    min-height: 180px;
}

.lot-photo-slot .photo-preview {
    min-height: 180px;
}

.lot-photo-slot .photo-preview img {
    max-height: 180px;
    object-fit: cover;
}

.lot-photo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    flex-shrink: 0;
}

/* ============================================
   QUICK EDIT MODALS
   ============================================ */

.quick-edit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.quick-edit-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.quick-edit-modal {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.quick-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.quick-edit-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.quick-edit-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.quick-edit-body {
    padding: 20px;
}

.quick-edit-product {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
    font-weight: 600;
}

.quick-edit-footer {
    padding: 0 20px 20px;
    display: flex;
    justify-content: flex-end;
}

.quick-edit-footer .btn-save-line {
    flex: 1;
    justify-content: center;
}

.lot-photo-viewer-modal {
    max-width: 500px;
}

.lot-photo-viewer-img img {
    /* Al ancho de la ventana (una foto pequeña salía a su tamaño, diminuta) */
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 60vh;
    border-radius: 12px;
    object-fit: contain;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   PHOTO UPLOAD GRID (Step 3)
   ============================================ */

.photo-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.photo-upload-wrapper {
    display: flex;
    flex-direction: column;
}

.photo-upload-slot {
    border-radius: 14px;
    border: 1.5px solid var(--border-color);
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.slot-title {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.slot-title svg { color: var(--text-secondary); }

.photo-upload-label {
    width: 100%;
    min-height: 220px;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-light);
    padding: 20px;
    flex: 1;
}

.photo-upload-label:hover {
    background: #F0FFF4;
}

.photo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 220px;
    background: #F8FAFC;
    flex: 1;
}

.photo-preview img {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
}

/* Buttons outside the card */
.slot-actions-outside {
    display: flex;
    flex-wrap: wrap; /* Cámara, Galería y Quitar: en columnas estrechas bajan de línea */
    justify-content: center;
    gap: 8px;
    padding: 8px 0 0;
}

/* Mismo tamano que .btn-clear-signature (9/16 de relleno, 13px de texto,
   6 de separacion e icono de 16): son botones del mismo rango dentro del
   formulario y no habia motivo para que estos fueran mas pequenos. */
.btn-slot-outside {
    padding: 9px 16px;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    background: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-slot-outside svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-slot-outside.btn-slot-attach {
    color: var(--primary-green);
    border-color: var(--primary-green);
}

.btn-slot-outside.btn-slot-attach:hover {
    background: #F0FFF4;
}

.btn-slot-outside.btn-slot-remove {
    color: #EF4444;
    border-color: #FCA5A5;
}

.btn-slot-outside.btn-slot-remove:hover {
    background: #FFF5F5;
}

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

/* ============================================
   SIGNATURES (Step 4)
   ============================================ */

.signatures-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.signature-card {
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    background: white;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.signature-card-header {
    padding: 14px 16px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.signature-card-header svg {
    color: var(--primary-green);
    flex-shrink: 0;
}

.signature-disclaimer {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 12px 16px;
    background: #FFFDE7;
    border-bottom: 1px solid #FFF9C4;
    min-height: 56px;
}

.signature-disclaimer svg {
    color: #F59E0B;
    flex-shrink: 0;
    margin-top: 1px;
}

.signature-disclaimer p {
    margin: 0;
    font-size: 12px;
    color: #92400E;
    line-height: 1.5;
    font-weight: 500;
}

.signature-canvas {
    width: calc(100% - 32px);
    height: 240px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    background: white;
    cursor: crosshair;
    touch-action: none;
    margin: 14px 16px 0;
}

.signature-instruction {
    font-size: 12px;
    color: var(--text-light);
    padding: 8px 16px 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    font-style: italic;
}

.signature-instruction svg { color: var(--text-light); }

.btn-clear-signature {
    margin: 10px 16px 14px;
    padding: 9px 16px;
    border-radius: 10px;
    background: white;
    border: 1.5px solid #FCA5A5;
    color: #EF4444;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    align-self: center;
}

.btn-clear-signature:hover {
    border-color: #EF4444;
    background: #FFF5F5;
}

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

/* ============================================
   BULTOS (Step 5) - Pill selector & cards
   ============================================ */
.pill-selector {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.pill-option {
    flex: 1;
    padding: 12px 8px;
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    background: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    text-align: center;
}

.pill-option:hover {
    border-color: var(--primary-green);
}

.pill-option.active {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
}

.etiqueta-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 4px;
}

.etiqueta-option {
    padding: 20px;
    border-radius: 14px;
    border: 2px solid var(--border-color);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.etiqueta-option span {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.etiqueta-option svg { color: var(--text-secondary); }

.etiqueta-option:hover {
    border-color: var(--primary-green);
}

.etiqueta-option.active {
    border-color: var(--primary-green);
    background: #F0FFF4;
}

.etiqueta-option.active svg {
    color: var(--primary-green);
}

.etiqueta-option.active span {
    color: var(--primary-green);
}

.bultos-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.bultos-list.bultos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

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

.bulto-card {
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: white;
}

.bulto-card-header {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
}

.bulto-card-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bulto-input {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    font-size: 14px;
    font-weight: 500;
    background: white;
    width: 100%;
    box-sizing: border-box;
}

.bulto-input:focus {
    outline: none;
    border-color: var(--primary-green);
}

.bulto-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-slot-action {
    padding: 9px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Igualado a .btn-clear-signature, como .btn-slot-outside. */
.btn-slot-action svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-slot-action.btn-slot-attach { color: var(--primary-green); border-color: var(--primary-green); }
.btn-slot-action.btn-slot-attach:hover { background: #F0FFF4; }
.btn-slot-action.btn-slot-remove { color: #EF4444; border-color: #FCA5A5; }
.btn-slot-action.btn-slot-remove:hover { background: #FFF5F5; }

.bulto-actions .btn-slot-action {
    flex: 0;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 9px 16px;
}

.bulto-actions .btn-slot-remove {
    border-color: #FCA5A5;
}

/* ============================================
   STEP 6 - Form extras
   ============================================ */
.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 6px;
    font-weight: 500;
}

/* Fila con recuadro; la casilla, con el mismo aspecto que "Recordar conexión" del login */
.form-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    /* Ámbar suave, como la banda "Necesita autorizar" del justificante */
    border: 1.5px solid #FDE68A;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #FFFBEB;
}

.form-check-row:hover,
.form-check-row:has(.form-checkbox:checked) {
    border-color: #F59E0B;
}

.form-check-row:has(.form-checkbox:checked) {
    background: #FEF3C7;
}

.form-checkbox {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Sin marcar se tiene que ver sobre el fondo ámbar (el verde claro de
       --border-color casi no se distinguía) */
    border: 2px solid #9CA3AF;
    border-radius: 6px;
    background: white;
    position: relative;
    transition: all 0.3s ease;
}

.form-checkbox:checked {
    background: var(--primary-green);
    border-color: var(--primary-green);
}

/* El tick, centrado igual que en el login (ver login.css) */
.form-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 9px;
    box-sizing: content-box;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

/* Misma letra que las etiquetas de los campos (.form-label) */
.form-check-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}
/* .modal-overlay: en components.css (aquí había una copia sin el z-index) */

/* ============================================
   CONTENT STEP 2 - SUMMARY BAR
   ============================================ */

.content-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 14px;
    margin-bottom: 20px;
    border: 1.5px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* Los totales van a la derecha: son informativos. La accion principal,
   Añadir producto, queda a la izquierda. */
.summary-badges-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex: 1;
}

.summary-item-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #6B7280;
    white-space: nowrap;
}

.summary-item-badge[data-ayuda] {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-radius: 10px;
}

.summary-item-badge[data-ayuda]:focus-visible {
    outline: 3px solid var(--primary-green);
    outline-offset: 3px;
}

.summary-item-badge svg {
    flex-shrink: 0;
    color: #9CA3AF;
}

.badge-label {
    color: #6B7280;
}

/* Pastillas de los totales: los colores de siempre pero en tono suave (fondo
   claro y texto del mismo color), porque son informativas y no deben competir
   con Añadir producto */
.badge-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    min-width: 26px;
    text-align: center;
    transition: transform 0.3s ease;
}

.badge-pill-red {
    background: #FEE2E2;
    color: #B91C1C;
}
.badge-pill-blue {
    background: #DBEAFE;
    color: #1D4ED8;
}
.badge-pill-orange {
    background: #FEF3C7;
    color: #B45309;
}

/* Importe bruto del paso 2 (sin depreciación): gris, el neto sigue en naranja */
.summary-importes { display: flex; align-items: center; gap: 16px; }

.badge-pill-gris {
    background: #F1F3F4;
    color: var(--text-secondary);
}

/* Bounce animation on value change */
@keyframes badgeBounce {
    0%   { transform: scale(1); }
    20%  { transform: scale(1.35); }
    40%  { transform: scale(0.9); }
    60%  { transform: scale(1.15); }
    80%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.badge-pill.bounce {
    animation: badgeBounce 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.btn-add-line-top {
    padding: 10px 22px;
    border-radius: 10px;
    background: #3B82F6;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-add-line-top:hover {
    background: #2563EB;
}
.btn-add-line-top:active {
    transform: scale(0.97);
}

.product-lines-list {
    min-height: 200px;
}

.product-line-card {
    background: white;
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    margin-bottom: 10px;
    transition: all 0.25s ease;
    overflow: hidden;
}

.product-line-card:hover {
    border-color: #CBD5E1;
}

/* === HEADER (collapsed view) === */
.product-line-header {
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.product-line-info {
    flex: 1;
    min-width: 0;
}

.product-line-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    line-height: 1.3;
}

/* Collapsed summary chips */
.product-line-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #9CA3AF;
    font-weight: 600;
}

.summary-chip {
    display: flex;
    align-items: center;
    gap: 3px;
}

.summary-chip.units-chip {
    background: rgba(124, 179, 66, 0.12);
    color: var(--primary-dark);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

/* Línea de un producto o lote en retirada (6.91.0) */
.summary-chip.retirada-chip {
    background: #FEF3C7;
    color: #92400E;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.summary-chip.units-chip svg {
    color: var(--primary-green);
}

.summary-chip svg {
    color: #C0C7D0;
}

.summary-sep {
    color: #E2E8F0;
    font-weight: 400;
}

/* Expand button */
.btn-expand {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--bg-main);
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.btn-expand:hover {
    background: #E2E8F0;
}

.btn-expand svg {
    transition: transform 0.3s ease;
}

.product-line-card.expanded .btn-expand svg {
    transform: rotate(180deg);
}

/* === EXPANDED DETAILS === */
.product-line-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    border-top: 0px solid transparent;
}

.product-line-card.expanded .product-line-details {
    max-height: 800px;
    border-top: 1px solid var(--border-color);
}

.product-line-expanded {
    display: flex;
    gap: 20px;
    padding: 16px;
}

/* Left: data rows */
.product-line-data {
    flex: 1;
    min-width: 0;
    /* Rótulos en una columna del ancho del más largo y datos en otra: antes
       cada rótulo tenía un mínimo fijo y "Código de barras:" o
       "Depreciación (%):" lo pasaban, así que los datos no quedaban alineados */
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 10px;
    align-items: baseline;
}
.product-line-data .data-row {
    display: contents;   /* sus dos celdas van directas a la rejilla */
}
.product-line-data .data-label,
.product-line-data .data-value {
    padding: 3px 0;
    font-size: 13px;
    line-height: 1.6;
}

.data-row {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    padding: 3px 0;
    font-size: 13px;
    line-height: 1.6;
}

.data-label {
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.data-value {
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.data-value strong {
    font-weight: 700;
}

/* Right: action buttons */
.product-line-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    width: 200px;
}

.btn-line-action {
    padding: 8px 16px;
    border-radius: 10px;
    border: 1.5px solid #9CA3AF;
    background: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #4B5563;
    white-space: nowrap;
}

.btn-line-action:hover {
    background: var(--bg-main);
    border-color: #6B7280;
}

.btn-line-action svg {
    flex-shrink: 0;
}

/* Delete button — red accent */
.btn-line-delete {
    color: #EF4444;
    border-color: #FCA5A5;
}
.btn-line-delete:hover {
    background: #FFF5F5;
}

@media (max-width: 768px) {
    /* Content summary: column layout on mobile */
    .content-summary {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px;
    }

    /* Los tres totales en una fila. `wrap` en lugar de `nowrap` como red de
       seguridad: un importe de cinco cifras mas el simbolo se sale en una
       pantalla de 360px, y con nowrap se salia recortado en vez de bajar. */
    /* Bajo "Añadir producto" y a lo ancho de la fila: repartidos de borde a
       borde en vez de apretados a la derecha. */
    .summary-badges-row {
        display: flex;
        gap: 8px 16px;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .summary-item-badge {
        gap: 7px;
        font-size: 12px;
    }

    /* El icono es lo unico que identifica cada total, porque la etiqueta va
       oculta (ver abajo): tiene que leerse de un vistazo. De 14 a 20px, y el
       gris sube de #9CA3AF al del texto, que a ese tamano se quedaba lavado. */
    .summary-item-badge svg {
        width: 20px;
        height: 20px;
        color: #6B7280;
    }

    .badge-pill {
        font-size: 15px;
        padding: 4px 12px;
        min-width: 32px;
    }

    /* La etiqueta sigue oculta: con ella, los tres totales piden ~384px de
       fila y en un movil hay ~318. El icono hace de etiqueta. */
    .badge-label {
        display: none;
    }
    /* Bruto (etiqueta de precio) y Neto (billete, el del importe de cada línea):
       en el móvil, como el resto, solo el icono */
    /* Y los dos juntos en su propia fila */
    .summary-importes { flex: 1 1 100%; justify-content: space-between; }

    /* Añadir producto: a todo el ancho, encima de los totales. Es la accion principal
       de este paso y se pulsa una vez por producto, asi que va holgado:
       50px de alto, por encima de los 44 minimos para el dedo. */
    .btn-add-line-top {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        padding: 14px 18px;
        font-size: 16px;
        min-height: 50px;
        gap: 9px;
        border-radius: 12px;
    }

    .btn-add-line-top svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    

    /* Stack expanded view vertically on mobile */
    .product-line-expanded {
        flex-direction: column;
        gap: 14px;
        padding: 12px;
    }

    .product-line-btns {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Acotado a .product-line-btns a proposito. Sin el ancestro, esta regla
       alcanzaba tambien a los botones de las fichas del LISTADO, que usan la
       misma clase: alli listado.css solo redefine tamano y relleno, asi que
       `flex: 1` y el `min-width` del 50% se colaban y le descuadraban la fila
       de acciones. */
    .product-line-btns .btn-line-action {
        flex: 1;
        min-width: calc(50% - 4px);
        font-size: 14px;
        padding: 10px 10px;
        min-height: 46px;
        gap: 7px;
        justify-content: center;
        border-radius: 10px;
        /* De dos en dos caben ~155px por botón y "Cambiar depreciación" con su
           icono pide ~190: con nowrap se salía del botón. Aquí el texto puede
           pasar a dos líneas; los de la misma fila se igualan en alto. */
        white-space: normal;
        text-align: center;
        line-height: 1.2;
    }

    .product-line-btns .btn-line-action svg {
        width: 17px;
        height: 17px;
    }

    .data-label {
        font-size: 13px;
    }

    .data-value {
        font-size: 13px;
    }

    /* ── Ficha de linea plegada ──
       No tenia ningun ajuste para movil: se quedaba con el nombre a 14px y el
       resumen a 12px, pensados para verse en un monitor. Es la vista que mas
       se consulta del paso, asi que sube toda. */
    .product-line-header {
        padding: 14px;
        gap: 10px;
    }

    .product-line-name {
        font-size: 16px;
    }

    /* `wrap` porque los tres datos (unidades, depreciacion e importe) con un
       importe de cuatro cifras piden mas ancho del que deja la ficha una vez
       descontado el boton de desplegar. Antes se salian recortados. */
    .product-line-summary {
        font-size: 13px;
        gap: 6px 10px;
        flex-wrap: wrap;
    }

    /* Los separadores "|" cuestan unos 44px entre barra y separaciones, y no
       hacen falta: las unidades ya van en pildora y los otros dos datos
       llevan su propio icono. Quitandolos el resumen entra en una linea. */
    .summary-sep {
        display: none;
    }

    .summary-chip {
        gap: 5px;
    }

    .summary-chip svg {
        width: 15px;
        height: 15px;
    }

    /* #C0C7D0 sobre blanco se queda en nada; al tamano de movil hacia falta
       contraste real. */
    .summary-chip:not(.units-chip) svg {
        color: #9CA3AF;
    }

    .summary-chip.units-chip {
        font-size: 14px;
        padding: 4px 11px;
    }

    .btn-expand {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    .btn-expand svg {
        width: 20px;
        height: 20px;
    }

    /* Solo iconos. Los pasos 2 al 6 llevan TRES botones (Cancelar, Anterior,
       Siguiente) mas el contador en la misma fila: con texto pide unos 440px
       de contenido y no entra en ningun movil.
       Lo que si crece es el icono (18 -> 22px) y el area tactil, que pasa a
       44x44, el minimo para acertar con el dedo sin mirar. */
    .btn-top-action {
        padding: 11px;
        gap: 0;
        min-height: 44px;
        min-width: 44px;
        justify-content: center;
        position: relative;
    }

    .btn-top-action svg {
        width: 22px;
        height: 22px;
    }

    /* El texto se oculta a la vista pero NO se quita del documento: con
       `display: none` un lector de pantalla anuncia tres botones sin nombre.
       Asi sigue leyendo "Cancelar", "Anterior" y "Siguiente". */
    .btn-top-action span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .step-counter {
        font-size: 15px;
        white-space: nowrap;
    }

    /* Circulos de paso. El ancho del circulo manda sobre la posicion de la
       linea de progreso: `top` es el radio, y left/right dejan libre medio
       circulo a cada lado para que la linea no le salga por debajo. */
    .progress-steps {
        padding: 0 8px;
        margin-bottom: 16px;
    }
    .step-circle {
        width: 38px;
        height: 38px;
        font-size: 15px;
        border-width: 2px;
    }
    .step-label {
        font-size: 11px;
        max-width: 58px;
        line-height: 1.15;
    }
    .progress-step {
        gap: 5px;
    }

    .progress-line {
        top: 19px; /* radio del circulo de 38px */
        left: 28px;
        right: 28px;
        height: 3px;
    }

    /* La ficha del paso era la unica del proyecto sin ajuste para movil: se
       quedaba en los 32px de escritorio mientras .list-card-body bajaba a 12,
       .stat-card a 14 y .search-fs-content a 16. Sumados a los 12px de
       .main-content dejaba 44px muertos a cada lado. */
    .step-card {
        padding: 20px 18px;
        border-radius: 18px;
        margin-bottom: 16px;
    }

    /* Step actions top bar */
    .step-actions-top {
        padding: 10px 12px;
        gap: 8px;
        margin-bottom: 12px;
    }
    .step-actions-nav {
        gap: 8px !important;
    }

    /* Enviar es la excepción: lleva siempre el texto, también en el móvil.
       Es la acción que no tiene vuelta atrás y tiene que leerse. */
    .btn-top-action.btn-send {
        gap: 6px;
        padding: 11px 12px;
    }
    .btn-top-action.btn-send span {
        position: static;
        width: auto;
        height: auto;
        margin: 0;
        overflow: visible;
        clip-path: none;
    }
    /* Con el texto, la columna de la derecha (Anterior + Enviar, ~152px) no
       cabe en el 1fr que le toca; aquí se lleva lo que necesite y el
       contador se centra en el hueco que queda. */
    .step-actions-top-enviar {
        grid-template-columns: auto 1fr auto;
    }
}

/* Moviles estrechos: se encogen los circulos de paso, no los botones. Con
   tres botones de 44px (132), el contador (~88) y las separaciones (24) la
   fila pide unos 244px, que entran hasta en una pantalla de 320px. */
@media (max-width: 380px) {
    .step-counter {
        font-size: 14px;
    }
    .step-circle {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
    .step-label {
        font-size: 10px;
        max-width: 50px;
    }
    .progress-line {
        top: 17px; /* radio del circulo de 34px */
        left: 26px;
        right: 26px;
    }
}

/* Solo por debajo de 340px se sacrifican las etiquetas: seis palabras no
   caben ahi sin partirse en varias lineas. Antes esto pasaba ya a 400px, que
   deja sin nombre de paso a buena parte de los moviles en uso. */
@media (max-width: 340px) {
    .step-label {
        display: none;
    }
    /* En el paso 6 no cabe el contador junto a Enviar con texto; el paso ya
       lo dicen los círculos de arriba. */
    .step-actions-top-enviar .step-counter {
        display: none;
    }
    .progress-steps {
        padding: 0 12px;
    }
    .step-circle {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
    .progress-line {
        top: 15px;
        left: 22px;
        right: 22px;
    }
}

/* DataMatrix button style */
.input-button-dm {
    background: var(--bg-main) !important;
}

/* ============================================
   ADD LINE MODAL
   ============================================ */

.add-line-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-main);
    z-index: 3000;
    display: none;
    flex-direction: column;
}

.add-line-modal.active {
    display: flex;
    animation: entraDerecha 0.3s ease;
}

.add-line-header {
    background: white;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-soft);
}

.add-line-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    text-align: center;
    flex: 1;
}

.btn-save-line {
    padding: 10px 20px;
    border-radius: 10px;
    background: var(--primary-green);
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save-line:hover {
    background: var(--primary-dark);
}

.add-line-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.add-line-content > .product-form {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

/* Dentro de una fila el espacio lo pone la fila: si cada campo sumaba también
   el suyo, debajo de la fila quedaba el doble de hueco (p. ej. entre Mayorista
   y "Necesita autorizar") */
.form-row > .form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.input-with-button {
    display: flex;
    align-items: stretch;
    border-radius: 12px;
    transition: box-shadow 0.3s ease;
}

.input-with-button:focus-within {
    box-shadow: 0 0 0 4px rgba(124, 179, 66, 0.1);
}

.input-with-button:focus-within .form-input {
    border-color: var(--primary-green);
}

.input-with-button:focus-within .input-button {
    border-color: var(--primary-green);
}

.input-with-button .form-input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    min-width: 0;
    height: 50px;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

.input-with-button .form-input:focus {
    box-shadow: none;
}

.input-button {
    width: 48px;
    height: 50px;
    border-radius: 0 12px 12px 0;
    background: var(--bg-main);
    /* Sin color propio, Safari (iPhone) pinta los iconos en su azul de sistema */
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

/* When multiple buttons: first becomes flat, middle/last get separator */
.input-button:not(:last-child) {
    border-radius: 0;
    border-right: none;
}

.input-button + .input-button {
    border-left: 2px solid var(--border-color);
}

.input-with-button:focus-within .input-button + .input-button {
    border-left-color: var(--primary-green);
}

.input-button:last-child {
    border-radius: 0 12px 12px 0;
}

.input-button:hover {
    background: white;
    color: var(--primary-green);
}

/* Campo bloqueado (EAN leído por el escáner): se ve apagado y su botón
   desactivado, sin reaccionar al dedo */
.input-with-button .form-input[readonly] {
    background: #F3F4F6;
    color: var(--text-secondary);
}
.input-button:disabled,
.input-button:disabled:hover {
    background: #F3F4F6;
    color: var(--text-light);
    cursor: not-allowed;
}

/* Search field dropdown for code/description/lot */
.search-field-wrapper {
    position: relative;
}

.field-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    z-index: 100;
    display: none !important;
    height: 0 !important;
    border: none !important;
    box-shadow: none !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

.field-dropdown.open {
    display: block !important;
    height: auto !important;
    max-height: 300px;
    border: 2px solid var(--border-color) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    visibility: visible !important;
}

.field-dropdown .dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

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

.field-dropdown .dropdown-item:hover,
.field-dropdown .dropdown-item.highlighted {
    background: rgba(124, 179, 66, 0.1);
    border-left: 4px solid var(--primary-green);
}

.field-dropdown .dropdown-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.field-dropdown .dropdown-item-main strong {
    font-size: 14px;
    color: var(--text-primary);
}

.field-dropdown .dropdown-item-sub {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================
   BARCODE SCANNER MODAL
   ============================================ */

.scanner-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-main);
    z-index: 3100;
    display: none;
    flex-direction: column;
}

.scanner-modal.active {
    display: flex;
    animation: entraDerecha 0.3s ease;
}

.scanner-header {
    background: white;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-soft);
    z-index: 10;
}

.scanner-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.scanner-body {
    position: relative;
    flex: 1;
    overflow: hidden !important;
    background: #000;
    display: flex;
    flex-direction: column;
}

.scanner-body video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hide html5-qrcode internal elements — we use our own overlay */
#scanRegionProxy video {
    object-fit: cover !important;
}
#scanRegionProxy > div > div {
    /* Hide the built-in green dashed scan region */
    border: none !important;
    box-shadow: none !important;
}
#scanRegionProxy img,
#scanRegionProxy__dashboard_section,
#scanRegionProxy__header_message,
#scanRegionProxy [style*="border: 4px"],
#scanRegionProxy [style*="border: 2px"] {
    display: none !important;
}
/* Also target the shaded region html5-qrcode adds */
#scanRegionProxy > div {
    border: none !important;
}
/* Force hide the qr-shaded-region borders */
#qr-shaded-region,
[id*="qr-shaded-region"] {
    border: none !important;
    box-shadow: none !important;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.scanner-frame {
    position: relative;
    width: min(78vw, 420px);
    height: min(28vh, 200px);
    border: 2px solid rgba(255,255,255,0.5);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
    border-radius: 12px;
    overflow: hidden;
}

/* Animated scanning line */
.scanner-line {
    position: absolute;
    left: 4%;
    right: 4%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #7CB342, #7CB342, transparent);
    box-shadow: 0 0 8px rgba(124,179,66,0.6), 0 0 20px rgba(124,179,66,0.3);
    animation: scanLine 2s ease-in-out infinite;
    z-index: 2;
}

@keyframes scanLine {
    0%, 100% { top: 8%; opacity: 0.6; }
    50% { top: 88%; opacity: 1; }
}

/* Success flash animation */
.scanner-frame.scan-success {
    border-color: #7CB342 !important;
    border-width: 3px;
    animation: scanSuccess 0.4s ease;
}
@keyframes scanSuccess {
    0% { box-shadow: 0 0 0 9999px rgba(0,0,0,0.5); }
    50% { box-shadow: 0 0 0 9999px rgba(0,0,0,0.5), inset 0 0 30px rgba(124,179,66,0.4); }
    100% { box-shadow: 0 0 0 9999px rgba(0,0,0,0.5); }
}

/* Botón «Hacer foto del DataMatrix» (lineas.js buscarEnFoto), abajo */
.scanner-foto-btn {
    position: absolute;
    left: 50%;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 12px 22px;
    background: rgba(255,255,255,0.95);
    color: #1f2937;
    border: none;
    border-radius: 24px;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    cursor: pointer;
}
.scanner-foto-btn:active { transform: translateX(-50%) scale(0.97); }
.scanner-foto-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Tamaño de la foto y lectores en «No se ve el código» (diagnóstico) */
.scanner-result-detalle { font-size: 11px; opacity: 0.7; }

/* Zoom al tocar (lineas.js prepararZoom): solo si la cámara lo admite */
.scanner-frame.scanner-frame--zoom {
    pointer-events: auto;
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
}
.scanner-zoom-marca {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    padding: 3px 9px;
    background: rgba(0,0,0,0.65);
    color: white;
    font-size: 13px;
    font-weight: 800;
    border-radius: 12px;
}
.scanner-zoom-ayuda {
    margin-top: 8px;
    padding: 6px 14px;
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 16px;
}

.scanner-hint {
    margin-top: 14px;
    padding: 10px 18px;
    background: rgba(0,0,0,0.65);
    color: white;
    font-size: 13px;
    font-weight: 700;
    border-radius: 20px;
    text-align: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.scanner-hint.scanner-hint-error {
    background: rgba(244, 67, 54, 0.85);
}

/* ── Scanner result card ── */
/* Arriba, bajo la cabecera, donde se lee nada más escanear. */
.scanner-result {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 16px;
    pointer-events: none;
}
.scanner-result-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    animation: slideDownFade 0.3s ease;
}
.scanner-result-found .scanner-result-card {
    border-left: 4px solid #4CAF50;
}
.scanner-result-notfound .scanner-result-card {
    border-left: 4px solid #FF9800;
}
.scanner-result-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scanner-result-found .scanner-result-icon {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
}
.scanner-result-notfound .scanner-result-icon {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
}
.scanner-result-text {
    flex: 1;
    font-size: 16px;
    line-height: 1.4;
}
.scanner-result-text strong {
    display: block;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
}
.scanner-result-text .scanner-result-sub {
    color: var(--text-secondary, #64748b);
    font-size: 15px;
}
/* DataMatrix encontrado: tarjeta propia, en el centro, sobre la cámara
   difuminada; el check se dibuja con un anillo que se expande */
.scanner-result-dm {
    bottom: 0;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: srFondo 0.25s ease both;
}
.scanner-result-dm .scanner-result-card {
    width: 100%;
    max-width: 420px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 24px 20px 20px;
    border-left: none;
    border-top: 5px solid var(--primary-green);
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    animation: srPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.scanner-result-dm .scanner-result-text { width: 100%; }
.scanner-result-dm .scanner-result-icon {
    position: relative;
    width: 60px;
    height: 60px;
    background: var(--primary-green);
    color: #fff;
    animation: srIcono 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}
.sr-anillo {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid var(--primary-green);
    animation: srAnillo 0.9s ease-out 0.25s both;
}
.sr-check {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: srTrazo 0.35s ease-out 0.35s forwards;
}
@keyframes srFondo { from { opacity: 0; } to { opacity: 1; } }
@keyframes srPop { from { opacity: 0; transform: scale(0.85) translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes srIcono { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes srAnillo { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.9); opacity: 0; } }
@keyframes srTrazo { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
    .scanner-result-dm, .scanner-result-dm .scanner-result-card, .scanner-result-dm .scanner-result-icon,
    .sr-anillo { animation: none; }
    .sr-check { animation: none; stroke-dashoffset: 0; }
}
.sr-dm-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #F1F8E9;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.scanner-result-dm .scanner-result-text strong {
    font-size: 19px;
    margin-bottom: 14px;
}
.sr-dm-datos {
    text-align: left;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.sr-dm-dato {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: #F1F8E9;
    border: 1px solid #DCEDC8;
}
.sr-dm-dato span {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.sr-dm-dato b {
    display: block;
    margin-top: 2px;
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.sr-dm-ean { grid-column: 1 / -1; }
.sr-dm-ean b {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 1px;
}

/* Modal "No encontrado en el maestro" (lo monta ofrecerFueraMaestro()).
   Botones uno bajo otro y a todo el ancho: en fila, "Sí, entrada manual"
   con su icono no cabe en la mitad de un móvil. */
.fuera-maestro-modal .modal-body {
    padding: 20px 24px;
}
/* Caducidad: se toca para elegir entre las fechas del maestro */
.input-caducidad {
    cursor: pointer;
}

/* Pantalla "Lote por caducidad" (#caducidadView, elegirCaducidad) */
.caducidad-desplegables {
    grid-template-columns: 1fr 1fr; /* lado a lado, como en el lote manual */
    gap: 12px;
    margin-bottom: 0;
}
/* Lotes de la fecha elegida, debajo de los desplegables */
.caducidad-lotes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.caducidad-lotes:empty {
    display: none;
}
.caducidad-sin-lotes {
    margin: 4px 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #F3F4F6;
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
}
.caducidad-lote {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: white;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}
.caducidad-lote strong {
    font-size: 18px;
    letter-spacing: 1px;
    color: var(--text-primary);
}
.caducidad-lote span {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.caducidad-lote:hover,
.caducidad-lote:focus-visible {
    border-color: var(--primary-green);
}
.caducidad-pregunta {
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}
.caducidad-encontrados {
    margin: 8px 0 2px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
}
.scanner-accion.caducidad-lote-manual {
    width: 100%;
    margin-top: 20px;
}

/* Aviso "Este lote está en el maestro" con otra caducidad (preguntarLoteMaestro) */
.lote-maestro-texto {
    margin: 0;
    font-size: 17px;
    line-height: 1.4;
    color: var(--text-primary);
}
.lote-maestro-comprobar {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    margin: 14px 0 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: #FFF7ED;
    border: 1.5px solid #FDBA74;
    color: #9A3412;
    font-size: 16px;
    font-weight: 700;
}
.lote-maestro-comprobar svg {
    flex-shrink: 0;
}
.lote-maestro-pregunta {
    margin: 18px 0 0;
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    color: var(--text-primary);
}
.modal-overlay .modal-footer.lote-maestro-botones {
    flex-direction: column;
    gap: 10px;
}

/* El EAN leído, dibujado como una etiqueta de código de barras */
.etiqueta-codigo {
    width: 200px;
    max-width: 100%;
    margin: 0 auto 16px;
    padding: 10px 14px 6px;
    background: white;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    text-align: center;
}
.etiqueta-codigo svg {
    display: block;
    width: 100%;
    height: 48px;
    fill: var(--text-primary);
}
.etiqueta-codigo-numero {
    display: block;
    margin-top: 4px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-primary);
}
/* Lote y caducidad que trae el DataMatrix, bajo el código */
.fuera-maestro-leido {
    margin: -4px 0 12px;
    text-align: center;
    font-size: 15px;
    color: var(--text-secondary);
}
.fuera-maestro-leido strong { color: var(--text-primary); }

.fuera-maestro-pregunta {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
}
.fuera-maestro-detalle {
    margin: 10px 0 0;
    font-size: 16px;
    line-height: 1.45;
    color: var(--text-secondary);
}
.modal-overlay .modal-footer.fuera-maestro-botones {
    flex-direction: column;
    gap: 10px;
}
.scanner-accion {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 14px;
    border: none;
    border-radius: 12px;
    /* Los colores de la app: naranja de "siguiente paso" para seguir con la
       entrada manual, verde para volver a escanear */
    background: var(--cta);
    color: white;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}
.scanner-accion-secundaria {
    background: var(--primary-green);
}

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

.text-center {
    text-align: center;
    font-weight: 700;
}

.text-right {
    text-align: right;
    font-weight: 700;
}

.form-input[readonly] {
    background: white;
    cursor: default;
}

/* Previous button style */
.btn-previous {
    background: white;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-previous:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.step-actions-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.step-actions-top .btn-cancel {
    justify-self: start;
}

.step-actions-top .step-counter {
    justify-self: center;
}

/* ============================================
   MOBILE OPTIMIZATION (≤480px)
   ============================================ */

@media (max-width: 480px) {
    .progress-steps {
        padding: 0 8px;
        margin-bottom: 20px;
    }

    /* 14 + los 12 de .main-content = 26px de margen por lado, en linea con lo
       que ya hacian el resto de fichas. */
    .step-card {
        padding: 16px 14px;
    }

    /* Las cajas que van DENTRO de la ficha suman su propio relleno al de
       ella. La de "Seleccionar cliente" se llevaba otros 20px por lado, que
       encima de los 26 anteriores dejaba el contenido a 46px del borde. */
    .step1-empty-state {
        padding: 32px 14px;
    }

    

    

    

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

    .form-row {
        gap: 12px;
        margin-bottom: 12px;
    }

    .form-label {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .form-check-label {
        font-size: 13px;
    }

    .form-input,
    .form-select {
        padding: 10px 12px;
        font-size: 14px;
    }

    .form-textarea {
        padding: 10px 12px;
    }

    .step-title {
        font-size: 18px;
    }

    .step-subtitle {
        font-size: 13px;
    }

    

    .photo-upload-slot {
        min-height: 120px;
    }

    /* El doble de alto (120 -> 240): firmar con el dedo en una banda de 120px
       obliga a hacer la firma diminuta. El canvas toma su tamano del CSS
       (canvas.height = canvas.clientHeight en reinitSignatures), asi que no
       hay nada que tocar en el JS. */
    .signature-canvas {
        height: 240px;
    }

    .content-summary {
        padding: 8px 10px;
    }

    

    /* Aqui habia un .btn-add-line-top que lo bajaba a 8px de relleno y 13px de
       texto. Al ir despues, anulaba el tamano de arriba justo en los moviles,
       que es donde mas falta hace que se vea. */

    .manual-entry-header {
        padding: 12px 16px;
    }

    .manual-entry-content {
        padding: 16px;
    }

    .quick-edit-modal {
        padding: 16px;
    }

    .step-actions-top {
        padding: 10px 16px;
    }
}

/* ============================================
   CÁMARA PROPIA PARA LAS FOTOS (js/camara.js)
   Por encima de todo: se abre desde el lote o el producto manual (9000)
   y desde los avisos (10000).
   ============================================ */
.camara-modal {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: none;
    flex-direction: column;
    background: #000;
}
.camara-modal.active {
    display: flex;
}
.camara-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.camara-body video,
.camara-body img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
/* Mientras arranca la cámara: rueda y texto sobre el fondo negro */
.camara-cargando {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    background: #000;
    pointer-events: none;
}
.camara-cargando[hidden] {
    display: none;
}
.camara-cargando-rueda {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: camaraRueda 0.9s linear infinite;
}
@keyframes camaraRueda {
    to { transform: rotate(360deg); }
}
.camara-acciones {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    background: #000;
}
/* Botón de disparo: el círculo de siempre de las cámaras */
.camara-disparo {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    border: 5px solid #fff;
    background: rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: transform 0.1s ease, background 0.1s ease;
}
.camara-disparo:active {
    transform: scale(0.92);
    background: #fff;
}
.camara-acciones .scanner-accion {
    max-width: 220px;
}
.scanner-accion.camara-repetir {
    background: #E5E7EB;
    color: var(--text-primary);
}

/* ============================================
   MODO MUESTRAS del asistente (Utilidades > Entrega de muestras)
   El mismo asistente que Nueva devolución, en 4 pasos (sin adjuntos ni bultos): lo que solo tiene
   sentido en una devolución lleva data-solo-devolucion y aquí se oculta.
   ============================================ */
.modo-muestras [data-solo-devolucion] { display: none !important; }

/* Parámetros del laboratorio (aplicarParametrosLab en main.js).
   valorar_dev = 0: ningún precio, importe ni depreciación a la vista. */
.sin-valorar [data-solo-valorar] { display: none !important; }
/* cli_man_block / prod_man_block: sin el botón +, el campo cierra solo */
.input-with-button .form-input.sin-boton {
    border-radius: 12px;
    border-right: 2px solid var(--border-color);
}
.input-with-button:focus-within .form-input.sin-boton { border-right-color: var(--primary-green); }
/* mix_*_linea: el campo lo fija la primera línea (fijarComoPrimeraLinea, lineas.js) */
.form-label.fijado-primera::after {
    content: '(Igual en cada línea)';
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}
.form-select:disabled {
    background: var(--bg-main);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 1;
}
/* adjuntoN_obligatorio */
.slot-title.required::after {
    content: ' *';
    color: #F44336;
}
/* Barra de progreso con 4 pasos (1, 2, 4 y 6, que se ven como 1-4) */
.modo-muestras .progress-steps[data-current="2"] .progress-line::after { width: 33.3%; }
.modo-muestras .progress-steps[data-current="4"] .progress-line::after { width: 66.6%; }
/* Una sola firma (la de la farmacia): el recuadro ocupa todo el ancho */
.modo-muestras .signatures-grid { grid-template-columns: 1fr; }

/* html5-qrcode pinta su propio sombreado al recortar la zona de lectura
   (modo DataMatrix): ya está nuestro recuadro guía, así que se oculta */
#scanRegionProxy #qr-shaded-region { display: none !important; }

/* ============================================
   SUSTITUCIÓN (destino "Sustitución", js/lineas.js)
   ============================================ */
.sustitucion-caja {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: white;
}
.sustitucion-resumen {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: 14px;
    color: var(--text-primary);
}
.sustitucion-resumen span {
    font-size: 12px;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}
/* Versión pequeña del botón de acción (el de "Utilizar el mismo producto") */
.sustitucion-caja .sustitucion-cambiar { flex: none; min-height: 36px; padding: 6px 12px; font-size: 13px; gap: 6px; border-radius: 10px; }
.sustitucion-caja .sustitucion-cambiar svg { width: 16px; height: 16px; }
.sustitucion-vista { z-index: 3050; }   /* encima de la línea (3000), debajo del escáner (3100) */
.sustitucion-contenido { display: flex; flex-direction: column; gap: 14px; }
.sustitucion-contenido .form-group { margin: 0; }
.sustitucion-contenido .form-input { margin-bottom: 0; }
/* "Utilizar el mismo": icono a la izquierda y el texto pequeño en dos filas, a la derecha de Descripción */
.input-button.sustitucion-mismo { font-family: inherit; flex-direction: row; gap: 6px; width: auto; min-width: 0; padding: 4px 10px; }
.input-button.sustitucion-mismo svg { flex: none; }
.input-button.sustitucion-mismo span { font-family: inherit; font-size: 11px; font-weight: 600; line-height: 1.15; text-align: left; white-space: nowrap; }
/* Totales con valorar_dev: devuelto / sustituto / diferencia */
.sust-totales:empty { display: none; }
#sustitucionTotales { margin-top: 10px; }
.sust-totales-tabla { width: 100%; border-collapse: collapse; font-size: 13px; background: white;
    border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; }
.sust-totales-tabla th, .sust-totales-tabla td { padding: 8px 10px; text-align: right; vertical-align: top; }
.sust-totales-tabla th:first-child { text-align: left; }
.sust-totales-tabla thead th { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .02em; }
.sust-totales-tabla tbody tr { border-top: 1px solid var(--border-color); }
.sust-totales-tabla td small { display: block; font-size: 11px; color: var(--text-secondary); }
.sust-totales-tabla tfoot tr { border-top: 2px solid var(--border-color); font-weight: 700; }
.sust-totales-tabla tfoot td.sube { color: #1E7B34; }
.sust-totales-tabla tfoot td.baja { color: #C62828; }

/* Adjunto PDF (permitir_archivos_web, en ordenador): icono y nombre en el recuadro */
.adjunto-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    padding: 10px;
    color: var(--text-secondary);
    text-align: center;
}
.adjunto-pdf-tipo {
    font-size: 12px;
    font-weight: 700;
    color: #C62828;
}
.adjunto-pdf-nombre {
    max-width: 100%;
    font-size: 12px;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

/* ── Tipo de devolución (arriba del paso 1): mismo diseño que el selector de
   etiqueta física/virtual (.etiqueta-option), con su propia clase porque el código
   de las etiquetas busca .etiqueta-option en todo el documento ── */
.tipo-dev-grupo { margin-bottom: 22px; }
.tipo-dev-grupo.tipo-dev-unico { display: none; }
/* Con un solo tipo no se pregunta (va ese): clase y no style, valorSiVisible lo sigue leyendo */
.tipo-dev-campo.tipo-dev-unico { display: none; }
.tipo-dev-grupo .step-title { margin-bottom: 12px; }
.tipo-dev-opciones { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 4px; }
.tipo-dev-opcion {
    padding: 20px; border-radius: 14px; border: 2px solid var(--border-color); background: white;
    cursor: pointer; transition: all 0.2s ease; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 10px; font: inherit;
}
.tipo-dev-opcion span { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.tipo-dev-opcion svg { color: var(--text-secondary); }
.tipo-dev-opcion:hover { border-color: var(--primary-green); }
.tipo-dev-opcion.elegida { border-color: var(--primary-green); background: #F0FFF4; }
.tipo-dev-opcion.elegida svg, .tipo-dev-opcion.elegida span { color: var(--primary-green); }
.step-subtitle:empty { display: none; }


/* Aptos: "Siguiente" del paso 1 mientras se pregunta si el cliente admite otra
   devolución en el periodo (js/devolucion.js). Mismo giro que Entrar. */
.btn-top-action.btn-next.cargando { position: relative; cursor: progress; color: transparent; }
.btn-top-action.btn-next.cargando > * { visibility: hidden; }
.btn-top-action.btn-next.cargando::after {
    content: ''; position: absolute; top: 50%; left: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
    border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%;
    animation: loginSpin 0.7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
    .btn-top-action.btn-next.cargando::after { animation: loginLatido 1.2s ease-in-out infinite; border-top-color: rgba(255, 255, 255, 0.35); }
}


/* Hueco bajo el buscador de cliente mientras tiene el foco en móvil
   (util.js subirAlEnfocar): sin él, con la página corta no hay recorrido
   para subir el campo y la lista se queda tapada por el teclado. */
@media (max-width: 768px) {
    .hueco-teclado { padding-bottom: 70vh !important; }
}
