/* ==========================================================================
   DOMINACIÓN RRHH CONTROL - ESTILOS CORPORATIVOS HIGH-STANDING (DARK MODE)
   Diseño inspirado en Linear, Stripe y Centros de Mando Digitales de Vanguardia
   ========================================================================== */

:root {
  /* Paleta Base Carbono Profundo */
  --bg-primary: #0d0e12;
  --bg-secondary: #13141b;
  --bg-surface: #1c1e27;
  --bg-surface-hover: #252834;
  --bg-card: rgba(28, 30, 39, 0.85);

  /* Acentos de Marca Dominación JCC */
  --gold-primary: #D4AF37;
  --gold-light: #F3E5AB;
  --gold-dark: #997C1E;
  --gold-glow: rgba(212, 175, 55, 0.25);

  --blue-mystic: #38bdf8;
  --blue-energy: #6366f1;
  --blue-glow: rgba(56, 189, 248, 0.25);

  /* Estados y Alertas */
  --color-emerald: #10b981;
  --color-emerald-bg: rgba(16, 185, 129, 0.12);
  --color-amber: #f59e0b;
  --color-amber-bg: rgba(245, 158, 11, 0.12);
  --color-crimson: #ef4444;
  --color-crimson-bg: rgba(239, 68, 68, 0.12);

  /* Texto y Bordes */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(212, 175, 55, 0.4);
  --glass-blur: blur(14px);

  /* Tipografías */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Elevaciones */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 0 25px rgba(212, 175, 55, 0.18);
  --shadow-blue: 0 0 25px rgba(56, 189, 248, 0.18);

  /* Radio de Bordes */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ajustes Fullscreen PWA y Safe Area para Móviles */
body {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  display: flex;
  flex-direction: column;
}

/* Background Gradients Sutiles */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 450px;
  background: radial-gradient(circle at 50% -20%, rgba(212, 175, 55, 0.12), rgba(56, 189, 248, 0.05) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Contenedor Principal */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px 100px 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- HEADER / NAVBAR CORPORATIVO --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(28, 30, 39, 0.7);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1c1e27, #13141b);
  border: 1px solid var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px var(--gold-glow);
}

.brand-logo svg {
  width: 24px;
  height: 24px;
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #F3E5AB, #D4AF37);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--blue-mystic);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.user-badge-role {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.role-admin {
  background: rgba(212, 175, 55, 0.2);
  color: #F3E5AB;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.role-practicante {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.role-colaborador {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.user-badge-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* --- TARJETAS Y CONTENEDORES VIDRIO ESMERILADO --- */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-title svg {
  color: var(--gold-primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.badge-emerald {
  background: var(--color-emerald-bg);
  color: var(--color-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-emerald .badge-dot { background: var(--color-emerald); box-shadow: 0 0 8px var(--color-emerald); }

.badge-amber {
  background: var(--color-amber-bg);
  color: var(--color-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-amber .badge-dot { background: var(--color-amber); box-shadow: 0 0 8px var(--color-amber); }

.badge-crimson {
  background: var(--color-crimson-bg);
  color: var(--color-crimson);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-crimson .badge-dot { background: var(--color-crimson); box-shadow: 0 0 8px var(--color-crimson); }

.badge-blue {
  background: var(--blue-glow);
  color: var(--blue-mystic);
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.badge-blue .badge-dot { background: var(--blue-mystic); box-shadow: 0 0 8px var(--blue-mystic); }

/* --- RELOJ DIGITAL SERVIDOR Y MARCAJE --- */
.clock-hero-section {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(180deg, rgba(28, 30, 39, 0.95), rgba(19, 20, 27, 0.95));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-gold);
  position: relative;
  margin-bottom: 24px;
}

.server-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-family: var(--font-mono);
}

.server-sync-indicator .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-emerald);
  box-shadow: 0 0 8px var(--color-emerald);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.digital-clock-display {
  font-family: var(--font-mono);
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.15);
  line-height: 1;
  margin-bottom: 8px;
}

.digital-date-display {
  font-size: 0.95rem;
  color: var(--gold-light);
  font-weight: 500;
  text-transform: capitalize;
  margin-bottom: 24px;
}

/* Timeline Secuencial de la Jornada */
.attendance-timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.timeline-step {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
  transition: all 0.25s ease;
}

.timeline-step.active {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.08);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.12);
}

.timeline-step.completed {
  border-color: var(--color-emerald);
  background: var(--color-emerald-bg);
}

.timeline-step-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.timeline-step-time {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Botones de Marcaje de 1 Clic */
.clock-action-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  margin: 0 auto;
}

.btn-clock-action {
  width: 100%;
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.btn-clock-action:active {
  transform: scale(0.98);
}

/* Colores Dinámicos de Botones */
.btn-ingreso {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.35);
}
.btn-ingreso:hover {
  background: linear-gradient(135deg, #34d399, #059669);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.5);
}

.btn-colacion-inicio {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.35);
}
.btn-colacion-inicio:hover {
  background: linear-gradient(135deg, #fbbf24, #d97706);
}

.btn-colacion-fin {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #ffffff;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.35);
}
.btn-colacion-fin:hover {
  background: linear-gradient(135deg, #7dd3fc, #0284c7);
}

.btn-salida {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.35);
}
.btn-salida:hover {
  background: linear-gradient(135deg, #f87171, #dc2626);
}

.btn-jornada-cerrada {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

/* Indicador de Horas Efectivas en Vivo */
.live-hours-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.live-hours-summary strong {
  color: var(--gold-primary);
  font-family: var(--font-mono);
  font-size: 1rem;
}

/* --- WIDGET DESTACADO: PROGRESO DE PRÁCTICA (PRACTICANTE) --- */
.intern-widget-card {
  background: linear-gradient(145deg, rgba(28, 30, 39, 0.95), rgba(19, 20, 27, 0.95));
  border: 1px solid rgba(212, 175, 55, 0.25);
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.1);
  position: relative;
  margin-bottom: 24px;
}

.intern-widget-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-primary), var(--blue-mystic), var(--gold-primary));
}

.intern-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 28px;
  align-items: center;
}

/* Medidor Circular Luminoso */
.circular-meter-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.circular-meter {
  position: relative;
  width: 170px;
  height: 170px;
}

.circular-meter svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.meter-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 12;
}

