/* Diseño simplificado para Opera 16.0.15 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

/* Header simplificado */
.header {
    background-color: #ffffff;
    border-bottom: 2px solid #e0e0e0;
    padding: 15px 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #2c5530;
    font-size: 24px;
    font-weight: bold;
}

.header-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.header-nav a {
    color: #666;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: #fff;
}

.header-nav a:hover {
    background-color: #f0f0f0;
}

/* Container principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Tabs optimizados para pantallas táctiles */
.tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 30px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Ocultar la barra de desplazamiento en las tabs, manteniendo el scroll táctil */
.tabs {
    -ms-overflow-style: none; /* IE y Edge */
    scrollbar-width: none;    /* Firefox */
}
.tabs::-webkit-scrollbar {
    display: none;            /* WebKit */
}

.tab-button {
    padding: 15px 24px;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-bottom: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    white-space: nowrap;
    /* Optimización para pantallas táctiles */
    min-height: 48px;
    min-width: 120px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
}

.tab-button.active {
    background-color: #ffffff;
    color: #2c5530;
    font-weight: bold;
    border-bottom: 2px solid #2c5530;
    margin-bottom: -2px;
}

.tab-button:hover {
    background-color: #f0f0f0;
}

.tab-button:active {
    background-color: #e8e8e8;
    transform: translateY(1px);
}

/* Área de subida simplificada */
.upload-area-legacy {
    border: 2px dashed #ccc;
    padding: 40px 20px;
    text-align: center;
    background-color: #ffffff;
    margin-bottom: 20px;
    cursor: pointer;
}

.upload-area-legacy:hover {
    border-color: #2c5530;
    background-color: #f9f9f9;
}

.upload-area-legacy p {
    margin: 10px 0;
}

/* Botones legacy mejorados */
.btn-legacy {
    display: inline-block;
    padding: 12px 20px;
    border: 1px solid #ddd;
    background-color: #f8f8f8;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: normal;
    text-align: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    /* Optimización para pantallas táctiles */
    min-height: 44px;
    min-width: 100px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-legacy:hover {
    background-color: #e8e8e8;
}

.btn-legacy:active {
    background-color: #d8d8d8;
    transform: translateY(1px);
}

.btn-primary {
    background-color: #2c5530;
    color: white;
    border-color: #2c5530;
}

.btn-primary:hover {
    background-color: #1e3a21;
}

/* Botón de login más grande en dispositivos táctiles */
.touch-device .login-container .btn-primary {
    padding: 16px;
    font-size: 18px;
    min-height: 52px;
}

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

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-secondary-legacy {
    background-color: #e9ecef;
    color: #495057;
    border-color: #ced4da;
}

.btn-secondary-legacy:hover {
    background-color: #dee2e6;
}

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

.btn-danger:hover {
    background-color: #c82333;
}

/* Estado deshabilitado para botones legacy */
.btn-legacy[disabled],
.btn-primary-legacy[disabled],
.btn-secondary-legacy[disabled],
.btn-danger-legacy[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(30%);
}

/* Tarjetas mejoradas */
.card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    /* Optimización para pantallas táctiles */
    touch-action: manipulation;
}

/* Contenedor del dashboard agrandado al máximo */
.dashboard-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 10px !important;
    box-sizing: border-box;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Asegurar que las tabs ocupen todo el ancho */
.dashboard-tabs {
    width: 100% !important;
    max-width: 100% !important;
}

/* Asegurar que el contenido interno también ocupe todo el ancho */
.dashboard-container .card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.card-title {
    font-size: 22px;
    font-weight: bold;
    color: #2c5530;
    margin-bottom: 20px;
    text-align: center;
}

