/* ===================================
   RESPONSIVE DESIGN - M&R ABOGADOS
   =================================== */

/* ========================================
   SIDEBAR RESPONSIVE
   ======================================== */

/* Desktop (por defecto) */
.sidebar {
    width: 280px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transition: all 0.3s ease;
    z-index: 1000;
    background: #2c3e50;
}

.main-content {
    margin-left: 280px;
    transition: all 0.3s ease;
}

/* Botón hamburguesa (oculto en desktop) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1100;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    transition: all 0.3s ease;
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* Overlay para cerrar sidebar en móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    cursor: pointer;
}

/* ========================================
   TABLETS Y PANTALLAS MEDIANAS (768px - 1024px)
   ======================================== */
@media (max-width: 1024px) {
    .container-fluid {
        padding: 15px;
    }
    
    .card {
        margin-bottom: 15px;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .btn-group {
        flex-wrap: wrap;
    }
    
    /* Sidebar más estrecho */
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
    }
}

/* ========================================
   TABLETS PEQUEÑAS Y MÓVILES (max 768px)
   ======================================== */
@media (max-width: 768px) {
    /* Mostrar botón hamburguesa */
    .sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 50px;
        height: 50px;
    }
    
    /* Sidebar oculto por defecto en móvil */
    .sidebar {
        position: fixed;
        left: -280px;
        width: 280px;
        height: 100vh;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    
    /* Sidebar visible cuando tiene clase 'active' */
    .sidebar.active {
        left: 0 !important;
    }
    
    /* Overlay visible cuando sidebar está activo */
    .sidebar.active ~ .sidebar-overlay,
    .sidebar-overlay.show {
        display: block !important;
    }
    
    /* Estilos del sidebar en móvil */
    .sidebar-header {
        padding: 20px;
        background: rgba(0, 0, 0, 0.2);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .sidebar-header h2 {
        color: white;
        font-size: 18px;
        margin: 0;
    }
    
    .sidebar-nav {
        padding: 10px 0;
    }
    
    .sidebar-nav .nav-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 15px 20px;
        color: rgba(255, 255, 255, 0.8);
        text-decoration: none;
        transition: all 0.3s ease;
        border-left: 3px solid transparent;
    }
    
    .sidebar-nav .nav-link:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
        border-left-color: #3498db;
    }
    
    .sidebar-nav .nav-link.active {
        background: rgba(52, 152, 219, 0.2);
        color: white;
        border-left-color: #3498db;
    }
    
    .sidebar-nav .nav-link i {
        font-size: 18px;
        width: 20px;
        text-align: center;
    }
    
    /* Main content ocupa todo el ancho */
    .main-content {
        margin-left: 0 !important;
        width: 100%;
        padding: 70px 15px 20px 15px;
    }
    
    /* Ajustes generales */
    .navbar-brand img {
        height: 35px !important;
    }
    
    .row {
        margin: 0;
    }
    
    .col-md-3, .col-md-4, .col-md-6, .col-md-8, .col-md-12 {
        width: 100%;
        padding: 10px;
    }
    
    /* Dashboard stats en columna */
    .dashboard-stats,
    .stats-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .stats-card, .stat-card {
        width: 100% !important;
        margin-bottom: 0;
    }
    
    /* Títulos más pequeños */
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    /* Tablas scrolleables */
    table {
        min-width: 600px;
        font-size: 14px;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }
    
    /* Botones de acción en tablas más pequeños */
    td .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Timeline seguimientos */
    .timeline-item {
        padding-left: 1rem;
    }
    
    .timeline-card {
        padding: 1rem;
    }
    
    /* Agenda tareas */
    .agenda-tarea {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .agenda-tarea-content {
        width: 100%;
    }
}

/* ========================================
   MÓVILES PEQUEÑOS (max 576px)
   ======================================== */
@media (max-width: 576px) {
    /* Header más compacto */
    .navbar {
        flex-direction: column;
        padding: 10px;
    }
    
    .navbar-brand img {
        height: 30px !important;
    }
    
    /* Botones ocupan todo el ancho */
    .btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .btn-group .btn {
        width: auto;
        flex: 1;
    }
    
    /* Modales más pequeños */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 10px;
    }
    
    /* Formularios más compactos */
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    label {
        font-size: 0.9rem;
    }
    
    input, select, textarea {
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    /* Tablas más pequeñas */
    table {
        font-size: 0.85rem;
        min-width: 500px;
    }
    
    th, td {
        padding: 0.5rem;
    }
    
    /* Cards más compactos */
    .card-body {
        padding: 10px;
    }
    
    /* Sidebar más estrecho en móviles pequeños */
    .sidebar {
        width: 260px;
        left: -260px;
    }
    
    .sidebar-toggle {
        top: 10px;
        left: 10px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    /* Gráficos responsive */
    canvas {
        max-height: 250px !important;
    }
    
    /* Timeline más compacto */
    .timeline-card {
        padding: 0.75rem;
    }
    
    .timeline-meta {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .timeline-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    /* Indicador "Solo Lectura" más pequeño */
    #indicador-lectura {
        top: 10px !important;
        right: 10px !important;
        font-size: 0.75rem !important;
        padding: 0.35rem 0.75rem !important;
    }
}

/* ========================================
   LANDSCAPE MODE (dispositivos horizontales)
   ======================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }
    
    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ========================================
   DESKTOP - Ocultar elementos móviles
   ======================================== */
@media (min-width: 769px) {
    .sidebar-toggle {
        display: none !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .hide-desktop {
        display: none !important;
    }
    
    .mobile-only {
        display: none !important;
    }
}

/* ========================================
   UTILIDADES RESPONSIVE
   ======================================== */

/* Ocultar en móvil */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
}

/* ========================================
   FASE 1 — DASHBOARD RESPONSIVE
   Agregar al final de responsive.css
   ======================================== */

/* --- Stats grid: 2x2 en móvil --- */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.68rem;
    }

    /* Dashboard cards en columna */
    .dashboard-content {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Estados panel en 1 columna */
    .estados-panel {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .estado-item {
        padding: 1rem;
    }

    /* Gráfico de tipos */
    #chartTipos {
        max-height: 200px !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }
}

