*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #e8edf7;
  background-image: url("data:image/svg+xml,%3Csvg width='320' height='320' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='320' height='320' fill='%23e8edf7'/%3E%3Cg stroke='%23c2cde6' stroke-width='1' fill='none'%3E%3Cpath d='M0 80 L90 80 L120 50 L320 50'/%3E%3Cpath d='M0 160 L70 160 L70 240 L320 240'/%3E%3Cpath d='M0 260 L40 260 L40 320'/%3E%3Cpath d='M210 0 L210 80 L260 80 L260 160 L320 160'/%3E%3Cpath d='M110 0 L110 30 L160 30 L160 80'/%3E%3Cpath d='M60 320 L60 210 L160 210 L160 160'/%3E%3Cpath d='M320 100 L280 100 L280 240'/%3E%3Cpath d='M0 320 L0 300 L100 300 L130 270 L320 270'/%3E%3C/g%3E%3Cg fill='%23a8b8d8'%3E%3Ccircle cx='120' cy='50' r='4'/%3E%3Ccircle cx='70' cy='160' r='4'/%3E%3Ccircle cx='70' cy='240' r='4'/%3E%3Ccircle cx='260' cy='80' r='4'/%3E%3Ccircle cx='260' cy='160' r='4'/%3E%3Ccircle cx='160' cy='210' r='4'/%3E%3Ccircle cx='160' cy='160' r='4'/%3E%3Ccircle cx='160' cy='80' r='4'/%3E%3Ccircle cx='280' cy='240' r='4'/%3E%3Ccircle cx='130' cy='270' r='4'/%3E%3Ccircle cx='110' cy='30' r='3'/%3E%3Ccircle cx='40' cy='260' r='3'/%3E%3C/g%3E%3Crect x='168' y='42' width='44' height='16' rx='2' stroke='%23c2cde6' stroke-width='1' fill='none'/%3E%3Crect x='22' y='172' width='36' height='22' rx='2' stroke='%23c2cde6' stroke-width='1' fill='none'/%3E%3Crect x='270' y='170' width='30' height='18' rx='2' stroke='%23c2cde6' stroke-width='1' fill='none'/%3E%3Ccircle cx='210' cy='80' r='6' stroke='%23c2cde6' stroke-width='1' fill='none'/%3E%3Ccircle cx='90' cy='80' r='6' stroke='%23c2cde6' stroke-width='1' fill='none'/%3E%3C/svg%3E");
  color: #1a1a2e;
  min-height: 100vh;
}

/* ── Layout principal ────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.app-sidebar {
  width: 210px;
  min-width: 210px;
  background: rgba(255,255,255,0.90);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid rgba(200,210,230,0.5);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 2px 0 16px rgba(79,70,229,0.06);
}

.sidebar-brand {
  padding: 20px 16px 14px;
  border-bottom: 1px solid rgba(84,110,122,0.12);
}

.sidebar-logo {
  width: 100%;
  max-width: 160px;
  display: block;
  margin: 0 auto 10px;
  border-radius: 12px;
}

.sidebar-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  color: #1a1a2e;
  letter-spacing: 0.06em;
  line-height: 1.4;
  margin-bottom: 4px;
}

.app-version {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #90A4AE;
  padding: 1px 6px;
  background: rgba(84,110,122,0.08);
  border-radius: 20px;
  border: 1px solid rgba(84,110,122,0.15);
  display: inline-block;
}

/* ── Nav sidebar ─────────────────────────────────────────────────────────── */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 8px;
  flex: 1;
}

.nav-item-group { display: flex; flex-direction: column; }