/* Lista de pedidos simplificada */
.order-item {
    background-color: #ffffff;
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-info {
    flex: 1;
}

.order-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.order-meta {
    color: #666;
    font-size: 14px;
}

.order-actions {
    display: flex;
    gap: 10px;
}

/* Estados simplificados */
.status-pending {
    background-color: #fff3cd;
    color: #856404;
    padding: 4px 8px;
    border: 1px solid #ffeaa7;
    font-size: 12px;
}

.status-completed {
    background-color: #d4edda;
    color: #155724;
    padding: 4px 8px;
    border: 1px solid #c3e6cb;
    font-size: 12px;
}

.status-cancelled {
    background-color: #f8d7da;
    color: #721c24;
    padding: 4px 8px;
    border: 1px solid #f5c6cb;
    font-size: 12px;
}

/* Modal simplificado */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #ffffff;
    border: 1px solid #ddd;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80%;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

/* Formularios simplificados */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

/* Formularios optimizados para iPad */
.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    background-color: #ffffff;
    font-size: 16px;
    color: #333;
    border-radius: 4px;
    /* Optimización para pantallas táctiles */
    min-height: 44px;
    touch-action: manipulation;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-input:focus {
    border-color: #2c5530;
    outline: none;
    box-shadow: 0 0 0 2px rgba(44, 85, 48, 0.2);
}

/* Estadísticas simplificadas */
.stats-grid {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 200px;
    background-color: #ffffff;
    border: 1px solid #ddd;
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #2c5530;
    display: block;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

/* Lista de archivos */
.file-list {
    margin-top: 20px;
}

.file-item {
    background-color: #ffffff;
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-icon {
    font-size: 16px;
}

.file-name {
    flex: 1;
    color: #333;
}

.file-size {
    color: #666;
    font-size: 12px;
}

/* Mensajes */
.message {
    padding: 12px 16px;
    margin-bottom: 15px;
    border: 1px solid;
}

.message-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.message-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* Utilidades */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.p-10 {
    padding: 10px;
}

.p-20 {
    padding: 20px;
}

/* Responsive básico */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .stats-grid {
        flex-direction: column;
    }
    
    .order-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .order-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Media queries específicas para iPad */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Ajustes generales para iPad */
    .container {
        padding: 30px;
    }
    
    /* Header optimizado para iPad */
    .header-content {
        padding: 0 30px;
    }
    
    .header h1 {
        font-size: 28px;
    }
    
    /* Tabs optimizados para iPad */
    .tabs {
        justify-content: center;
        gap: 5px;
    }
    
    .tab-button {
        padding: 15px 30px;
        font-size: 18px;
        min-width: 150px;
        text-align: center;
    }
    
    /* Área de subida optimizada para iPad */
    .upload-area-legacy {
        padding: 60px 40px;
        font-size: 18px;
    }
    
    /* Botones más grandes para pantallas táctiles */
    .btn-legacy {
        padding: 15px 25px;
        font-size: 16px;
        min-height: 48px;
        min-width: 120px;
    }
    
    /* Estadísticas en cuadrícula de 2x2 para iPad */
    .stats-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 30px;
    }
    
    .stat-card {
        padding: 25px;
    }
    
    .stat-number {
        font-size: 32px;
    }
    
    .stat-label {
        font-size: 16px;
    }
    
    /* Tarjetas optimizadas para iPad */
    .card {
        padding: 25px;
        margin-bottom: 25px;
    }
    
    .card-title {
        font-size: 26px;
        margin-bottom: 25px;
    }
    
    /* Items de pedidos optimizados para iPad */
    .order-item {
        padding: 20px;
        gap: 15px;
    }
    
    .order-title {
        font-size: 18px;
    }
    
    .order-meta {
        font-size: 16px;
    }
    
    .order-actions {
        gap: 15px;
    }
    
    /* Formularios optimizados para iPad */
    .form-input {
        padding: 15px;
        font-size: 16px;
        min-height: 48px;
    }
    /* Botón de "Iniciar Sesión" más grande en la pantalla de login (solo iPad) */
    .login-container .btn-primary {
        padding: 16px;
        font-size: 18px;
        min-height: 52px;
    }
    
    /* Modal optimizado para iPad */
    .modal-content {
        width: 90%;
        max-width: 700px;
        padding: 30px;
    }
    
    .modal-title {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    /* Estados de pedidos más visibles */
    .status-pending,
    .status-completed,
    .status-cancelled {
        padding: 8px 15px;
        font-size: 14px;
        font-weight: bold;
    }
}

/* Media queries para iPad en orientación horizontal */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .order-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .order-actions {
        width: auto;
        justify-content: flex-end;
    }
}

/* Modal PDF optimizado para iPad */
.pdf-modal-ipad {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0,0,0,0.9) !important;
    z-index: 99999 !important;
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    display: none; /* oculto por defecto, se muestra con .show */
}

