/* ============================================
   AR LAB - Mobile Responsive Styles
   ============================================
   Sistema de estilos responsive para móviles
   Importar DESPUÉS de los estilos principales
   ============================================ */

/* ============================================
   1. VARIABLES Y CONFIGURACIÓN
   ============================================ */
:root {
    --touch-min: 44px;
    --spacing-mobile: 0.75rem;
    --border-radius-mobile: 12px;
}

/* ============================================
   1.5 MENÚ HAMBURGUESA Y DRAWER MÓVIL
   ============================================ */

/* Botón Hamburguesa - Oculto en desktop */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Overlay del drawer */
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.active {
    display: block;
    opacity: 1;
}

/* Drawer lateral */
.mobile-drawer {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height para móviles */
    background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);
    z-index: 1999;
    display: flex;
    flex-direction: column;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
}

.mobile-drawer.open {
    left: 0;
}

/* Header del drawer */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid rgba(13, 148, 136, 0.15);
}

.drawer-close {
    background: transparent;
    border: none;
    color: #475569;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.drawer-close:hover {
    background: rgba(13, 148, 136, 0.1);
    color: #0d9488;
}

/* Navegación del drawer */
.drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.drawer-section {
    font-size: 0.7rem;
    font-weight: 600;
    color: #0f766e;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1rem 1rem 0.5rem;
    margin-top: 0.5rem;
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: #475569;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.drawer-item:hover,
.drawer-item:active {
    background: rgba(13, 148, 136, 0.1);
    color: #0d9488;
}

.drawer-item.active {
    background: rgba(13, 148, 136, 0.12);
    color: #0d9488;
    font-weight: 700;
    border-left: 3px solid #0d9488;
    padding-left: calc(1rem - 3px);
}

.drawer-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.drawer-item-primary {
    margin: 0.5rem 0;
}

.drawer-item-primary.active {
    background: var(--primary);
    color: white;
    border-left: none;
    padding-left: 1rem;
    font-weight: 700;
}

/* Footer del drawer */
.drawer-footer {
    padding: 1rem;
    border-top: 1px solid rgba(13, 148, 136, 0.15);
}

.drawer-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.drawer-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.drawer-user-info {
    display: flex;
    flex-direction: column;
}

.drawer-user-info span:first-child {
    color: #1e293b;
    font-weight: 500;
}

.drawer-user-role {
    font-size: 0.75rem;
    color: #64748b;
}

.drawer-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.drawer-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* MÓVIL: Mostrar hamburguesa, ocultar menú desktop */
@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Ocultar navegación desktop */
    .navbar-nav {
        display: none !important;
    }

    /* Ocultar detalles de usuario en navbar */
    .navbar-user .user-details {
        display: none !important;
    }

    /* Navbar más compacta */
    .navbar {
        height: 60px !important;
        padding: 0 0.75rem !important;
    }

    .navbar-brand {
        flex: 1;
        justify-content: center;
    }

    .navbar-logo {
        height: 40px !important;
    }

    /* Body padding ajustado */
    body {
        padding-top: 60px !important;
    }
}

/* ============================================
   2. RESET TÁCTIL - Tamaños mínimos accesibles
   ============================================ */
@media (max-width: 768px) {

    /* Botones táctiles */
    .btn,
    button:not(.modal-close):not(.popover-close),
    [role="button"] {
        min-height: var(--touch-min);
        min-width: var(--touch-min);
        padding: 0.75rem 1rem;
    }

    /* Inputs táctiles */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    input[type="time"],
    input[type="search"],
    select,
    textarea,
    .form-input,
    .form-select,
    .form-textarea {
        min-height: var(--touch-min);
        font-size: 16px !important;
        /* Previene zoom en iOS */
        padding: 0.75rem;
    }

    /* Checkboxes y radios más grandes */
    input[type="checkbox"],
    input[type="radio"] {
        width: 22px;
        height: 22px;
        margin-right: 0.5rem;
    }
}

/* ============================================
   3. UTILIDADES DE VISIBILIDAD
   ============================================ */
.hide-mobile {
    display: none !important;
}

.show-mobile {
    display: block !important;
}

.show-mobile-flex {
    display: flex !important;
}

@media (min-width: 769px) {
    .hide-mobile {
        display: block !important;
    }

    .hide-desktop {
        display: none !important;
    }

    .show-mobile,
    .show-mobile-flex {
        display: none !important;
    }
}

/* ============================================
   4. LAYOUT RESPONSIVE (BLOQUEO DE DESPLAZAMIENTO HORIZONTAL)
   ============================================ */
