:root {
  --bg-principal: #f4f6f9;
  --sidebar-color: #1e293b;
  --texto-claro: #ffffff;
  --texto-oscuro: #334155;
  --azul-corporativo: #2563eb;
  --por-hacer: #64748b;
  --en-proceso: #3b82f6;
  --en-revision: #f59e0b;
  --completado: #10b981;
  --bloqueado: #ef4444;
}
* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0; padding: 0;
  background-color: var(--bg-principal);
  color: var(--texto-oscuro);
  display: flex; height: 100vh; overflow: hidden;
}
.sidebar {
  width: 270px; background-color: var(--sidebar-color); color: var(--texto-claro);
  padding: 20px; box-sizing: border-box; display: flex; flex-direction: column;
  justify-content: space-between; flex-shrink: 0; overflow-y: auto;
}
.logo-area h2 { font-size: 1.15rem; margin-bottom: 4px; color: #60a5fa; }
.logo-area p { font-size: 0.78rem; margin: 0; opacity: 0.7; }
.espacios-menu { margin-top: 24px; flex-grow: 1; }
.espacio-item { margin-bottom: 14px; }
.espacio-titulo { font-weight: bold; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; margin-bottom: 6px; }
.lista-links { list-style: none; padding-left: 8px; margin: 0; }
.lista-links li { padding: 7px 6px; font-size: 0.84rem; cursor: pointer; opacity: 0.8; transition: 0.2s; border-radius: 5px; }
.lista-links li:hover { opacity: 1; color: #60a5fa; background: rgba(255,255,255,0.05); }
.lista-links li.activo { opacity: 1; color: #fff; background: var(--azul-corporativo); }
.lista-links li.deshabilitado { opacity: 0.35; cursor: not-allowed; }
.lista-links li.deshabilitado:hover { background: none; color: inherit; }
.usuario-selector { margin-top: 16px; }
.usuario-selector label { font-size: 0.78rem; color: #94a3b8; display: block; margin-bottom: 6px; }
.usuario-selector select {
  width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #334155;
  background: #0f172a; color: white; font-size: 0.85rem;
}
.main-content { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.header {
  background-color: #ffffff; padding: 18px 32px; border-bottom: 1px solid #e2e8f0;
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; flex-wrap: wrap; gap: 12px;
}
.header h1 { margin: 0; font-size: 1.35rem; }
.header p.subt { margin: 4px 0 0 0; color: #64748b; font-size: 0.85rem; }
.vista-panel { flex-grow: 1; overflow-y: auto; display: none; }
.vista-panel.activo { display: flex; flex-direction: column; }

/* TABLERO */
.tablero-container { padding: 24px 32px; display: flex; gap: 18px; overflow-x: auto; flex-grow: 1; align-items: flex-start; }
.columna { background-color: #eaeff5; width: 300px; flex-shrink: 0; border-radius: 8px; padding: 14px; box-sizing: border-box; display: flex; flex-direction: column; max-height: 100%; }
.columna-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-weight: bold; font-size: 0.88rem; }
.badge-conteo { background-color: #cbd5e1; padding: 2px 8px; border-radius: 12px; font-size: 0.72rem; }
.contenedor-tarjetas { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.contenedor-tarjetas.drag-over { background: rgba(37,99,235,0.08); border-radius: 6px; }
.tarjeta { background-color: #ffffff; border-radius: 6px; padding: 13px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-left: 4px solid transparent; cursor: grab; transition: transform 0.1s; }
.tarjeta:active { cursor: grabbing; }
.tarjeta:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.08); }
.t-por-hacer { border-left-color: var(--por-hacer); }
.t-en-proceso { border-left-color: var(--en-proceso); }
.t-en-revision { border-left-color: var(--en-revision); }
.t-completado { border-left-color: var(--completado); }
.tarjeta-tag { font-size: 0.68rem; text-transform: uppercase; font-weight: bold; padding: 2px 6px; border-radius: 4px; display: inline-block; margin-bottom: 6px; }
.tag-contabilidad { background-color: #dbeafe; color: #1e40af; }
.tag-th { background-color: #fce7f3; color: #9d174d; }
.tag-sgi { background-color: #e0f2fe; color: #0369a1; }
.tag-otra { background-color: #f1f5f9; color: #475569; }
.tarjeta-titulo { font-size: 0.87rem; font-weight: 600; margin: 0 0 8px 0; line-height: 1.3; }
.tarjeta-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: #64748b; margin-top: 8px; border-top: 1px solid #f1f5f9; padding-top: 7px; gap: 6px; }
.responsable { background-color: #e2e8f0; padding: 2px 6px; border-radius: 4px; font-weight: 500; white-space: nowrap; }
.vencimiento.critico { color: #ef4444; font-weight: bold; }
.btn-flotante-nuevo {
  position: absolute; bottom: 24px; right: 32px; background: var(--azul-corporativo); color: white;
  border: none; border-radius: 50px; padding: 12px 20px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 10px rgba(37,99,235,0.35); z-index: 10;
}
.estado-vacio-col { font-size: 0.75rem; color: #94a3b8; text-align: center; padding: 16px 4px; }

/* CARGA LABORAL */
.workload-container { padding: 24px 32px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-content: start; }
.workload-card { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.workload-card-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.workload-card-header h3 { margin: 0; font-size: 1rem; }
.workload-nivel { font-size: 0.72rem; font-weight: bold; padding: 3px 9px; border-radius: 10px; }
.nivel-bajo { background: #d1fae5; color: #065f46; }
.nivel-medio { background: #fef3c7; color: #92400e; }
.nivel-alto { background: #fee2e2; color: #991b1b; }
.workload-barra-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.workload-barra-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.workload-stats { display: flex; gap: 12px; font-size: 0.78rem; color: #64748b; margin-bottom: 10px; }
.workload-stats b { color: var(--texto-oscuro); }
.workload-vencidas { font-size: 0.78rem; color: #ef4444; font-weight: 600; margin-bottom: 8px; }
.workload-lista { list-style: none; padding: 0; margin: 0; border-top: 1px solid #f1f5f9; padding-top: 8px; }
.workload-lista li { font-size: 0.78rem; padding: 4px 0; color: #475569; display: flex; justify-content: space-between; gap: 6px; }
.workload-lista li span.area { color: #94a3b8; font-size: 0.7rem; white-space: nowrap; }

/* CALENDARIO */
.calendario-container { padding: 24px 32px; flex-grow: 1; display: flex; flex-direction: column; }
.calendario-nav { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.calendario-nav button { background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 0.85rem; }
.calendario-nav button:hover { background: #e2e8f0; }
.calendario-nav h2 { margin: 0; font-size: 1.1rem; text-transform: capitalize; min-width: 180px; text-align: center; }
.calendario-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #e2e8f0; border: 1px solid #e2e8f0; flex-grow: 1; }
.cal-dia-header { background: #f8fafc; padding: 8px; text-align: center; font-size: 0.72rem; font-weight: bold; color: #64748b; text-transform: uppercase; }
.cal-dia { background: #fff; min-height: 90px; padding: 6px; font-size: 0.75rem; position: relative; display: flex; flex-direction: column; gap: 3px; }
.cal-dia.fuera-mes { background: #fafbfc; color: #cbd5e1; }
.cal-dia.hoy { background: #eff6ff; }
.cal-dia-num { font-weight: 600; color: #94a3b8; font-size: 0.72rem; }
.cal-dia.hoy .cal-dia-num { color: var(--azul-corporativo); }
.cal-evento { font-size: 0.66rem; padding: 2px 5px; border-radius: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-evt-contabilidad { background: #dbeafe; color: #1e40af; }
.cal-evt-th { background: #fce7f3; color: #9d174d; }
.cal-evt-sgi { background: #e0f2fe; color: #0369a1; }
.cal-evt-otra { background: #f1f5f9; color: #475569; }

/* PENDIENTES */
.pendientes-container { padding: 24px 32px; max-width: 800px; }
.pendiente-item { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-left: 4px solid var(--en-revision); }
.pendiente-item.urgente { border-left-color: var(--bloqueado); }
.pendiente-titulo { font-weight: 600; font-size: 0.92rem; margin: 0 0 6px 0; }
.pendiente-detalle { font-size: 0.82rem; color: #64748b; margin: 0 0 10px 0; }
.pendiente-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; }
.pendiente-dias { color: #ef4444; font-weight: 600; }
.btn-resolver { background: #d1fae5; color: #065f46; border: none; padding: 6px 12px; border-radius: 6px; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.btn-resolver:hover { background: #a7f3d0; }
.vacio-msg { text-align: center; color: #94a3b8; padding: 60px 20px; font-size: 0.9rem; }

/* DASHBOARD CUMPLIMIENTO */
.dashboard-container { padding: 24px 32px; }
.dash-metricas { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.dash-metrica-card { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.dash-metrica-label { font-size: 0.76rem; color: #64748b; margin-bottom: 6px; }
.dash-metrica-valor { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.dash-metrica-valor.ok { color: #10b981; }
.dash-metrica-valor.warn { color: #f59e0b; }
.dash-metrica-valor.bad { color: #ef4444; }
.dash-metrica-sub { font-size: 0.72rem; color: #94a3b8; margin-top: 4px; }
.dash-seccion { background: #fff; border-radius: 8px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 20px; }
.dash-seccion h3 { margin: 0 0 14px 0; font-size: 0.95rem; }
.dash-fila-barra { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.dash-fila-barra .nombre { width: 170px; font-size: 0.8rem; flex-shrink: 0; }
.dash-fila-barra .barra-bg { flex-grow: 1; height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.dash-fila-barra .barra-fill { height: 100%; border-radius: 5px; }
.dash-fila-barra .pct { width: 48px; text-align: right; font-size: 0.78rem; font-weight: 600; flex-shrink: 0; }
.dash-tendencia { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.dash-tendencia-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.dash-tendencia-barra { width: 28px; border-radius: 4px 4px 0 0; background: #3b82f6; min-height: 2px; }
.dash-tendencia-mes { font-size: 0.7rem; color: #64748b; }
.dash-tendencia-pct { font-size: 0.7rem; font-weight: 600; }
.dash-sin-datos { color: #94a3b8; font-size: 0.82rem; padding: 10px 0; }

/* TABLAS DE CATALOGO (areas, cargos, colaboradores) */
.catalogo-container { padding: 24px 32px; flex-grow: 1; overflow-y: auto; }
.catalogo-toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.btn-primario-toolbar { background: var(--azul-corporativo); color: white; border: none; padding: 9px 16px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.btn-primario-toolbar:hover { background: #1d4ed8; }
.tabla-catalogo { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.tabla-catalogo th { background: #f8fafc; text-align: left; padding: 10px 14px; font-size: 0.76rem; text-transform: uppercase; color: #64748b; border-bottom: 1px solid #e2e8f0; }
.tabla-catalogo td { padding: 10px 14px; font-size: 0.85rem; border-bottom: 1px solid #f1f5f9; }
.tabla-catalogo tr:last-child td { border-bottom: none; }
.tabla-catalogo tr:hover { background: #f8fafc; }
.badge-estado { font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.badge-activo { background: #d1fae5; color: #065f46; }
.badge-inactivo { background: #fee2e2; color: #991b1b; }
.acciones-fila { display: flex; gap: 6px; }
.acciones-fila button { background: none; border: 1px solid #e2e8f0; border-radius: 5px; padding: 4px 9px; font-size: 0.75rem; cursor: pointer; }
.acciones-fila button:hover { background: #f1f5f9; }
.acciones-fila button.btn-eliminar { color: #ef4444; border-color: #fecaca; }
.acciones-fila button.btn-eliminar:hover { background: #fef2f2; }

/* MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.5); align-items: center; justify-content: center; z-index: 100; }
.modal-overlay.activo { display: flex; }
.modal-box { background: #fff; border-radius: 10px; padding: 24px; width: 460px; max-width: 90vw; max-height: 85vh; overflow-y: auto; }
.modal-box h3 { margin: 0 0 16px 0; font-size: 1.05rem; }
.form-grupo { margin-bottom: 14px; }
.form-grupo label { display: block; font-size: 0.8rem; font-weight: 600; color: #475569; margin-bottom: 5px; }
.form-grupo input, .form-grupo select, .form-grupo textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 0.85rem; font-family: inherit;
}
.form-grupo textarea { resize: vertical; min-height: 50px; }
.form-fila-doble { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-acciones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-acciones button { padding: 8px 16px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border: 1px solid #cbd5e1; background: #f1f5f9; }
.modal-acciones .btn-primario { background: var(--azul-corporativo); color: white; border-color: var(--azul-corporativo); }
.modal-acciones .btn-peligro { background: #fee2e2; color: #991b1b; border-color: #fecaca; margin-right: auto; }
