/* ==========================================================================
   1. VARIABLES GLOBALES Y RESET
   ========================================================================== */
:root {
  --primary-color: #1b4332;
  --primary-light: #2d5a45;
  --secondary-color: #c5cfc9;
  --secondary-light: #f1f4f2;
  --bg-color: #f8faf9;
  --card-bg: #ffffff;
  --text-main: #1b4332;
  --text-muted: #537061;
  --error-color: #bc3a3a;
  --error-bg: #fde8e8;
  --border-radius: 12px;
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 4px rgba(27, 67, 50, 0.05);
  --shadow-md: 0 8px 16px rgba(27, 67, 50, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   2. PANTALLA DE LOGIN
   ========================================================================== */
.login-body {
  background: linear-gradient(
    135deg,
    var(--secondary-light) 0%,
    var(--secondary-color) 100%
  );
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 440px;
  background-color: var(--card-bg);
  padding: 40px 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.4s ease-out;
}

.login-header {
  text-align: center;
  margin-bottom: 35px;
}

.brand-logo {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: inline-block;
}

.form-title-area {
  margin-bottom: 25px;
}

.form-title-area h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.form-title-area p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Campos de entrada flotantes modernos */
.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group input {
  width: 100%;
  padding: 16px 16px 16px 48px;
  border: 1.5px solid var(--secondary-color);
  background-color: transparent;
  border-radius: var(--border-radius);
  font-size: 1rem;
  color: var(--primary-color);
  outline: none;
  transition: var(--transition-smooth);
}

/* Interacción con el label flotante */
.input-group label {
  position: absolute;
  left: 48px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: var(--transition-smooth);
  font-size: 1rem;
  background-color: transparent;
  padding: 0 4px;
}

.input-group input:focus,
.input-group input:not(:placeholder-shown) {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(27, 67, 50, 0.1);
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
  top: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-color);
  background-color: var(--card-bg);
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.input-group input:focus ~ .input-icon {
  color: var(--primary-color);
}

.password-toggle-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.password-toggle-btn:hover {
  color: var(--primary-color);
}

/* Mensajes de error */
.login-error-message {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--error-bg);
  color: var(--error-color);
  padding: 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  border-left: 4px solid var(--error-color);
}

.form-utilities {
  margin-bottom: 25px;
  text-align: right;
}

.forgot-password-link {
  color: var(--primary-color);
  font-size: 0.85rem;
  text-decoration: none;
  font-weight: 500;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

/* Botón Principal */
.btn-primary {
  width: 100%;
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  padding: 16px;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 12px rgba(27, 67, 50, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(27, 67, 50, 0.3);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* ==========================================================================
   3. ANIMACIONES SIMPLES
   ========================================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   4. ADAPTACIÓN PARA ORDENADOR (MEDIA QUERIES)
   ========================================================================== */
@media (min-width: 768px) {
  .login-container {
    padding: 50px 40px;
  }
}

/* DASHBOARD */
/* ==========================================================================
   5. NAVEGACIÓN Y DISPOSICIÓN GLOBAL (DASHBOARD)
   ========================================================================== */
.dashboard-body {
  background-color: var(--bg-color);
  display: flex;
  flex-direction: row; /* Preparado para diseño lateral en escritorio */
  min-height: 100vh;
  overflow-x: hidden;
}

/* Envoltorio principal del contenido */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Evita desbordamientos en flexbox */
  padding-bottom: 70px; /* Espacio de seguridad para la barra inferior móvil */
}

/* Cabecera superior */
.main-header {
  background-color: var(--card-bg);
  height: 65px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--secondary-light);
  position: sticky;
  top: 0;
  z-index: 10;
}

@media (min-width: 992px) {
  .main-header {
    background-color: var(--primary-color);
    border-bottom: 1px solid var(--primary-light);
  }

  .icon-badge-btn {
    color: #ffffff !important;
  }

  .icon-badge-btn:hover {
    background-color: var(--primary-light) !important;
  }

  .icon-badge-btn .badge{
    border: 2px solid var(--primary-color) !important;
  }
}

.view-title-desktop {
  display: none; /* Se oculta en móvil */
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  /* color: var(--primary-color); */
}

.mobile-header-logo {
  height: 35px;
  height: 50px;
  width: auto;
  object-fit: contain;
}

/* Botones con iconos y badges */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-badge-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.icon-badge-btn:hover {
  background-color: var(--secondary-light);
}

.icon-badge-btn .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: var(--error-color);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--card-bg);
}