@media (max-width: 768px) {

    /* Prevenir desplazamiento a la derecha en body y contenedores principales */
    html, body {
        display: block !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        margin: 0 !important;
        padding-top: 60px !important;
        position: relative !important;
        font-size: 14px;
    }

    #navbar-container {
        width: 100% !important;
        max-width: 100vw !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 99999 !important;
    }

    .main-content {
        display: block !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 auto !important;
        padding: 0.5rem !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .content-area,
    .content-area > div {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }

    /* Respetar estricto display: none en vistas inactivas para evitar apilar vistas al scrollear */
    .content-area > div[style*="display: none"],
    .content-area > div[style*="display:none"],
    #viewInicio[style*="display: none"],
    #viewInicio[style*="display:none"],
    #viewAnalitica[style*="display: none"],
    #viewAnalitica[style*="display:none"],
    #viewTomaMuestra[style*="display: none"],
    #viewTomaMuestra[style*="display:none"],
    #viewProcesoAnalitico[style*="display: none"],
    #viewProcesoAnalitico[style*="display:none"] {
        display: none !important;
    }

    /* Grid de 12 columnas → stack vertical */
    .home-grid,
    .grid-12 {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .home-grid>*,
    [class*="grid-column"],
    .widget-stat,
    .widget-caja {
        grid-column: span 12 !important;
        width: 100% !important;
    }

    /* Cards */
    .card,
    .stat-card,
    .widget-stat {
        padding: 1rem !important;
        border-radius: var(--border-radius-mobile) !important;
    }

    /* Quick actions grid */
    .quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .action-card {
        padding: 1rem !important;
    }

    .action-card svg {
        width: 28px !important;
        height: 28px !important;
    }

    .action-card h3 {
        font-size: 0.85rem !important;
    }
}

/* ============================================
   5. TABLAS RESPONSIVE
   ============================================ */
@media (max-width: 768px) {

    /* Contenedor con scroll horizontal */
    .table-container,
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }

    /* Indicador de scroll */
    .table-container::after {
        content: '→ Desliza para ver más';
        display: block;
        text-align: center;
        font-size: 0.7rem;
        color: #94a3b8;
        padding: 0.5rem;
        background: linear-gradient(to right, transparent, #f1f5f9);
    }

    table {
        min-width: 600px;
    }

    th,
    td {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.8rem !important;
        white-space: nowrap;
    }

    /* Ocultar columnas menos importantes */
    .hide-on-mobile,
    th.hide-mobile,
    td.hide-mobile {
        display: none !important;
    }

    /* Tabla de citas - versión card */
    .appointments-table {
        min-width: 100%;
    }

    .appointments-table thead {
        display: none;
    }

    .appointments-table tbody tr {
        display: block;
        background: white;
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 0.75rem;
        padding: 1rem;
    }

    .appointments-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0 !important;
        border-bottom: 1px solid #f1f5f9;
        white-space: normal;
    }

    .appointments-table tbody td:last-child {
        border-bottom: none;
    }

    .appointments-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 0.75rem;
        text-transform: uppercase;
        flex-shrink: 0;
        margin-right: 1rem;
    }
}

/* ============================================
   6. MODALES RESPONSIVE (MÓVIL BOTTOM-SHEET)
   ============================================ */