/* --- Agenda Hoy en Dashboard --- */
@media (max-width: 768px) {
    .agenda-resumen {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }

    .resumen-card {
        padding: 0.75rem;
    }

    .resumen-valor {
        font-size: 1.2rem;
    }

    .agenda-hoy-item {
        padding: 10px 12px;
        gap: 8px;
    }

    .agenda-hoy-titulo {
        font-size: 13px;
    }

    .agenda-hoy-meta {
        gap: 5px;
    }

    /* Header section en móvil: título arriba, botón abajo */
    .header-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .header-section h1 {
        font-size: 1.4rem;
    }

    .header-section .btn {
        width: 100%;
        justify-content: center;
    }
}

/* --- Top bar + hamburguesa: evitar choque --- */
@media (max-width: 768px) {
    .top-bar {
        padding: 8px 12px 8px 72px; /* deja espacio al botón hamburguesa (50px + 15px offset + margen) */
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .user-menu-btn {
        font-size: 13px;
        padding: 6px 10px;
    }

    /* Ocultar nombre de usuario en móvil muy pequeño, dejar solo el ícono */
    @media (max-width: 400px) {
        #userMenuNombre {
            display: none;
        }
    }
}

/* --- Agenda tabs en móvil --- */
@media (max-width: 768px) {
    .agenda-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 0;
    }

    .agenda-tab-btn {
        white-space: nowrap;
        padding: 0.75rem 0.9rem;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .agenda-user-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .agenda-user-selector input {
        min-width: unset;
        width: 100%;
    }

    .agenda-content {
        padding: 1rem;
    }
}

/* ========================================
   FASE 2 — AGENDA / PENDIENTES RESPONSIVE
   Agregar al final de responsive.css
   ======================================== */

@media (max-width: 768px) {

    /* Contenedor principal de cada tarea */
    .agenda-tarea {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 12px;
    }

    /* Fila superior: checkbox + hora + tipo + badge atrasada */
    .agenda-tarea-content {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    /* Primera fila dentro del contenido */
    .agenda-tarea-content {
        flex-wrap: nowrap;
    }

    /* Hora destacada */
    .agenda-tarea-hora {
        font-size: 13px;
        min-width: unset;
    }

    /* Título ocupa todo el ancho */
    .agenda-tarea-titulo {
        max-width: 100%;
        white-space: normal;
        font-size: 13px;
        width: 100%;
        flex-shrink: unset;
    }

    /* Descripción ocupa todo el ancho */
    .agenda-tarea-desc {
        width: 100%;
        white-space: normal;
        font-size: 12px;
    }

    /* Usuario en su propia línea */
    .agenda-tarea-usuario {
        font-size: 11px;
    }

    /* Botones de acción al final, alineados a la derecha */
    .agenda-tarea-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        margin-left: 0;
        margin-top: 4px;
    }

    /* Expediente como chip pequeño */
    .agenda-tarea-expediente {
        font-size: 11px;
        padding: 2px 6px;
    }

    /* Checkbox más fácil de tocar */
    .agenda-checkbox input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }

    /* Fila meta: hora + tipo + badge en una línea */
    .agenda-tarea-content {
        display: grid;
        grid-template-areas:
            "hora tipo badge"
            "titulo titulo titulo"
            "desc desc expediente"
            "usuario usuario acciones";
        grid-template-columns: auto auto 1fr;
        align-items: center;
        gap: 4px 8px;
    }

    .agenda-tarea-hora       { grid-area: hora; }
    .agenda-tarea-tipo       { grid-area: tipo; }
    .agenda-badge-atrasada   { grid-area: badge; justify-self: end; }
    .agenda-tarea-titulo     { grid-area: titulo; max-width: 100%; white-space: normal; }
    .agenda-tarea-desc       { grid-area: desc; white-space: normal; }
    .agenda-tarea-expediente { grid-area: expediente; justify-self: end; }
    .agenda-tarea-usuario    { grid-area: usuario; }
    .agenda-tarea-actions    { grid-area: acciones; justify-self: end; margin-left: 0; }

    /* Resumen cards agenda: ya cubierto en Fase 1 */

    /* Filtros de agenda */
    .timeline-filters {
        flex-wrap: wrap;
        gap: 4px;
    }

    .filter-btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .agenda-tarea {
        padding: 8px 10px;
    }

    .agenda-tarea-content {
        grid-template-areas:
            "hora tipo"
            "titulo titulo"
            "desc desc"
            "usuario acciones";
        grid-template-columns: auto 1fr;
    }

    /* Ocultar badge atrasada en pantallas muy pequeñas si hay poco espacio */
    .agenda-badge-atrasada {
        grid-area: tipo;
        justify-self: end;
    }

    .agenda-tarea-expediente {
        display: none; /* Se puede ver en el detalle */
    }
}

