/* ══════════════════════════════════════════════════════
   CalendarTRD — Estilos residuales
   Solo lo que Tailwind no puede manejar:
   print, calendario grid, animaciones, dark mode toggle
══════════════════════════════════════════════════════ */

/* ── Light Mode (Diseño Nativo y Elegante) ─────────────── */
html:not(.dark) {
  color-scheme: light;
}

html:not(.dark) body {
  background-color: #f8fafc !important; /* slate-50 */
  color: #0f172a !important;            /* slate-900 */
}

/* ── Superficies principales (Fondo general y headers) ── */
html:not(.dark) .bg-\[\#0a0a0a\],
html:not(.dark) .bg-\[\#0f0f0f\],
html:not(.dark) .bg-\[\#111\],
html:not(.dark) .bg-\[\#111113\],
html:not(.dark) .bg-\[\#121212\],
html:not(.dark) .bg-\[\#121214\],
html:not(.dark) .bg-\[\#141414\],
html:not(.dark) .bg-\[\#141416\],
html:not(.dark) .bg-\[\#151515\] {
  background-color: #f8fafc !important;
}

/* ── Sidebar y Topbar específicos ── */
html:not(.dark) #sidebar,
html:not(.dark) header,
html:not(.dark) #bottomNav {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

/* ── Tarjetas, Paneles, Modales y Contenedores (Surface 1) ── */
html:not(.dark) .bg-\[\#1a1a1a\],
html:not(.dark) .bg-\[\#161616\],
html:not(.dark) .bg-\[\#171717\],
html:not(.dark) .bg-\[\#181818\],
html:not(.dark) .bg-\[\#18181b\] {
  background-color: #ffffff !important;
}

/* ── Superficies secundarias (Pills, inputs, barras, subpaneles) ── */
html:not(.dark) .bg-\[\#1e1e1e\],
html:not(.dark) .bg-\[\#1f1f1f\],
html:not(.dark) .bg-\[\#1f1f23\],
html:not(.dark) .bg-\[\#222\],
html:not(.dark) .bg-\[\#232328\],
html:not(.dark) .bg-\[\#242424\],
html:not(.dark) .bg-\[\#252525\],
html:not(.dark) .bg-\[\#262626\],
html:not(.dark) .bg-\[\#2c2c2c\],
html:not(.dark) .bg-\[\#2e2e2e\],
html:not(.dark) .bg-\[\#2e2e32\],
html:not(.dark) .bg-\[\#333\],
html:not(.dark) .bg-\[\#3e3e3e\],
html:not(.dark) .bg-\[\#3e3e42\],
html:not(.dark) .bg-\[\#555\] {
  background-color: #f1f5f9 !important; /* slate-100 */
}

/* ── Bordes en Modo Claro ── */
html:not(.dark) .border-\[\#1e1e1e\],
html:not(.dark) .border-\[\#222\],
html:not(.dark) .border-\[\#242424\],
html:not(.dark) .border-\[\#252525\],
html:not(.dark) .border-\[\#262626\],
html:not(.dark) .border-\[\#26262a\],
html:not(.dark) .border-\[\#282828\],
html:not(.dark) .border-\[\#292929\],
html:not(.dark) .border-\[\#2a2a2a\],
html:not(.dark) .border-\[\#2c2c2c\],
html:not(.dark) .border-\[\#2e2e2e\],
html:not(.dark) .border-\[\#2e2e32\],
html:not(.dark) .border-\[\#333\] {
  border-color: #e2e8f0 !important; /* slate-200 */
}

html:not(.dark) .border-\[\#3a3a3a\],
html:not(.dark) .border-\[\#3e3e3e\],
html:not(.dark) .border-\[\#444\] {
  border-color: #cbd5e1 !important; /* slate-300 */
}

/* ── Textos en Modo Claro ── */
html:not(.dark) .text-white,
html:not(.dark) .text-\[\#ededed\],
html:not(.dark) .text-\[\#f0f0f0\] {
  color: #0f172a !important; /* slate-900 */
}

html:not(.dark) .text-\[\#e0e0e0\],
html:not(.dark) .text-\[\#ddd\] {
  color: #1e293b !important; /* slate-800 */
}

html:not(.dark) .text-\[\#ccc\],
html:not(.dark) .text-\[\#bbb\],
html:not(.dark) .text-\[\#aaa\] {
  color: #334155 !important; /* slate-700 */
}

html:not(.dark) .text-\[\#888\],
html:not(.dark) .text-\[\#777\] {
  color: #64748b !important; /* slate-500 */
}

html:not(.dark) .text-\[\#666\],
html:not(.dark) .text-\[\#555\],
html:not(.dark) .text-\[\#444\],
html:not(.dark) .text-\[\#333\] {
  color: #94a3b8 !important; /* slate-400 */
}

/* ── Preservar texto blanco en botones con fondo sólido ── */
html:not(.dark) .bg-indigo-600,
html:not(.dark) .bg-indigo-500,
html:not(.dark) .bg-indigo-700,
html:not(.dark) .bg-emerald-600,
html:not(.dark) .bg-emerald-500,
html:not(.dark) .bg-red-600,
html:not(.dark) .bg-red-500,
html:not(.dark) .bg-amber-600,
html:not(.dark) .bg-amber-500,
html:not(.dark) .bg-sky-600,
html:not(.dark) .bg-sky-500,
html:not(.dark) .bg-purple-600 {
  color: #ffffff !important;
}

html:not(.dark) .bg-indigo-600 *,
html:not(.dark) .bg-indigo-500 *,
html:not(.dark) .bg-indigo-700 *,
html:not(.dark) .bg-emerald-600 *,
html:not(.dark) .bg-emerald-500 *,
html:not(.dark) .bg-red-600 *,
html:not(.dark) .bg-red-500 *,
html:not(.dark) .bg-amber-600 *,
html:not(.dark) .bg-amber-500 *,
html:not(.dark) .bg-sky-600 *,
html:not(.dark) .bg-sky-500 *,
html:not(.dark) .bg-purple-600 * {
  color: #ffffff !important;
}

/* ── Botones secundarios y de navegación ── */
html:not(.dark) button.bg-\[\#1a1a1a\],
html:not(.dark) a.bg-\[\#1a1a1a\] {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

html:not(.dark) button.bg-\[\#1a1a1a\]:hover,
html:not(.dark) a.bg-\[\#1a1a1a\]:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

/* Hovers de navegación */
html:not(.dark) .hover\:bg-\[\#1a1a1a\]:hover,
html:not(.dark) .hover\:bg-\[\#242424\]:hover {
  background-color: #f1f5f9 !important;
}

html:not(.dark) .hover\:text-white:hover {
  color: #0f172a !important;
}

html:not(.dark) .hover\:border-\[\#444\]:hover,
html:not(.dark) .hover\:border-\[\#3a3a3a\]:hover {
  border-color: #94a3b8 !important;
}

/* Nav links activos */
html:not(.dark) .nav-link.bg-indigo-500\/15 {
  background-color: #e0e7ff !important;
  color: #4338ca !important;
}

/* ── Formularios, Inputs y Selects ── */
html:not(.dark) input,
html:not(.dark) select,
html:not(.dark) textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html:not(.dark) input::placeholder,
html:not(.dark) textarea::placeholder {
  color: #94a3b8 !important;
}

html:not(.dark) input:focus,
html:not(.dark) select:focus,
html:not(.dark) textarea:focus {
  border-color: #6366f1 !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2) !important;
}

/* ── Modales y Overlays ── */
html:not(.dark) .modal-overlay,
html:not(.dark) .bg-black\/50,
html:not(.dark) .bg-black\/60,
html:not(.dark) .bg-black\/70,
html:not(.dark) #sidebarOverlay {
  background-color: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(4px);
}

/* ── Sombras suaves para modo claro ── */
html:not(.dark) .shadow-2xl,
html:not(.dark) .shadow-xl {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04) !important;
}

/* ── Tabla del Calendario en Modo Claro ── */
html:not(.dark) .month-table th {
  background-color: #f8fafc !important;
  color: #475569 !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html:not(.dark) .month-table td {
  border-right: 1px solid #e2e8f0 !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html:not(.dark) .cal-day-work {
  background-color: #ffffff !important;
}

html:not(.dark) .cal-day-weekend {
  background-color: #f8fafc !important;
}

html:not(.dark) .cal-day-empty {
  background-color: #f1f5f9 !important;
}

html:not(.dark) .cal-day-today {
  outline: 2px solid #6366f1 !important;
  outline-offset: -2px;
  background-color: rgba(99, 102, 241, 0.06) !important;
}

html:not(.dark) .day-number {
  color: #64748b !important;
}

html:not(.dark) .cal-day-holiday {
  background-color: #fef2f2 !important;
  border-left: 2px solid #ef4444 !important;
}

html:not(.dark) .holiday-name {
  color: #dc2626 !important;
}

/* Pills de personas en calendario */
html:not(.dark) .cal-principal {
  background-color: #e0e7ff !important; /* indigo-100 */
}
html:not(.dark) .cal-principal .p-name {
  color: #3730a3 !important; /* indigo-800 */
  font-weight: 600;
}

html:not(.dark) .cal-secundario {
  background-color: #dcfce7 !important; /* emerald-100 */
}
html:not(.dark) .cal-secundario .s-name {
  color: #166534 !important; /* emerald-800 */
  font-weight: 600;
}

html:not(.dark) .cal-teletrabajo {
  background-color: #e0f2fe !important; /* sky-100 */
}
html:not(.dark) .cal-teletrabajo .p-name {
  color: #0369a1 !important; /* sky-700 */
  font-weight: 600;
}
html:not(.dark) .cal-teletrabajo .tt-dot {
  background-color: #0284c7 !important;
}

html:not(.dark) .cal-sec-label.lbl-tt {
  color: #0284c7 !important;
}
html:not(.dark) .cal-sec-label.lbl-sop {
  color: #15803d !important;
}

html:not(.dark) .tp-label {
  color: #92400e !important;
  background-color: #fef3c7 !important;
}
html:not(.dark) .tp-label.tp-prado {
  color: #065f46 !important;
  background-color: #d1fae5 !important;
}

html:not(.dark) .cal-vacia {
  border: 1px dashed #cbd5e1 !important;
}
html:not(.dark) .cal-vacia .v-name {
  color: #94a3b8 !important;
}

html:not(.dark) .turno-label {
  color: #64748b !important;
  border-top: 1px solid #e2e8f0 !important;
}

html:not(.dark) .badge-override {
  background-color: #fef3c7 !important;
  color: #92400e !important;
}

html:not(.dark) .badge-conflict {
  background-color: #fee2e2 !important;
  color: #dc2626 !important;
}

html:not(.dark) .badge-notion {
  background-color: #eef2ff !important;
  color: #4338ca !important;
  border-color: #c7d2fe !important;
}

/* ── Badges con transparencias (Tailwind text / bg opacity) ── */
html:not(.dark) .bg-emerald-500\/10,
html:not(.dark) .bg-emerald-500\/20 {
  background-color: #ecfdf5 !important;
}
html:not(.dark) .text-emerald-400,
html:not(.dark) .text-emerald-300 {
  color: #047857 !important;
}

html:not(.dark) .bg-amber-500\/10,
html:not(.dark) .bg-amber-500\/20 {
  background-color: #fffbeb !important;
}
html:not(.dark) .text-amber-400,
html:not(.dark) .text-amber-300 {
  color: #b45309 !important;
}

html:not(.dark) .bg-red-500\/10,
html:not(.dark) .bg-red-500\/20 {
  background-color: #fef2f2 !important;
}
html:not(.dark) .text-red-400,
html:not(.dark) .text-red-300 {
  color: #b91c1c !important;
}

html:not(.dark) .bg-indigo-500\/10,
html:not(.dark) .bg-indigo-500\/20 {
  background-color: #eef2ff !important;
}
html:not(.dark) .text-indigo-400,
html:not(.dark) .text-indigo-300 {
  color: #4338ca !important;
}

html:not(.dark) .bg-sky-500\/10,
html:not(.dark) .bg-sky-500\/20 {
  background-color: #f0f9ff !important;
}
html:not(.dark) .text-sky-400,
html:not(.dark) .text-sky-300 {
  color: #0369a1 !important;
}

/* ── Skeleton loaders en modo claro ── */
html:not(.dark) .skeleton-header,
html:not(.dark) .skeleton-row {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%) !important;
  background-size: 200% 100%;
}

/* ── Vista show/hide ──────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Nav btn estado activo ────────────────────────────── */
.nav-btn.active {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

/* ── Panel colapsable ─────────────────────────────────── */
.card-body.collapsed { display: none; }

/* ── Tabla del calendario ─────────────────────────────── */
.calendar-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.month-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

/* Sábado y domingo más estrechos: casi nunca tienen contenido, así los días
   laborables ganan ancho y los nombres dejan de cortarse */
.month-table .col-lab { width: 16.6%; }
.month-table .col-fin { width: 8.5%; }

.month-table th {
  padding: 10px 4px;
  text-align: center;
  border-bottom: 1px solid #2e2e2e;
  font-size: 0.85em;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: #141414;
}

.month-table td {
  padding: 6px;
  border-right: 1px solid #2e2e2e;
  border-bottom: 1px solid #2e2e2e;
  vertical-align: top;
  height: 132px;
  overflow: hidden;
  position: relative;
  transition: background 0.15s ease;
}

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

/* Tipos de celda */
.cal-day-empty   { background: #141414; }
.cal-day-weekend { background: #111111; }
.cal-day-work    { background: #0f0f0f; }
.cal-day-friday  { border-left: 2px solid rgba(99, 102, 241, 0.3); }
.cal-day-holiday {
  border-left: 2px solid #ef4444;
  background: rgba(239, 68, 68, 0.04);
}
.cal-day-override { background: rgba(245, 158, 11, 0.04); }
.cal-day-today {
  outline: 2px solid #6366f1 !important;
  outline-offset: -2px;
  background: rgba(99, 102, 241, 0.08) !important;
}

/* Highlight de persona desde panel de estadísticas */
.cal-cell-highlighted {
  outline: 2px solid var(--highlight-color, #6366f1) !important;
  outline-offset: -2px;
  background: color-mix(in srgb, var(--highlight-color, #6366f1) 8%, transparent) !important;
  z-index: 1;
  position: relative;
}
.cal-cell-dimmed {
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

/* Número del día */
.day-number {
  font-size: 0.95em;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: #555;
  text-align: right;
  padding: 2px 4px 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  line-height: 1;
}

.day-number.holiday-num { color: #ef4444; }

/* Badges de día */
.day-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.65em;
  font-weight: 600;
  gap: 2px;
}

.badge-override {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge-conflict {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Nombre del festivo dentro de celda */
.holiday-name {
  font-size: 0.8em;
  color: #ef4444;
  padding: 0 4px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
}

/* Persona pill */
.cal-persona {
  cursor: pointer;
  border-radius: 4px;
  padding: 3px 6px;
  margin-bottom: 3px;
  transition: opacity 0.15s ease, filter 0.15s ease;
  overflow: hidden;
}

.cal-persona:hover { opacity: 0.85; }
.cal-persona.highlighted { outline: 2px solid #f59e0b; border-radius: 4px; }

/* Principal pill */
.cal-principal {
  background: rgba(99, 102, 241, 0.12);
}
/* Nombre y etiqueta Torre/Prado en la misma línea */
.cal-principal, .cal-secundario {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cal-principal .p-name, .cal-secundario .s-name { flex: 1; min-width: 0; }
.cal-principal .tp-label, .cal-secundario .tp-label { flex-shrink: 0; }
.cal-principal .p-name {
  font-size: 0.9em;
  font-weight: 600;
  color: #a5b4fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Secundario pill */
.cal-secundario {
  background: rgba(34, 197, 94, 0.1);
}
.cal-secundario .s-name {
  font-size: 0.9em;
  font-weight: 500;
  color: #86efac;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Teletrabajo pill */
.cal-teletrabajo {
  background: rgba(56, 189, 248, 0.1);
  display: flex;
  align-items: center;
  gap: 3px;
}
.cal-teletrabajo .tt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-teletrabajo .p-name {
  font-size: 0.9em;
  font-weight: 500;
  color: #7dd3fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  flex: 1;
  min-width: 0;
}

/* Etiquetas de sección dentro de las celdas (Teletrabajo / Soporte) */
.cal-sec-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.4;
  margin: 3px 0 2px 1px;
  opacity: 0.8;
}
.cal-sec-label:first-child { margin-top: 0; }
.cal-sec-label.lbl-tt { color: #38bdf8; }
.cal-sec-label.lbl-sop { color: #34d399; }

/* Etiquetas Torre / Prado en soporte */
.tp-label {
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border-radius: 2px;
  padding: 0 3px;
  margin-left: 3px;
  vertical-align: middle;
}
.tp-label.tp-prado {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
}

/* Placeholder vacío */
.cal-vacia {
  border: 1px dashed #2e2e2e;
  background: transparent !important;
  opacity: 0.45;
}
.cal-vacia:hover {
  opacity: 0.85;
  border-color: rgba(99, 102, 241, 0.4);
}
.cal-vacia .v-name {
  font-size: 0.72em;
  color: #444;
  font-style: italic;
  display: block;
}

/* Teléfono en celda — oculto para mantener celdas compactas */
.cal-telefono {
  display: none;
}

/* Turno label */
.turno-label {
  font-size: 0.66em;
  color: #555;
  font-weight: 600;
  border-top: 1px solid #1e1e1e;
  padding-top: 2px;
  margin-top: 2px;
}

/* Sin asignar */
.cal-unassigned {
  font-size: 0.72em;
  color: #333;
  padding: 2px 4px;
}

/* ── Skeleton ──────────────────────────────────────────── */
.skeleton-header {
  background: linear-gradient(90deg, #1e1e1e 25%, #2a2a2a 50%, #1e1e1e 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-row {
  background: linear-gradient(90deg, #1e1e1e 25%, #2a2a2a 50%, #1e1e1e 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Spin animation (loading) ─────────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Group hover actions visibility ──────────────────── */
.group-item:hover .group-actions { opacity: 1 !important; }

/* ── Prevent horizontal page scroll on mobile ─────────── */
body { overflow-x: hidden; max-width: 100vw; }

/* ── PWA / Mobile safe areas (iOS notch & home bar) ──── */
body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  overscroll-behavior: none;
}

/* Layout responsivo adaptado al notch/Dynamic Island y barra inferior */
.app-content-layout {
  padding-top: calc(4.75rem + env(safe-area-inset-top, 0px));
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 1024px) {
  .app-content-layout {
    padding-top: 5rem;
    padding-bottom: 2rem;
  }
}

/* Barra inferior móvil con suficiente altura para iconos, badges y home bar */
#bottomNav {
  height: calc(4.25rem + env(safe-area-inset-bottom, 0px)) !important;
  padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  box-sizing: border-box;
}

/* Toast container respetando la barra inferior */
#toastContainer {
  bottom: calc(5rem + env(safe-area-inset-bottom, 0px)) !important;
}
@media (min-width: 1024px) {
  #toastContainer {
    bottom: 1.5rem !important;
  }
}

/* ── Touch optimizations (eliminates 300ms tap delay) ─── */
button, a, label, select,
input[type="checkbox"], input[type="radio"] {
  touch-action: manipulation;
}

/* ── iOS: prevent auto-zoom on input focus (font-size < 16px triggers zoom) */
@supports (-webkit-touch-callout: none) {
  input, select, textarea {
    font-size: 16px;
  }
}

/* Banner de instalación PWA */
#pwa-install-banner {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  min-width: 280px;
  max-width: calc(100vw - 2rem);
  animation: pwaIn 0.3s ease forwards;
}

@keyframes pwaIn {
  from { transform: translateX(calc(-50% + 40px)); opacity: 0; }
  to   { transform: translateX(-50%);              opacity: 1; }
}

/* Teclado virtual en móvil: evitar que el fixed bottom tape el input */
@supports (-webkit-touch-callout: none) {
  .mobile-scroll-fix { -webkit-overflow-scrolling: touch; }
}

/* ── Toast animations ─────────────────────────────────── */
@keyframes toastIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateX(40px); opacity: 0; }
}

/* ── Modal animation ──────────────────────────────────── */
@keyframes modalIn {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1);       opacity: 1; }
}

.modal-overlay > div {
  animation: modalIn 0.18s ease;
}

/* ── Layout del generador (calendario + panel lateral) ── */
.generator-layout {
  display: grid;
  gap: 1rem;
  align-items: start;
  grid-template-columns: minmax(0, 1fr) 280px;
}

/* Panel lateral plegado: el calendario ocupa todo el ancho */
.generator-layout.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
.generator-layout.sidebar-collapsed > aside { display: none; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .generator-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .config-grid      { grid-template-columns: 1fr !important; }
}

@media (max-width: 900px) {
  .month-table td { height: 112px; padding: 4px; }
}

@media (max-width: 640px) {
  .nav-label   { display: none; }
  .hide-mobile { display: none; }
  .month-table { min-width: 560px; }
  .month-table td { height: 104px; padding: 3px; }
  .cal-principal .p-name, .cal-secundario .s-name { font-size: 0.8em; }
  .cal-teletrabajo .p-name { font-size: 0.8em; }
  .cal-teletrabajo .tt-dot { width: 6px; height: 6px; }
  .cal-sec-label { font-size: 8px; }
  .tp-label { font-size: 0.6em; padding: 0 2px; margin-left: 2px; }
  .cal-telefono { display: none; }
}

/* ── Bottom sheet modals en móvil ─────────────────────── */
@media (max-width: 639px) {
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal-overlay > div {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 1.25rem !important;
    border-top-right-radius: 1.25rem !important;
    max-height: 88vh;
    overflow-y: auto;
    width: 100% !important;
    max-width: 100% !important;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)) !important;
    scroll-padding-bottom: 4rem;
    animation: sheetIn 0.25s ease;
  }
}

@keyframes sheetIn {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Drag & Drop Interactions & Micro-animations ─────── */
[draggable="true"] {
  user-select: none;
  -webkit-user-drag: element;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
[draggable="true"]:hover {
  transform: translateY(-1px);
}
td[data-fecha] {
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.drag-over {
  background-color: rgba(99, 102, 241, 0.15) !important;
  box-shadow: inset 0 0 0 2px #6366f1;
}

/* Card hover smooth transitions */
.agenda-card {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease, box-shadow 0.18s ease;
}
.agenda-card:hover {
  transform: translateY(-2px);
}

/* ── Print ────────────────────────────────────────────── */
@media print {
  nav, .toolbar, aside, .view-header, #calendarSkeleton, #calendarEmpty { display: none !important; }
  body { padding-top: 0 !important; background: white !important; color: black !important; }
  .view { max-width: none; padding: 0; }
  .generator-layout { display: block !important; }
  #calendarContainer {
    border: none !important;
    box-shadow: none !important;
    background: white !important;
  }
  .month-table td { height: 120px; border-color: #ccc !important; }
  .month-table th { background: #f5f5f5 !important; border-color: #ccc !important; color: #333 !important; }
  .cal-principal { background: #e8eaf6 !important; }
  .cal-principal .p-name { color: #3949ab !important; }
  .cal-secundario { background: #e8f5e9 !important; }
  .cal-secundario .s-name { color: #388e3c !important; }
  .cal-teletrabajo { background: #dbeafe !important; }
  .cal-teletrabajo .p-name { color: #1e40af !important; }
  .cal-sec-label.lbl-tt { color: #1e40af !important; }
  .cal-sec-label.lbl-sop { color: #166534 !important; }
  .tp-label { color: #b45309 !important; background: #fef3c7 !important; }
  .tp-label.tp-prado { color: #047857 !important; background: #d1fae5 !important; }
  .cal-day-holiday { background: #ffebee !important; border-left-color: #e53935 !important; }
  .holiday-name { color: #e53935 !important; }
  .day-number { color: #333 !important; }
}

/* ── Notion Integration Badges ───────────────────────── */
.badge-notion {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.375rem;
  font-size: 0.625rem;
  font-weight: 600;
  background-color: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* ── Tarjetas KPI de Incidencias (Contraste garantizado en Modo Oscuro y Claro) ── */
.kpi-num {
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
}

/* Modo oscuro (predeterminado o con clase .dark) */
#kpiTotalNum, .kpi-num-total {
  color: #ffffff !important;
}
#kpiAbiertasNum, .kpi-num-abiertas {
  color: #fbbf24 !important; /* amber-400 muy luminoso */
}
#kpiCriticasNum, .kpi-num-criticas {
  color: #f87171 !important; /* red-400 muy luminoso */
}
#kpiResueltasNum, .kpi-num-resueltas {
  color: #34d399 !important; /* emerald-400 muy luminoso */
}
#kpiMiasNum, .kpi-num-mias {
  color: #a5b4fc !important; /* indigo-300 muy luminoso */
}

/* Modo claro (cuando html no tiene clase .dark) */
html:not(.dark) #kpiTotalNum, html:not(.dark) .kpi-num-total {
  color: #0f172a !important; /* slate-900 */
}
html:not(.dark) #kpiAbiertasNum, html:not(.dark) .kpi-num-abiertas {
  color: #d97706 !important; /* amber-600 */
}
html:not(.dark) #kpiCriticasNum, html:not(.dark) .kpi-num-criticas {
  color: #dc2626 !important; /* red-600 */
}
html:not(.dark) #kpiResueltasNum, html:not(.dark) .kpi-num-resueltas {
  color: #059669 !important; /* emerald-600 */
}
html:not(.dark) #kpiMiasNum, html:not(.dark) .kpi-num-mias {
  color: #4f46e5 !important; /* indigo-600 */
}

/* ── Calendario del técnico: vista de equipo con días propios remarcados ── */
/* Línea compacta (cuadrícula) */
.tec-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 1.35;
  padding: 1px 4px;
  margin-bottom: 1px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
}
.tec-line .tec-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tec-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: currentColor; }
.tec-more { font-size: 10px; color: #666; padding: 0 4px; cursor: help; }

/* Badge (agenda) */
.tec-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
  background: #1c1c1c;
}

/* Compañeros: tono apagado */
.tec-otro.tec-prin { color: rgba(165, 180, 252, 0.6); }
.tec-otro.tec-sec  { color: rgba(134, 239, 172, 0.5); }
.tec-otro.tec-tt   { color: rgba(125, 211, 252, 0.55); }
.tec-otro .tec-dot { opacity: 0.7; }

/* Propio usuario: color intenso */
.tec-mine { color: #fff; font-weight: 700; }
.tec-mine.tec-prin { background: rgba(99, 102, 241, 0.35); box-shadow: inset 0 0 0 1px rgba(165, 180, 252, 0.7); border-color: transparent; }
.tec-mine.tec-sec  { background: rgba(16, 185, 129, 0.30); box-shadow: inset 0 0 0 1px rgba(110, 231, 183, 0.7); border-color: transparent; }
.tec-mine.tec-tt   { background: rgba(14, 165, 233, 0.30); box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.7); border-color: transparent; }
.tec-mine .tec-dot { background: #fff; }

.tu-tag {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 0 4px;
  border-radius: 3px;
  line-height: 1.5;
  color: #fff;
  background: #6366f1;
}
.tec-sec .tu-tag { background: #059669; }
.tec-tt .tu-tag  { background: #0284c7; }

/* Celda del día propio (cuadrícula) */
.cal-day-mine {
  background: rgba(99, 102, 241, 0.10) !important;
  box-shadow: inset 0 0 0 2px rgba(129, 140, 248, 0.65);
}
.cal-day-mine.mine-tt {
  background: rgba(14, 165, 233, 0.08) !important;
  box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.6);
}
.cal-day-mine .day-number { color: #c7d2fe; font-weight: 700; }
.cal-day-mine.mine-tt .day-number { color: #bae6fd; }

/* Tarjeta del día propio (agenda) */
.tec-card-mine {
  border-color: rgba(129, 140, 248, 0.55) !important;
  background: rgba(99, 102, 241, 0.09);
  box-shadow: 0 4px 18px -6px rgba(99, 102, 241, 0.35);
}
.tec-card-mine.mine-tt {
  border-color: rgba(56, 189, 248, 0.5) !important;
  background: rgba(14, 165, 233, 0.07);
  box-shadow: 0 4px 18px -6px rgba(14, 165, 233, 0.3);
}

/* Pill de cabecera "Tu soporte" / "Tu teletrabajo" */
.tec-mi-pill {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  background: #6366f1;
}
.tec-mi-pill.tec-sec { background: #059669; }
.tec-mi-pill.tec-tt  { background: #0284c7; }

/* Modo claro */
html:not(.dark) .tec-otro.tec-prin { color: #6366f1; opacity: 0.75; }
html:not(.dark) .tec-otro.tec-sec  { color: #059669; opacity: 0.75; }
html:not(.dark) .tec-otro.tec-tt   { color: #0284c7; opacity: 0.75; }
html:not(.dark) .tec-badge { background: #f8fafc; border-color: #e2e8f0; }
html:not(.dark) .tec-mine { color: #0f172a; }
html:not(.dark) .tec-mine .tec-dot { background: #0f172a; }
html:not(.dark) .tec-mine.tec-prin { background: #c7d2fe; box-shadow: inset 0 0 0 1px #818cf8; }
html:not(.dark) .tec-mine.tec-sec  { background: #a7f3d0; box-shadow: inset 0 0 0 1px #34d399; }
html:not(.dark) .tec-mine.tec-tt   { background: #bae6fd; box-shadow: inset 0 0 0 1px #38bdf8; }
html:not(.dark) .cal-day-mine { background-color: #eef2ff !important; box-shadow: inset 0 0 0 2px #818cf8; }
html:not(.dark) .cal-day-mine.mine-tt { background-color: #f0f9ff !important; box-shadow: inset 0 0 0 2px #38bdf8; }
html:not(.dark) .cal-day-mine .day-number { color: #4338ca !important; }
html:not(.dark) .cal-day-mine.mine-tt .day-number { color: #0369a1 !important; }
html:not(.dark) .tec-card-mine { background: #eef2ff; }
html:not(.dark) .tec-card-mine.mine-tt { background: #f0f9ff; }
html:not(.dark) .tec-more { color: #94a3b8; }



/* ─────────────────────────────────────────────────────────────────────────
   Mi configuración (#/ajustes)
   ───────────────────────────────────────────────────────────────────────── */
@keyframes ajsFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ajsPulse { 0% { opacity: 0; transform: scale(.92); } 100% { opacity: 1; transform: none; } }
.ajs-fade  { animation: ajsFade .28s ease both; }
.ajs-pulse { animation: ajsPulse .25s ease both; }
.ajs-tabs::-webkit-scrollbar { display: none; }
.ajs-tabs { scrollbar-width: none; }
.ajs-tab { color: #888; }
.ajs-tab:hover { color: #ddd; background: #1e1e1e; }
.ajs-tab-activa,
.ajs-tab-activa:hover { color: #fff; background: linear-gradient(135deg, #4f46e5, #7c3aed); box-shadow: 0 6px 18px -6px rgba(99,102,241,.6); }

/* Interruptor (switch) accesible basado en checkbox */
.ajs-switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex-shrink: 0; cursor: pointer; }
.ajs-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.ajs-switch span { position: absolute; inset: 0; border-radius: 999px; background: #3a3a3a; transition: background-color .2s ease, opacity .2s ease; }
.ajs-switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.45); transition: transform .22s cubic-bezier(.4,0,.2,1); }
.ajs-switch input:checked + span { background: #6366f1; }
.ajs-switch.email input:checked + span { background: #0ea5e9; }
.ajs-switch input:checked + span::after { transform: translateX(16px); }
.ajs-switch input:indeterminate + span { background: #6366f1; opacity: .55; }
.ajs-switch.email input:indeterminate + span { background: #0ea5e9; }
.ajs-switch input:indeterminate + span::after { transform: translateX(8px); }
.ajs-switch input:focus-visible + span { outline: 2px solid #818cf8; outline-offset: 2px; }
.ajs-switch input:disabled { cursor: not-allowed; }
.ajs-switch input:disabled + span { opacity: .3; }
.ajs-switch:hover input:not(:disabled) + span::after { box-shadow: 0 0 0 4px rgba(99,102,241,.18), 0 1px 3px rgba(0,0,0,.45); }

/* Matriz tipo de aviso × canal */
.ajs-fila { display: grid; grid-template-columns: 1fr 64px 64px; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid #252525; transition: background-color .15s; }
.ajs-fila:first-child { border-top: 0; }
.ajs-fila:not(.ajs-fila-head):hover { background: #1e1e1e; }
.ajs-fila-head { background: #151515; padding-top: 10px; padding-bottom: 10px; }
.ajs-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
@media (min-width: 640px) { .ajs-fila { grid-template-columns: 1fr 80px 80px; padding-left: 20px; padding-right: 20px; } }

/* Selector de tema */
.ajs-tema:hover { border-color: #444; transform: translateY(-1px); }
.ajs-tema-activo { border-color: #6366f1 !important; box-shadow: 0 0 0 1px #6366f1, 0 8px 24px -10px rgba(99,102,241,.55); }
.ajs-tema-preview { width: 44px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.08); }
.ajs-tema-dark   { background: #0f0f0f; color: #a5b4fc; }
.ajs-tema-light  { background: #f8fafc; color: #f59e0b; border-color: #e2e8f0; }
.ajs-tema-system { background: linear-gradient(135deg, #0f0f0f 50%, #f8fafc 50%); color: #818cf8; }

/* Modo claro */
html:not(.dark) .ajs-tab { color: #64748b; }
html:not(.dark) .ajs-tab:hover { color: #0f172a; background: #f1f5f9; }
html:not(.dark) .ajs-tab-activa, html:not(.dark) .ajs-tab-activa:hover { color: #fff; }
html:not(.dark) .ajs-tab-activa span, html:not(.dark) .ajs-tab-activa i { color: #fff !important; }
html:not(.dark) .ajs-switch span { background: #cbd5e1; }
html:not(.dark) .ajs-switch input:checked + span,
html:not(.dark) .ajs-switch input:indeterminate + span { background: #6366f1; }
html:not(.dark) .ajs-switch.email input:checked + span,
html:not(.dark) .ajs-switch.email input:indeterminate + span { background: #0ea5e9; }
html:not(.dark) .ajs-fila { border-top-color: #e2e8f0; }
html:not(.dark) .ajs-fila:not(.ajs-fila-head):hover { background: #f8fafc; }
html:not(.dark) .ajs-fila-head { background: #f1f5f9; }
html:not(.dark) .ajs-tema:hover { border-color: #cbd5e1; }

/* ─────────────────────────────────────────────────────────────────────────
   Intercambios (asistente del técnico y panel del jefe/admin)
   ───────────────────────────────────────────────────────────────────────── */
/* Color por tipo: --ix = fondo (r,g,b) · --ixt = texto */
.ix-soporte { --ix: 99, 102, 241;  --ixt: #a5b4fc; }
.ix-tt      { --ix: 14, 165, 233;  --ixt: #7dd3fc; }
.ix-turno   { --ix: 245, 158, 11;  --ixt: #fcd34d; }

@keyframes ixUp   { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes ixIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes ixSlide{ from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes ixSwap { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }

.ix-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700;
  letter-spacing: .2px; background: rgba(var(--ix), .15); color: var(--ixt); border: 1px solid rgba(var(--ix), .28); white-space: nowrap; }
.ix-pill i, .ix-pill svg { width: 11px; height: 11px; }

/* Cabecera «cómo funciona» */
.ix-how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ix-how-paso { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: #161616; border: 1px solid #242424; font-size: 11px; color: #9a9a9a; line-height: 1.3; }
.ix-how-num { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800;
  color: #c7d2fe; background: rgba(99, 102, 241, .16); border: 1px solid rgba(99, 102, 241, .35); }
@media (max-width: 520px) { .ix-how { grid-template-columns: 1fr; } }

/* Tarjetas de la lista */
.ix-card { position: relative; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 16px; padding: 14px 14px 14px 18px; overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s; animation: ajsFade .3s ease both; }
.ix-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: rgb(var(--ix, 99, 102, 241)); opacity: .85; }
.ix-card:hover { border-color: #3a3a3a; box-shadow: 0 10px 30px -18px rgba(var(--ix, 99, 102, 241), .6); }
.ix-card.ix-card-destacada { border-color: rgba(var(--ix), .45); box-shadow: 0 10px 30px -16px rgba(var(--ix), .55); }

/* Visual del cambio: Tú das ⇄ Recibes */
.ix-swap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 8px; }
.ix-swap-lado { border-radius: 12px; padding: 9px 11px; background: #121212; border: 1px solid #262626; min-width: 0; }
.ix-swap-lado.da  { border-color: rgba(239, 68, 68, .28); background: rgba(239, 68, 68, .05); }
.ix-swap-lado.rec { border-color: rgba(16, 185, 129, .3); background: rgba(16, 185, 129, .06); }
.ix-swap-et { font-size: 9px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: #777; }
.ix-swap-lado.da .ix-swap-et  { color: #fca5a5; }
.ix-swap-lado.rec .ix-swap-et { color: #6ee7b7; }
.ix-swap-fecha { font-size: 13px; font-weight: 700; color: #f0f0f0; margin-top: 2px; text-transform: capitalize; }
.ix-swap-sub { font-size: 10px; color: #8a8a8a; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ix-swap-flecha { display: grid; place-items: center; width: 30px; color: rgb(var(--ix, 129, 140, 248)); }
.ix-swap-flecha i, .ix-swap-flecha svg { animation: ixSwap 2.4s ease-in-out infinite; }

/* Avisos (no bloquean) */
.ix-avisos { border-radius: 12px; padding: 10px 12px; background: rgba(245, 158, 11, .08); border: 1px solid rgba(245, 158, 11, .3); color: #fcd34d; }
.ix-avisos-tit { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; }
.ix-avisos ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.ix-avisos li { position: relative; padding-left: 12px; font-size: 11px; color: #fde68a; line-height: 1.4; }
.ix-avisos li::before { content: ''; position: absolute; left: 2px; top: 6px; width: 4px; height: 4px; border-radius: 50%; background: #f59e0b; }
.ix-avisos li b { color: #fff3c4; font-weight: 700; }
.ix-avisos-pie { margin-top: 6px; font-size: 10px; color: #b8a26a; }
.ix-ok { display: flex; align-items: center; gap: 6px; border-radius: 12px; padding: 9px 12px; font-size: 11px; font-weight: 600;
  background: rgba(16, 185, 129, .08); border: 1px solid rgba(16, 185, 129, .28); color: #6ee7b7; }

/* Seguimiento del estado: Enviada → Compañero → Jefe */
.ix-track { display: flex; align-items: center; gap: 0; }
.ix-track-paso { display: flex; align-items: center; gap: 5px; font-size: 10px; color: #666; white-space: nowrap; }
.ix-track-dot { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: #242424; border: 1px solid #333; color: #666; }
.ix-track-dot i, .ix-track-dot svg { width: 10px; height: 10px; }
.ix-track-linea { flex: 1; min-width: 14px; height: 2px; margin: 0 6px; background: #2a2a2a; border-radius: 2px; }
.ix-track-paso.ok { color: #9ca3af; }
.ix-track-paso.ok .ix-track-dot { background: #10b981; border-color: #10b981; color: #fff; }
.ix-track-paso.ok + .ix-track-linea { background: #10b981; }
.ix-track-paso.act { color: #fcd34d; font-weight: 600; }
.ix-track-paso.act .ix-track-dot { background: rgba(245, 158, 11, .18); border-color: #f59e0b; color: #fcd34d; box-shadow: 0 0 0 3px rgba(245, 158, 11, .12); }

/* Avatar con iniciales */
.ix-avatar { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800;
  color: #fff; background: var(--av, #4f46e5); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.ix-avatar.sm { width: 24px; height: 24px; font-size: 9px; }

/* ── Asistente ───────────────────────────────────────────────────────── */
.ix-overlay { position: fixed; inset: 0; z-index: 9990; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: ixIn .2s ease both; }
@media (min-width: 640px) { .ix-overlay { align-items: center; padding: 24px; } }
.ix-panel { width: 100%; max-width: 580px; max-height: 94vh; display: flex; flex-direction: column; background: #161616; border: 1px solid #2a2a2a;
  border-radius: 22px 22px 0 0; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8); animation: ixUp .28s cubic-bezier(.2, .8, .2, 1) both; overflow: hidden; }
@media (min-width: 640px) { .ix-panel { border-radius: 22px; max-height: 88vh; } }
.ix-head { padding: 16px 18px 12px; border-bottom: 1px solid #242424;
  background: radial-gradient(120% 140% at 0% 0%, rgba(99, 102, 241, .14), transparent 55%), #161616; }
.ix-body { flex: 1; overflow-y: auto; padding: 16px 18px; overscroll-behavior: contain; }
.ix-body > .ix-paso { animation: ixSlide .25s ease both; }
.ix-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #242424; background: #141414; }
.ix-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 12px;
  font-size: 12px; font-weight: 600; transition: background-color .15s, transform .1s, opacity .15s, box-shadow .2s; }
.ix-btn:active:not(:disabled) { transform: scale(.97); }
.ix-btn:disabled { opacity: .4; cursor: not-allowed; }
.ix-btn-sec { background: #242424; color: #bbb; }
.ix-btn-sec:hover:not(:disabled) { background: #2e2e2e; color: #fff; }
.ix-btn-pri { color: #fff; background: linear-gradient(135deg, #4f46e5, #7c3aed); box-shadow: 0 8px 22px -10px rgba(99, 102, 241, .8); }
.ix-btn-pri:hover:not(:disabled) { box-shadow: 0 10px 26px -8px rgba(99, 102, 241, .9); filter: brightness(1.08); }
.ix-btn-ok  { color: #fff; background: #059669; }
.ix-btn-ok:hover:not(:disabled) { background: #10b981; }
.ix-btn-no  { color: #fca5a5; background: rgba(239, 68, 68, .12); }
.ix-btn-no:hover:not(:disabled) { background: rgba(239, 68, 68, .2); color: #fecaca; }
.ix-btn-sm { min-height: 34px; padding: 0 12px; font-size: 11px; border-radius: 10px; }
.ix-cerrar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: #888; transition: background-color .15s, color .15s; }
.ix-cerrar:hover { background: #262626; color: #fff; }

/* Indicador de pasos */
.ix-steps { display: flex; align-items: center; margin-top: 12px; }
.ix-step { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #666; white-space: nowrap; }
.ix-step-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: #222; border: 1px solid #333; color: #777;
  transition: all .25s ease; }
.ix-step-num i, .ix-step-num svg { width: 12px; height: 12px; }
.ix-step-linea { flex: 1; height: 2px; margin: 0 8px; border-radius: 2px; background: #2a2a2a; position: relative; overflow: hidden; }
.ix-step-linea::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #6366f1, #8b5cf6); transform: scaleX(0); transform-origin: left; transition: transform .35s ease; }
.ix-step.done .ix-step-num { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.ix-step.done + .ix-step-linea::after { transform: scaleX(1); }
.ix-step.act { color: #e5e7eb; font-weight: 600; }
.ix-step.act .ix-step-num { background: linear-gradient(135deg, #4f46e5, #7c3aed); border-color: transparent; color: #fff; box-shadow: 0 0 0 4px rgba(99, 102, 241, .18); }
@media (max-width: 420px) { .ix-step:not(.act) .ix-step-txt { display: none; } }

.ix-sec-tit { font-size: 10px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; color: #777; margin-bottom: 8px; }

/* Calendario del paso 1 */
.ix-cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ix-cal-mes { font-size: 14px; font-weight: 700; color: #f0f0f0; text-transform: capitalize; }
.ix-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.ix-dow { text-align: center; font-size: 10px; font-weight: 700; color: #5a5a5a; text-transform: uppercase; padding-bottom: 2px; }
.ix-day { position: relative; aspect-ratio: 1 / .92; min-height: 38px; border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12px; font-weight: 600; color: #4a4a4a; background: transparent; border: 1px solid transparent; cursor: default; transition: transform .12s, background-color .15s, box-shadow .2s, border-color .15s; }
.ix-day.vacio { visibility: hidden; }
.ix-day.hoy { color: #9ca3af; box-shadow: inset 0 0 0 1px #3a3a3a; }
.ix-day.asig { cursor: pointer; color: var(--ixt); background: rgba(var(--ix), .13); border-color: rgba(var(--ix), .32); }
.ix-day.asig:hover { transform: translateY(-2px); background: rgba(var(--ix), .22); box-shadow: 0 8px 18px -10px rgba(var(--ix), .9); }
.ix-day.mixto { --ix: 99, 102, 241; color: #e0e7ff; border-color: rgba(125, 211, 252, .35);
  background: linear-gradient(135deg, rgba(99, 102, 241, .22) 0 50%, rgba(14, 165, 233, .22) 50% 100%); }
.ix-day.sel, .ix-day.sel:hover { color: #fff; background: rgb(var(--ix)); border-color: transparent; transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 22px -8px rgba(var(--ix), .95), 0 0 0 2px rgba(255, 255, 255, .14) inset; }
.ix-day.bloq { cursor: not-allowed; color: #6b6b6b; background: repeating-linear-gradient(135deg, rgba(var(--ix), .08) 0 5px, transparent 5px 10px);
  border: 1px dashed rgba(var(--ix), .35); }
.ix-day.bloq:hover { transform: none; box-shadow: none; }
.ix-day-dots { display: flex; gap: 3px; height: 5px; }
.ix-day-dots span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .9; }
.ix-day-dots span.s { background: #818cf8; } .ix-day-dots span.t { background: #38bdf8; } .ix-day-dots span.u { background: #fbbf24; }
.ix-day.sel .ix-day-dots span { background: #fff; }
.ix-leyenda { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 10px; color: #8a8a8a; }
.ix-leyenda span { display: inline-flex; align-items: center; gap: 5px; }
.ix-leyenda b { width: 12px; height: 12px; border-radius: 4px; background: rgba(var(--ix), .25); border: 1px solid rgba(var(--ix), .55); }
.ix-leyenda b.bloq { background: repeating-linear-gradient(135deg, rgba(150, 150, 150, .25) 0 3px, transparent 3px 6px); border: 1px dashed #666; }

/* Tarjetas de opción (tipo, modo, rango) */
.ix-opciones { display: grid; gap: 8px; }
.ix-opcion { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; padding: 13px 14px; border-radius: 15px; background: #1b1b1b; border: 1px solid #2a2a2a;
  transition: border-color .15s, background-color .15s, transform .12s, box-shadow .2s; cursor: pointer; }
.ix-opcion:hover { border-color: #3d3d3d; transform: translateY(-1px); }
.ix-opcion.act { border-color: rgba(var(--ix, 99, 102, 241), .7); background: rgba(var(--ix, 99, 102, 241), .09); box-shadow: 0 10px 26px -16px rgba(var(--ix, 99, 102, 241), .9); }
.ix-opcion-ico { flex-shrink: 0; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--ixt, #a5b4fc);
  background: rgba(var(--ix, 99, 102, 241), .14); border: 1px solid rgba(var(--ix, 99, 102, 241), .3); }
.ix-opcion-tit { font-size: 13px; font-weight: 700; color: #f0f0f0; }
.ix-opcion-desc { font-size: 11px; color: #8a8a8a; margin-top: 2px; line-height: 1.4; }
.ix-opcion-check { margin-left: auto; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #3a3a3a; display: grid; place-items: center; transition: all .15s; }
.ix-opcion.act .ix-opcion-check { border-color: rgb(var(--ix, 99, 102, 241)); background: rgb(var(--ix, 99, 102, 241)); box-shadow: inset 0 0 0 3px #1b1b1b; }

/* Chips de rango y de días */
.ix-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ix-chip { position: relative; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 11px; border-radius: 11px; font-size: 11px; font-weight: 600;
  color: #cfcfcf; background: #1f1f1f; border: 1px solid #2e2e2e; cursor: pointer; transition: all .15s; }
.ix-chip small { font-size: 9.5px; font-weight: 500; color: #808080; }
.ix-chip:hover { border-color: rgba(var(--ix, 99, 102, 241), .6); color: #fff; }
.ix-chip.act, .ix-chip.act:hover { color: #fff; background: rgba(var(--ix, 99, 102, 241), .85); border-color: transparent; box-shadow: 0 6px 16px -8px rgba(var(--ix, 99, 102, 241), 1); }
.ix-chip.act small { color: rgba(255, 255, 255, .8); }
.ix-chip.rango { flex-direction: row; align-items: center; gap: 5px; padding: 7px 12px; }
.ix-chip-flags { position: absolute; top: -5px; right: -5px; display: flex; gap: 2px; }
.ix-flag { width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 800; border: 2px solid #161616; }
.ix-flag i, .ix-flag svg { width: 8px; height: 8px; }
.ix-flag.evento { background: #f59e0b; color: #1a1a1a; }
.ix-flag.ausencia { background: #ef4444; color: #fff; }
.ix-flag.comprometido { background: #6b7280; color: #fff; }

/* Fila de compañero candidato */
.ix-persona { border-radius: 15px; padding: 11px 12px; background: #1a1a1a; border: 1px solid #262626; transition: border-color .15s, box-shadow .2s; }
.ix-persona.act { border-color: rgba(var(--ix, 99, 102, 241), .55); box-shadow: 0 10px 24px -16px rgba(var(--ix, 99, 102, 241), .9); }
.ix-buscar { position: relative; }
.ix-buscar i, .ix-buscar svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: #666; pointer-events: none; }
.ix-buscar input { width: 100%; padding: 9px 12px 9px 32px; border-radius: 11px; font-size: 12px; background: #0f0f0f; border: 1px solid #2a2a2a; color: #eee; outline: none; transition: border-color .15s; }
.ix-buscar input:focus { border-color: #6366f1; }
.ix-input { width: 100%; padding: 9px 12px; border-radius: 11px; font-size: 12px; background: #0f0f0f; border: 1px solid #2a2a2a; color: #eee; outline: none; transition: border-color .15s; }
.ix-input:focus { border-color: #6366f1; }

/* Resumen final */
.ix-resumen { border-radius: 16px; padding: 12px; background: linear-gradient(180deg, rgba(var(--ix), .08), rgba(var(--ix), .02)); border: 1px solid rgba(var(--ix), .25); }
.ix-vacio { text-align: center; padding: 26px 16px; border-radius: 16px; border: 1px dashed #2e2e2e; color: #6b6b6b; font-size: 12px; }
.ix-vacio i, .ix-vacio svg { width: 30px; height: 30px; margin: 0 auto 8px; color: #3a3a3a; }
.ix-cargando { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 28px 0; font-size: 12px; color: #777; }

/* Modo claro */
html:not(.dark) .ix-soporte { --ixt: #4338ca; }
html:not(.dark) .ix-tt      { --ixt: #0369a1; }
html:not(.dark) .ix-turno   { --ixt: #b45309; }
html:not(.dark) .ix-how-paso { background: #fff; border-color: #e2e8f0; color: #64748b; }
html:not(.dark) .ix-how-num { color: #4338ca; background: #eef2ff; border-color: #c7d2fe; }
html:not(.dark) .ix-card { background: #fff; border-color: #e2e8f0; }
html:not(.dark) .ix-card:hover { border-color: #cbd5e1; }
html:not(.dark) .ix-swap-lado { background: #f8fafc; border-color: #e2e8f0; }
html:not(.dark) .ix-swap-lado.da  { background: #fef2f2; border-color: #fecaca; }
html:not(.dark) .ix-swap-lado.rec { background: #ecfdf5; border-color: #a7f3d0; }
html:not(.dark) .ix-swap-lado.da .ix-swap-et  { color: #b91c1c; }
html:not(.dark) .ix-swap-lado.rec .ix-swap-et { color: #047857; }
html:not(.dark) .ix-swap-fecha { color: #0f172a; }
html:not(.dark) .ix-swap-sub { color: #64748b; }
html:not(.dark) .ix-avisos { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
html:not(.dark) .ix-avisos li { color: #78350f; }
html:not(.dark) .ix-avisos li b { color: #451a03; }
html:not(.dark) .ix-avisos-pie { color: #a16207; }
html:not(.dark) .ix-ok { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
html:not(.dark) .ix-track-dot { background: #f1f5f9; border-color: #cbd5e1; color: #94a3b8; }
html:not(.dark) .ix-track-linea { background: #e2e8f0; }
html:not(.dark) .ix-track-paso { color: #94a3b8; }
html:not(.dark) .ix-track-paso.ok { color: #475569; }
html:not(.dark) .ix-track-paso.act { color: #b45309; }
html:not(.dark) .ix-track-paso.act .ix-track-dot { background: #fef3c7; color: #b45309; }
html:not(.dark) .ix-overlay { background: rgba(15, 23, 42, .45); }
html:not(.dark) .ix-panel { background: #fff; border-color: #e2e8f0; box-shadow: 0 30px 80px -20px rgba(15, 23, 42, .35); }
html:not(.dark) .ix-head { border-color: #e2e8f0; background: radial-gradient(120% 140% at 0% 0%, rgba(99, 102, 241, .10), transparent 55%), #fff; }
html:not(.dark) .ix-foot { background: #f8fafc; border-color: #e2e8f0; }
html:not(.dark) .ix-btn-sec { background: #f1f5f9; color: #334155; }
html:not(.dark) .ix-btn-sec:hover:not(:disabled) { background: #e2e8f0; color: #0f172a; }
html:not(.dark) .ix-btn-no { color: #b91c1c; background: #fef2f2; }
html:not(.dark) .ix-btn-no:hover:not(:disabled) { background: #fee2e2; color: #991b1b; }
html:not(.dark) .ix-cerrar:hover { background: #f1f5f9; color: #0f172a; }
html:not(.dark) .ix-step { color: #94a3b8; }
html:not(.dark) .ix-step-num { background: #f1f5f9; border-color: #cbd5e1; color: #64748b; }
html:not(.dark) .ix-step-linea { background: #e2e8f0; }
html:not(.dark) .ix-step.act { color: #0f172a; }
html:not(.dark) .ix-sec-tit { color: #64748b; }
html:not(.dark) .ix-cal-mes { color: #0f172a; }
html:not(.dark) .ix-dow { color: #94a3b8; }
html:not(.dark) .ix-day { color: #cbd5e1; }
html:not(.dark) .ix-day.hoy { color: #64748b; box-shadow: inset 0 0 0 1px #cbd5e1; }
html:not(.dark) .ix-day.asig { background: rgba(var(--ix), .12); }
html:not(.dark) .ix-day.asig { color: var(--ixt); }
html:not(.dark) .ix-day.mixto { color: #312e81; background: linear-gradient(135deg, rgba(99, 102, 241, .18) 0 50%, rgba(14, 165, 233, .18) 50% 100%); }
html:not(.dark) .ix-day.sel, html:not(.dark) .ix-day.sel:hover { color: #fff; background: rgb(var(--ix)); border-color: transparent; }
html:not(.dark) .ix-day.bloq { color: #94a3b8; }
html:not(.dark) .ix-leyenda { color: #64748b; }
html:not(.dark) .ix-opcion { background: #fff; border-color: #e2e8f0; }
html:not(.dark) .ix-opcion:hover { border-color: #cbd5e1; }
html:not(.dark) .ix-opcion.act { background: rgba(var(--ix, 99, 102, 241), .07); border-color: rgba(var(--ix, 99, 102, 241), .6); }
html:not(.dark) .ix-opcion-tit { color: #0f172a; }
html:not(.dark) .ix-opcion-desc { color: #64748b; }
html:not(.dark) .ix-opcion-check { border-color: #cbd5e1; }
html:not(.dark) .ix-opcion.act .ix-opcion-check { box-shadow: inset 0 0 0 3px #fff; }
html:not(.dark) .ix-chip { background: #fff; border-color: #e2e8f0; color: #334155; }
html:not(.dark) .ix-chip small { color: #94a3b8; }
html:not(.dark) .ix-chip:hover { color: #0f172a; }
html:not(.dark) .ix-chip.act, html:not(.dark) .ix-chip.act:hover { color: #fff; background: rgba(var(--ix, 99, 102, 241), .9); border-color: transparent; }
html:not(.dark) .ix-chip.act small { color: rgba(255, 255, 255, .85); }
html:not(.dark) .ix-flag { border-color: #fff; }
html:not(.dark) .ix-persona { background: #fff; border-color: #e2e8f0; }
html:not(.dark) .ix-buscar input, html:not(.dark) .ix-input { background: #fff; border-color: #cbd5e1; color: #0f172a; }
html:not(.dark) .ix-vacio { border-color: #e2e8f0; color: #94a3b8; }
html:not(.dark) .ix-vacio i, html:not(.dark) .ix-vacio svg { color: #cbd5e1; }

/* ── Corrección e icono SVG de inputs de fecha y tiempo ── */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
  padding-right: 36px !important;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.25em;
  margin: 0;
}

/* Modo oscuro: SVG Lucide Calendar blanco puro */
html.dark input[type="date"],
html.dark input[type="datetime-local"],
input[type="date"],
input[type="datetime-local"] {
  color-scheme: dark !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 18px 18px !important;
}

html.dark input[type="date"]::-webkit-calendar-picker-indicator,
html.dark input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0 !important;
  cursor: pointer !important;
  width: 32px !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Modo claro: SVG Lucide Calendar gris oscuro */
html:not(.dark) input[type="date"],
html:not(.dark) input[type="datetime-local"],
html.light input[type="date"],
html.light input[type="datetime-local"] {
  color-scheme: light !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 18px 18px !important;
}

html:not(.dark) input[type="date"]::-webkit-calendar-picker-indicator,
html:not(.dark) input[type="datetime-local"]::-webkit-calendar-picker-indicator,
html.light input[type="date"]::-webkit-calendar-picker-indicator,
html.light input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0 !important;
  cursor: pointer !important;
  width: 32px !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}