@media (max-width: 768px) {

    /* Capa overlay solo cuando el modal está activo/abierto */
    .modal-overlay.active,
    .modal-backdrop.active,
    .modal-container.active,
    .modal-overlay.show,
    .modal-overlay.open,
    .swal2-container.swal2-shown {
        padding: 0 !important;
        display: flex !important;
        align-items: flex-end !important;
        justify-content: center !important;
        z-index: 100000 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }

    /* Ocultar estrictamente modales y overlays cerrados */
    .modal-overlay:not(.active):not(.show):not(.open),
    .modal-container:not(.active):not(.show):not(.open),
    .modal:not(.active):not(.show):not(.open),
    .modal[style*="display: none"],
    .modal[style*="display:none"],
    .modal-overlay[style*="display: none"],
    .modal-overlay[style*="display:none"],
    [id*="Modal"][style*="display: none"],
    [id*="Modal"][style*="display:none"] {
        display: none !important;
    }

    /* Estilo Bottom-Sheet para los cuadros modales cuando están abiertos */
    .modal,
    .modal-box,
    .modal-content,
    .modal-dialog,
    .swal2-popup {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92vh !important;
        border-radius: 20px 20px 0 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.25) !important;
        position: relative !important;
    }

    .modal.active,
    .modal-overlay.active .modal,
    .modal-box.active,
    .modal-content.active,
    .swal2-popup {
        display: flex !important;
        flex-direction: column !important;
    }

    .modal-header,
    .modal-title-bar {
        padding: 0.9rem 1.15rem !important;
        position: sticky !important;
        top: 0 !important;
        background: #ffffff !important;
        z-index: 10 !important;
        border-bottom: 1px solid #e2e8f0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        border-radius: 20px 20px 0 0 !important;
    }

    .modal-title,
    .modal-header h2,
    .modal-header h3 {
        font-size: 1.05rem !important;
        font-weight: 800 !important;
        color: #0f172a !important;
        margin: 0 !important;
    }

    .modal-body {
        padding: 1rem 1.15rem !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        flex: 1 1 auto !important;
        max-height: calc(92vh - 130px) !important;
        box-sizing: border-box !important;
    }

    .modal-body input,
    .modal-body select,
    .modal-body textarea,
    .modal-body .form-control,
    .modal-body .form-input {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        font-size: 0.95rem !important;
        padding: 0.65rem 0.85rem !important;
        border-radius: 9px !important;
    }

    .modal-body .form-row,
    .modal-body .form-group-row,
    .modal-body .grid,
    .modal-body .grid-2,
    .modal-body .grid-3 {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .modal-footer,
    .modal-actions {
        padding: 0.85rem 1.15rem !important;
        position: sticky !important;
        bottom: 0 !important;
        background: #ffffff !important;
        z-index: 10 !important;
        border-top: 1px solid #e2e8f0 !important;
        display: flex !important;
        flex-direction: column-reverse !important;
        gap: 0.55rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .modal-footer .btn,
    .modal-footer button,
    .modal-actions .btn,
    .modal-actions button {
        width: 100% !important;
        min-height: 44px !important;
        font-size: 0.9rem !important;
        font-weight: 700 !important;
        justify-content: center !important;
        text-align: center !important;
        border-radius: 10px !important;
        box-sizing: border-box !important;
    }

    .modal-close {
        width: 38px !important;
        height: 38px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        background: #f1f5f9 !important;
    }
}

/* ============================================
   7. FORMULARIOS RESPONSIVE
   ============================================ */
@media (max-width: 768px) {

    /* Stack vertical para form groups */
    .form-row,
    .form-group-row {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .form-group {
        width: 100% !important;
        margin-bottom: 1rem;
    }

    .form-label {
        margin-bottom: 0.5rem;
        font-size: 0.85rem;
    }

    /* Botones de formulario a ancho completo */
    .form-actions,
    .modal-footer {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .form-actions .btn,
    .form-actions button {
        width: 100% !important;
    }

    /* Selectores de fecha/hora lado a lado */
    .datetime-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
}

/* ============================================
   8. DASHBOARD ESPECÍFICO
   ============================================ */
@media (max-width: 768px) {

    /* Top bar */
    .top-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        padding: 0.6rem 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .page-title {
        font-size: 1.15rem !important;
    }

    .top-bar-actions {
        width: 100% !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 0.35rem !important;
        align-items: center !important;
        justify-content: space-between !important;
        box-sizing: border-box !important;
    }

    .top-bar-actions .btn {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        padding: 0.45rem 0.5rem !important;
        font-size: 0.75rem !important;
        justify-content: center !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
        min-height: 38px !important;
        border-radius: 8px !important;
        gap: 0.3rem !important;
    }

    .top-bar-actions .btn svg {
        width: 15px !important;
        height: 15px !important;
        flex-shrink: 0 !important;
    }

    /* Stats widgets en 2 columnas */
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .widget-stat {
        padding: 1rem !important;
    }

    .widget-stat-value {
        font-size: 1.5rem !important;
    }

    .widget-stat-label {
        font-size: 0.75rem !important;
    }

    /* Widget caja */
    .widget-caja {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }

    .caja-balance {
        font-size: 1.5rem !important;
    }

    /* Calendario compacto */
    .calendar-grid {
        gap: 2px !important;
    }

    .calendar-day {
        font-size: 0.75rem !important;
        padding: 0.5rem !important;
    }

    /* Accesos rápidos e Iconos compactos */
    .quick-actions {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .action-card {
        padding: 0.75rem 0.5rem !important;
        min-height: 90px !important;
        border-radius: 14px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        word-break: break-word !important;
    }

    .hexagon-icon {
        width: 42px !important;
        height: 42px !important;
        margin-bottom: 0.4rem !important;
        box-shadow: 0 4px 10px -2px var(--card-glow, rgba(0, 0, 0, 0.12)) !important;
    }

    .hexagon-icon::before {
        transform: scale(1.15) !important;
    }

    .hexagon-svg {
        width: 20px !important;
        height: 20px !important;
    }

    .action-card.hexagon-style h3 {
        font-size: 0.775rem !important;
        line-height: 1.25 !important;
        margin-bottom: 0.1rem !important;
        font-weight: 600 !important;
        word-break: break-word !important;
    }

    .action-card .shortcut-subtitle {
        font-size: 0.65rem !important;
    }
}

@media (max-width: 480px) {
    /* Botón Personalizar como icono en pantallas estrechas */
    .btn-customize-mobile span {
        display: none !important;
    }

    .btn-customize-mobile {
        padding: 0.45rem !important;
        min-width: 36px !important;
    }

    .top-bar-actions #btnTopRegistrarPaciente,
    .top-bar-actions #btnTopNuevaCita {
        flex: 1 1 50% !important;
        font-size: 0.76rem !important;
        padding: 0.5rem 0.4rem !important;
    }
}

/* ============================================
   9. NUEVA CITA / REGISTRO PACIENTE RESPONSIVE
   ============================================ */
@media (max-width: 900px) {

    /* Layout 70/30 → stack */
    .cita-container,
    .split-layout,
    .form-split {
        flex-direction: column !important;
    }

    .cita-left,
    .cita-right,
    .split-left,
    .split-right {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Secciones del formulario */
    .form-section {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .section-title {
        font-size: 1rem !important;
    }

    /* Header de Filtros del Catálogo en Móviles */
    #catalogoColumn > div:first-child > div {
        flex-wrap: wrap !important;
        gap: 0.4rem !important;
    }

    #buscarEstudioCompact {
        min-width: 0 !important;
        width: 100% !important;
    }

    #filtroCategoriaCompact {
        width: auto !important;
        flex: 1 1 calc(50% - 0.25rem) !important;
        min-width: 0 !important;
        height: 36px !important;
        font-size: 0.8rem !important;
    }

    #btnEstudioManualCompact {
        flex: 1 1 calc(50% - 0.25rem) !important;
        font-size: 0.75rem !important;
        padding: 0.4rem 0.5rem !important;
        justify-content: center !important;
        height: 36px !important;
        white-space: nowrap !important;
    }

    #btnFavoritos {
        flex: 0 0 36px !important;
        height: 36px !important;
        width: 36px !important;
        padding: 0 !important;
        justify-content: center !important;
    }
}