/* ========================================
   FASE 3 — EXPEDIENTES / CLIENTES RESPONSIVE
   Agregar al final de responsive.css
   ======================================== */

@media (max-width: 768px) {

    /* --- Filtros apilados --- */
    .filters-panel {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        padding: 0.75rem;
        align-items: center;
    }

    .filters-panel select {
        width: 100%;
        min-width: unset;
        margin: 0;
    }

    /* Botón limpiar filtros ocupa toda la fila */
    .filters-panel .btn {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: center;
    }

    /* --- Barra de búsqueda --- */
    .search-bar {
        padding: 0.625rem 0.75rem;
    }

    .search-bar input {
        font-size: 16px; /* evita zoom iOS */
    }

    /* --- Tabla expedientes: scroll horizontal cómodo --- */
    #view-expedientes .table-container,
    #view-clientes .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Indicador visual de scroll */
        background:
            linear-gradient(to right, white 30%, rgba(255,255,255,0)),
            linear-gradient(to right, rgba(255,255,255,0), white 70%) 0 100%,
            linear-gradient(to right, rgba(0,0,0,0.08), rgba(0,0,0,0)),
            linear-gradient(to left, rgba(0,0,0,0.08), rgba(0,0,0,0));
        background-repeat: no-repeat;
        background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
        background-position: 0 0, 100% 0, 0 0, 100% 0;
        background-attachment: local, local, scroll, scroll;
    }

    /* Reducir columnas menos importantes en expedientes */
    #tablaExpedientes th:nth-child(6), /* Usuario */
    #tablaExpedientes td:nth-child(6),
    #tablaExpedientes th:nth-child(7), /* Oficina */
    #tablaExpedientes td:nth-child(7) {
        display: none;
    }

    #view-expedientes .data-table {
        min-width: 750px; /* reducido desde 1200px */
    }

    /* Ajustar padding de celdas */
    .data-table th,
    .data-table td {
        padding: 0.625rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Botones de acción en tabla más compactos */
    .data-table .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
        margin: 1px;
    }

    /* --- Detalle expediente: campos en 1 columna --- */
    .exp-fila {
        grid-template-columns: 1fr;
    }

    .exp-filas {
        gap: 4px;
    }

    /* Estado cambio: campos en 1 columna */
    .estado-cambio-campos {
        grid-template-columns: 1fr;
    }

    /* Editar expediente: campos en 1 columna */
    .edit-fila {
        grid-template-columns: 1fr;
    }

    .edit-campo-wide {
        grid-column: span 1;
    }

    /* Info panel en 1 columna */
    .info-panel {
        grid-template-columns: 1fr;
    }

    /* Info grid en 1 columna */
    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Tabs de detalle expediente: scroll horizontal */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }

    .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    /* Equipo chips en móvil */
    .equipo-chips {
        gap: 4px;
    }

    .equipo-chip {
        font-size: 0.78rem;
        padding: 3px 8px;
    }

    /* Anotación form en 1 columna */
    .anotacion-fila {
        grid-template-columns: 1fr;
    }

    .anotacion-campo-wide {
        grid-column: span 1;
    }

    .anotacion-checks-fila {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .anotacion-adjunto {
        margin-left: 0;
        width: 100%;
    }

    .anotacion-adjunto input[type="file"] {
        max-width: 100%;
    }

    /* Acciones de anotación */
    .anotacion-acciones {
        flex-direction: row;
        width: 100%;
    }

    .btn-guardar-anotacion,
    .btn-cancelar-anotacion {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {

    /* Ocultar más columnas en pantallas muy pequeñas */
    #tablaExpedientes th:nth-child(5), /* Abogado */
    #tablaExpedientes td:nth-child(5),
    #tablaClientes th:nth-child(4),
    #tablaClientes td:nth-child(4) {
        display: none;
    }

    #view-expedientes .data-table {
        min-width: 520px;
    }

    /* Modal a pantalla completa en móvil pequeño */
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 12px 12px 0 0;
        position: fixed;
        bottom: 0;
        max-height: 92vh;
    }

    .modal {
        align-items: flex-end;
    }
}

/* ========================================
   FASE 5 — REPORTES Y DETALLES FINALES
   Agregar al final de responsive.css
   ======================================== */