/* Contenedor central de contenidos */
.content-container {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ==========================================================================
   6. BLOQUES DE CONTENIDO (CARDS)
   ========================================================================== */
/* Tarjeta de Bienvenida */
.welcome-card {
  background-color: var(--primary-color);
  color: #ffffff;
  padding: 25px;
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}

.welcome-text h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.welcome-text .employee-title {
  color: var(--secondary-color);
  font-size: 0.95rem;
}

.highlight-name {
  color: #ffffff;
  font-weight: 600;
}

.welcome-datetime {
  border-top: 1px solid var(--primary-light);
  padding-top: 15px;
}

.clock-display {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums; /* Evita que los números bailen al cambiar */
  letter-spacing: 1px;
}

.date-display {
  font-size: 0.85rem;
  color: var(--secondary-color);
  margin-top: 4px;
}

/* Tarjeta de Fichaje */
.fichaje-card {
  background-color: var(--card-bg);
  padding: 25px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--secondary-light);
}

.fichaje-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 10px;
}

.fichaje-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Etiquetas de estado */
.status-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.status-offline {
  background-color: var(--secondary-light);
  color: var(--text-muted);
}
.status-working {
  background-color: #e3f2fd;
  color: #0d47a1;
}
.status-break {
  background-color: #fff3e0;
  color: #e65100;
}

/* Cronómetro */
.counter-container {
  text-align: center;
  background-color: var(--secondary-light);
  padding: 20px;
  border-radius: var(--border-radius);
  margin-bottom: 25px;
}

.counter-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
}

.timer-display {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-color);
  font-variant-numeric: tabular-nums;
}

/* Botonera de acciones */
.fichaje-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-fichaje {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
}

.btn-fichaje:disabled {
  background-color: var(--secondary-light) !important;
  color: #a0b2a6 !important;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
}

.btn-start-work {
  background-color: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(27, 67, 50, 0.15);
}

.btn-start-work:not(:disabled):hover {
  background-color: var(--primary-light);
}
.btn-stop-work {
  background-color: var(--error-color);
  color: #ffffff;
}
.btn-stop-work:not(:disabled):hover {
  background-color: #a32f2f;
}

.btn-pause-work {
  background-color: #ffffff;
  color: #e65100;
  border: 1.5px solid #e65100;
}
.btn-pause-work:not(:disabled):hover {
  background-color: #fffafd;
}