/* ============================================
   10. RESULTADOS RESPONSIVE
   ============================================ */
@media (max-width: 768px) {

    /* Sidebar colapsable */
    .results-sidebar,
    .sidebar-left {
        position: fixed !important;
        left: -100% !important;
        top: 60px !important;
        width: 85% !important;
        max-width: 320px !important;
        height: calc(100vh - 60px) !important;
        background: white !important;
        z-index: 999 !important;
        transition: left 0.3s ease !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15) !important;
        overflow-y: auto !important;
    }

    .results-sidebar.open,
    .sidebar-left.open {
        left: 0 !important;
    }

    /* Overlay para sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Botón toggle sidebar móvil */
    .mobile-sidebar-toggle {
        display: flex !important;
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 56px;
        height: 56px;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
        z-index: 997;
        cursor: pointer;
    }

    .mobile-sidebar-toggle svg {
        width: 24px;
        height: 24px;
    }

    /* Contenido principal ocupa todo */
    .results-main,
    .main-panel {
        width: 100% !important;
        margin-left: 0 !important;
    }

    /* Tabla de resultados */
    .results-table {
        font-size: 0.8rem;
    }

    .results-table input {
        font-size: 14px !important;
        padding: 0.5rem !important;
    }
}

@media (min-width: 769px) {
    .mobile-sidebar-toggle {
        display: none !important;
    }
}

/* ============================================
   11. INDEX/LOGIN RESPONSIVE  
   ============================================ */
@media (max-width: 768px) {

    .login-container,
    .auth-container {
        padding: 1rem !important;
    }

    .login-box,
    .auth-box {
        padding: 1.5rem !important;
        margin: 0 !important;
        border-radius: 16px !important;
    }

    .login-title,
    .auth-title {
        font-size: 1.5rem !important;
    }

    .login-form .btn,
    .auth-form .btn {
        width: 100%;
        padding: 1rem;
    }
}

/* ============================================
   12. PACIENTES Y LISTAS RESPONSIVE
   ============================================ */