@media (max-width: 768px) {

    /* --- Reportes: tabs en scroll horizontal --- */
    .reporte-tabs {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding: 4px;
    }

    .reporte-tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 0.78rem;
        padding: 6px 12px;
    }

    /* --- Reportes: grid en 1 columna --- */
    .reporte-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .reporte-card-full {
        grid-column: 1;
    }

    .reporte-card {
        padding: 12px;
    }

    /* --- Filtros de reportes apilados --- */
    .reporte-filtros {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px;
    }

    .reporte-filtro-campo {
        width: 100%;
    }

    .reporte-filtro-campo input,
    .reporte-filtro-campo select {
        width: 100%;
    }

    .btn-filtrar-reporte,
    .btn-descargar-reporte {
        width: 100%;
        justify-content: center;
        height: 38px;
    }

    /* --- Buscador 360 --- */
    .buscador360-container {
        padding: 10px 0;
    }

    .buscador360-input {
        font-size: 15px;
        padding: 12px 12px 12px 44px;
    }

    .resultado360-item {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* --- Login responsive --- */
    .login-container {
        padding: 28px 20px;
        width: 95%;
    }

    .login-header i {
        font-size: 38px;
    }

    .login-header h1 {
        font-size: 20px;
    }

    /* ========================================
   FIX reCAPTCHA MÓVIL
   ======================================== */

/* Contenedor del reCAPTCHA centrado */
.g-recaptcha {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

@media (max-width: 768px) {
    .g-recaptcha {
        transform: scale(0.82);
        transform-origin: center center;
        overflow: hidden;
        /* Compensar el espacio que deja el scale */
        margin: -6px 0;
    }
}

@media (max-width: 480px) {
    .g-recaptcha {
        transform: scale(0.72);
        transform-origin: center center;
        margin: -12px 0;
    }
}

@media (max-width: 360px) {
    .g-recaptcha {
        transform: scale(0.62);
        transform-origin: center center;
        margin: -18px 0;
    }
}

    /* --- Configuración: tablas --- */
    #view-configuracion .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #view-configuracion .data-table {
        min-width: 600px;
    }

    /* Submenú configuración en móvil */
    .submenu {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        border-radius: 12px 12px 0 0;
        padding: 12px 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
        z-index: 2000;
    }

    .submenu-item {
        padding: 14px 24px;
        font-size: 0.95rem;
    }

    /* --- Timeline tabla en expediente --- */
    .timeline-table-wrapper {
        max-height: 280px;
    }

    .timeline-table {
        font-size: 0.72rem;
    }

    /* Ocultar columna usuario en timeline móvil */
    .timeline-table th:nth-child(5),
    .timeline-table td:nth-child(5) {
        display: none;
    }

    /* --- Indicador solo lectura --- */
    #indicador-lectura {
        top: 65px !important;
        right: 10px !important;
        font-size: 0.7rem !important;
        padding: 0.3rem 0.6rem !important;
    }

    /* --- Modales generales desde abajo en móvil --- */
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 14px 14px 0 0;
        position: fixed;
        bottom: 0;
        max-height: 92vh;
        overflow-y: auto;
    }

    .modal {
        align-items: flex-end;
    }

    /* Excepción: modal visor de documentos */
    .modal-viewer .modal-content {
        max-height: 95vh;
    }

    /* --- Formularios en modales --- */
    .modal-content form {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr !important;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1;
        justify-content: center;
    }
}

/* ========================================
   FIX reCAPTCHA MÓVIL
   ======================================== */

.recaptcha-wrapper {
    overflow: hidden;
    width: 100%;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .recaptcha-wrapper {
        height: 74px;
    }
    .g-recaptcha {
        transform: scale(0.82);
        transform-origin: left top;
        margin: 0;
    }
}

@media (max-width: 480px) {
    .recaptcha-wrapper {
        height: 68px;
    }
    .g-recaptcha {
        transform: scale(0.72);
        transform-origin: left top;
        margin: 0;
    }

    /* Tabla reportes compacta */
    #tabla-carga-abogados th,
    #tabla-carga-abogados td,
    #tabla-oficinas-reporte th,
    #tabla-oficinas-reporte td {
        padding: 0.4rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .recaptcha-wrapper {
        height: 60px;
    }
    .g-recaptcha {
        transform: scale(0.62);
        transform-origin: left top;
        margin: 0;
    }
}

/* ========================================
   FIX GRÁFICOS REPORTES
   Agregar al final de responsive.css
   ======================================== */

@media (max-width: 768px) {

    /* Contenedor del canvas con altura fija */
    .reporte-card {
        position: relative;
    }

    /* Todos los canvas de reportes */
    #chartAbogados,
    #chartOficinas,
    #chartEstados {
        max-height: 220px !important;
        width: 100% !important;
        height: 220px !important;
    }

    /* Chart del dashboard */
    #chartTipos {
        max-height: 180px !important;
        width: 100% !important;
        height: 180px !important;
    }

    /* Wrapper para que Chart.js respete el tamaño */
    .reporte-card canvas {
        max-width: 100%;
        display: block;
        margin: 0 auto;
    }

    /* Tablas dentro de reportes con scroll */
    .reporte-card .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #tabla-carga-abogados,
    #tabla-oficinas-reporte,
    #tabla-nuevos-procesos {
        min-width: 500px;
    }

    /* Nuevos procesos: ocultar columnas menos críticas */
    #tabla-nuevos-procesos th:nth-child(7),
    #tabla-nuevos-procesos td:nth-child(7) {
        display: none;
    }
}