.meter-progress {
  fill: none;
  stroke: url(#goldBlueGrad);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 440;
  stroke-dashoffset: 440;
  transition: stroke-dashoffset 1.4s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.4));
}

.meter-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.meter-percentage {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, #FFF2A3, #D4AF37);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.meter-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* Métricas del Practicante */
.intern-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.metric-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 4px;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.metric-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.highlight-gold {
  color: var(--gold-light);
}

.highlight-blue {
  color: var(--blue-mystic);
}

.intern-projection-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.projection-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.projection-text strong {
  color: var(--blue-mystic);
}

.btn-duoc-report {
  background: linear-gradient(135deg, #1c1e27, #13141b);
  border: 1px solid var(--gold-primary);
  color: #F3E5AB;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.15);
}

.btn-duoc-report:hover {
  background: rgba(212, 175, 55, 0.15);
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.3);
  transform: translateY(-1px);
}

/* --- MÓDULO DE PERMISOS Y REPOSICIÓN --- */
.permissions-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: rgba(13, 14, 18, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #D4AF37, #997C1E);
  color: #0d0e12;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #FFF2A3, #D4AF37);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.35);
}

.requests-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
}

.request-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: border-color 0.2s ease;
}

.request-item:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.request-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.request-item-reason {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.request-item-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.request-item-details strong {
  color: var(--gold-light);
}

/* --- TABLAS MODERNAS CORPORATIVAS --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.table-custom {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.table-custom th {
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.table-custom td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  white-space: nowrap;
}

.table-custom tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

.table-custom td strong {
  color: var(--text-primary);
}

/* --- CHAT DE TRABAJO RÁPIDO (TIPO WHATSAPP FLOTANTE) --- */
.chat-fab-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(37, 211, 102, 0.4);
  border: none;
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.chat-fab-trigger:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 35px rgba(37, 211, 102, 0.6);
}