.modal-overlay.open { display: flex !important; }
.modal-overlay.open .sheet-box { transform: translateY(0) !important; }
.btn-option-fichaje {
    display: flex; align-items: center; gap: 14px; width: 100%; padding: 1rem;
    background: #F4F6F5; border: 1px solid #C5CFC9; border-radius: 12px;
    cursor: pointer; text-align: left; transition: all 0.2s ease;
}
.btn-option-fichaje:hover { background: #E2ECE9; border-color: #1B4332; }
.btn-option-fichaje img { width: 28px; height: 28px; object-fit: contain; }
.option-meta-text { display: flex; flex-direction: column; gap: 2px; }
.option-title { font-weight: bold; color: var(--primary-color); font-size: 0.95rem; }
.option-desc { font-size: 0.75rem; color: #666; line-height: 1.2; }





/* ==========================================================================
   7. MENÚS DE NAVEGACIÓN (RESPONSIVE DUAL)
   ========================================================================== */
/* Barra lateral (Escritorio) -> Oculta en móvil por defecto */
.sidebar {
  display: none;
  width: 260px;
  background-color: var(--primary-color);
  color: #ffffff;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 30px 20px;
}

/* Barra inferior (Móvil) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background-color: var(--card-bg);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--secondary-light);
  z-index: 10;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  gap: 4px;
  flex: 1;
  padding: 8px 0;
  transition: var(--transition-smooth);
}

.bottom-nav-item .material-icons {
  font-size: 24px;
  transition: var(--transition-smooth);
}

.bottom-nav-item.active {
  color: var(--primary-color);
}

.bottom-nav-item.active .material-icons {
  transform: scale(1.1);
}

/* ==========================================================================
   8. PANEL DE NOTIFICACIONES DESPLEGABLE
   ========================================================================== */
.notification-panel-overlay {
  position: fixed;
  top: 0;
  right: -100%; /* Oculto a la derecha */
  width: 100%;
  height: 100vh;
  background-color: rgba(27, 67, 50, 0.4);
  z-index: 100;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-panel-overlay.open {
  right: 0;
}

.notification-sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 85%;
  max-width: 360px;
  height: 100%;
  background-color: var(--card-bg);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.notif-header {
  padding: 20px;
  border-bottom: 1px solid var(--secondary-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-header h3 {
  font-size: 1.1rem;
  color: var(--primary-color);
}

.btn-close-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: var(--transition-smooth);
}

.notif-item.unread {
  background-color: var(--secondary-light);
}
.notif-icon {
  font-size: 20px;
}
.text-success {
  color: #2e7d32;
}
.text-warning {
  color: #f57c00;
}

.notif-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.notif-text {
  font-size: 0.85rem;
  line-height: 1.3;
}
.notif-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Elementos útiles globales ocultables */
.mobile-only-btn {
  display: flex;
}

/* ==========================================================================
   9. MEDIA QUERIES - TRANSFORMACIÓN A ENTORNO ESCRITORIO
   ========================================================================== */
@media (min-width: 992px) {
  /* Ocultar barra móvil inferior y botón logout superior */
  .bottom-nav,
  .mobile-only-btn,
  .mobile-header-logo {
    display: none !important;
  }

  /* Activar Barra Lateral de Escritorio */
  .sidebar {
    display: flex;
  }

  .view-title-desktop {
    display: block;
  }

  .main-wrapper {
    padding-bottom: 0; /* Quitamos espacio inferior de seguridad móvil */
  }

  /* Cambiar distribución de las Cards en rejilla espaciosa */
  .content-container {
    /* display: grid; */
    /* grid-template-columns: 1fr 1fr; /* Dos columnas perfectas */
    gap: 25px;
    padding: 40px;
  }

  .welcome-card {
    grid-column: span 2; /* Tarjeta bienvenida completa a lo ancho */
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 35px;
  }
  .welcome-datetime {
    border-top: none;
    border-left: 1px solid var(--primary-light);
    padding-top: 0;
    padding-left: 35px;
    text-align: right;
  } /* Ajuste de Botones horizontales en escritorio */
  .fichaje-actions {
    flex-direction: row;
  } /* Estilos menú sidebar */
  .sidebar-brand {
    text-align: start;
    margin-bottom: 40px;
    padding-left: 16px;
  }
  .sidebar-logo {
    max-width: 100%;
    height: auto;
    max-height: 55px;
    object-fit: contain;
  }
  .sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
  }
  .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--secondary-color);
    text-decoration: none;
    padding: 14px 16px;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition-smooth);
  }
  .menu-item:hover,
  .menu-item.active {
    background-color: var(--primary-light);
    color: #ffffff;
  }
  .btn-logout {
    width: 100%;
    background: none;
    border: 1.5px solid var(--secondary-color);
    color: #ffffff;
    padding: 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
  }
  .btn-logout:hover {
    background-color: var(--error-color);
    border-color: var(--error-color);
  }
}











/* CALENDARIO */
/* ==========================================================================
   10. INTERFAZ Y MAQUETACIÓN PREMIUM DEL CALENDARIO LABORAL
   ========================================================================== */

.calendar-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--secondary-light);
    box-shadow: var(--shadow-sm);
}

.calendar-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.calendar-nav-header h2 {
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 700;
}

.calendar-nav-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}
.calendar-nav-btn:hover { background-color: var(--secondary-light); }

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