@media (max-width: 480px) {
    #chartAbogados,
    #chartOficinas,
    #chartEstados {
        max-height: 180px !important;
        height: 180px !important;
    }
}

/* ========================================
   FIX SUBMENÚ CONFIGURACIÓN EN MÓVIL
   Agregar al final de responsive.css
   ======================================== */

@media (max-width: 768px) {

    /* Submenú inline dentro del sidebar, no flotando */
    #submenu-configuracion {
        position: static !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        background: rgba(0, 0, 0, 0.2) !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        border-top: 1px solid rgba(255,255,255,0.05);
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    #submenu-configuracion .submenu-item {
        padding: 12px 20px 12px 48px; /* indentado para indicar jerarquía */
        font-size: 0.875rem;
        color: rgba(255,255,255,0.7);
        border-left: 3px solid transparent;
    }

    #submenu-configuracion .submenu-item:hover,
    #submenu-configuracion .submenu-item.active {
        background: rgba(255,255,255,0.08);
        color: white;
        border-left-color: #3b82f6;
    }

    #submenu-configuracion .submenu-item i {
        margin-right: 10px;
        font-size: 0.85rem;
        width: 16px;
    }

    /* Flecha del menú configuración rota cuando está abierto */
    .menu-item.has-submenu .submenu-arrow {
        transition: transform 0.3s ease;
    }

    .menu-item.has-submenu.open .submenu-arrow {
        transform: rotate(180deg);
    }
}

/* ========================================
   FIX TABLAS CLIENTES / EXPEDIENTES
   ======================================== */

@media (max-width: 768px) {

    /* ---- CLIENTES: ocultar ID y Email ---- */
    #tablaClientes th:nth-child(1),
    #tablaClientes td:nth-child(1),
    #tablaClientes th:nth-child(4),
    #tablaClientes td:nth-child(4) {
        display: none;
    }

    #view-clientes .data-table {
        min-width: 380px;
    }

    /* ---- EXPEDIENTES: ocultar Abogado, Usuario, Oficina y Fecha ---- */
    #tablaExpedientes th:nth-child(5),
    #tablaExpedientes td:nth-child(5),
    #tablaExpedientes th:nth-child(6),
    #tablaExpedientes td:nth-child(6),
    #tablaExpedientes th:nth-child(7),
    #tablaExpedientes td:nth-child(7),
    #tablaExpedientes th:nth-child(8),
    #tablaExpedientes td:nth-child(8) {
        display: none;
    }

    #view-expedientes .data-table {
        min-width: 400px !important;
    }

    /* Botones de acción más fáciles de tocar */
    #tablaClientes .btn-sm,
    #tablaExpedientes .btn-sm {
        padding: 0.35rem 0.6rem;
        font-size: 0.78rem;
        margin: 2px;
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Celda de acciones no se comprima */
    #tablaClientes td:last-child,
    #tablaExpedientes td:last-child {
        white-space: nowrap;
        width: 1%;
    }

    /* Nombre cliente con ellipsis */
    #tablaClientes td:nth-child(2) {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Nº expediente compacto */
    #tablaExpedientes td:nth-child(1) {
        font-size: 0.75rem;
        white-space: nowrap;
    }

    /* Cliente en expediente con ellipsis */
    #tablaExpedientes td:nth-child(2) {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Estado formateado */
    #tablaExpedientes td:nth-child(4) {
        font-size: 0.75rem;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    /* Clientes: ocultar también Cédula */
    #tablaClientes th:nth-child(3),
    #tablaClientes td:nth-child(3) {
        display: none;
    }

    #view-clientes .data-table {
        min-width: 280px;
    }

    /* Expedientes: ocultar también Tipo */
    #tablaExpedientes th:nth-child(3),
    #tablaExpedientes td:nth-child(3) {
        display: none;
    }

    #view-expedientes .data-table {
        min-width: 320px !important;
    }
}

/* ========================================
   AGENDA TAREAS - CARDS EN MÓVIL
   ======================================== */