@media (max-width: 768px) {

    /* Filtros colapsables */
    .filters-bar,
    .search-filters {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .filter-group {
        width: 100% !important;
    }

    .search-input {
        width: 100% !important;
    }

    /* Lista de pacientes como cards */
    .patients-list .patient-row {
        display: block !important;
        padding: 1rem !important;
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 0.75rem;
    }

    .patient-name {
        font-size: 1rem !important;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }

    .patient-details {
        font-size: 0.8rem;
        color: #64748b;
    }
}

/* ============================================
   13. COMPROBANTES RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .voucher-card {
        padding: 1rem !important;
    }

    .voucher-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }

    .voucher-amount {
        font-size: 1.25rem !important;
    }

    .voucher-actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }

    .voucher-actions .btn {
        flex: 1;
    }
}

/* ============================================
   14. TOAST Y NOTIFICACIONES
   ============================================ */
@media (max-width: 768px) {
    .toast-container {
        left: 1rem !important;
        right: 1rem !important;
        bottom: 4.5rem !important;
        bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px)) !important;
        margin: 0 auto !important;
        max-width: 92% !important;
        z-index: 99999 !important;
    }

    .toast {
        min-width: auto !important;
        width: 100% !important;
        box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2) !important;
        border-radius: 12px !important;
    }
}

/* ============================================
   15. ANIMACIONES REDUCIDAS (accesibilidad)
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   16. MEJORAS TÁCTILES GENERALES
   ============================================ */
