:root {            
    --sidebar-blue: #1e3a8a;            
    --sidebar-bar: green;            
    --sidebar-yellow: #f59e0b;            
    --sidebar-hover: #3b82f6;            
    --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #ffffff 100%);            
    --card-bg: rgba(255, 255, 255, 0.9);            
    --text-main: #1f2937;            
    --text-muted: #6b7280;           
    --accent-blue: #021949;            
    --radius: 12px;            
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);        
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box;  
    font-family: 'Segoe UI', sans-serif; 
    font-size: 1rem; 
}

body {  
    background: linear-gradient(135deg, #feffff, #dae7f8); 
    background-attachment: fixed; 
    display: flex; 
    min-height: 100vh; 
    color: var(--text-main); 
}

/* --- SIDEBAR BASE --- */
.sidebar { 
    width: 250px; 
    background: linear-gradient(135deg, #091638, #176af0); 
    color: white; 
    padding: 20px; 
    position: fixed; 
    height: 100%; 
    z-index: 1000; 
    transition: all 0.3s ease; 
    overflow-y: auto; 
    overflow-x: hidden;
}

/* --- ESTADO COLAPSADO (PC) --- */
.sidebar.collapsed { 
    width: 80px; 
    padding: 20px 10px; 
}

/* Ocultar textos cuando colapsa */
.sidebar.collapsed .logo span, 
.sidebar.collapsed .nav-item span, 
.sidebar.collapsed .nav-items span, 
.sidebar.collapsed .toggle-icon, 
.sidebar.collapsed .copyright { 
    display: none !important; 
}
thead {
  position: sticky;
  top: 0;
  z-index: 10;

}
.sidebar.collapsed .logo { justify-content: center; }
.sidebar.collapsed .nav-item, 
.sidebar.collapsed .nav-items { justify-content: center; padding: 15px 0; }

.logo { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 1.8rem; font-weight: bold; margin-bottom: 30px; }
.hamburger-btn { display: none; cursor: pointer; font-size: 1.5rem; }
.nav-menu { list-style: none; flex-grow: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 15px; border-radius: 8px; cursor: pointer; transition: 0.3s; color: #d1d5db; text-decoration: none; margin-bottom: 5px; }
.nav-item:hover, .nav-item.active { background-color: var(--sidebar-hover); color: white; }
.submenu { display: none; flex-direction: column; margin-left: 10px; }
.collapsible { justify-content: space-between; }
.toggle-icon { transition: 0.3s; }
.collapsible.active + .submenu { display: flex; }
.collapsible.active .toggle-icon { transform: rotate(180deg); }
.copyright { font-size: 0.75rem; color: #f9fafc; font-style: italic; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 15px; margin-top: 20px; }
.main-content { margin-left: 250px; flex: 1; padding: 40px; transition: 0.3s; min-width:0;}
.header-title { text-align: center; font-size: 2rem; margin-bottom: 20px; color: #1e3a8a; position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; }
.header-title2 { text-align: center; font-size: 1.5rem; margin-bottom: 5px; color: #1e3a8a; position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; }
.header-title i { background: linear-gradient(135deg, #3b82f6, #1e3a8a); color: white; padding: 12px; border-radius: 50%; font-size: 1.2rem; box-shadow: 0 5px 10px rgba(0,0,0,0.15); }
.header-title::after { content: ""; position: absolute; bottom: -12px; width: 120px; height: 4px; background: linear-gradient(70deg, #d3d3d4, #010b27); border-radius: 10px; }
.header-subtitle { text-align: center; font-size: 1.5rem; margin-bottom: 30px; color: rgb(41, 41, 41); position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; }
.header-subtitle2 { text-align: center; font-size: 1.2rem; margin: 15px 0; color: #1e3a8a;; position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; }
.icon-big{ font-size:2.5rem; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:10px;}
.section-card { background: var(--card-bg); border-radius: var(--radius); padding: 25px; margin-bottom: 30px; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,0.3); }
.section-header { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.2rem; margin-bottom: 20px; color: var(--accent-blue); }
.data-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
.data-cell { display: flex; border-bottom: 1px solid #e5e7eb; }
.data-label { background: #f8fafc; padding: 10px 15px; width: 160px; font-weight: 600; font-size: 0.85rem; color: var(--text-muted); border-right: 1px solid #e5e7eb; }
.data-value { padding: 10px 15px; flex: 1; font-size: 0.9rem; background: white; }
.btn-container { display: flex; justify-content: flex-end; margin-top: 15px; }
.btn-blue { background: linear-gradient(135deg, #1e3a8a, #3b82f6); color: white; border: none; padding: 12px 24px; border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.3s ease; position: relative; overflow: hidden; box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3); border: 1px solid rgba(255,255,255,0.1);}
.nav-items { display: flex; align-items: start; text-align: start; gap: 12px; padding: 12px 15px; border-radius: 8px; cursor: pointer; transition: 0.3s; color: #d1d5db; text-decoration: none; margin-bottom: 5px; background: none; border: none; font: inherit; }
.nav-items:hover,.nav-items.active { background-color: var(--sidebar-hover); color: white;}
   
.btn-doc,.btn-edit { display: inline-flex; justify-content: center; align-items: center; width: 40px; height: 40px; padding: 0; margin: 0 2px; border: none; border-radius: 6px; text-decoration: none; background-color: #f3f4f6; cursor: pointer; transition: background 0.2s;}
.btn-doc i,.btn-edit i { font-size: 1.2rem; }
.btn-doc:hover, .btn-edit:hover { background-color: #e5e7eb; }
.search-input { width: 100%; max-width: 430px; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; margin-bottom: 15px; }
.search-input2 { width: 100%; max-width: 250px; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; margin-bottom: 15px; }
.checkboxlabel{ display: flex; gap: 0.7rem; padding-left: 1rem; padding-right: 1rem; background: red; max-width: 10%;}
.checkbox-seleccionar-todo{ transform: scale(1.5); margin-left: 1rem; margin-right: 0.5rem;}
.checkbox-seleccionar-todo-label{margin-right: 2rem;}
.btn-blue:active { transform: translateY(1px);}
.grid-layout { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px; }
.item-box { position: relative; background: white; padding: 20px; border-radius: var(--radius); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; transition: 0.3s; cursor: pointer; border: 1px solid transparent; }
.item-box:hover { transform: translateY(-5px); border-color: var(--sidebar-hover); box-shadow: 0 10px 15px rgba(0,0,0,0.1); }
.folder { color: #fbbf24; font-size: 3rem; filter: drop-shadow(2px 3px 2px rgba(0,0,0,0.2)); }
.badge-icon { font-size: 1.3rem; position: absolute; top: 45px; right: 38px; }
.main-icon { font-size: 2.5rem; border-radius: 50%; padding: 10px; background: rgba(255,255,255,0.8); }
.badge-icon:hover{font-size: 1.6rem;}
.color-green { color: rgb(5, 138, 49); }
.color-blue { color: #3b82f6; }
.color-red { color: #ef4444; }
.color-orange { color: #f59e0b; }
.color-brown{ color:#250b03}
.color-purple { color: #8b5cf6; }
.color-yellow { color: #fbbf24;}
.color-gray { color: #d1d5db;}
.color-sky { color: #71c0f5;}

.section-header:hover{font-size: 1.5rem; color: #3b82f6; text-shadow: #d0d0d1 0px 0px 10px;}
.toast { padding: 15px 25px; border-radius: 8px; color: white; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 10px; animation: slideIn 0.3s ease;}
.close-modal { position: absolute; top: 15px; right: 20px; cursor: pointer; font-size: 1.2rem; }  
.modal-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);backdrop-filter: blur(4px);z-index:1000;justify-content:center;align-items:center;}
.modal-overlay.active{display:flex;}
.modal-content{background:white;padding:30px;border-radius:10px;width:360px;max-width:90%;box-shadow:0 10px 30px rgba(0,0,0,0.2);position:relative;}
.close-modal{position:absolute;right:15px;top:10px;cursor:pointer;font-size:20px;}
.toggle-button { width: 200px;   padding: 10px 25px;    font-size: 18px;    border: none;    border-radius: 25px;    cursor: pointer;    transition: background 0.3s, color 0.3s;       }
.altas { background: linear-gradient(135deg, #1e3a8a, #0c5cdb); color: white; transition: all 0.3s ease; color: white;  }
.bajas { background: linear-gradient(135deg, #414141, #dfdfdf); color: white; transition: all 0.3s ease; color: white;  }
.tiquear { transform: scale(1.5); cursor: pointer; margin: 5px; accent-color: #e6e7e7; }
.tabs-card { background: #fff; border-radius: 12px; padding: 4px; box-shadow: 0 10px 20px rgba(0,0,0,0.1);}
.tabs-retroceso{display: flex; }

/* Estilos globales base para pestañas en PC */
.tabs-buttons { display: flex; gap: 5px; width: 90%; border-bottom: 1px solid #ddd; margin-bottom: 15px;}
.retroceso-button{ width: 10%;}
.tab-btn { padding: 8px 15px; border: none; border-top-left-radius: 6px; border-top-right-radius: 6px; background: #f3f4f6; cursor: pointer; font-weight: 600; color: #555; transition: all 0.2s;}
.tab-btn-retroceso{ margin-left: auto; display: flex; align-items: center; justify-content: center; width: 75px; height: 35px; border-radius: 15% 5% 5% 15%; background: linear-gradient(55deg, #2b50cc, #0b46a0); color: white; text-decoration: none; font-size: 20px; transition: 0.3s; cursor: pointer;}
.tab-btn-retroceso:hover{ background: #356af0; transform: scale(1.05);}
.tab-btn.active { background: linear-gradient(135deg,  #3d84cc,#0c5cdb); border-bottom: 1px solid #fff; color: #f7f7f7;}
.tab-content { display: none; }
.tab-content.active { display: block;}
.columnaUltimo{ width: 1%; white-space: nowrap; padding: 0; margin: 0; text-align: center;}
.botones{ display: flex; align-items: center; justify-content: center; gap: 6px; }
.botones button{ background: none; border: none; padding: 4px; margin: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;}
.botones i{ font-size: 18px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;}
.table-container{ width:100%; height:550px; overflow-x:scroll; overflow-y:scroll; cursor: grab; }
.table-container:active{ cursor: grabbing;}
.table-containerdocumento{ width:100%; height: 250px; overflow-x:scroll; overflow-y:scroll; cursor: grab; }
.table-containerdocumento:active{ cursor: grabbing;}
.table-wrapper{ max-height:400px; overflow-y:auto;  }
.table-wrapperdocumento{ height:auto; overflow-y:auto;  }
.styled-table{ width:max-content; min-width:100%; border-collapse:collapse; font-size:14px; }
.styled-table th,.styled-table td{ padding:6px 12px; border:1px solid #ddd; white-space:nowrap; }
.styled-table th{ padding:0px 12px; margin: 0; border:1px solid #ddd; white-space:nowrap; }
.styled-table thead tr{ padding: 0; margin: 0; background: linear-gradient(55deg, #3d84cc,#0c5cdb); color:white;}
.styled-table tbody tr:nth-child(even){ background:#f3f3f3 !important;}
.styled-table tbody tr:last-child{ border-bottom: solid #2c3e50;}
.tabledoctrab thead tr{ padding: 10px !important; margin: 10px !important; }
.tabledoctrab th{ padding:10px 10px; margin: 0;}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.input-error{ border: 2px solid #e53935 !important; background-color: #fff5f5;}
.input-ok{ border: 1px solid #d1d5db;}
#formularios-container { display: grid; grid-template-columns: repeat(3, minmax(350px, 1fr)); gap: 20px; margin-top: 5px; justify-content: center; }
.trabajador-bloque { background: #ffffff; padding: 15px; border: 1px solid #e1e4e8; border-radius: 16px; box-shadow: 0 4px 6px rgba(0,0,0,0.4); background: rgb(255, 254, 254); }
.trabajador-bloque h4 { margin: 0 0 10px 0; color: #2d3748; font-size: 1.1rem; border-bottom: 2px solid #edf2f7; padding-bottom: 10px;}
.form-grid { display: flex; flex-direction: column; gap: 10px; }
.form-group { display: flex; flex-direction: column; width: 100%;}
.form-group label { font-weight: 600; color: #4a5568; margin-bottom: 2px; font-size: 0.9rem;}
.form-group input, .form-group select { width: 100%; padding: 5px; border: 1px solid #cbd5e0; border-radius: 8px; box-sizing: border-box; }
.grupo{ display: flex; padding: 0; margin: 0; width: 100%; gap: 10px;}
.telfsexo in .full-width { grid-column: span 2;}
.btnregistrartodos{ padding-top: 1rem;}
.direccion{ display: none;}
.modal-overlay2 {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); 
    z-index: 9999; 
    justify-content: center;
    align-items: center;
}

.modal-content2 {
    background-color: #ffffff !important; 
    background: #ffffff;
    padding: 30px;
    border-radius: 10px;
    width: 600px;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
    position: relative;
    opacity: 1; 
    max-height: 90vh; overflow-y: auto; padding: 20px;
}

.form-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap:10px; 
    margin-bottom: 20px;
}

.form-group2 {
    display: flex;
    flex-direction: column;
}
.nada{ display: none; }
.form-group2 input, 
.form-group2 select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.pdf-main-container {
    display: flex;
    flex-direction: column;
    height: 100vh; 
    background-color: #f8f9fa;
}

.pdf-header {
    background: #ffffff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
    z-index: 10;
}

.pdf-title-group h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: 0.5px;
}

.pdf-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e9ecef;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 5px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    color: #495057;
}

.pdf-viewer-wrapper {
    flex-grow: 1; 
    background: #525659; 
    display: flex;
    justify-content: center;
    align-items: center;
}

.pdf-viewer-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

.main-contentancho {
    margin-left: 250px; 
    transition: margin-left 0.3s ease; 
}

.main-contentdelgado {
    margin-left: 80px; 
    transition: margin-left 0.3s ease; 
}

.toggle-sidebar-btn {
    cursor: pointer;
    padding: 5px;
    transition: transform 0.3s ease;
}

.sidebar.collapsed #toggle-sidebar {
    transform: rotate(180deg);
}

.sidebar.collapsed .submenu {
    display: none !important;
}

.mini-popup{
    position: fixed;
    top: 50%;
    left: 50%;
    width: 90%;              
    max-width: 500px;        
    background: rgb(248, 248, 248);
    border: 1px solid #3a5fd6;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    z-index: 9999;
    display: none;
    cursor: grab;
    animation: fadeIn 0.2s ease;
}

.mini-popup:active{ cursor: grabbing; }
.cerrar-popup{ float: right; cursor: pointer; color: red; font-size: 14px; }
.panel-doc-wrapper0{ margin: 3px; text-align:center; }
.panel-doc-wrapper {
  margin-top: 3px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background-color: #fff;
  overflow: hidden;
  margin-bottom: 0;
  padding-bottom: 0;
}

.panel-doc-select, 
.panel-doc-btn, 
.panel-doc-obs {
  padding: 10px 15px;
  font-size: 14px;
  border: none;
  outline: none;
  box-sizing: border-box;
}

.panel-doc-select { background-color: #f8f9fa; border-bottom: 1px solid #ced4da; }
.panel-doc-btn { background-color: #e9ecef; font-weight: bold; cursor: pointer; border-bottom: 1px solid #ced4da; white-space: nowrap; color: #3a5fd6; }
.panel-doc-buscar { background-color: #e9ecef; color: #3a5fd6; font-weight: normal; cursor: pointer; border-bottom: 1px solid #ced4da; white-space: nowrap; }
.panel-doc-btn:hover { background-color: #dde2e6; }
.panel-doc-obs { width: 100%; }
.doc-subir { padding-top: 0; margin-top: 0px; font-size: 0.9rem; font-style: italic; padding-left: 3.5rem; color: #0c5cdb; }


/* ==================================================================
   ESTILOS PARA MÓVIL (Menos de 768px) - Pestañas adaptadas en Columna
   ================================================================== */
@media (max-width: 768px) { 
    /* 1. OCULTAR ELEMENTOS DE PC */
    .toggle-sidebar-btn, 
    #toggle-sidebar, 
    .sidebar.collapsed .logo span { 
        display: none !important; 
    }

    /* 2. SIDEBAR MÓVIL (Barra superior) */
    .sidebar { 
        width: 100%; 
        height: 60px; 
        overflow: hidden; 
        transition: height 0.3s ease-in-out;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 9999; 
        padding: 10px 20px;
        display: flex;
        flex-direction: column;
    }  

    /* Expansión al hacer click en hamburguesa */
    .sidebar.show { 
        height: 100vh; 
        overflow-y: auto;
    } 
/* ========================================================
       FUERZA BRUTA: Centrado absoluto de Registrar Trabajador
       ======================================================== */
    
    /* 1. Obligamos al contenedor padre a ser un eje flexible centrado */
    #formularios-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important; /* Centra los hijos horizontalmente */
        justify-content: flex-start !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        transform: none !important; /* Elimina posibles desfases por herencia */
        left: 0 !important;
    }

    /* 2. Forzamos a que la tarjeta ocupe el ancho correcto sin márgenes negativos ocultos */
    .trabajador-bloque {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 20px 0 !important; /* Quitamos márgenes laterales extraños */
        padding: 15px !important;
        box-sizing: border-box !important;
        float: none !important; /* Elimina desbordamientos si usaba float */
        position: relative !important;
    }

    /* 3. Rompemos las filas inline (width: 60%, 40%, etc.) del JavaScript */
    .form-grid, .grupo {
        display: flex !important;
        flex-direction: column !important; /* Un input debajo del otro */
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* 4. Los grupos internos ocupan el 100% real */
    .form-group {
        width: 100% !important; 
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        margin-bottom: 12px !important;
        box-sizing: border-box !important;
    }

    /* 5. Aseguramos que los inputs y selects no midan más que su tarjeta */
    .form-group input, 
    .form-group select {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    /* Ajuste del Logo y Hamburguesa en la cabecera móvil */
    .logo {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0; 
        min-height: 40px;
    }

    .sidebar.show .logo {
        margin-bottom: 30px; 
    }

    /* 3. MENÚ DE NAVEGACIÓN */
    .nav-menu { 
        display: none; 
        width: 100%;
        opacity: 0;
        transition: opacity 0.3s ease;
    } 

    .sidebar.show .nav-menu { 
        display: block; 
        opacity: 1;
    }

    /* 4. BOTÓN HAMBURGUESA */
    .hamburger-btn { 
        display: block !important; 
        font-size: 1.8rem;
        color: white;
        cursor: pointer;
        order: 2; 
    }

    /* 5. AJUSTE DE CONTENIDO PRINCIPAL */
    .main-content { 
        margin-left: 0 !important; 
        padding: 15px; 
        margin-top: 70px !important; 
    }

    .data-grid, .data-cell { grid-template-columns: 1fr; }     
    .table-container { width: 100%; overflow-x: auto; }
    .styled-table { min-width: 700px; }

    /* ========================================================
       NUEVO: Forzar pestañas en columna para dispositivos móviles
       ======================================================== */
    .tabs-buttons {
        flex-direction: column !important;
        width: 100% !important;
        gap: 8px;
        border-bottom: none; 
    }

    .tab-btn {
        width: 100%;
        text-align: left; 
        border-radius: 6px !important; 
        padding: 12px; 
    }

    .tabs-retroceso {
        flex-direction: column;
    }

    .retroceso-button {
        width: 100%;
        margin-top: 10px;
    }
}


/* ==================================================================
   ESTILOS PARA ESCRITORIO (768px o más) - Pestañas en Fila Horizontal
   ================================================================== */
@media (min-width: 768px) {
    /* Panel de Documentación */
    .panel-doc-wrapper {
        display: flex;
        width: 100%;
    }

    /* Forzar flujo horizontal ordenado en PC */
    .tabs-retroceso {
        flex-direction: row;
        align-items: center;
    }

    .tabs-buttons {
        width: 90%;
        display: flex !important;
        flex-direction: row !important; 
    }

    .tab-btn {
        width: auto;
        display: inline-block;
    }

    .retroceso-button {
        width: 10%;
        margin-top: 0;
    }

    .panel-doc-select {
        width: 180px; 
        border-bottom: none;
        border-right: 1px solid #ced4da;
    }

    .panel-doc-btn {
        width: auto; 
        border-bottom: none;
        border-right: 1px solid #ced4da;
    }

    .panel-doc-obs {
        flex-grow: 1; 
        width: 0;     
        min-width: 100px; 
    }
}