@media (max-width: 768px) {

    /* Convertir cada tarea en una card */
    .agenda-tarea {
        flex-direction: column;
        align-items: flex-start;
        background: white;
        border-radius: 10px;
        border-left: 4px solid var(--primary-color);
        border-bottom: none;
        padding: 12px 14px;
        margin-bottom: 10px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        gap: 8px;
    }

    .agenda-tarea:first-child,
    .agenda-tarea:last-child {
        border-radius: 10px;
    }

    .agenda-tarea.atrasada {
        border-left-color: #ef4444;
        background: #fff8f8;
    }

    .agenda-tarea.hoy {
        border-left-color: #f59e0b;
        background: #fffdf5;
    }

    /* Fila superior: checkbox + hora + tipo + badge */
    .agenda-tarea-content {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 6px;
    }

    /* Fila 1: hora + tipo + badge atrasada */
    .agenda-tarea-meta-row {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .agenda-tarea-hora {
        font-size: 13px;
        font-weight: 700;
        color: #2563eb;
        min-width: unset;
    }

    .agenda-tarea-tipo {
        font-size: 11px;
        padding: 2px 8px;
    }

    .agenda-badge-atrasada {
        font-size: 11px;
        margin-left: auto;
    }

    /* Fila 2: título */
    .agenda-tarea-titulo {
        font-size: 14px;
        font-weight: 600;
        white-space: normal;
        max-width: 100%;
        overflow: visible;
        text-overflow: unset;
        color: #1e293b;
        line-height: 1.4;
    }

    /* Fila 3: descripción */
    .agenda-tarea-desc {
        font-size: 12px;
        color: #64748b;
        white-space: normal;
        overflow: visible;
    }

    /* Fila 4: usuario + expediente + acciones */
    .agenda-tarea-footer-row {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        margin-top: 2px;
    }

    .agenda-tarea-usuario {
        font-size: 11px;
        color: #64748b;
        flex: 1;
    }

    .agenda-tarea-expediente {
        font-size: 11px;
        padding: 2px 7px;
    }

    .agenda-tarea-actions {
        margin-left: auto;
        margin-top: 0;
    }

    .agenda-tarea-actions .btn-sm {
        width: auto !important;
        padding: 4px 10px;
        font-size: 12px;
    }

    /* Checkbox arriba a la derecha */
    .agenda-checkbox {
        position: absolute;
        right: 14px;
        top: 14px;
    }

    .agenda-tarea {
        position: relative;
        padding-right: 36px; /* espacio para el checkbox */
    }

    .agenda-checkbox input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }

    /* Lista de agenda sin gap extra */
    .agenda-lista {
        gap: 0;
    }
}

/* ========================================
   OVERRIDE FINAL - EXPEDIENTES MÓVIL
   ======================================== */
@media (max-width: 768px) {
    #theadExpedientes th:nth-child(3),
    #theadExpedientes th:nth-child(5),
    #theadExpedientes th:nth-child(6),
    #theadExpedientes th:nth-child(7),
    #theadExpedientes th:nth-child(8),
    #tablaExpedientes td:nth-child(3),
    #tablaExpedientes td:nth-child(5),
    #tablaExpedientes td:nth-child(6),
    #tablaExpedientes td:nth-child(7),
    #tablaExpedientes td:nth-child(8) {
        display: none !important;
    }

    #view-expedientes .data-table {
        min-width: 400px !important;
    }
}

/* ========================================
   CLIENTES — CARDS EN MÓVIL
   ======================================== */

@media (max-width: 768px) {

    #view-clientes .table-container {
        display: none;
    }

    #clientesCardsList {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 12px;
    }

    .cliente-card {
        background: white;
        border-radius: 12px;
        padding: 14px 16px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        border-left: 4px solid #2563eb;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .cliente-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 8px;
    }

    .cliente-card-nombre {
        font-size: 15px;
        font-weight: 700;
        color: #1e293b;
        flex: 1;
        line-height: 1.3;
    }

    .cliente-card-acciones {
        display: flex;
        gap: 6px;
        flex-shrink: 0;
    }

    .cliente-card-acciones .btn-sm {
        width: 34px !important;
        height: 34px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }

    .cliente-card-datos {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 12px;
        margin-top: 4px;
    }

    .cliente-card-dato {
        display: flex;
        flex-direction: column;
        gap: 1px;
    }

    .cliente-card-dato-label {
        font-size: 10px;
        color: #9ca3af;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        font-weight: 600;
    }

    .cliente-card-dato-valor {
        font-size: 13px;
        color: #374151;
        font-weight: 500;
    }

    .cliente-card-dato-valor.vacio {
        color: #d1d5db;
        font-style: italic;
        font-weight: 400;
    }
}

@media (min-width: 769px) {
    #clientesCardsList {
        display: none !important;
    }
}

/* ========================================
   TIMELINE SEGUIMIENTO — CARDS MÓVIL
   ======================================== */