.chat-fab-trigger .badge-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-crimson);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-primary);
}

/* Panel Drawer del Chat */
.chat-drawer {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 380px;
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  z-index: 999;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-drawer.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.chat-header {
  background: #111b21;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar-group {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #128C7E, #25D366);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
}

.chat-title-group h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chat-title-group span {
  font-size: 0.7rem;
  color: #25D366;
}

.chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #0b141a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 16px 16px;
}

.chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
}

.chat-msg.mine {
  align-self: flex-end;
  background: #005c4b;
  color: #e9edef;
  border-bottom-right-radius: 2px;
}

.chat-msg.other {
  align-self: flex-start;
  background: #202c33;
  color: #e9edef;
  border-bottom-left-radius: 2px;
}

.chat-msg-sender {
  font-size: 0.68rem;
  font-weight: 700;
  color: #53bdeb;
  margin-bottom: 3px;
}

.chat-msg-meta {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  text-align: right;
  margin-top: 4px;
  font-family: var(--font-mono);
}

.chat-footer {
  padding: 10px 14px;
  background: #202c33;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
}

.chat-input {
  flex: 1;
  background: #2a3942;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  color: #e9edef;
  font-size: 0.88rem;
  font-family: inherit;
}

.chat-input:focus {
  outline: none;
}

.chat-send-btn {
  background: #00a884;
  border: none;
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.chat-send-btn:hover {
  transform: scale(1.05);
}

/* --- DASHBOARD CUENTA MAESTRA (ADMIN) --- */
.admin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.admin-card-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.admin-stat-num {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  margin: 6px 0 2px 0;
}

/* Centro de Descarga Directa */
.export-card {
  background: linear-gradient(135deg, rgba(28, 30, 39, 0.9), rgba(19, 20, 27, 0.9));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.export-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-export-excel {
  background: linear-gradient(135deg, #107c41, #0f6233);
  color: white;
  border: 1px solid rgba(16, 124, 65, 0.5);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-export-excel:hover {
  background: linear-gradient(135deg, #15934e, #0f6233);
  box-shadow: 0 0 20px rgba(16, 124, 65, 0.4);
}

/* --- MODALES Y DIÁLOGOS --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Vista de Impresión Duoc UC */
.duoc-sheet {
  background: #ffffff;
  color: #111827;
  padding: 30px;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
}

.duoc-sheet h2 {
  color: #002b49;
  font-size: 1.3rem;
  border-bottom: 2px solid #ffaa00;
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.duoc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin: 16px 0;
}

.duoc-table th, .duoc-table td {
  border: 1px solid #d1d5db;
  padding: 8px;
  text-align: left;
}

.duoc-table th {
  background: #f3f4f6;
  font-weight: 700;
}

/* Login Screen */
.auth-wrapper {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-gold);
  text-align: center;
}

.auth-card .brand-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px auto;
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(90deg, #F3E5AB, #D4AF37);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  color: var(--text-primary);
  font-size: 0.88rem;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slide-in 0.3s ease;
  min-width: 280px;
  max-width: 400px;
}

.toast-success { border-left: 4px solid var(--color-emerald); }
.toast-error { border-left: 4px solid var(--color-crimson); }
.toast-info { border-left: 4px solid var(--blue-mystic); }

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Tabs */
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold-primary);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .admin-metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 12px 14px 110px 14px;
  }

  .navbar {
    padding: 10px 14px;
  }

  .user-badge-name {
    display: none;
  }

  .digital-clock-display {
    font-size: 2.7rem;
  }

  .attendance-timeline {
    grid-template-columns: repeat(2, 1fr);
  }

  .intern-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .intern-metrics-grid {
    grid-template-columns: 1fr;
  }

  .permissions-section {
    grid-template-columns: 1fr;
  }

  .admin-metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .export-card {
    flex-direction: column;
    align-items: stretch;
  }

  .chat-drawer {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 90px;
  }
}

@media print {
  body * {
    visibility: hidden;
  }
  .duoc-sheet, .duoc-sheet * {
    visibility: visible;
  }
  .duoc-sheet {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 20px;
    box-shadow: none;
  }
}