.btn-nav {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.btn-nav:hover { background: rgba(79,70,229,0.07); color: #4f46e5; }
.btn-nav.activo { background: rgba(79,70,229,0.11); color: #4f46e5; }

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  color: inherit;
}
.nav-label { flex: 1; }

/* Colores de ícono por módulo */
#btn-vista-lista     .nav-icon { color: #5C80B4; }
#btn-vista-detalle   .nav-icon { color: #26A69A; }
#btn-vista-bitacora  .nav-icon { color: #AB47BC; }
#btn-vista-proyectos .nav-icon { color: #F58F1C; }
#btn-vista-categorias .nav-icon { color: #EF5350; }
#btn-vista-periodos  .nav-icon { color: #00ACC1; }
.btn-nav.activo .nav-icon { color: #4f46e5; }

/* Sub-nav */
.subnav {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 4px 24px;
}
.subnav.visible { display: flex; }

.btn-subnav {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.78rem;
  color: #64748b;
  text-align: left;
  transition: background 0.13s, color 0.13s;
}
.btn-subnav:hover  { background: rgba(79,70,229,0.06); color: #4f46e5; }
.btn-subnav.activo { background: rgba(79,70,229,0.09); color: #4f46e5; font-weight: 600; }

.subnav-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.6;
}
.btn-subnav.activo .subnav-dot { opacity: 1; }

/* Sidebar acciones */
.sidebar-acciones {
  padding: 12px 8px 16px;
  border-top: 1px solid rgba(84,110,122,0.1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-btn-nueva {
  width: 100%;
  text-align: center;
  justify-content: center;
  font-size: 0.82rem;
  padding: 9px 10px;
}

/* ── Contenido principal ─────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px;
  overflow-x: hidden;
}

/* Buttons */
.btn-primary {
  background: #F58F1C;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
  box-shadow: 0 4px 12px rgba(79,70,229,0.3);
  letter-spacing: 0.01em;
}
.btn-primary:hover { background: #d97c0e; box-shadow: 0 6px 18px rgba(245,143,28,0.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: #4f46e5;
  border: 1.5px solid #4f46e5;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-outline:hover { background: #eef2ff; }

/* ── Login ───────────────────────────────────────────────────────────────── */
#pantalla-login {
  position: fixed;
  inset: 0;
  background-color: #e8edf7;
  background-image: url("data:image/svg+xml,%3Csvg width='320' height='320' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='320' height='320' fill='%23e8edf7'/%3E%3Cg stroke='%23c2cde6' stroke-width='1' fill='none'%3E%3Cpath d='M0 80 L90 80 L120 50 L320 50'/%3E%3Cpath d='M0 160 L70 160 L70 240 L320 240'/%3E%3Cpath d='M0 260 L40 260 L40 320'/%3E%3Cpath d='M210 0 L210 80 L260 80 L260 160 L320 160'/%3E%3Cpath d='M110 0 L110 30 L160 30 L160 80'/%3E%3Cpath d='M60 320 L60 210 L160 210 L160 160'/%3E%3Cpath d='M320 100 L280 100 L280 240'/%3E%3C/g%3E%3Cg fill='%23a8b8d8'%3E%3Ccircle cx='120' cy='50' r='4'/%3E%3Ccircle cx='70' cy='160' r='4'/%3E%3Ccircle cx='70' cy='240' r='4'/%3E%3Ccircle cx='260' cy='80' r='4'/%3E%3Ccircle cx='260' cy='160' r='4'/%3E%3Ccircle cx='160' cy='210' r='4'/%3E%3Ccircle cx='160' cy='160' r='4'/%3E%3C/g%3E%3C/svg%3E");
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#login-box {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.95);
  border-radius: 24px;
  padding: 52px 44px;
  max-width: 390px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 48px rgba(79,70,229,0.15), 0 4px 12px rgba(0,0,0,0.06);
}

#login-logo {
  font-size: 3rem;
  margin-bottom: 16px;
}

#login-box h1 {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: cursive;
  font-style: italic;
  margin-bottom: 8px;
  color: #1a1a2e;
}

#login-box p {
  color: #6b7280;
  font-size: 0.9rem;
  margin-bottom: 32px;
}

#btn-google-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
#btn-google-login:hover {
  background: #f9fafb;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Barra de usuario (dentro del sidebar) */
.user-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(84,110,122,0.1);
  flex-wrap: wrap;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #F58F1C;
  box-shadow: 0 0 0 2px rgba(245,143,28,0.25);
  flex-shrink: 0;
}

.user-nombre {
  font-size: 0.72rem;
  font-weight: 600;
  color: #374151;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

.btn-logout {
  background: none;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 0.7rem;
  color: #6b7280;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-logout:hover { background: #fee2e2; color: #ef4444; border-color: #fca5a5; }

/* Filtro barra de completadas (Fecha Límite) */
.fl-filtro-bar {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(158,158,158,0.08);
  flex-wrap: wrap;
}
.fl-filtro-btn {
  padding: 3px 8px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.7);
  border-radius: 20px;
  font-size: 0.7rem;
  cursor: pointer;
  color: #607d8b;
  transition: background 0.13s, color 0.13s;
}
.fl-filtro-btn:hover { background: rgba(79,70,229,0.07); color: #4f46e5; border-color: #4f46e5; }
.fl-filtro-btn.activo { background: #9E9E9E; color: #fff; border-color: #9E9E9E; font-weight: 600; }

/* Filtros */
.filtros {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filtros input,
.filtros select {
  padding: 10px 14px;
  border: 1.5px solid rgba(255,255,255,0.8);
  border-radius: 10px;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #1a1a2e;
  flex: 1;
  min-width: 140px;
  box-shadow: 0 2px 8px rgba(79,70,229,0.06);
}
.filtros input:focus,
.filtros select:focus { outline: none; border-color: #4f46e5; background: #fff; }

/* Lista de tareas */
#lista-tareas {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#cargando {
  animation: pulso 1.2s ease-in-out infinite;
}
@keyframes pulso {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
  font-size: 1rem;
}

/* Tarjeta de tarea */
.tarea-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: 0 2px 12px rgba(79,70,229,0.07), 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid #f0f2f8;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: box-shadow 0.2s, transform 0.15s;
}
.tarea-card:hover {
  box-shadow: 0 6px 20px rgba(79,70,229,0.11), 0 2px 6px rgba(0,0,0,0.05);
  transform: translateY(-1px);
}
.tarea-card.completada { opacity: 0.55; }

.tarea-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}
.tarea-check.marcada {
  background: #4f46e5;
  border-color: #4f46e5;
}
.tarea-check.marcada::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.tarea-body { flex: 1; min-width: 0; }

.tarea-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.tarea-titulo {
  font-weight: 600;
  font-size: 1rem;
  word-break: break-word;
}
.completada .tarea-titulo { text-decoration: line-through; }

.tarea-cat {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  color: #fff;
}

.tarea-desc {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 8px;
  word-break: break-word;
}

.tarea-fechas {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: #9ca3af;
}
.tarea-fechas span { display: flex; align-items: center; gap: 4px; }

.tarea-acciones {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s;
  color: #9ca3af;
}
.btn-icon:hover { background: #f3f4f6; color: #1a1a2e; }
.btn-icon.delete:hover { background: #fee2e2; color: #ef4444; }

/* Estado en ejecución */
.tarea-card.en_ejecucion {
  border-left: 4px solid #059669;
}

.badge-ejecucion {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #6ee7b7;
}

.badge-ejecucion::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #059669;
  animation: pulso-verde 1s ease-in-out infinite;
}

.badge-pausa {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fcd34d;
}

.tarea-card.en_pausa {
  border-left: 4px solid #d97706;
}

.crono-display.pausado {
  color: #d97706;
  background: #fffbeb;
  border-color: #fcd34d;
}

.btn-pausar {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(217,119,6,0.3);
  white-space: nowrap;
}
.btn-pausar:hover { box-shadow: 0 4px 12px rgba(217,119,6,0.4); transform: translateY(-1px); }

.btn-reanudar {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(5,150,105,0.3);
  white-space: nowrap;
}
.btn-reanudar:hover { box-shadow: 0 4px 12px rgba(5,150,105,0.4); transform: translateY(-1px); }

@keyframes pulso-verde {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}

/* Cronómetro */
.crono-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.crono-display {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #059669;
  letter-spacing: 2px;
  background: #ecfdf5;
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid #6ee7b7;
}

.crono-total {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  padding: 3px 10px;
  border-radius: 8px;
}

/* Botón iniciar */
.btn-iniciar {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(5,150,105,0.3);
  white-space: nowrap;
}
.btn-iniciar:hover { box-shadow: 0 4px 12px rgba(5,150,105,0.4); transform: translateY(-1px); }

/* Badge recurrencia */
.tarea-recurrencia {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  background: #f0fdf4;
  color: #059669;
  border: 1px solid #6ee7b7;
  white-space: nowrap;
}

/* Progreso */
.progreso-wrap {
  margin-top: 10px;
}

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

.progreso-label {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.progreso-label:hover { color: #4f46e5; }

.progreso-pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: #4f46e5;
}
.progreso-pct.completo { color: #059669; }

.progreso-bar-bg {
  height: 6px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
}

.progreso-bar-fill {
  height: 100%;
  background: #4f46e5;
  border-radius: 99px;
  transition: width 0.3s ease;
}
.progreso-bar-fill.completo { background: #059669; }

/* Lista de subtareas en la tarjeta */
.subtareas-lista {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subtarea-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.subtarea-item:hover { background: #f9fafb; }

.subtarea-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}
.subtarea-check.marcada {
  background: #4f46e5;
  border-color: #4f46e5;
}
.subtarea-check.marcada::after {
  content: '✓';
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.subtarea-texto {
  font-size: 0.84rem;
  color: #374151;
  flex: 1;
  word-break: break-word;
}
.subtarea-texto.completada {
  text-decoration: line-through;
  color: #9ca3af;
}

/* Vencida */
.tarea-card.vencida .tarea-fechas .fecha-fin { color: #ef4444; font-weight: 600; }

/* Modal */
#modal-overlay, #modal-cat-overlay, #modal-proy-overlay, #modal-subp-overlay,
#modal-nota-overlay, #modal-edit-cat-overlay, #modal-periodo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30,30,60,0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.hidden { display: none !important; }

#modal {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 20px;
  padding: 30px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(79,70,229,0.18), 0 4px 16px rgba(0,0,0,0.06);
}

#modal-cat {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 20px;
  padding: 28px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 24px 64px rgba(79,70,229,0.18), 0 4px 16px rgba(0,0,0,0.06);
}

#modal h2, #modal-cat h3 {
  margin-bottom: 20px;
  font-size: 1.2rem;
}

#modal form { display: flex; flex-direction: column; gap: 14px; }

#modal label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
}

#modal input,
#modal textarea,
#modal select,
#modal-cat input {
  padding: 9px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #1a1a2e;
  background: #fff;
  width: 100%;
  transition: border-color 0.2s;
}
#modal input:focus,
#modal textarea:focus,
#modal select:focus,
#modal-cat input:focus { outline: none; border-color: #4f46e5; }

.categoria-row {
  display: flex;
  gap: 8px;
}
.categoria-row select { flex: 1; }

.fecha-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

#modal-cat input { margin-bottom: 16px; }

/* ── Detalle Lista ──────────────────────────────────────────────────────────── */
#vista-detalle {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(79,70,229,0.07);
  overflow: hidden;
}

#detalle-scroll {
  overflow-x: auto;
}

#detalle-tabla {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-size: 0.84rem;
}

#detalle-tabla thead tr {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
}

#detalle-tabla th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

#detalle-tabla td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f2f8;
  vertical-align: middle;
}

#detalle-tabla tbody tr {
  transition: background 0.15s;
}
#detalle-tabla tbody tr:hover { background: #f5f7ff; }
#detalle-tabla tbody tr:last-child td { border-bottom: none; }