@media (max-width: 768px) {

    /* Botón nueva anotación — ancho automático */
    #btnToggleAnotacion {
        width: auto !important;
    }

    /* Filtros en wrap */
    .timeline-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 10px;
    }

    .filter-btn {
        font-size: 0.75rem;
        padding: 5px 12px;
    }

    /* Ocultar tabla */
    .timeline-table-wrapper {
        display: none !important;
    }

    /* Cards container */
    #timelineCardsList {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: 8px;
    }

    .tl-card {
        background: white;
        border-radius: 10px;
        padding: 12px 14px;
        border-left: 4px solid #94a3b8;
        box-shadow: 0 1px 4px rgba(0,0,0,0.07);
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .tl-card.tipo-agenda   { border-left-color: #10b981; }
    .tl-card.tipo-historial { border-left-color: #3b82f6; }
    .tl-card.tipo-aviso    { border-left-color: #f59e0b; }
    .tl-card.tipo-termino  { border-left-color: #ef4444; }
    .tl-card.tipo-documento { border-left-color: #6366f1; }
    .tl-card.pendiente     { background: #fffbeb; }

    .tl-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .tl-card-asunto {
        font-size: 14px;
        font-weight: 600;
        color: #1e293b;
        flex: 1;
        line-height: 1.3;
    }

    .tl-card-meta {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

    .tl-card-fecha {
        font-size: 11px;
        color: #64748b;
    }

    .tl-card-usuario {
        font-size: 11px;
        color: #64748b;
    }

    .tl-card-acciones {
        display: flex;
        justify-content: flex-end;
        gap: 6px;
        margin-top: 4px;
    }

    .tl-card-acciones .btn-sm {
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 7px;
    }
}

@media (min-width: 769px) {
    #timelineCardsList {
        display: none !important;
    }
}

/* ========================================
   EXPEDIENTES — CARDS EN MÓVIL
   ======================================== */

@media (max-width: 768px) {

    #view-expedientes .table-container {
        display: none;
    }

    #expedientesCardsList {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 12px;
    }

    .expediente-card {
        background: white;
        border-radius: 12px;
        padding: 14px 16px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
        border-left: 4px solid #2563eb;
        display: flex;
        flex-direction: column;
        gap: 8px;
        cursor: pointer;
        transition: box-shadow 0.2s;
    }

    .expediente-card:active {
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    .expediente-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .expediente-card-numero {
        font-size: 15px;
        font-weight: 700;
        color: #1e293b;
    }

    .expediente-card-numero i {
        color: #2563eb;
        margin-right: 5px;
    }

    .expediente-card-datos {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 12px;
    }

    .expediente-card-acciones {
        display: flex;
        justify-content: flex-end;
        padding-top: 4px;
        border-top: 1px solid #f1f5f9;
    }

    .expediente-card-acciones .btn-sm {
        width: 34px !important;
        height: 34px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }
}

@media (min-width: 769px) {
    #expedientesCardsList {
        display: none !important;
    }
}
/* Ocultar stats para no admins en móvil */
.stats-grid.hidden-no-admin {
    display: none !important;
}

/* ========================================
   v109 — MODAL EXPEDIENTE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {

    /* ---- Modal expediente: pantalla completa sin márgenes ---- */
    #modalExpediente .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 14px 14px 0 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        max-height: 95vh !important;
        overflow-y: auto !important;
    }

    #modalExpediente.modal {
        align-items: flex-end !important;
    }

    /* ---- Header del modal más compacto ---- */
    #modalExpediente .modal-header {
        padding: 14px 16px 10px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        border-bottom: 1px solid #f1f5f9;
    }

    #modalExpediente .modal-header h2 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100% - 36px);
    }

    /* ---- Tabs sticky debajo del header ---- */
    #modalExpediente .tabs {
        position: sticky;
        top: 53px; /* altura del header */
        background: white;
        z-index: 9;
        border-bottom: 1px solid #e2e8f0;
        padding: 0 8px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    #modalExpediente .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 0.8rem;
        padding: 10px 14px;
    }

    /* ---- Tab Principal: campos en 1 columna ---- */
    #tab-principal {
        padding: 12px 14px;
    }

    /* Info grid del expediente en 1 columna */
    #tab-principal .info-grid,
    #tab-principal .exp-fila,
    #tab-principal .edit-fila {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    /* Etiquetas wrap */
    #tab-principal .etiquetas-list {
        flex-wrap: wrap;
        gap: 4px;
    }

    /* ---- Tab Seguimiento ---- */
    #tab-seguimiento {
        padding: 10px 12px;
    }

    /* Toolbar anotación */
    .seguimiento-toolbar {
        margin-bottom: 10px;
    }

    /* Formulario nueva anotación en 1 columna */
    .anotacion-form-box {
        padding: 12px;
    }

    /* ---- Cards timeline: truncar descripción a 2 líneas ---- */
    .tl-card .tl-desc {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 12px;
        color: #64748b;
        margin: 2px 0 4px;
        line-height: 1.5;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* URLs largas no rompen el layout */
    .tl-card .tl-card-asunto {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* ---- Tab Estado ---- */
    #tab-estado-exp {
        padding: 12px 14px;
    }

    .estado-tab-nuevo {
        gap: 12px;
    }

    .estado-cambio-campos {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .estado-actual-row {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .estado-actual-badge {
        font-size: 0.85rem;
    }

    .btn-cambiar-estado {
        width: 100%;
        justify-content: center;
    }
}

/* ---- Modal Editar Expediente: mismo tratamiento ---- */
@media (max-width: 768px) {

    #modalEditarExpediente .modal-content,
    #modalFormExpediente .modal-content,
    #modalAgregarEquipo .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 14px 14px 0 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        max-height: 95vh !important;
        overflow-y: auto !important;
    }

    #modalEditarExpediente.modal,
    #modalFormExpediente.modal,
    #modalAgregarEquipo.modal {
        align-items: flex-end !important;
    }

    /* Tabs dentro de editar expediente */
    #modalEditarExpediente .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* Campos editar expediente en 1 columna */
    #modalEditarExpediente .edit-fila,
    #modalFormExpediente .edit-fila {
        grid-template-columns: 1fr !important;
    }

    #modalEditarExpediente .edit-campo-wide,
    #modalFormExpediente .edit-campo-wide {
        grid-column: span 1 !important;
    }

    /* Acciones del formulario */
    #modalEditarExpediente .edit-acciones,
    #modalFormExpediente .edit-acciones {
        flex-direction: row;
        padding: 10px 14px 14px;
        gap: 8px;
    }

    #modalEditarExpediente .btn-guardar-anotacion,
    #modalEditarExpediente .btn-cancelar-anotacion,
    #modalFormExpediente .btn-guardar-anotacion,
    #modalFormExpediente .btn-cancelar-anotacion {
        flex: 1;
        justify-content: center;
        width: auto !important;
    }
}

