/* ================= MODALES Y UI BASE ================= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow-y: auto;
}

/* Título de Modal (Barra Superior) */
.modal-content h2,
.modal-content h3,
.modal-content h4 {
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    color: var(--primary);
}

.close-modal {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-light);
    z-index: 10;
}

.close-modal:hover {
    color: var(--danger);
}

.modal-mini {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

.modal-mini.show {
    display: flex;
}

.modal-mini-content {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
}

/* Título de Mini Modal */
.modal-mini-content h2,
.modal-mini-content h3,
.modal-mini-content h4 {
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    color: var(--primary);
    text-align: left;
    /* Alinear título a la izquierda como los otros */
}

:root {
    --primary: #214fb9;
    --accent: #0a439e;
    --bg-app: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #334155;
    --text-light: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --inactive: #94a3b8;
    --holiday-bg: #fce7f3;
    --holiday-text: #be185d;
    --selection-bg: rgba(59, 130, 246, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    caret-color: transparent; /* Previene el cursor parpadeando en áreas no editables */
}

input, textarea, select, [contenteditable="true"] {
    caret-color: auto; /* Restaura el cursor en los campos de escritura */
}

/* HEADER & NAV */
.main-header {
    background: #ffffff;
    padding: 0.8rem 2rem;
    display: flex;
    align-items: center;
    /* Removed justify-content: space-between to allow margin:auto centering */
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    height: 72px;
    z-index: 50;
    position: relative;
}

.header-brand {
    display: flex;
    align-items: center;
    min-width: 200px;
}

.main-header h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.highlight {
    color: var(--accent);
}

/* Modern Tabs Design - Pill Style */
.tabs-nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    background: #e2e8f0;
    /* Darker background for depth */
    padding: 0.35rem;
    border-radius: 50px;
    margin: 0 auto;
    /* Centers the tabs */
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    /* Inner shadow for depth */
}

.tabs-nav .tab-btn {
    background: transparent;
    border: none;
    padding: 0.6rem 1.5rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.tabs-nav .tab-btn:hover {
    color: var(--primary);
    background: #cbd5e1;
    /* Darker gray for hover contrast */
}

.tabs-nav .tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: scale(1.02);
    /* Slight scale up */
}

/* LAYOUT */
.content-area {
    padding: 2rem;
    flex: 1;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

.tab-content {
    display: none;
    height: 100%;
    flex-direction: column;
}

.tab-content.active {
    display: flex;
}

.split-view-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    overflow-y: auto;
    padding-bottom: 1rem;
    width: 100%;
}

/* CARDS & LISTS */
.card {
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.full-width-card {
    flex: 1;
    height: 100%;
    border-radius: 8px;
    background: var(--bg-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

/* NÓMINA */
.nomina-item {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
    width: fit-content;
    /* Adapt width to content (table) */
    min-width: 800px;
    /* Minimum width to prevent it from being too narrow */
    margin: 1rem auto;
    /* Center horizontally */
    display: flex;
    flex-direction: column;
}

/* Ensure the ribbon takes full width of the container */
.nomina-ribbon {
    width: 100%;
}

/* Ensure inner content respects container width */
.nomina-content {
    width: 100%;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
    gap: 10px;
}

.list-item:hover {
    background: #f8fafc;
}

.item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 0.2rem;
    flex-shrink: 0;
}

/* UI ELEMENTS */
.worker-inactive {
    background-color: #f1f5f9;
    opacity: 0.7;
}

.worker-inactive .item-info strong {
    text-decoration: line-through;
    color: var(--inactive);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

/* Accordion Styles */
.accordion-wrapper {
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.accordion-header {
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.accordion-content {
    display: none;
    padding: 1rem;
    background: white;
}

.accordion-wrapper.open .accordion-content {
    display: block;
}

.accordion-wrapper.open .arrow-icon {
    transform: rotate(180deg);
}

.arrow-icon {
    transition: transform 0.2s;
}

.btn-icon:hover {
    background: #e2e8f0;
}

.btn-icon.edit {
    color: var(--accent);
}

.btn-icon.history {
    color: var(--primary);
}

.btn-icon.delete {
    color: var(--danger);
}

.btn-icon.toggle {
    color: var(--warning);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 1rem;
}

.row {
    display: flex;
    gap: 1rem;
}

input,
select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.time-widget-row {
    display: flex;
    gap: 0.5rem;
}

.time-widget-row select {
    flex: 1;
    min-width: 0;
}

.accordion-wrapper {
    margin: 1rem 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.accordion-header {
    background: #e2e8f0;
    padding: 0.8rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-content {
    padding: 1rem;
    display: none;
    background: #fff;
    border-top: 1px solid var(--border);
}

.accordion-wrapper.open .accordion-content {
    display: block;
}

.arrow-icon {
    transition: transform 0.3s;
}

.accordion-wrapper.open .arrow-icon {
    transform: rotate(180deg);
}

/* PROGRAMACIÓN */
.toolbar {
    padding: 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 2rem;
    align-items: center;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.period-select {
    padding: 0.5rem;
    border: 1px solid var(--accent);
    border-radius: 4px;
    font-weight: 500;
    width: 240px;
    /* Fixed width for longest month */
    text-align: center;
    background: #eff6ff;
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: bold;
}

.schedule-container {
    flex: 1;
    overflow: auto;
    position: relative;
    outline: none;
    user-select: none;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
    table-layout: fixed;
}

thead th {
    position: sticky;
    top: 0;
    background: var(--accent);
    color: white;
    z-index: 10;
    border-bottom: 2px solid var(--border);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem;
    height: 60px;
}

.col-holiday {
    background-color: var(--holiday-bg) !important;
}

.is-holiday {
    color: var(--holiday-text);
    font-weight: bold;
}

.col-worker {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 15;
    text-align: left;
    padding-left: 1rem;
    width: 200px;
    border-right: 2px solid var(--border);
    vertical-align: middle !important;
    color: var(--text-main);
}

thead th.col-worker {
    background: var(--accent);
    color: white;
    border-right: 2px solid rgba(255, 255, 255, 0.2);
}

tbody td {
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    height: 75px;
    padding: 0;
    vertical-align: top;
    cursor: cell;
}

.split-cell {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    padding: 3px;
    box-sizing: border-box;
}

.cell-text-wrapper {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
    width: 100%;
    line-height: 1.1;
}

.cell-top {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 2px;
    border-radius: 4px;
    transition: transform 0.1s;
    padding: 0 2px;
}

.cell-bottom {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 4px;
    padding: 0 2px;
}

td.selected-cell {
    border: 2px solid var(--accent) !important;
    background-color: var(--selection-bg);
    z-index: 5;
}

@keyframes copyFlash {
    0% {
        background: var(--success);
    }

    100% {
        background: var(--selection-bg);
    }
}

.copy-feedback {
    animation: copyFlash 0.3s ease-out;
}

/* TABLA HISTORIAL COMPACTA (Estilo corregido) */
.table-simple {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    min-width: 100%;
    table-layout: auto;
}

.table-simple th {
    background-color: #f1f5f9;
    color: var(--primary);
    font-weight: 600;
    text-align: center;
    padding: 6px;
    border-bottom: 2px solid var(--border);
}

.table-simple td {
    padding: 6px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    text-align: center;
    height: auto;
    vertical-align: middle;
}

.table-simple tr:last-child td {
    border-bottom: none;
}

/* SELECTORES MINI */
.list-simple-scroll {
    max-height: 250px;
    overflow-y: auto;
    text-align: left;
}

.list-simple-item {
    padding: 0.7rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.list-simple-item:hover {
    background: #f1f5f9;
    color: var(--accent);
}

.grid-turnos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.btn-select-shift {
    padding: 0.8rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    width: 100%;
}

.btn-text {
    background: none;
    border: none;
    margin-top: 1rem;
    text-decoration: underline;
    cursor: pointer;
    width: 100%;
    color: var(--text-main);
}

/* ================================================================
   ESTILOS NUEVOS: MÓDULO CÁLCULOS (ESTILO NÓMINA)
   ================================================================ */
.nomina-item {
    margin-bottom: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.nomina-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Cinta (Ribbon) de Encabezado */
/* Cinta (Ribbon) de Encabezado */
.nomina-ribbon {
    background: linear-gradient(90deg, var(--accent) 0%, var(--primary) 100%) !important;
    color: white;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    border-left: 5px solid rgba(255, 255, 255, 0.3);
}

.nomina-ribbon:hover {
    opacity: 0.95;
}

.nomina-ribbon.reviewed {
    background: #64748b !important;
    /* Slate 500 - Validated visually distinct */
    border-left-color: #94a3b8;
}

.nomina-ribbon.reviewed h3 {
    text-decoration: line-through;
    opacity: 0.9;
}

.nomina-ribbon h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.nomina-ribbon-info {
    font-size: 0.85rem;
    opacity: 1;
    font-weight: 500;
}

/* Panel de Información del Trabajador */
/* Panel de Información del Trabajador */
.nomina-worker-info {
    background: #f8fafc;
    padding: 1.2rem 1rem;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    width: 100%;
    /* Match parent width */
    box-sizing: border-box;
}

.table-nomina {
    width: 100%;
    /* Match parent width */
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: auto;
    /* Let content dictate column width */
}

.info-block label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 4px;
    text-align: center;
    width: 100%;
}

.info-block span {
    font-weight: 500;
    color: var(--primary);
    font-size: 1rem;
    text-align: center;
}

/* Contenido Expandible */
/* Contenido Expandible con Animación */
.nomina-content {
    max-height: 0;
    overflow: hidden;
    padding: 0;
    background: white;
    opacity: 0;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.nomina-item.open .nomina-content {
    opacity: 1;
    /* max-height handled by JS */
}

.nomina-item.open .arrow-icon {
    transform: rotate(180deg);
}

/* Tabla de Nómina Detallada */
.table-nomina {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table-nomina th {
    background: #eef2f6;
    color: var(--primary);
    font-weight: 600;
    text-align: left;
    padding: 10px 1.5rem;
    border-bottom: 2px solid var(--border);
}

.table-nomina td {
    padding: 10px 1.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.table-nomina td.concept-col {
    font-weight: 500;
}

.table-nomina .num-col {
    text-align: right;
    font-family: 'Roboto', monospace;
}

/* Alineación derecha para números */

.nomina-total-row th {
    background: var(--primary);
    color: white;
    font-size: 1.1rem;
    padding: 1rem 1.5rem;
}

.tabla-calculos {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-top: 5px;
    min-width: auto !important;
    /* Override global table min-width */
    table-layout: auto !important;
    /* Allow columns to adapt */
}

.tabla-calculos th {
    background-color: #f8fafc;
    color: #64748b;
    font-weight: 600;
    padding: 8px;
    border-bottom: 2px solid #e2e8f0;
    text-align: center;
    white-space: nowrap;
}

.tabla-calculos td {
    padding: 4px;
    border-bottom: 1px solid #f1f5f9;
    text-align: center;
    height: auto !important;
    /* Override global 75px height */
}

.tabla-calculos tr:hover {
    background-color: #f1f5f9;
}

/* === TABLA DE CÁLCULOS DETALLADA (Estilo Nomina) === */
.table-nomina {
    width: auto;
    min-width: 600px;
    max-width: 100%;
    margin: 0 auto;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 0.82rem;
    border: 1px solid #1e3a8a;
}

.table-nomina th {
    background-color: var(--primary);
    color: white;
    padding: 0.6rem 2px;
    border: 1px solid white;
    text-align: center;
    font-weight: bold;
    white-space: nowrap;
    font-size: 0.72rem;
    line-height: 1.1;
    height: auto;
}

.table-nomina td {
    border: 1px solid #e2e8f0;
    padding: 5px 6px;
    text-align: center;
    color: #334155;
    height: auto;
    font-size: 0.82rem;
    white-space: nowrap;
}

.table-nomina tr:nth-child(even):not(.row-holiday) {
    background-color: #f8fafc;
}

.row-holiday {
    background-color: #fce7f3 !important;
}

/* Column groups colors (Optional - can use th classes) */
.th-group-recargos {
    background-color: var(--accent) !important;
}

.th-group-extras {
    background-color: var(--accent) !important;
}

/* Special Rows */
.row-total-general td {
    background-color: #1e3a8a;
    color: white;
    font-weight: bold;
    border-color: white;
    padding: 5px;
}

.row-porcentajes td {
    background-color: #172554;
    color: #fbbf24;
    font-weight: bold;
    border-color: white;
    font-style: italic;
    padding: 5px;
}

.row-valor-pagar td {
    background-color: #0f172a;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
    border-color: white;
    padding: 7px;
}

.cell-resaltado {
    font-weight: bold;
    color: #1e3a8a;
}

.label-total-pagar {
    background: #0f172a;
    color: white;
    width: 100%;
    max-width: 100%;
    text-align: center;
    padding: 0.8rem;
    font-size: 1.15rem;
    font-weight: bold;
    border-radius: 8px;
    margin: 0 auto;
    margin-top: 0.5rem;
}

/* LOGIN STYLES */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-app), #cbd5e1);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

/* USER PROFILE STYLES */
.user-circle {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s;
}

.user-circle:hover {
    transform: scale(1.1);
}

.profile-popup {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    width: 250px;
    z-index: 2000;
}

.profile-popup.show {
    display: block;
}

.role-badge {
    background: #e0f2fe;
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

/* ================= LOGIN & OVERLAYS PRO ================= */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 420px;
    text-align: center;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

/* Decoración superior bar */
.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
}

@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.login-card h2 {
    color: #1e293b;
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.login-card p.subtitle {
    color: #64748b;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.login-card .form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.login-card label {
    display: block;
    margin-bottom: 0.5rem;
    color: #475569;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-card input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1.1rem;
    transition: all 0.2s;
    background: #f8fafc;
    color: #334155;
    font-family: 'Roboto', monospace;
    /* Para que los números se vean bien */
}

.login-card input:focus {
    border-color: var(--primary);
    outline: none;
    background: white;
    box-shadow: 0 0 0 4px rgba(33, 79, 185, 0.15);
}

.login-card .btn-primary {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    margin-top: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 6px -1px rgba(33, 79, 185, 0.3);
}

.login-card .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(33, 79, 185, 0.4);
}

.login-footer {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-light);
    border-top: 1px solid #f1f5f9;
    padding-top: 1rem;
}

/* ================= RESPONSIVE MOBILE AJUSTES ================= */
@media (max-width: 768px) {

    /* HEADER: Pila Vertical */
    .main-header {
        height: auto !important;
        flex-direction: column;
        padding: 1rem 0.5rem !important;
        gap: 0.2rem;
    }

    /* 1. Perfil de Usuario ARRIBA del todo */
    .user-profile-container {
        position: static !important;
        /* Ya no absolute */
        order: -1;
        /* Importante: Mover al principio del flex */
        margin: 0 auto !important;
        margin-bottom: 0.5rem !important;
    }

    .user-circle {
        width: 45px;
        /* Un poco más grande para tocar fácil */
        height: 45px;
        font-size: 1rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    /* 2. Brand (Título) debajo del perfil */
    .header-brand {
        order: 0;
        justify-content: center;
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
    }

    /* 3. Selector de Periodos: Label Arriba, Controles Abajo */
    .toolbar-group {
        width: 100%;
        justify-content: center !important;
        flex-wrap: wrap !important;
        /* Permitir wrap */
        gap: 0.5rem;
    }

    .toolbar-group label {
        width: 100%;
        /* Ocupa todo el ancho */
        text-align: center;
        margin-bottom: 0.2rem;
        display: block;
        color: var(--text-light);
        font-weight: 500;
        font-size: 0.9rem;
    }

    .period-select {
        width: auto !important;
        min-width: 140px;
        max-width: 180px;
    }

    /* TOOLBARS EN PESTAÑAS */
    .toolbar {
        flex-direction: column;
        gap: 1rem;
        padding: 0.8rem;
        align-items: center !important;
    }

    /* NÓMINA / CÁLCULOS */

    /* Acordeón Header (Ribbon) */
    /* Acordeón Header (Ribbon) - Mobile Adjustment */
    .nomina-ribbon {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        /* Pack items to start */
        text-align: left !important;
        padding: 0.75rem 1rem !important;
        gap: 0.5rem;
        height: auto !important;
    }

    .nomina-ribbon h3 {
        width: auto !important;
        margin: 0 !important;
        font-size: 1rem !important;
        color: white !important;
        display: block !important;
        text-shadow: none;
        flex: 0 1 auto !important;
        /* Shrink allowed, grow prevented */
        margin-right: 0.2rem !important;
        /* Small gap before price */
    }

    .nomina-ribbon-info {
        flex: 1 !important;
        /* Grow to fill separate space */
        display: flex !important;
        /* Enable flex for inner items (Price + Arrow) */
        justify-content: space-between !important;
        /* Price Left, Arrow Right */
        align-items: center !important;
        color: white !important;
        font-size: 1rem !important;
        font-weight: bold !important;
        background: none !important;
        padding: 0 !important;
        border-radius: 0;
        margin-top: 0;
        text-align: left;
    }

    .nomina-ribbon-info strong {
        color: white !important;
    }

    /* Datos del Trabajador */
    /* Datos del Trabajador */
    .nomina-worker-info {
        flex-direction: row !important;
        /* Back to row to allow side-by-side */
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 0.5rem !important;
        /* Reduced gap */
        padding: 0.5rem !important;
        /* Reduced padding */
    }

    /* Force container width to fit screen on mobile, overriding JS calculation */
    .nomina-item {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0.5rem 0 !important;
    }

    .info-block {
        width: 32% !important;
        /* Attempt 3 columns */
        min-width: 80px;
        /* Prevent too small */
        text-align: left !important;
        border-right: none !important;
        border-bottom: none !important;
        /* Remove borders */
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    .info-block:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .info-block label {
        margin-bottom: 0px !important;
        font-size: 0.7rem !important;
        /* Smaller font */
        text-align: left !important;
        color: #94a3b8;
    }

    .info-block span,
    .info-block div {
        font-size: 0.8rem !important;
        /* Smaller font */
        font-weight: 500;
        text-align: left !important;
        display: block;
        line-height: 1.1;
    }

    /* Contenedor de la tabla */
    .schedule-container {
        padding: 0 !important;
    }

    .table-nomina {
        font-size: 0.8rem !important;
    }

    /* Ocultar botones de descarga en móvil para ahorrar espacio si es necesario, o estilizarlos mejor */
    .toolbar-actions {
        flex-direction: column;
        width: 100%;
    }

    .toolbar-actions button {
        width: 100%;
        justify-content: center;
    }

    /* Fix Total Box Width */
    .label-total-pagar {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 0 6px 6px;
        box-sizing: border-box;
    }

    /* Tabs Nav */
    .tabs-nav {
        flex-wrap: wrap;
        border-radius: 12px;
        order: 1;
        /* Tabs después del título */
    }
}

/* ================================================================
   TOGGLE SWITCH (interruptor)
   ================================================================ */
.toggle-switch-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.toggle-switch-label input[type="checkbox"] {
    display: none;
    width: auto;
    padding: 0;
    border: none;
}

.toggle-track {
    position: relative;
    width: 40px;
    height: 22px;
    background: #cbd5e1;
    border-radius: 999px;
    transition: background 0.25s;
    flex-shrink: 0;
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}

.toggle-switch-label input:checked + .toggle-track {
    background: var(--primary);
}

.toggle-switch-label input:checked + .toggle-track::after {
    transform: translateX(18px);
}

/* ================================================================
   MODAL AJUSTES CALIFICACIONES (flotante / dropdown)
   ================================================================ */
#modal-ajustes-calif {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 1.2rem 1.4rem;
    min-width: 260px;
    z-index: 400;
    flex-direction: column;
    gap: 1rem;
}

#modal-ajustes-calif.open {
    display: flex;
}

.ajustes-calif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.6rem;
    margin-bottom: 0.4rem;
}

.ajustes-calif-header button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 1.3rem;
    line-height: 1;
    padding: 0;
}

.ajustes-calif-header button:hover {
    color: var(--danger);
}

.btn-subir-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    width: 100%;
    justify-content: center;
    transition: opacity 0.2s;
}

.btn-subir-logo:hover {
    opacity: 0.88;
}

/* Wrapper para posicionamiento relativo del dropdown */
.ajustes-calif-wrapper {
    position: relative;
}