.det-titulo {
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 2px;
}
.det-titulo.completada { text-decoration: line-through; color: #9ca3af; }

.det-desc {
  font-size: 0.78rem;
  color: #6b7280;
  max-width: 220px;
}

.det-actividad {
  font-size: 0.8rem;
  color: #374151;
  white-space: nowrap;
}
.det-actividad .det-sub {
  font-size: 0.74rem;
  color: #9ca3af;
  display: block;
}

.det-limite {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.det-limite.vencida { color: #ef4444; }
.det-limite.hoy     { color: #d97706; }
.det-limite.ok      { color: #059669; }

.det-estado {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}
.det-estado.pendiente    { background:#f3f4f6; color:#6b7280; }
.det-estado.en_ejecucion { background:#ecfdf5; color:#059669; border:1px solid #6ee7b7; }
.det-estado.en_pausa     { background:#fffbeb; color:#d97706; border:1px solid #fcd34d; }
.det-estado.completada   { background:#eef2ff; color:#4f46e5; border:1px solid #c7d2fe; }

.det-rec {
  font-size: 0.78rem;
  color: #059669;
  font-weight: 600;
  white-space: nowrap;
}

.det-empty {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
  font-size: 0.95rem;
}

/* ── Gantt ─────────────────────────────────────────────────────────────────── */
#vista-gantt {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  overflow: hidden;
}

#gantt-scroll {
  overflow-x: auto;
  overflow-y: visible;
}

#gantt-inner {
  min-width: 100%;
  position: relative;
  font-size: 0.82rem;
}

.gantt-header {
  display: flex;
  border-bottom: 2px solid #e5e7eb;
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 10;
}

.gantt-label-col {
  width: 200px;
  min-width: 200px;
  padding: 10px 14px;
  font-weight: 700;
  color: #6b7280;
  border-right: 1px solid #e5e7eb;
  position: sticky;
  left: 0;
  background: #f9fafb;
  z-index: 11;
}

.gantt-timeline-header {
  display: flex;
  flex: 1;
}

.gantt-day-header {
  text-align: center;
  padding: 6px 2px;
  border-right: 1px solid #f3f4f6;
  color: #9ca3af;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}
.gantt-day-header.hoy {
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 700;
}
.gantt-day-header.inicio-semana {
  border-right: 1px solid #d1d5db;
  color: #374151;
}

.gantt-row {
  display: flex;
  border-bottom: 1px solid #f3f4f6;
  align-items: center;
  min-height: 52px;
  transition: background 0.15s;
}
.gantt-row:hover { background: #fafafa; }

.gantt-row-label {
  width: 200px;
  min-width: 200px;
  padding: 8px 14px;
  border-right: 1px solid #e5e7eb;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
}
.gantt-row:hover .gantt-row-label { background: #fafafa; }

.gantt-row-titulo {
  font-weight: 600;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-row-titulo.completada { text-decoration: line-through; color: #9ca3af; }

.gantt-row-cat {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  color: #fff;
  align-self: flex-start;
}

.gantt-timeline-row {
  flex: 1;
  position: relative;
  height: 52px;
}

.gantt-grid-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: #f3f4f6;
  pointer-events: none;
}
.gantt-grid-line.semana { background: #e5e7eb; }
.gantt-grid-line.hoy    { background: #c7d2fe; width: 2px; }

.gantt-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  min-width: 4px;
}
.gantt-bar:hover { opacity: 1; box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.gantt-bar.completada { opacity: 0.45; }

.gantt-progreso-strip {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(255,255,255,0.3);
  border-radius: 6px 0 0 6px;
  pointer-events: none;
}

.gantt-empty {
  padding: 60px 20px;
  text-align: center;
  color: #9ca3af;
}

/* Subtareas en el modal */
.subtareas-seccion {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subtareas-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
}

.subtareas-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: #9ca3af;
}

#lista-subtareas-modal {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subtarea-modal-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #f9fafb;
  border-radius: 7px;
  font-size: 0.88rem;
  color: #374151;
  user-select: none;
}
.subtarea-modal-item span { flex: 1; word-break: break-word; }
.subtarea-modal-item .btn-icon { padding: 2px 5px; font-size: 0.8rem; }

.subtarea-orden {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}
.btn-orden {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  font-size: 0.7rem;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 3px;
  transition: background 0.15s, color 0.15s;
}
.btn-orden:hover { background: #e5e7eb; color: #4f46e5; }
.btn-orden:disabled { opacity: 0.2; cursor: default; }

.subtarea-add-row {
  display: flex;
  gap: 8px;
}
.subtarea-add-row input { flex: 1; }
.subtarea-add-row .btn-outline { padding: 8px 14px; white-space: nowrap; }

/* ── Panel de comentarios ────────────────────────────────────────────────── */
.panel-coment {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(20px);
  box-shadow: -4px 0 32px rgba(0,0,0,0.14);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.panel-coment.abierto { transform: translateX(0); }

.panel-coment-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
}
.panel-coment-overlay.abierto { opacity: 1; }

.panel-coment-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border-radius: 0;
}

.panel-coment-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }

.panel-coment-titulo {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  word-break: break-word;
}

.panel-coment-estado {
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 99px;
  width: fit-content;
}

.btn-cerrar-panel {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-cerrar-panel:hover { background: rgba(255,255,255,0.35); }

.panel-coment-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coment-vacio {
  text-align: center;
  color: #9ca3af;
  font-size: 0.85rem;
  margin: auto;
  padding: 40px 20px;
}

.coment-burbuja {
  background: #f3f4f6;
  border-radius: 12px 12px 12px 2px;
  padding: 10px 14px;
  max-width: 100%;
  position: relative;
}

.coment-timestamp {
  font-size: 0.68rem;
  color: #9ca3af;
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
}

.coment-texto {
  font-size: 0.88rem;
  color: #1a1a2e;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.coment-burbuja-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.coment-estrella {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.25;
  padding: 0 2px;
  transition: opacity 0.15s, transform 0.1s;
  line-height: 1;
}
.coment-estrella:hover { opacity: 0.7; transform: scale(1.15); }
.coment-estrella.activa { opacity: 1; }
.coment-permanente {
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
}

.coment-actividad {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px;
  border-left: 3px solid #c7d2fe;
  margin: 2px 0;
  background: transparent;
}
.coment-act-texto {
  font-size: 0.78rem;
  color: #6366f1;
  font-weight: 600;
  font-style: italic;
}
.coment-act-time {
  font-size: 0.68rem;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

.panel-coment-input-wrap {
  padding: 14px 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f9fafb;
}

.panel-coment-input {
  width: 100%;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
}
.panel-coment-input:focus { border-color: #6366f1; }

.btn-enviar-coment {
  align-self: flex-end;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-enviar-coment:hover { opacity: 0.88; }

/* Botón de comentarios en la tarjeta */
.btn-comentarios {
  background: none;
  border: 1.5px solid #c7d2fe;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 0.75rem;
  color: #4f46e5;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-comentarios:hover { background: #eef2ff; }
.btn-comentarios.con-coments { background: #eef2ff; }

@media (max-width: 600px) {
  .panel-coment { width: 100%; }
}

/* ── Botón Nueva nota ────────────────────────────────────────────────────── */
.btn-nueva-nota {
  background: #F58F1C;
}
.btn-nueva-nota:hover { background: #d97c0e; }

/* ── Vista Categorías ────────────────────────────────────────────────────── */
.cats-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cats-nueva-card {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.6);
  padding: 22px 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.cats-nueva-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 14px;
}

.cats-nueva-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cats-nueva-form input {
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.cats-nueva-form input:focus { border-color: #6366f1; }

.cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.cat-gestion-card {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.6);
  border-left: 5px solid var(--cat-color, #9ca3af);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: box-shadow 0.15s, transform 0.15s;
}
.cat-gestion-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-1px); }

.cat-gestion-color {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-gestion-nombre {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1a1a2e;
}

.cat-gestion-acciones {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.cat-gestion-card:hover .cat-gestion-acciones { opacity: 1; }

/* Modal editar categoría */
#modal-edit-cat {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(79,70,229,0.18);
}

@media (max-width: 600px) {
  .cats-grid { grid-template-columns: 1fr; }
}

/* ── Botón Nuevo proyecto ────────────────────────────────────────────────── */
.btn-nuevo-proyecto {
  background: #F58F1C;
}
.btn-nuevo-proyecto:hover { background: #d97c0e; }

.btn-nuevo-periodo {
  background: #00ACC1;
}
.btn-nuevo-periodo:hover { background: #00838f; }

/* ── Vista Proyectos ─────────────────────────────────────────────────────── */
#lista-proyectos {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.proy-card {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.6);
  border-left: 5px solid var(--proy-color, #4f46e5);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.proy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  gap: 16px;
  transition: background 0.15s;
}
.proy-header:hover { background: rgba(0,0,0,0.02); }

.proy-header-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.proy-chevron {
  font-size: 1rem;
  color: #9ca3af;
  margin-top: 3px;
  flex-shrink: 0;
}

.proy-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.proy-titulo {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1a1a2e;
}

.proy-desc {
  font-size: 0.82rem;
  color: #6b7280;
}

.proy-fechas {
  font-size: 0.78rem;
  color: #9ca3af;
  font-weight: 600;
}

.proy-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.proy-progreso-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 160px;
}

.proy-progreso-label {
  font-size: 0.74rem;
  color: #6b7280;
  font-weight: 600;
  white-space: nowrap;
}

.proy-progreso-bg {
  width: 160px;
  height: 7px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
}

.proy-progreso-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* Sub-proyectos */
.subp-lista {
  padding: 0 20px 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subp-card {
  border-left-width: 3px;
  border-left-style: solid;
  border-left-color: #c7d2fe;
}


.btn-add-subp {
  align-self: flex-start;
  margin-top: 4px;
  background: none;
  border: 1.5px dashed #c7d2fe;
  color: #6366f1;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-add-subp:hover { background: #eef2ff; border-color: #6366f1; }

/* Modal proyecto */
#modal-proy {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 64px rgba(79,70,229,0.18);
}

/* Modal sub-proyecto */
#modal-subp {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(79,70,229,0.18);
}

.modal-subp-contexto {
  font-size: 0.78rem;
  font-weight: 700;
  color: #6366f1;
  background: #eef2ff;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  display: inline-block;
}

/* Selector de colores */
.proy-colores {
  display: grid;
  grid-template-columns: repeat(7, 28px);
  gap: 8px;
  margin-top: 6px;
}

.proy-color-opt {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}
.proy-color-opt:hover    { transform: scale(1.15); }
.proy-color-opt.seleccionado { border-color: #1a1a2e; transform: scale(1.15); }

@media (max-width: 600px) {
  .proy-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .proy-header-right { width: 100%; justify-content: space-between; }
  .proy-progreso-wrap { min-width: 0; flex: 1; align-items: flex-start; }
  .proy-progreso-bg { width: 100%; }
  .subp-lista { padding-left: 12px; }
}

/* ── Vista Bitácora: layout ──────────────────────────────────────────────── */
#vista-bitacora { margin-top: 4px; }

.bitacora-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 20px;
  align-items: start;
}

/* Sidebar */
.bitacora-sidebar {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.5);
  padding: 16px;
  position: sticky;
  top: 16px;
}

.bitacora-area-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.btn-area {
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #374151;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-area:hover  { background: #f3f4f6; }
.btn-area.activo { background: #eef2ff; color: #4f46e5; }

.bitacora-cat-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
}

.btn-cat-filter {
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-cat-filter:hover  { background: #f9fafb; color: #111827; }
.btn-cat-filter.activo { background: #dbeafe; color: #1d4ed8; font-weight: 700; }

/* Main: lista de notas */
.bitacora-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Nota card */
.nota-card {
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.5);
  border-left: 4px solid #9ca3af;
  padding: 16px 18px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
}
.nota-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.1); transform: translateY(-1px); }

.nota-card.area-laboral { border-left-color: #3b82f6; }
.nota-card.area-personal { border-left-color: #10b981; }

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

.nota-cat-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 99px;
}

.nota-fecha {
  font-size: 0.72rem;
  color: #9ca3af;
  white-space: nowrap;
}

.nota-titulo {
  font-size: 0.98rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 6px;
}

.nota-preview {
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.nota-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.nota-tag {
  background: #eef2ff;
  color: #4f46e5;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}

.nota-vinculo {
  font-size: 0.78rem;
  color: #059669;
  margin-top: 4px;
}

.nota-acciones {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.nota-card:hover .nota-acciones { opacity: 1; }

/* Modal nota */
#modal-nota {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(79,70,229,0.18), 0 4px 16px rgba(0,0,0,0.06);
}

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

/* ── Modal periodo ───────────────────────────────────────────────────────── */
#modal-periodo {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(79,70,229,0.18);
}
#modal-periodo h2 { margin-bottom: 20px; font-size: 1.2rem; }
#modal-periodo form { display: flex; flex-direction: column; gap: 14px; }
#modal-periodo label { display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; font-weight: 600; color: #374151; }
#modal-periodo input { padding: 9px 12px; border: 1.5px solid #d1d5db; border-radius: 8px; font-size: 0.9rem; font-family: inherit; color: #1a1a2e; background: #fff; width: 100%; transition: border-color 0.2s; }
#modal-periodo input:focus { outline: none; border-color: #4f46e5; }

/* ── Periodos ────────────────────────────────────────────────────────────── */
.periodo-seccion {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 4px;
  border: 1px solid rgba(0,0,0,0.07);
}

.periodo-seccion.per-abierto { border-color: rgba(5,150,105,0.2); }
.periodo-seccion.per-cerrado { border-color: rgba(107,114,128,0.2); opacity: 0.82; }
.periodo-seccion.per-sin     { border-color: rgba(245,143,28,0.2); }

.periodo-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  gap: 10px;
  flex-wrap: wrap;
}
.per-abierto .periodo-header-bar { background: linear-gradient(135deg,#ecfdf5,#d1fae5); }
.per-cerrado .periodo-header-bar { background: linear-gradient(135deg,#f3f4f6,#e5e7eb); }

.periodo-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.periodo-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.periodo-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.per-badge-abierto { background: #059669; color: #fff; }
.per-badge-cerrado { background: #6b7280; color: #fff; }

.periodo-nombre {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1a1a2e;
}

.periodo-fechas {
  font-size: 0.76rem;
  color: #6b7280;
  font-weight: 600;
}

.periodo-cuerpo {
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255,255,255,0.5);
}

.periodo-empty {
  font-size: 0.82rem;
  color: #9ca3af;
  padding: 4px 0;
}

.periodo-sin-header {
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #92400e;
  background: linear-gradient(135deg,#fff7ed,#fef3c7);
}

.btn-periodo {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-cerrar-periodo {
  background: #374151;
  color: #fff;
}
.btn-cerrar-periodo:hover { background: #1f2937; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.btn-abrir-periodo {
  background: #059669;
  color: #fff;
}
.btn-abrir-periodo:hover { background: #047857; box-shadow: 0 2px 8px rgba(5,150,105,0.3); }

.btn-add-periodo {
  align-self: flex-start;
  margin-top: 6px;
  background: none;
  border: 1.5px dashed #6366f1;
  color: #4f46e5;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-add-periodo:hover { background: #eef2ff; }

.btn-add-sinperiodo {
  border-color: #e5e7eb;
  color: #9ca3af;
}
.btn-add-sinperiodo:hover { background: #f9fafb; border-color: #d1d5db; }

.subp-readonly { opacity: 0.85; }

.periodo-readonly-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  white-space: nowrap;
}

/* ── Vista Periodos ──────────────────────────────────────────────────────── */
#lista-periodos {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.per-gestion-grupo {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.6);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.per-gestion-grupo-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.6);
  border-left: 5px solid #4f46e5;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.per-gestion-proy-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.per-gestion-proy-nombre {
  font-size: 1rem;
  font-weight: 800;
  color: #1a1a2e;
}

.per-gestion-lista {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.per-gestion-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: background 0.15s;
}
.per-gestion-card:last-child { border-bottom: none; }
.per-gestion-card:hover { background: rgba(255,255,255,0.5); }
.per-gestion-abierto { background: rgba(236,253,245,0.4); }
.per-gestion-cerrado { background: rgba(243,244,246,0.5); opacity: 0.85; }

.per-gestion-estado { flex-shrink: 0; }

.per-gestion-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.per-gestion-nombre {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a2e;
}

.per-gestion-fechas {
  font-size: 0.78rem;
  color: #6b7280;
  font-weight: 600;
}

.per-gestion-progress {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}

.per-gestion-prog-label {
  font-size: 0.72rem;
  color: #9ca3af;
}

.per-gestion-bar-bg {
  height: 5px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
  max-width: 200px;
}

.per-gestion-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

.per-gestion-acciones {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Mobile: barra horizontal superior (igual que antes) ─────────────────── */
@media (max-width: 600px) {
  #app { flex-direction: column; }

  /* Sidebar → barra horizontal pegada arriba */
  .app-sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    position: sticky;
    top: 0;
    flex-direction: column;
    padding: 8px 10px;
    border-right: none;
    border-bottom: 1px solid rgba(200,210,230,0.5);
    gap: 6px;
    overflow-x: auto;
    overflow-y: visible;
    z-index: 200;
  }

  .sidebar-brand { display: none; }

  /* Nav en fila horizontal scrollable */
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    padding: 0;
    gap: 2px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  /* Botones principales: ícono arriba + etiqueta abajo (estilo original) */
  .nav-item-group { flex-direction: column; gap: 0; }

  .btn-nav {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 5px 8px;
    font-size: 0.6rem;
    border-radius: 8px;
    white-space: nowrap;
  }
  .nav-icon {
    width: auto;
    font-size: 1rem;
    line-height: 1;
  }
  .nav-label { font-size: 0.6rem; }

  /* Sub-nav en fila debajo del btn-nav principal */
  .subnav {
    flex-direction: row;
    flex-wrap: nowrap;
    padding: 2px 0 0 0;
    gap: 2px;
    overflow-x: auto;
  }
  .btn-subnav {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 7px;
    font-size: 0.58rem;
    white-space: nowrap;
  }
  .subnav-dot { display: none; }

  /* Acciones: en fila */
  .sidebar-acciones {
    flex-direction: row;
    border-top: none;
    padding: 0;
    gap: 4px;
    align-items: center;
  }
  .sidebar-btn-nueva { width: auto; padding: 6px 12px; font-size: 0.78rem; }

  .app-main { padding: 12px 10px; }
  .btn-primary { padding: 8px 13px; font-size: 0.82rem; }

  .filtros { gap: 7px; margin-bottom: 12px; }
  .filtros input,
  .filtros select { padding: 7px 10px; font-size: 0.8rem; min-width: 110px; }

  #lista-tareas { gap: 8px; }

  .tarea-card {
    padding: 11px 13px;
    gap: 10px;
    border-radius: 11px;
  }

  .tarea-check { width: 18px; height: 18px; }
  .tarea-check.marcada::after { font-size: 10px; }

  .tarea-titulo { font-size: 0.85rem; }
  .tarea-cat    { font-size: 0.65rem; padding: 1px 6px; }
  .tarea-recurrencia { font-size: 0.65rem; padding: 1px 6px; }
  .badge-ejecucion, .badge-pausa { font-size: 0.65rem; padding: 1px 6px; }

  .tarea-desc   { font-size: 0.76rem; margin-bottom: 5px; }

  .tarea-fechas { gap: 8px; font-size: 0.7rem; }

  .btn-icon     { font-size: 0.85rem; padding: 4px; }
  .btn-iniciar,
  .btn-pausar,
  .btn-reanudar { padding: 4px 9px; font-size: 0.72rem; }

  .progreso-pct   { font-size: 0.7rem; }
  .progreso-label { font-size: 0.7rem; }
  .progreso-bar-bg { height: 5px; }

  .subtarea-texto { font-size: 0.78rem; }
  .subtarea-check { width: 14px; height: 14px; }
  .subtarea-check.marcada::after { font-size: 9px; }

  .crono-display { font-size: 0.9rem; padding: 3px 9px; letter-spacing: 1px; }
  .crono-total   { font-size: 0.76rem; }

  /* Bitácora mobile */
  .bitacora-layout { grid-template-columns: 1fr; }
  .bitacora-sidebar { position: static; }
  .bitacora-area-btns { flex-direction: row; flex-wrap: wrap; }
  .btn-area { width: auto; font-size: 0.78rem; padding: 6px 10px; }
  .bitacora-cat-list { flex-direction: row; flex-wrap: wrap; }
  .btn-cat-filter { width: auto; font-size: 0.76rem; padding: 5px 10px; }
  .nota-area-cat-row { grid-template-columns: 1fr; }

  /* Kanban mobile */
  .kanban-board { gap: 10px; padding-bottom: 10px; }
  .kanban-col { flex: 0 0 240px; }
  .kanban-col-titulo { font-size: 0.76rem; }
}

/* ── Kanban Board (Planificador & Fecha Límite) ────────────────────────────── */
#vista-planificador,
#vista-fechalimite {
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-height: calc(100vh - 220px);
  padding-bottom: 20px;
  min-width: max-content;
}

.kanban-col {
  flex: 0 0 272px;
  background: rgba(255,255,255,0.72);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 14px rgba(0,0,0,0.07);
  border: 1px solid rgba(255,255,255,0.9);
  transition: box-shadow 0.2s;
}

.kanban-col.drag-over {
  box-shadow: 0 0 0 2px #4f46e5, 0 4px 20px rgba(79,70,229,0.18);
}
.kanban-col.drag-over .kanban-col-body {
  background: rgba(79,70,229,0.04);
}

.kanban-col-header {
  padding: 11px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}

.kanban-col-titulo {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.kanban-col-count {
  background: rgba(255,255,255,0.28);
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 0.82rem;
  font-weight: 700;
}

.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 80px;
}

/* Kanban Card */
.kanban-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 12px 13px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.07);
  border: 1px solid #eef0f7;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: box-shadow 0.18s, transform 0.15s;
  user-select: none;
}

.kanban-card:hover {
  box-shadow: 0 4px 14px rgba(79,70,229,0.13);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.38;
  cursor: grabbing;
  transform: rotate(1.5deg);
}

.kanban-card.vencida {
  border-left: 3px solid #ef4444;
}

.kanban-card.completada {
  opacity: 0.6;
}

.kanban-card-titulo {
  font-weight: 600;
  font-size: 0.86rem;
  color: #1e293b;
  line-height: 1.35;
}

.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.kanban-fecha {
  font-size: 0.73rem;
  color: #64748b;
}
.kanban-fecha.vencida {
  color: #ef4444;
  font-weight: 600;
}

.kanban-resp {
  font-size: 0.73rem;
  color: #64748b;
}

.kanban-progreso {
  height: 4px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 2px;
}
.kanban-progreso-fill {
  height: 100%;
  background: #4f46e5;
  border-radius: 4px;
  transition: width 0.3s;
}
.kanban-progreso-fill.completo {
  background: #22c55e;
}

.kanban-card-acciones {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}

.kanban-btn-add {
  width: 100%;
  padding: 7px 10px;
  border: 2px dashed rgba(0,0,0,0.13);
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #94a3b8;
  letter-spacing: 0.02em;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.kanban-btn-add:hover {
  border-color: #4f46e5;
  color: #4f46e5;
  background: rgba(79,70,229,0.04);
}

.kanban-empty {
  font-size: 0.78rem;
  color: #b0bec5;
  text-align: center;
  padding: 14px 0;
  font-style: italic;
}

/* ── Eywa ──────────────────────────────────────────────────────────────────── */
.eywa-header {
  margin-bottom: 16px;
}
.eywa-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border, #e2e8f0);
  padding-bottom: 0;
}
.eywa-tab {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: color 0.15s, border-color 0.15s;
}
.eywa-tab:hover { color: #4f46e5; }
.eywa-tab.activo {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

/* Grafo */
.grafo-leyenda {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 0.78rem;
  color: #64748b;
}
.grafo-ley-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.grafo-ley-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.grafo-ley-hint {
  margin-left: auto;
  font-style: italic;
  color: #94a3b8;
  font-size: 0.75rem;
}
.grafo-wrap {
  position: relative;
  background: #f1f5f9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
#grafo-svg {
  display: block;
  width: 100%;
  height: 560px;
}
.grafo-node { cursor: default; }
.grafo-node-item { cursor: pointer; }
.grafo-node-item circle { transition: opacity 0.12s; }
.grafo-node-item:hover circle { opacity: 0.82; }

/* Popup de nodo */
.grafo-popup {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.13);
  padding: 14px 16px 14px 16px;
  min-width: 200px;
  max-width: 280px;
  z-index: 10;
  border: 1px solid #e2e8f0;
}
.grafo-popup-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  color: #94a3b8;
}
.grafo-popup-tipo {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 4px;
}
.grafo-popup-titulo {
  font-weight: 600;
  font-size: 0.92rem;
  color: #1e293b;
  margin-bottom: 10px;
  line-height: 1.3;
}
.grafo-popup-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.grafo-popup-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.03em;
}

/* Gestión de etiquetas */
.etiq-gestion {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
  align-items: start;
}
.etiq-nueva-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 18px 20px;
}
.etiq-nueva-card h3,
.etiq-lista h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 14px;
}
.etiq-nueva-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.etiq-nueva-form input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.etiq-nueva-form input[type="text"]:focus { border-color: #4f46e5; }
.etiq-paleta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.etiq-color-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.1s, border-color 0.1s;
}
.etiq-color-btn:hover { transform: scale(1.15); }
.etiq-color-btn.sel {
  border-color: #1e293b;
  transform: scale(1.15);
}
.etiq-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #64748b;
}
.etiq-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.03em;
}
.etiq-lista { padding: 4px 0; }
.etiq-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.etiq-row:last-child { border-bottom: none; }
.etiq-uso {
  font-size: 0.76rem;
  color: #94a3b8;
  margin-left: auto;
}
.btn-icon-sm {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.5;
  transition: opacity 0.15s;
  padding: 2px 4px;
  border-radius: 4px;
}
.btn-icon-sm:hover { opacity: 1; background: #fee2e2; }

.etiq-row-editing {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 4px;
}
.etiq-edit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.etiq-edit-input {
  padding: 7px 11px;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
}
.etiq-edit-input:focus { border-color: #4f46e5; }
.etiq-edit-paleta { display: flex; flex-wrap: wrap; gap: 6px; }
.etiq-edit-color-btn {
  width: 22px; height: 22px; border-radius: 50%;
  cursor: pointer; border: 3px solid transparent;
  transition: transform 0.1s, border-color 0.1s;
}
.etiq-edit-color-btn:hover { transform: scale(1.15); }
.etiq-edit-color-btn.sel { border-color: #1e293b; transform: scale(1.15); }
.etiq-edit-acciones { display: flex; gap: 8px; }
.btn-sm { padding: 5px 14px !important; font-size: 0.82rem !important; }

@media (max-width: 600px) {
  .etiq-gestion { grid-template-columns: 1fr; }
  .grafo-ley-hint { display: none; }
}