/* ---- Modal Subir Documento ---- */
@media (max-width: 768px) {
    #modalSubirDocumentoGlobal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 14px 14px 0 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        max-height: 95vh !important;
        overflow-y: auto !important;
    }

    #modalSubirDocumentoGlobal.modal {
        align-items: flex-end !important;
    }
}

/* ========================================
   v109 — REPORTES RESPONSIVE
   ======================================== */

@media (max-width: 768px) {

    /* ---- Gráficos: forzar ancho contenedor ---- */
    .reporte-card {
        overflow: hidden;
    }

    .reporte-card canvas {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Barras más delgadas: reducir padding del chart via wrapper */
    #chartAbogados,
    #chartOficinas,
    #chartEstados {
        max-height: 200px !important;
        height: 200px !important;
        width: 100% !important;
    }

    /* ---- Tabla Carga de Trabajo: ocultar Civil, Penal, Laboral, Otros ---- */
    /* Columnas: Abogado(1) Total(2) Activos(3) EnProceso(4) Cerrados(5) Civil(6) Penal(7) Laboral(8) Otros(9) */
    #tabla-carga-abogados th:nth-child(6),
    #tabla-carga-abogados td:nth-child(6),
    #tabla-carga-abogados th:nth-child(7),
    #tabla-carga-abogados td:nth-child(7),
    #tabla-carga-abogados th:nth-child(8),
    #tabla-carga-abogados td:nth-child(8),
    #tabla-carga-abogados th:nth-child(9),
    #tabla-carga-abogados td:nth-child(9) {
        display: none !important;
    }

    #tabla-carga-abogados {
        min-width: unset !important;
        width: 100%;
    }

    /* ---- Tabla Nuevos Procesos: ocultar Tipo ---- */
    /* Columnas: Fecha(1) Expediente(2) Cliente(3) Tipo(4) Estado(5) Abogado(6) Usuario(7) */
    #tabla-nuevos-procesos th:nth-child(4),
    #tabla-nuevos-procesos td:nth-child(4) {
        display: none !important;
    }

    #tabla-nuevos-procesos {
        min-width: unset !important;
        width: 100%;
    }

    /* ---- Tabla Oficinas: sin cambios pero ajustar ancho ---- */
    #tabla-oficinas-reporte {
        min-width: unset !important;
        width: 100%;
    }

    /* Celdas más compactas en todas las tablas de reportes */
    #tabla-carga-abogados th,
    #tabla-carga-abogados td,
    #tabla-oficinas-reporte th,
    #tabla-oficinas-reporte td,
    #tabla-nuevos-procesos th,
    #tabla-nuevos-procesos td {
        padding: 0.5rem 0.4rem;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* Primera columna (nombre) con ellipsis */
    #tabla-carga-abogados td:nth-child(1),
    #tabla-nuevos-procesos td:nth-child(3) {
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Agregar al final de responsive.css — override columnas carga trabajo */

@media (max-width: 768px) {
    #tabla-carga-abogados th:nth-child(n+6),
    #tabla-carga-abogados td:nth-child(n+6) {
        display: none !important;
    }

    #tabla-carga-abogados {
        min-width: unset !important;
        width: 100% !important;
    }
}

/* OVERRIDE FINAL — tabla carga trabajo móvil */
@media (max-width: 768px) {
    /* Ficha cliente — ocultar email en mobile */
    .cliente-detalle-email {
        display: none !important;
    }
}

@media (max-width: 768px) {

    /* Quitar min-width que fuerza scroll horizontal */
    #tabla-carga-abogados {
        min-width: unset !important;
        width: 100% !important;
        table-layout: fixed !important;
    }

    /* Ocultar columnas Civil, Penal, Laboral, Otros */
    #tabla-carga-abogados th:nth-child(6),
    #tabla-carga-abogados td:nth-child(6),
    #tabla-carga-abogados th:nth-child(7),
    #tabla-carga-abogados td:nth-child(7),
    #tabla-carga-abogados th:nth-child(8),
    #tabla-carga-abogados td:nth-child(8),
    #tabla-carga-abogados th:nth-child(9),
    #tabla-carga-abogados td:nth-child(9) {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        padding: 0 !important;
    }

    /* Quitar scroll del wrapper de la tabla */
    #tab-reporte-carga-trabajo .table-container {
        overflow-x: hidden !important;
    }
}

@media (max-width: 768px) {
    #view-expediente-detalle {
        left: 0;
        top: 0;
        padding: 16px;
    }
}