/* CELDAS DIARIAS CON NÚMERO CENTRADO */
.calendar-day-cell {
    aspect-ratio: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Vuelve a estar perfectamente centrado */
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    background-color: var(--card-bg);
    border: 1px solid #eef1f0; /* 1px por defecto en móvil */
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.calendar-day-cell:hover:not(.empty-cell) {
    background-color: var(--secondary-light);
}

.calendar-day-cell.empty-cell { 
    cursor: default; 
    border-color: transparent;
    background: none !important;
}

.calendar-day-cell.selected-day {
    background-color: var(--primary-color) !important;
    color: #ffffff !important;
    border-color: var(--primary-color) !important;
}

/* --- BARRA DE TRABAJO ORDINARIO EN LA BASE DE LA CELDA --- */
.cell-work-indicator {
    position: absolute;
    bottom: 0;
    left: 8px;
    right: 8px;
    height: 4px;
    border-radius: 4px 4px 0 0;
}
.calendar-day-cell.selected-day .cell-work-indicator {
    background-color: #ffffff !important;
}

/* --- BOLAS DE PERMISOS AMPLIADAS (ESQUINA SUPERIOR DERECHA) --- */
.cell-dot-container {
    display: flex;
    justify-content: center;
    gap: 3px;
    position: absolute;
    top: 6px;
    right: 6px;
}

.micro-bullet {
    width: 9px; /* Incrementado para máxima visibilidad */
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

/* Permiso Aceptado -> Bola sólida visible */
.micro-bullet.bullet-accepted {
    background-color: var(--dot-color) !important;
}

/* Permiso Pendiente -> Bola hueca con borde continuo más grueso */
.micro-bullet.bullet-pending {
    background-color: transparent !important;
    border: 2px solid var(--dot-color) !important; /* Borde continuo más grueso de 2px */
}

/* Si la celda está seleccionada por click, forzamos contraste blanco */
.calendar-day-cell.selected-day .micro-bullet {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
}


/* --- TEXTURAS Y FONDOS SUTILES PARA DIAS ESPECIALES --- */

/* Vacaciones / Permiso Vacaciones: El entramado de rayas cruzadas que te encantaba */
.cell-vacation-effect {
    background: repeating-linear-gradient(
        45deg,
        var(--vacation-color-raw),
        var(--vacation-color-raw) 4px,
        var(--vacation-bg-flat) 4px,
        var(--vacation-bg-flat) 8px
    ) !important; /* Tramado limpio en un solo sentido alternando línea y fondo */
    border: 1px solid var(--vacation-border-raw) !important;
}

/* Festivos Oficiales */
.cell-festive-effect {
    background-color: var(--festive-bg-raw) !important;
    border: 1px solid var(--festive-border-raw) !important;
}

@media (min-width: 768px) {
    .calendar-day-cell { border-width: 2px; }
    .cell-vacation-effect {
        border-width: 2px !important;
        background-size: auto !important; 
    }
    .cell-festive-effect { border-width: 2px !important; }
}

@media (max-width: 767px) {
    .micro-bullet {
      width: 6px;
      height: 6px;
      margin: -1px;
  }
}

/* PANEL LATERAL DE DETALLES (CORREGIDO SIN HUECOS EN PC) */
.calendar-detail-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--secondary-light);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
}

.detail-header h3 { font-size: 1.1rem; color: var(--primary-color); }
.detail-header p { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }

.day-info-content { display: flex; flex-direction: column; gap: 16px; }
.info-row { display: flex; gap: 12px; align-items: start; }
.info-title { font-size: 0.75rem; color: var(--text-muted); }
.info-value { font-size: 0.9rem; font-weight: 600; color: var(--primary-color); }


/* LEYENDA DINÁMICA COMPACTA */
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    font-size: 0.8rem;
}

.custom-legend-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text-main);
}

.legend-line-sample {
    width: 16px;
    height: 5px;
    border-radius: 2px;
    display: inline-block;
}
.legend-circle-sample {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.legend-circle-sample.sample-pending {
    background-color: transparent !important;
    border: 2px solid var(--sample-color) !important;
}
.legend-circle-sample.sample-festive {
    width: 16px;
    height: 10px;
    border-radius: 3px;
    border: 1px solid var(--sample-color);
}
.legend-circle-sample.sample-vacation {
    border: 1px solid var(--sample-color) !important;
    width: 16px;
    height: 10px;
    border-radius: 3px;
}


/* VENTANAS MODALES */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.4);
    display: none;
    align-items: center; justify-content: center;
    z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background-color: var(--card-bg);
    width: 100%; max-width: 400px;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-md);
}
.modal-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.modal-form { display: flex; flex-direction: column; gap: 16px; }
.form-group-static { display: flex; flex-direction: column; gap: 6px; }
.form-group-static label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }

.input-readonly, .select-professional {
    width: 100%; padding: 12px; border: 1.5px solid var(--secondary-color);
    border-radius: 8px; font-size: 0.95rem; color: var(--primary-color); outline: none;
}
.select-professional { background-color: #ffffff; cursor: pointer; }


/* ==========================================================================
   CONMUTACIÓN DE GROSORES EN CONFIGURACIONES DE PC
   ========================================================================== */
@media (min-width: 768px) {
    /* Los grosores de bordes suben a 2px en ordenadores automáticamente */
    .calendar-day-cell { border-width: 2px; }
    .cell-vacation-effect { border-width: 2px !important; background-size: 12px 12px !important; }
    .cell-festive-effect { border-width: 2px !important; }
}

@media (min-width: 992px) {
    .grid-calendar-layout {
        display: grid;
        grid-template-columns: 1.4fr 0.8fr !important;
        gap: 25px;
    }
    .calendar-detail-card { min-height: 480px; }
    .btn-request-day { margin-top: auto; } /* Botón abajo limpio sin huecos */
}


#calendarMonthYearLabel {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}
#calendarMonthYearLabel:hover {
    background-color: var(--secondary-light);
}



/* PERMISOS */
/* ==========================================================================
   11. DISEÑO DE PANTALLA GESTIÓN DE PERMISOS
   ========================================================================== */
.permisos-form-card, .permisos-history-card {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    border: 1px solid var(--secondary-light);
    box-shadow: var(--shadow-sm);
}

.permisos-form-card h2, .permisos-history-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.section-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 20px;
}

/* Campos de Formulario Profesionales */
.professional-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-field-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-field-box label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.input-professional, .textarea-professional {
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--secondary-color);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--primary-color);
    outline: none;
    background-color: transparent;
    transition: var(--transition-smooth);
}

.textarea-professional {
    resize: none;
    font-family: inherit;
}

.input-professional:focus, .select-professional:focus, .textarea-professional:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(27, 67, 50, 0.08);
}

.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid-1col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Sistema de Pestañas (Tabs) */
.history-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--secondary-light);
    padding-bottom: 15px;
}

.tabs-container {
    display: flex;
    gap: 4px;
    background-color: var(--secondary-light);
    padding: 4px;
    border-radius: 8px;
    overflow-x: auto; /* Desplazamiento horizontal si hay muchas pestañas en móvil */
    scrollbar-width: none;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    white-space: nowrap;
    transition: var(--transition-smooth);
}