.pdf-modal-ipad.show {
    display: block;
}

.pdf-modal-content-ipad {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: white !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    touch-action: auto !important;
}

.pdf-modal-header {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
    min-height: 70px;
    position: relative;
    z-index: 2;
}

.pdf-modal-body {
    flex: 1;
    /* Forzar un alto explícito para habilitar scroll interno */
    height: calc(100vh - 70px);
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y !important;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.pdf-iframe-ipad {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    flex: 1 !important;
    background: white !important;
    touch-action: auto !important;
    pointer-events: auto !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
}

/* Asegurar visión completa también en ordenadores (pantallas grandes) */
@media screen and (min-width: 1025px) {
    .pdf-modal-ipad {
        padding: 0 !important;
        background: rgba(0,0,0,0.85) !important;
    }
    .pdf-modal-content-ipad {
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    .pdf-modal-header {
        min-height: 64px;
    }
    .pdf-modal-body {
        height: calc(100vh - 64px);
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y !important;
    }
    .pdf-iframe-ipad {
        height: calc(100vh - 64px);
    }
}

/* Modo pantalla completa del PDF dentro del modal */
/* Eliminado modo pantalla completa en escritorio */

/* Estilos específicos para iPad */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .pdf-modal-ipad {
        padding: 0 !important;
        height: 100dvh !important; /* altura dinámica fiable en iPad */
    }
    
    .pdf-modal-content-ipad {
        border-radius: 0 !important;
        box-shadow: none !important;
        height: 100dvh !important;
    }
    
    .pdf-modal-header {
        padding: 12px;
        min-height: 56px;
        border-bottom: 1px solid #e2e8f0;
        background: #ffffff;
    }
    
    .pdf-modal-body {
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
        height: calc(100dvh - 56px) !important;
        overscroll-behavior: contain;
        touch-action: pan-x pan-y !important;
    }
    
    .pdf-iframe-ipad {
        height: calc(100dvh - 56px) !important;
        min-height: calc(100dvh - 56px) !important;
        display: block !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .pdf-embed-ipad {
        height: calc(100dvh - 56px) !important;
        min-height: calc(100dvh - 56px) !important;
    }
}

/* Estilos mejorados para el historial */
.historial-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Contenedor e iframes para modo dos páginas en iPad legacy */
.pdf-legacy-two-container {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
    width: 100%;
}
.pdf-legacy-frame {
    width: 48%;
    min-width: 0;
    border: none;
    background: #ffffff;
    height: 500px; /* altura segura por defecto */
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
@media screen and (min-width: 1025px) {
    .pdf-legacy-frame {
        height: calc(100vh - 64px);
    }
}
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .pdf-legacy-two-container {
        display: flex;
    }
    .pdf-legacy-frame {
        height: calc(100dvh - 56px) !important;
        min-height: calc(100dvh - 56px) !important;
    }
}

.historial-title {
    font-size: 28px;
    font-weight: bold;
    color: #2c5530;
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

/* Estadísticas del historial */
.historial-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.historial-stat-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.historial-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.historial-stat-card.total {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.historial-stat-card.completed {
    border-color: #10b981;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.historial-stat-card.pending {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.historial-stat-card.cancelled {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.stat-icon {
    font-size: 32px;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #1f2937;
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* Filtro del historial */
.historial-filter {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.filter-form {
    display: flex;
    justify-content: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: bold;
    color: #374151;
    font-size: 16px;
}

.filter-input {
    padding: 10px 15px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    min-width: 150px;
}

.filter-input:focus {
    border-color: #2c5530;
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.1);
}

.filter-btn, .clear-filter-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.filter-btn {
    background: #2c5530;
    color: white;
}

.filter-btn:hover {
    background: #1e3a21;
    transform: translateY(-1px);
}

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

.clear-filter-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Estado vacío del historial */
.historial-empty {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-title {
    font-size: 24px;
    font-weight: bold;
    color: #374151;
    margin-bottom: 10px;
}

.empty-description {
    font-size: 16px;
    color: #6b7280;
}

/* Lista del historial */
.historial-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.historial-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

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

.historial-item.terminado {
    border-left: 5px solid #10b981;
}

.historial-item.cancelado {
    border-left: 5px solid #ef4444;
}

.historial-item-header {
    display: flex;
    align-items: center;
    padding: 20px;
    gap: 15px;
}

.item-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
}

.item-info {
    flex: 1;
}

.item-title {
    font-size: 18px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 5px;
}

.item-status {
    margin-bottom: 0;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.item-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.historial-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.view-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

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

.delete-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.historial-item-meta {
    background: #f8fafc;
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-icon {
    font-size: 16px;
}

.meta-text {
    font-size: 14px;
    color: #6b7280;
}

/* Responsive para el historial */
@media screen and (max-width: 768px) {
    .historial-container {
        padding: 15px;
    }
    
    .historial-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .historial-stat-card {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 24px;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .historial-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .item-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .historial-item-meta {
        flex-direction: column;
        gap: 10px;
    }
}

/* iPad específico para historial */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .historial-stats {
        grid-template-columns: repeat(2, 120px);
        justify-content: center;
        gap: 12px;
    }
    
    /* Mostrar las tarjetas del historial como cuadraditos en iPad */
    .historial-stat-card {
        aspect-ratio: 1 / 1;
        padding: 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    .stat-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    .stat-icon {
        margin-bottom: 6px;
        font-size: 24px;
    }
    .stat-number {
        font-size: 20px;
    }
    .stat-label {
        font-size: 12px;
    }
    
    .historial-item-header {
        padding: 25px;
    }
    
    .historial-btn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 44px;
        min-width: 100px;
    }
}

/* Estilos específicos para Opera 16.0.15 */
.opera16 * {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.opera16 .btn-legacy {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.opera16 .form-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
/* Visor PDF alternativo para iPad */
.pdf-embed-ipad {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    flex: 1 !important;
    background: white !important;
    display: block !important;
}

/* Contenedor para render PDF.js en iPad (mismo modal) */
.pdf-canvas-container {
    width: 100% !important;
    /* Dejar que el cuerpo del modal gestione el scroll */
    height: auto !important;
    min-height: auto !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    background: #ffffff !important;
    flex: 1 !important;
}

@media screen and (min-width: 1025px) {
    .pdf-canvas-container {
        height: auto !important;
        min-height: auto !important;
    }
}

/* Layout de doble página para iPad (PDF.js) */
.pdf-page-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: flex-start;
    padding: 8px 12px;
    flex-wrap: nowrap;
}
.pdf-page-canvas {
    display: block;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    height: auto;
    flex: 0 0 auto;
}

/* Badge: Subido este mes */
.badge-month {
    display: inline-block;
    padding: 4px 8px;
    border: 1px solid #93c5fd;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px; /* cuadradito suave */
    margin-left: 8px;
}

/* Tarjeta mensual del historial */
.historial-stat-card.month {
    border-color: #60a5fa;
    background: linear-gradient(135deg, #e0f2fe 0%, #bfdbfe 100%);
}

/* Tarjeta mes pasado */
.historial-stat-card.last-month {
    border-color: #93c5fd;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}
