/* No dependas de esto para inputs; los inputs ya van con clases Tailwind en templates. */
details > summary::-webkit-details-marker { display: none; }
details > summary { list-style: none; }

/* ===============================
   SISTEMA DE BOTONES INSTITUCIONAL
   =============================== */

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;

  padding: 0.55rem 0.95rem;
  border-radius: 8px;

  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;

  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;

  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.btn:hover{
  transform: translateY(-1px);
}

.btn:active{
  transform: translateY(0);
}

.btn-sm{
  padding: 0.42rem 0.75rem;
  border-radius: 999px;          /* “pill” compacta para acciones del header */
  font-size: 0.8125rem;
  font-weight: 500;
}

.btn-link{
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  color: #1D4ED8;
  font-weight: 500;
}
.btn-link:hover{
  background: transparent;
  color: #1E40AF;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-link-danger{
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  color: #B91C1C;
  font-weight: 500;
}
.btn-link-danger:hover{
  background: transparent;
  color: #991B1B;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Disabled: NO opacity global (mata legibilidad y deja ver fondos). */
.btn:disabled,
.btn-disabled{
  pointer-events: none;
  cursor: default;
  background: #F8FAFC !important;
  border-color: #E2E8F0 !important;
  color: #94A3B8 !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Focus accesible consistente */
.btn:focus-visible{
  outline: 2px solid rgba(30,107,184,0.4);
  outline-offset: 3px;
}

/* Primary (Acción principal) */
.btn-primary{
  background-color: #1E6BB8;
  color: #ffffff;
  border-color: #1E6BB8;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.10);
}
.btn-primary:hover{
  background-color: #155290;
  border-color: #155290;
}
.btn-primary:active{
  background-color: #0B2D50;
  border-color: #0B2D50;
}

/* Secondary (Institucional liviano) */
/* Secondary (neutro institucional) */
.btn-secondary{
  background-color: #ffffff;
  color: #667085;
  border-color: #E4E7EC;
  box-shadow: none;
}
.btn-secondary:hover{
  background-color: #F8FAFC;
  border-color: #E4E7EC;
}
.btn-secondary:active{
  background-color: #F1F5F9;
  border-color: #94A3B8;
}



/* Danger */
.btn-danger{
  background-color: #F04438;
  color: #ffffff;
  border-color: #F04438;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.10);
}
.btn-danger:hover{
  background-color: #D92D20;
  border-color: #D92D20;
}
.btn-danger:active{
  background-color: #B42318;
  border-color: #B42318;
}

/* Warning */
.btn-warning{
  background-color: #FACC15;
  color: #0F172A;
  border-color: #EAB308;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08);
}
.btn-warning:hover{
  background-color: #EAB308;
  border-color: #CA8A04;
}
.btn-warning:active{
  background-color: #CA8A04;
  border-color: #A16207;
}

/* Success */
.btn-success{
  background-color: #12B76A;
  color: #ffffff;
  border-color: #12B76A;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.10);
}
.btn-success:hover{
  background-color: #0E9F5A;
  border-color: #0E9F5A;
}
.btn-success:active{
  background-color: #0A7B45;
  border-color: #0A7B45;
}

/* Botón “Agregar criterio” */
.btn-add-criterion{
  border-color: #1E6BB8;
  color: #1E6BB8;
  background: #E8F2FB;
}
.btn-add-criterion:hover{
  background: #D0E5F7;
  border-color: #155290;
}
.btn-add-criterion:active{
  background: #D0E5F7;
  border-color: #155290;
}

/* ===============================
   HEADER DE PROCESO (no sticky)
   =============================== */

.process-header{
  position: relative;
  z-index: 1;
  margin-bottom: 1rem;
  background: #ffffff;
  border: 1px solid #E4E7EC;
  border-radius: 12px;
  box-shadow: 0 1px 10px rgba(15, 23, 42, 0.06);
  padding: 0.6rem 0.75rem;
}

/* Fila stepper + acciones */
.process-header__row{
  display: flex;
  align-items: center;
  gap: 1.0rem;
  flex-wrap: nowrap;          /* desktop: stepper scrollea, botones en la misma fila */
}

/* Acciones derecha */
.process-actions,
.process-header__actions{
  flex: 0 0 auto;
  margin-left: auto;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  flex-wrap: nowrap;
  gap: 0.5rem;
  white-space: nowrap;

  padding-right: 0.25rem;
}

/* En pantallas angostas: wrap para que botones bajen */
@media (max-width: 640px){
  .process-header__row{ flex-wrap: wrap; gap: 0.35rem; }
  .process-actions,
  .process-header__actions{ width: 100%; }
}

/* Acciones de exportación: siempre en columna (apiladas) */
.export-actions{
  display: flex;
  flex-direction: column;
  gap: 0.5rem;

  /* alineado a la derecha del header */
  align-items: stretch;
}

/* Asegura botones “compactos” y sin cortes raros */
.export-actions .btn{
  white-space: nowrap;
}


/* ===============================
   META DEL PROCESO (arriba del stepper)
   =============================== */

.process-meta{
  min-width: 0;
  margin: 0 0 0.35rem 0;
}

.process-meta__name{
  font-size: 0.90rem;
  font-weight: 600;
  color: #0F172A;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.process-meta__ids{
  margin-top: 0.10rem;
  font-size: 0.75rem;
  color: #64748B;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.process-meta__mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.process-meta__sep{
  margin: 0 0.5rem;
  color: #94A3B8;
}
/* ===============================
   STEPPER (geometría estable)
   =============================== */

.stepper{
  /* Sistema único de medidas (evita hardcodes duplicados) */
  --st-node: 1.85rem;        /* diámetro TOTAL del nodo (incluye borde vía border-box) */
  --st-rail: 2px;            /* grosor del rail */
  --st-pad-x: 0.50rem;       /* padding horizontal interno del stepper */
  --st-step: 6.25rem;        /* ancho fijo por etapa (slot) => centros estables */
  --st-gap-x: 0.85rem;       /* separación entre slots */
  --st-label-size: 0.85rem;  /* tamaño del label */
  --st-label-h: 1.05rem;     /* sube el alto para que no se corte */
  --st-label-gap: 0.30rem;   /* separación label ↔ nodo */

  flex: 1 1 auto;
  min-width: 0;

  /* El scroll vive aquí (no en la lista), sin scrollbar visible */
  overflow-x: auto;
  overflow-y: visible;
  scroll-behavior: smooth;

 }

/* Scrollbar: no la ocultes. Aparece SOLO cuando hay overflow real. */
.stepper{
  scrollbar-width: thin;      /* Firefox */
  scrollbar-gutter: stable;   /* evita saltos cuando aparece (si el navegador lo soporta) */
}

/* WebKit (Chrome/Edge/Safari): grosor consistente */
.stepper::-webkit-scrollbar{
  height: 8px;
}

.stepper-list{
  position: relative;
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;

  /* El contenido define su largo real (rail puede abarcar todo el stepper) */
  width: max-content;

  gap: var(--st-gap-x);
  padding: 0 var(--st-pad-x);
  margin: 0;
  list-style: none;
}

/* Rail único: arranca/termina en el centro del primer/último nodo */
.stepper-list::before{
  content: "";
  position: absolute;

  left:  calc(var(--st-pad-x) + (var(--st-step) / 2));
  right: calc(var(--st-pad-x) + (var(--st-step) / 2));

  /* Centro real del nodo */
  top: calc(var(--st-label-h) + var(--st-label-gap) + (var(--st-node) / 2));
  height: var(--st-rail);
  transform: translateY(-50%);

  background: #E4E7EC;
  z-index: 0;
}

.stepper-item{
  position: relative;
  flex: 0 0 var(--st-step);
  scroll-snap-align: start;
}

.stepper-link{
  display: flex;
  width: 100%;
  justify-content: center;
  text-decoration: none;
  color: #0F172A;

  border-radius: 0.85rem;
  position: relative;
  z-index: 1;
}

.stepper-link:focus-visible{
  outline: 2px solid #93C5FD;
  outline-offset: 3px;
}

.stepper-nodewrap{
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--st-label-gap);

  position: relative;
  z-index: 2; /* siempre sobre el rail */
}

/* Label arriba (sin absoluto => no hacks verticales) */
.stepper-toplabel{
  position: static;
  transform: none;

  font-size: var(--st-label-size);
  line-height: 1.1;

  height: var(--st-label-h);
  display: flex;
  align-items: flex-end;
  justify-content: center;

  font-weight: 700;
  color: #334155;

  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  pointer-events: none;
}

.stepper-node{
  box-sizing: border-box; /* clave: el tamaño incluye el borde => centro real estable */
  width: var(--st-node);
  height: var(--st-node);
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-weight: 800;
  font-size: 0.95rem;

  border: 2px solid #E4E7EC;
  background: #FFFFFF; /* SIEMPRE opaco => el rail nunca atraviesa visualmente */
  color: #0F172A;

  position: relative;
  z-index: 3;
  flex: 0 0 auto;
}

/* Estados */
.stepper-item.is-current .stepper-node{
  border-color: #1E6BB8;
  background: #1E6BB8;
  color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(30,107,184,0.2);
}
.stepper-item.is-current .stepper-toplabel{
  color: #1E6BB8;
  font-weight: 600;
}

.stepper-item.is-complete .stepper-node{
  border-color: #12B76A;
  background: #12B76A;
  color: #FFFFFF;
}

.stepper-item.is-disabled .stepper-link{
  pointer-events: none;
  cursor: default;
}

.stepper-item.is-disabled .stepper-toplabel{
  color: #94A3B8;
}

.stepper-item.is-disabled .stepper-node{
  border-color: #E4E7EC;
  background: #FFFFFF;
  color: #98A2B3;
}

/* ===============================
   BOTÓN OUTLINE AZUL (export)
   =============================== */

.btn-outline{
  background: #ffffff;
  color: #1E6BB8;
  border: 1px solid #1E6BB8;
}

.btn-outline:hover{
  background: #E8F2FB;
  border-color: #155290;
}