/* ============================================================================
   SMARTIN JOBS - Organigrama. Arbol con lineas de conexion hechas con bordes:
   sin libreria de dibujo, sin SVG que recalcular al cambiar de tamano.
   ========================================================================== */

#sj-org {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}
#sj-org[hidden] { display: none; }

.sj-org__fondo {
  position: absolute;
  inset: 0;
  background: rgba(14, 26, 44, .55);
  backdrop-filter: blur(2px);
}

.sj-org__panel {
  position: relative;
  width: min(1100px, calc(100vw - 32px));
  height: min(780px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: var(--sj-papel, #fff);
  border: 1px solid var(--sj-linea, #E4DCCF);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(14, 26, 44, .3);
  overflow: hidden;
}
html.dark .sj-org__panel { background: #16243A; border-color: rgba(255,255,255,.12); }

.sj-org__panel > header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--sj-linea, #E4DCCF);
}
html.dark .sj-org__panel > header { border-color: rgba(255,255,255,.1); }
.sj-org__panel h2 {
  margin: 0;
  flex: 1;
  font-family: var(--sj-display, Georgia, serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--sj-tinta, #0E1A2C);
}
html.dark .sj-org__panel h2 { color: #F1ECE2; }

.sj-org__cerrar {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: none; cursor: pointer;
  color: var(--sj-tinta, #0E1A2C);
}
html.dark .sj-org__cerrar { color: #F1ECE2; }
.sj-org__cerrar:hover { background: rgba(14,26,44,.08); }
.sj-org__cerrar svg { width: 18px; height: 18px; }

.sj-org__aviso {
  margin: 0;
  padding: 10px 18px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #6B5E4A;
  background: rgba(220, 180, 63, .10);
  border-bottom: 1px solid var(--sj-linea, #E4DCCF);
}
html.dark .sj-org__aviso { color: #CFC4B0; border-color: rgba(255,255,255,.1); }

.sj-org__aviso-error {
  margin: 0;
  padding: 10px 18px;
  font-size: 13px;
  color: #fff;
  background: var(--sj-rojo, #B3443B);
}
.sj-org__aviso-error[hidden] { display: none; }

.sj-org__cuerpo {
  flex: 1;
  overflow: auto;          /* el arbol crece a lo ancho: que ruede el, no la pagina */
  padding: 26px 18px 34px;
}
.sj-org__nada {
  margin: 40px auto;
  max-width: 420px;
  text-align: center;
  color: #7A7164;
  font-size: 14px;
  line-height: 1.6;
}

/* ---- el arbol ----------------------------------------------------------- */

.sj-org__arbol, .sj-org__hijos {
  display: flex;
  justify-content: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.sj-org__nodo {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 22px;
}
.sj-org__arbol > .sj-org__nodo { padding-top: 0; }

/* Linea vertical de cada hijo hacia su barra horizontal. */
.sj-org__nodo::before {
  content: "";
  position: absolute;
  top: 0;
  width: 1px;
  height: 22px;
  background: var(--sj-linea, #D8CDB8);
}
.sj-org__arbol > .sj-org__nodo::before { display: none; }

/* Barra horizontal que une a los hermanos. */
.sj-org__hijos {
  position: relative;
  margin-top: 22px;
}
.sj-org__hijos::before {
  content: "";
  position: absolute;
  top: -22px;
  left: 0; right: 0;
  height: 1px;
  background: var(--sj-linea, #D8CDB8);
}
/* Un hijo unico no necesita barra: queda una linea recta. */
.sj-org__hijos:has(> .sj-org__nodo:only-child)::before { display: none; }
/* Los extremos de la barra no deben sobresalir del primer y ultimo hijo. */
.sj-org__hijos > .sj-org__nodo:first-child::after,
.sj-org__hijos > .sj-org__nodo:last-child::after {
  content: "";
  position: absolute;
  top: -1px;
  width: 50%;
  height: 1px;
  background: var(--sj-papel, #fff);
}
html.dark .sj-org__hijos > .sj-org__nodo:first-child::after,
html.dark .sj-org__hijos > .sj-org__nodo:last-child::after { background: #16243A; }
.sj-org__hijos > .sj-org__nodo:first-child::after { left: 0; }
.sj-org__hijos > .sj-org__nodo:last-child::after { right: 0; }
.sj-org__hijos > .sj-org__nodo:only-child::after { display: none; }

/* Linea que baja de un padre hacia sus hijos. */
.sj-org__nodo:has(> .sj-org__hijos)::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 1px;
  background: var(--sj-linea, #D8CDB8);
}

/* ---- la caja de cada equipo --------------------------------------------- */

.sj-org__caja {
  width: 232px;
  padding: 13px 14px 11px;
  background: var(--sj-papel, #fff);
  border: 1px solid var(--sj-linea, #E4DCCF);
  border-top: 3px solid var(--sj-azul, #B8862B);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(14,26,44,.05), 0 8px 20px rgba(14,26,44,.07);
}
html.dark .sj-org__caja { background: #1B2C45; border-color: rgba(255,255,255,.12); }

.sj-org__caja h3 {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--sj-tinta, #0E1A2C);
}
html.dark .sj-org__caja h3 { color: #F1ECE2; }

.sj-org__desc {
  margin: 0 0 7px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #83796E;
}

.sj-org__lider {
  margin: 0 0 7px;
  font-size: 12.5px;
  color: var(--sj-tinta, #0E1A2C);
}
html.dark .sj-org__lider { color: #E6DECF; }
.sj-org__lider span {
  display: inline-block;
  margin-right: 5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--sj-azul, #B8862B);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sj-org__gente {
  display: block;
  list-style: disc;
  margin: 0 0 9px;
  padding-left: 15px;
  font-size: 12.5px;
  line-height: 1.65;
  color: #5E5648;
}
html.dark .sj-org__gente { color: #C9BFAE; }
.sj-org__gente i { color: #8C8273; font-style: normal; font-size: 11px; }

.sj-org__vacio {
  margin: 0 0 9px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #8C8273;
}

.sj-org__dep {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #8C8273;
}
.sj-org__dep select {
  width: 100%;
  margin-top: 3px;
  padding: 5px 6px;
  border: 1px solid var(--sj-linea, #E4DCCF);
  border-radius: 5px;
  background: var(--sj-fondo, #F8F5EF);
  color: var(--sj-tinta, #0E1A2C);
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
html.dark .sj-org__dep select {
  background: #13203A; color: #E6DECF; border-color: rgba(255,255,255,.14);
}
.sj-org__dep select:disabled { opacity: .5; }

@media (max-width: 720px) {
  .sj-org__arbol, .sj-org__hijos { flex-direction: column; align-items: center; }
  .sj-org__hijos::before { display: none; }
  .sj-org__caja { width: min(300px, calc(100vw - 70px)); }
}

/* ---- vista por persona --------------------------------------------------
   El arbol responde "quien esta en este equipo"; esta tabla responde la otra
   mitad: "de que es lider esta persona y donde es solo miembro". */

.sj-org__personas {
  max-width: 860px;
  margin: 40px auto 0;
  padding-top: 26px;
  border-top: 1px solid var(--sj-linea, #E4DCCF);
}
html.dark .sj-org__personas { border-color: rgba(255,255,255,.1); }
.sj-org__personas h3 {
  margin: 0 0 12px;
  font-family: var(--sj-display, Georgia, serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--sj-tinta, #0E1A2C);
}
html.dark .sj-org__personas h3 { color: #F1ECE2; }

.sj-org__personas table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sj-org__personas th {
  padding: 6px 10px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #8C8273;
  border-bottom: 1px solid var(--sj-linea, #E4DCCF);
}
.sj-org__personas td {
  padding: 9px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--sj-linea, #EEE7DB);
  color: var(--sj-tinta, #0E1A2C);
}
html.dark .sj-org__personas th,
html.dark .sj-org__personas td { border-color: rgba(255,255,255,.08); }
html.dark .sj-org__personas td { color: #E6DECF; }
.sj-org__personas td span:not(.sj-org__et) {
  display: block;
  font-size: 11px;
  color: #8C8273;
}
.sj-org__personas i { color: #A39A8B; font-style: normal; }

.sj-org__et {
  display: inline-block;
  margin: 1px 3px 1px 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sj-fondo-2, #F1ECE2);
  color: #5E5648;
  font-size: 11.5px;
}
html.dark .sj-org__et { background: rgba(255,255,255,.08); color: #D6CCBA; }
.sj-org__et--lider { background: var(--sj-azul, #B8862B); color: #fff; font-weight: 600; }