@media (max-width: 768px) {

    /* Espaciado entre elementos clicables */
    .action-btns {
        gap: 0.75rem !important;
    }

    .action-btn {
        width: 36px !important;
        height: 36px !important;
    }

    /* Status badges más grandes */
    .status-badge {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.75rem !important;
    }

    /* Semaforo dots más grandes */
    .step-dot,
    .status-dot {
        width: 10px !important;
        height: 10px !important;
    }

    /* Links y elementos interactivos */
    a,
    .clickable {
        padding: 0.25rem;
    }

    /* ============================================
       19. VISTA FASE ANALÍTICA - PROCESAMIENTO MÓVIL
       ============================================ */
    .content-area {
        padding: 0.5rem !important;
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #viewProcesoAnalitico,
    #viewProcesoAnalitico .card {
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .top-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
        padding: 0.75rem 0.85rem !important;
    }

    .top-bar-title-group {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .top-bar .page-title {
        font-size: 1.1rem !important;
        line-height: 1.25 !important;
        margin: 0 !important;
    }

    .top-bar-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .top-bar-actions .btn {
        width: 100% !important;
        min-height: 42px !important;
        font-size: 0.78rem !important;
        font-weight: 700 !important;
        padding: 0.55rem 0.5rem !important;
        justify-content: center !important;
        text-align: center !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
        border-radius: 9px !important;
    }

    .analitica-filter-bar {
        padding: 0.75rem 0.85rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
    }

    .analitica-filter-bar > div {
        max-width: 100% !important;
        width: 100% !important;
    }

    .analitica-filter-bar select#selectCategoria {
        width: 100% !important;
        min-width: 0 !important;
    }

    .analitica-date-box {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.6rem !important;
        background: #f8fafc !important;
        padding: 0.75rem 0.85rem !important;
        border-radius: 12px !important;
        border: 1.5px solid #cbd5e1 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .analitica-date-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        border-bottom: 1px dashed #cbd5e1 !important;
        padding-bottom: 0.45rem !important;
    }

    .analitica-count-pill {
        display: flex !important;
        align-items: center !important;
        gap: 0.4rem !important;
    }

    .analitica-count-pill #analiticaCount {
        font-size: 1.3rem !important;
        font-weight: 800 !important;
        color: #0284c7 !important;
    }

    .analitica-count-pill .count-label {
        font-size: 0.78rem !important;
        font-weight: 700 !important;
        color: #475569 !important;
    }

    .btn-refresh-analitica {
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 0.35rem 0.65rem !important;
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 6px !important;
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        color: #334155 !important;
        cursor: pointer !important;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
    }

    .analitica-date-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.6rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .date-field-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.25rem !important;
        width: 100% !important;
    }

    .date-field-group label {
        font-size: 0.7rem !important;
        font-weight: 700 !important;
        color: #64748b !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }

    .date-field-group input[type="date"] {
        width: 100% !important;
        padding: 0.45rem 0.5rem !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 8px !important;
        font-size: 0.82rem !important;
        font-weight: 600 !important;
        color: #0f172a !important;
        background: #ffffff !important;
        box-sizing: border-box !important;
    }

    #analiticaTable thead {
        display: none !important;
    }

    #analiticaTable, 
    #analiticaTable tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #analiticaTable tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        border-radius: 14px !important;
        padding: 0.85rem 1rem !important;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05) !important;
        gap: 0.4rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        position: relative !important;
    }

    #analiticaTable tbody tr td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
    }

    /* FILA 1: Folio a la izquierda */
    #analiticaTable tbody tr td:nth-child(1) {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        border-bottom: 1px dashed #e2e8f0 !important;
        padding-bottom: 0.45rem !important;
        padding-right: 85px !important; /* Espacio reservado para el botón de etiquetas */
        box-sizing: border-box !important;
        width: 100% !important;
    }

    #analiticaTable tbody tr td:nth-child(1) div {
        font-size: 1.05rem !important;
        font-weight: 900 !important;
        color: #0f172a !important;
        font-family: 'Consolas', 'Monaco', monospace !important;
        letter-spacing: 0.8px !important;
        text-align: left !important;
    }

    /* Botón de Etiquetas fijo arriba a la derecha */
    #analiticaTable tbody tr td:nth-child(4) {
        position: absolute !important;
        top: 0.65rem !important;
        right: 0.85rem !important;
        width: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        z-index: 5 !important;
    }

    /* FILA 2: Nombre del Paciente a la Izquierda */
    #analiticaTable tbody tr td:nth-child(2) {
        width: 100% !important;
        text-align: left !important;
        margin-top: 0.15rem !important;
    }

    #analiticaTable tbody tr td:nth-child(2) div:first-child a {
        font-size: 0.98rem !important;
        font-weight: 800 !important;
        color: #0f172a !important;
        display: block !important;
        text-align: left !important;
        line-height: 1.25 !important;
        word-break: break-word !important;
    }

    #analiticaTable tbody tr td:nth-child(2) div:nth-child(2) {
        font-size: 0.72rem !important;
        color: #64748b !important;
        margin-top: 0.3rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 0.75rem !important;
        flex-wrap: wrap !important;
    }

    /* FILA 3: Áreas / Categorías con Semáforo */
    #analiticaTable tbody tr td:nth-child(3) {
        width: 100% !important;
        margin-top: 0.25rem !important;
        padding-top: 0.45rem !important;
        border-top: 1px dashed #e2e8f0 !important;
    }

    /* ============================================
       20. VISTA SALA DE ESPERA MÓVIL (#viewAnalitica)
       ============================================ */
    #viewAnalitica,
    #viewAnalitica .card {
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .sala-espera-filter-bar {
        padding: 0.75rem 0.85rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
    }

    .sala-espera-filter-bar > div {
        max-width: 100% !important;
        width: 100% !important;
    }

    .sala-espera-date-box {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.6rem !important;
        background: #f8fafc !important;
        padding: 0.75rem 0.85rem !important;
        border-radius: 12px !important;
        border: 1.5px solid #cbd5e1 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .appointments-table:has(#workListTableBody) thead {
        display: none !important;
    }

    #workListTableBody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 0.5rem !important;
    }

    #workListTableBody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        border-radius: 14px !important;
        padding: 0.85rem 1rem !important;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05) !important;
        gap: 0.4rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        position: relative !important;
    }

    #workListTableBody tr td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
    }

    #workListTableBody tr td:nth-child(1),
    #tomaMuestraTableBody tr td:nth-child(1) {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        border-bottom: 1px dashed #e2e8f0 !important;
        padding-bottom: 0.45rem !important;
        padding-right: 110px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    #workListTableBody tr td:nth-child(1) div,
    #tomaMuestraTableBody tr td:nth-child(1) div {
        font-size: 1.05rem !important;
        font-weight: 900 !important;
        color: #0f172a !important;
        font-family: 'Consolas', 'Monaco', monospace !important;
        letter-spacing: 0.8px !important;
        text-align: left !important;
    }

    #workListTableBody tr td:nth-child(5),
    #tomaMuestraTableBody tr td:nth-child(5) {
        position: absolute !important;
        top: 0.5rem !important;
        right: 0.75rem !important;
        width: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        z-index: 5 !important;
    }

    #workListTableBody tr td:nth-child(5) > div,
    #tomaMuestraTableBody tr td:nth-child(5) > div {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        flex-wrap: nowrap !important;
    }

    #workListTableBody tr td:nth-child(5) .action-btn,
    #tomaMuestraTableBody tr td:nth-child(5) .action-btn,
    #workListTableBody tr td:nth-child(5) button,
    #tomaMuestraTableBody tr td:nth-child(5) button {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 10px !important;
        flex-shrink: 0 !important;
        font-size: 0 !important;
    }

    #workListTableBody tr td:nth-child(5) svg,
    #tomaMuestraTableBody tr td:nth-child(5) svg {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
    }

    #workListTableBody tr td:nth-child(2),
    #tomaMuestraTableBody tr td:nth-child(2) {
        width: 100% !important;
        text-align: left !important;
        margin-top: 0.15rem !important;
        padding-right: 90px !important;
        box-sizing: border-box !important;
    }

    #workListTableBody tr td:nth-child(2) div:first-child {
        font-size: 0.98rem !important;
        font-weight: 800 !important;
        color: #0f172a !important;
        text-align: left !important;
        line-height: 1.25 !important;
    }

    #workListTableBody tr td:nth-child(3) {
        width: 100% !important;
        margin-top: 0.25rem !important;
        padding-top: 0.45rem !important;
        border-top: 1px dashed #e2e8f0 !important;
    }

    #workListTableBody tr td:nth-child(4) {
        width: 100% !important;
        margin-top: 0.2rem !important;
    }

    #noWorkListMessage {
        padding: 2.5rem 1rem !important;
        text-align: center !important;
        margin: 0 auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* ============================================
       21. VISTA TOMA DE MUESTRA MÓVIL (#viewTomaMuestra)
       ============================================ */
    #viewTomaMuestra,
    #viewTomaMuestra .card {
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .toma-muestra-filter-bar {
        padding: 0.75rem 0.85rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
    }

    .toma-muestra-filter-bar > div {
        max-width: 100% !important;
        width: 100% !important;
    }

    .toma-muestra-date-box {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.6rem !important;
        background: #f8fafc !important;
        padding: 0.75rem 0.85rem !important;
        border-radius: 12px !important;
        border: 1.5px solid #cbd5e1 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .appointments-table:has(#tomaMuestraTableBody) thead {
        display: none !important;
    }

    #tomaMuestraTableBody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 0.5rem !important;
    }

    #tomaMuestraTableBody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        border-radius: 14px !important;
        padding: 0.85rem 1rem !important;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05) !important;
        gap: 0.4rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        position: relative !important;
    }

    #tomaMuestraTableBody tr td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
    }

    #tomaMuestraTableBody tr td:nth-child(1) {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        border-bottom: 1px dashed #e2e8f0 !important;
        padding-bottom: 0.45rem !important;
        padding-right: 90px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    #tomaMuestraTableBody tr td:nth-child(1) div {
        font-size: 1.05rem !important;
        font-weight: 900 !important;
        color: #0f172a !important;
        font-family: 'Consolas', 'Monaco', monospace !important;
        letter-spacing: 0.8px !important;
        text-align: left !important;
    }

    #tomaMuestraTableBody tr td:nth-child(5) {
        position: absolute !important;
        top: 0.65rem !important;
        right: 0.85rem !important;
        width: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        z-index: 5 !important;
    }

    #tomaMuestraTableBody tr td:nth-child(2) {
        width: 100% !important;
        text-align: left !important;
        margin-top: 0.15rem !important;
        padding-right: 90px !important;
        box-sizing: border-box !important;
    }

    #tomaMuestraTableBody tr td:nth-child(2) div:first-child {
        font-size: 0.98rem !important;
        font-weight: 800 !important;
        color: #0f172a !important;
        text-align: left !important;
        line-height: 1.25 !important;
    }

    #tomaMuestraTableBody tr td:nth-child(3) {
        width: 100% !important;
        margin-top: 0.25rem !important;
        padding-top: 0.45rem !important;
        border-top: 1px dashed #e2e8f0 !important;
    }

    #tomaMuestraTableBody tr td:nth-child(4) {
        width: 100% !important;
        margin-top: 0.2rem !important;
    }

    #noTomaMuestraMessage {
        padding: 2.5rem 1rem !important;
        text-align: center !important;
        margin: 0 auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* ============================================
       22. VISTA RECEPCIÓN DE MUESTRAS MÓVIL (#viewRecepcionMuestras)
       ============================================ */
    #viewRecepcionMuestras,
    #viewRecepcionMuestras .card {
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .recepcion-muestra-filter-bar {
        padding: 0.75rem 0.85rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
    }

    .recepcion-muestra-filter-bar > div {
        max-width: 100% !important;
        width: 100% !important;
    }

    .recepcion-muestra-date-box {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.6rem !important;
        background: #f8fafc !important;
        padding: 0.75rem 0.85rem !important;
        border-radius: 12px !important;
        border: 1.5px solid #cbd5e1 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .appointments-table:has(#recepcionMuestrasTableBody) thead {
        display: none !important;
    }

    #recepcionMuestrasTableBody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 0.5rem !important;
    }

    #recepcionMuestrasTableBody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        border-radius: 14px !important;
        padding: 0.85rem 1rem !important;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05) !important;
        gap: 0.4rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        position: relative !important;
    }

    #recepcionMuestrasTableBody tr td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
    }

    #recepcionMuestrasTableBody tr td:nth-child(1) {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        border-bottom: 1px dashed #e2e8f0 !important;
        padding-bottom: 0.45rem !important;
        padding-right: 110px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    #recepcionMuestrasTableBody tr td:nth-child(1) div {
        font-size: 1.05rem !important;
        font-weight: 900 !important;
        color: #0f172a !important;
        font-family: 'Consolas', 'Monaco', monospace !important;
        letter-spacing: 0.8px !important;
        text-align: left !important;
    }

    #recepcionMuestrasTableBody tr td:nth-child(4) {
        position: absolute !important;
        top: 0.5rem !important;
        right: 0.75rem !important;
        width: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        z-index: 5 !important;
    }

    #recepcionMuestrasTableBody tr td:nth-child(2) {
        width: 100% !important;
        text-align: left !important;
        margin-top: 0.15rem !important;
        padding-right: 90px !important;
        box-sizing: border-box !important;
    }

    #recepcionMuestrasTableBody tr td:nth-child(3) {
        width: 100% !important;
        margin-top: 0.25rem !important;
        padding-top: 0.45rem !important;
        border-top: 1px dashed #e2e8f0 !important;
    }

    #noRecepcionMuestrasMessage {
        padding: 2.5rem 1rem !important;
        text-align: center !important;
        margin: 0 auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* ============================================
       23. VISTA GESTIÓN DE CITAS MÓVIL (#viewCitas)
       ============================================ */
    #viewCitas,
    #viewCitas .card {
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .citas-stats-bar {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    .citas-stats-bar > div {
        width: 100% !important;
        box-sizing: border-box !important;
        justify-content: flex-start !important;
    }

    .citas-date-box {
        padding: 0.75rem 0.85rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
        background: #f8fafc !important;
        border-radius: 12px !important;
        border: 1.5px solid #cbd5e1 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .citas-date-box > div:first-child {
        width: 100% !important;
    }

    .citas-date-box > div:last-child {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.6rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .citas-search-bar {
        padding: 0.75rem 0.85rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
    }

    .citas-search-bar > div {
        max-width: 100% !important;
        width: 100% !important;
    }

    .appointments-table:has(#citasTableBody) thead {
        display: none !important;
    }

    #citasTableBody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 0.5rem !important;
    }

    #citasTableBody tr {
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        border-radius: 14px !important;
        padding: 0.85rem 1rem !important;
        box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05) !important;
        gap: 0.4rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        position: relative !important;
    }

    #citasTableBody tr td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
    }

    #citasTableBody tr td:nth-child(3) {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center !important;
        border-bottom: 1px dashed #e2e8f0 !important;
        padding-bottom: 0.45rem !important;
        padding-right: 110px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    #citasTableBody tr td:nth-child(3) div,
    #citasTableBody tr td:nth-child(3) {
        font-size: 1.05rem !important;
        font-weight: 900 !important;
        color: #0f172a !important;
        font-family: 'Consolas', 'Monaco', monospace !important;
        letter-spacing: 0.8px !important;
        text-align: left !important;
    }

    #citasTableBody tr td:nth-child(7) {
        position: absolute !important;
        top: 0.5rem !important;
        right: 0.75rem !important;
        width: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        z-index: 5 !important;
    }

    #citasTableBody tr td:nth-child(4) {
        width: 100% !important;
        text-align: left !important;
        margin-top: 0.15rem !important;
        padding-right: 90px !important;
        box-sizing: border-box !important;
    }

    #citasTableBody tr td:nth-child(5) {
        width: 100% !important;
        margin-top: 0.25rem !important;
        padding-top: 0.45rem !important;
        border-top: 1px dashed #e2e8f0 !important;
    }

    #citasTableBody tr td:nth-child(6) {
        width: 100% !important;
        margin-top: 0.2rem !important;
    }

    /* ============================================
       24. VISTA INDICACIONES DE ESTUDIOS MÓVIL (#viewIndicaciones)
       ============================================ */
    #viewIndicaciones,
    #viewIndicaciones .card {
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .indicaciones-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .indicaciones-layout > .card {
        height: auto !important;
        max-height: 480px !important;
        padding: 0.85rem !important;
        border-radius: 14px !important;
    }

    #indDetallesContainer {
        min-height: auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .ind-sidebar-item {
        padding: 0.65rem 0.75rem !important;
        gap: 0.6rem !important;
    }

    .ind-sidebar-item div[title] {
        white-space: normal !important;
        word-break: break-word !important;
        font-size: 0.88rem !important;
    }

    .ind-sidebar-item span[title] {
        max-width: none !important;
        white-space: normal !important;
    }
}

/* ============================================
   17. LANDSCAPE MODE (Móvil horizontal)
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        height: 50px !important;
    }

    body {
        padding-top: 50px !important;
    }

    .modal {
        max-height: 95vh !important;
    }
}

/* ============================================
   18. PRINT OVERRIDE (No afectar impresión)
   ============================================ */
@media print {

    .hide-mobile,
    .show-mobile,
    .mobile-sidebar-toggle {
        display: initial !important;
    }
}