.tab-btn.active {
    background-color: #ffffff;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Tarjetas de elementos del historial */
.permisos-list-scroll {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 480px;
    overflow-y: auto;
}

.permit-item-card {
    border: 1px solid var(--secondary-light);
    padding: 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
}

.permit-meta-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.permit-badge-type {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
}

.permit-date-range {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.permit-comments-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 2px;
}

/* Badges de estados para el historial */
.pill-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.pill-pending { background-color: #fff3e0; color: #e65100; }
.pill-approved { background-color: #e8f5e9; color: #2e7d32; }
.pill-rejected { background-color: #ffebee; color: #c62828; }

/* Adaptación del layout a Escritorio */
@media (min-width: 992px) {
    .grid-permisos-layout {
        display: grid;
        grid-template-columns: 0.9fr 1.1fr !important;
        gap: 25px;
        align-items: start;
    }
    
    .history-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .tabs-container {
        flex-input: none;
    }
}

.btn-secondary-link { background: none; border: none; color: var(--primary-color); display: flex; align-items: center; gap: 4px; font-size: 0.85rem; font-weight: 600; cursor: pointer; padding: 4px 0; text-decoration: underline; }
.form-grid-2col { display: flex; gap: 10px; }
.form-grid-2col .input-field-box { flex: 1; }




/* RESUMEN */
/* ==========================================================================
   12. PANTALLA HISTORIAL / RESUMEN DE FICHAJES
   ========================================================================== */
/* Rejilla de métricas */
/* ==========================================================================
   13. DISEÑO AVANZADO DE HISTORIAL Y RESUMEN DE FICHAJES
   ========================================================================== */

/* CONTENEDOR GENERAL */
.resumen-fichajes-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* CABECERA DE LA PÁGINA */
.page-history-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
}

@media (min-width: 768px) {
    .page-history-header {
        flex-direction: row;
        align-items: center;
    }
}

.period-picker-card {
    position: relative; 
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--card-bg);
    padding: 10px 16px;
    border: 1px solid var(--secondary-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.picker-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* RENDER DEL CONTENEDOR INTERACTIVO DEL INPUT MES */
.calendar-picker-wrapper {
    position: relative;
    cursor: pointer;
    display: inline-block;
    padding: 2px 4px;
    border-radius: 4px;
}

.hidden-month-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
}

/* TARJETAS DE MÉTRICAS DE RESUMEN MENSUAL */
.metrics-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 576px) {
    .metrics-dashboard-grid { 
        grid-template-columns: repeat(3, 1fr); 
    }
}

.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--secondary-light);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--secondary-color);
}

.stat-card.border-success { border-left-color: #52B788; }
.stat-card.border-info { border-left-color: #81D4FA; }
.stat-card.border-primary { border-left-color: var(--primary-color); }

.stat-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-success-soft { background-color: #e8f5e9; }
.bg-info-soft { background-color: #e1f5fe; }
.bg-primary-soft { background-color: #e2ece9; }

.stat-info { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 1.25rem; font-weight: 700; color: var(--primary-color); }

/* CONTENEDOR PRINCIPAL DEL TIMELINE */
.timeline-records-section {
    background-color: var(--card-bg);
    border: 1px solid var(--secondary-light);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-sm);
}

.records-grid-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* TARJETA INDIVIDUAL DE CADA DÍA COMPUTADO */
.history-row-item {
    background-color: var(--bg-color);
    border: 1px solid var(--secondary-light);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: var(--transition-smooth);
}

.history-row-item:hover {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

/* BLOQUE DE FECHA E INFORMACIÓN DE JORNADA */
.day-meta-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.day-badge-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background-color: var(--secondary-light);
    border-radius: 50%;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1rem;
}

.day-activity-info { 
    display: flex; 
    flex-direction: column; 
}

.day-date-txt {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
}

.day-sub-txt {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* CONTENEDOR HORIZONTAL DE BALANCES (PÍLDORAS ADAPTATIVAS) */
.day-chips-horizontal-flow {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    flex: 1;
}

@media (min-width: 576px) {
    .day-chips-horizontal-flow {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .day-chips-horizontal-flow {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
}

.balance-mini-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

/* ADAPTACIÓN RESTRUCTURADA PARA ESCRITORIOS (FILA ÚNICA RECTA) */
@media (min-width: 768px) {
    .history-row-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 16px 24px;
        gap: 20px;
    }
}

.btn-picker-month-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.9rem 1.2rem;
    background-color: #F4F6F5;
    border: 1px solid #C5CFC9;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-picker-month-item:hover {
    background-color: #E2ECE9;
    border-color: #1B4332;
    color: #1B4332;
}

/* Estado del mes seleccionado actualmente */
.btn-picker-month-item.active-month {
    background-color: #1B4332;
    border-color: #1B4332;
    color: #FFFFFF;
}


/* NOTIFICACIONES */
.notif-title-area { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.btn-text-action { background: none; border: none; color: var(--primary-color); font-size: 0.8rem; cursor: pointer; text-decoration: underline; padding: 0; font-weight: 600; }
.btn-text-action:hover { opacity: 0.8; }
.notif-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn-action-read { background: none; border: none; color: var(--secondary-color); cursor: pointer; display: flex; align-items: center; transition: color 0.2s; }
.btn-action-read:hover { color: var(--primary-color); }
