/* RNP-Sys — Topbar global v2 (rediseño 2026-07-18, Claude Design "Centro de
   Control RNP"): 4 grupos por MOMENTO de trabajo con dropdowns, en vez de 12
   botones planos. Mismas URLs de siempre — solo navegación. */
#rnp-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 99990;
  height: 42px; display: flex; align-items: center; gap: 6px;
  padding: 0 12px; box-sizing: border-box;
  background: #0f4a2f;
  background: linear-gradient(180deg, #15603d 0%, #0f4a2f 100%);
  border-bottom: 2px solid #0b3a25;
  font-family: "IBM Plex Sans", "Archivo", -apple-system, sans-serif;
  font-size: 12.5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
#rnp-topbar a { text-decoration: none; }

/* marca → /rrhh */
#rnp-topbar .rnp-tb-brand {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 4px 10px 4px 5px; border-radius: 8px;
  background: rgba(255, 255, 255, .16); color: #fff;
}
#rnp-topbar .rnp-tb-brand:hover { background: rgba(255, 255, 255, .26); }
#rnp-topbar .rnp-tb-brand.activo { background: rgba(255, 255, 255, .30); }
#rnp-topbar .rnp-tb-brand .tile {
  width: 24px; height: 24px; border-radius: 7px; background: #fff; color: #15603d;
  display: grid; place-items: center; font: 700 13px "Archivo", sans-serif;
}
#rnp-topbar .rnp-tb-brand .nom { font: 700 13px "Archivo", sans-serif; letter-spacing: .01em; }

/* grupos */
#rnp-topbar .rnp-tb-grupos { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
#rnp-topbar .rnp-tb-grupo { position: relative; height: 42px; display: flex; align-items: center; }
#rnp-topbar .rnp-tb-grupo > button {
  display: inline-flex; align-items: center; gap: 5px; height: 30px;
  padding: 0 11px; border: none; border-radius: 8px; background: transparent;
  color: #d7e8de; font: 600 12.5px "IBM Plex Sans", sans-serif; cursor: pointer;
  white-space: nowrap;
}
#rnp-topbar .rnp-tb-grupo > button .caret { font-size: 8px; opacity: .7; }
#rnp-topbar .rnp-tb-grupo > button:hover { background: rgba(255, 255, 255, .13); color: #fff; }
#rnp-topbar .rnp-tb-grupo.activo > button { background: rgba(255, 255, 255, .22); color: #fff; box-shadow: inset 0 -2px 0 #7fe0a8; }
#rnp-topbar .rnp-tb-grupo.abierto > button { background: rgba(255, 255, 255, .22); color: #fff; }

/* dropdown */
#rnp-topbar .rnp-tb-dd {
  display: none; position: absolute; top: 44px; left: 0; min-width: 236px;
  background: #fff; border: 1px solid #dbe5df; border-radius: 12px;
  box-shadow: 0 14px 34px rgba(11, 42, 28, .18); padding: 6px; z-index: 99995;
}
#rnp-topbar .rnp-tb-grupo.abierto .rnp-tb-dd { display: block; }
#rnp-topbar .rnp-tb-dd .dd-titulo {
  font: 600 9.5px "IBM Plex Mono", monospace; letter-spacing: .08em;
  text-transform: uppercase; color: #8aa295; padding: 7px 10px 4px;
}
#rnp-topbar .rnp-tb-dd a {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: 8px; color: #16241c; font: 500 13px "IBM Plex Sans", sans-serif;
  white-space: nowrap;
}
#rnp-topbar .rnp-tb-dd a:hover { background: #eef5f1; color: #0e4a2e; }
#rnp-topbar .rnp-tb-dd a.activo { background: #e8f5ef; color: #0e4a2e; font-weight: 600; }
#rnp-topbar .rnp-tb-dd a .ic { width: 18px; text-align: center; }
#rnp-topbar .rnp-tb-dd a.tenue { color: #5c6b62; }
#rnp-topbar .rnp-tb-dd .dd-sep { height: 1px; background: #eef1ee; margin: 5px 8px; }

/* derecha */
#rnp-topbar .rnp-tb-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#rnp-topbar .rnp-tb-user { color: #9fc4b0; font: 500 11.5px "IBM Plex Mono", monospace; }
#rnp-topbar .rnp-tb-right a {
  color: #d7e8de; padding: 5px 9px; border-radius: 7px; font-weight: 600;
}
#rnp-topbar .rnp-tb-right a:hover { background: rgba(255, 255, 255, .13); color: #fff; }
#rnp-topbar #rnp-tb-salir { color: #ffd7d0; }
#rnp-topbar #rnp-tb-salir:hover { background: rgba(197, 48, 48, .35); color: #fff; }

/* toggle de la sub-barra de accesos (vive en la barra principal → colapsada
   la sub-barra cuesta 0px, sin franja residual) */
#rnp-topbar #rnp-tb-sub-toggle {
  border: none; background: transparent; color: #9fc4b0; cursor: pointer;
  width: 28px; height: 28px; border-radius: 7px; font-size: 13px; line-height: 1;
}
#rnp-topbar #rnp-tb-sub-toggle:hover { background: rgba(255, 255, 255, .13); color: #fff; }
#rnp-topbar #rnp-tb-sub-toggle.on { background: rgba(255, 255, 255, .18); color: #fff; }

/* ── Sub-barra de ACCESOS (Claude Design 1d/2a) ── */
#rnp-tb-sub {
  position: fixed; top: 42px; left: 0; right: 0; z-index: 99989;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px; box-sizing: border-box;
  background: #0b3a25; border-bottom: 2px solid #082b1c;
  overflow-x: auto; scrollbar-width: none;
  font-family: "IBM Plex Sans", -apple-system, sans-serif;
}
#rnp-tb-sub::-webkit-scrollbar { display: none; }
#rnp-tb-sub .sub-lbl {
  flex: none; font: 600 9px "IBM Plex Mono", monospace;
  letter-spacing: .09em; text-transform: uppercase; color: #6fae8c;
  padding-right: 4px;
}
#rnp-tb-sub .chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 20px;
  background: rgba(255, 255, 255, .08); color: #dcefe4;
  font: 600 12px "IBM Plex Sans", sans-serif; text-decoration: none;
  white-space: nowrap; transition: background .15s, color .15s;
}
#rnp-tb-sub .chip:hover { background: rgba(255, 255, 255, .2); color: #fff; }
#rnp-tb-sub .chip .ic { font-size: 13px; }
#rnp-tb-sub .chip.activo {
  background: #eaf7ef; color: #0b3a25;
  box-shadow: inset 0 0 0 1px #7fe0a8;
}
#rnp-tb-sub .chip.activo:hover { background: #fff; color: #0b3a25; }

/* ── 🤖 FAB Intelligence A.I — siempre presente, ARRASTRABLE a cualquier
   parte (pedido Julio 2026-07-19: chocaba con "➕ Registrar novedad" en
   la misma esquina). Posición default = esquina inferior derecha; el JS
   la reemplaza por left/top en cuanto se arrastra (persistida). ── */
#rnp-ia-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 99985;
  display: inline-flex; align-items: center; height: 50px; padding: 0 13px;
  border-radius: 999px;
  background: linear-gradient(180deg, #15603d, #0f4a2f); color: #fff;
  box-shadow: 0 6px 20px rgba(11, 58, 37, .45);
  text-decoration: none;
  cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none;
  transition: transform .18s, box-shadow .18s;
}
#rnp-ia-fab .ia-ic { font-size: 24px; line-height: 1; }
#rnp-ia-fab .ia-lbl {
  max-width: 0; overflow: hidden; white-space: nowrap;
  font: 600 13px "IBM Plex Sans", -apple-system, sans-serif;
  transition: max-width .25s ease, margin-left .25s ease;
}
#rnp-ia-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(11, 58, 37, .55);
}
#rnp-ia-fab:hover .ia-lbl { max-width: 150px; margin-left: 8px; }
#rnp-ia-fab::before {
  content: ""; position: absolute; inset: 0; border-radius: 999px;
  animation: rnpIaPulse 4s ease-out infinite; pointer-events: none;
}
@keyframes rnpIaPulse {
  0%   { box-shadow: 0 0 0 0 rgba(45, 174, 109, .40); }
  55%  { box-shadow: 0 0 0 13px rgba(45, 174, 109, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 174, 109, 0); }
}
@media (prefers-reduced-motion: reduce) { #rnp-ia-fab::before { animation: none; } }

/* ── Panel de chat del FAB (iframe /copiloto?embed=1) ── */
#rnp-ia-panel {
  display: none; position: fixed; z-index: 99986;
  background: #fff; border: 1px solid #dbe5df; border-radius: 16px;
  box-shadow: 0 18px 50px rgba(11, 42, 28, .3);
  flex-direction: column; overflow: hidden;
}
#rnp-ia-panel.abierto { display: flex; }
#rnp-ia-panel .ia-head {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #15603d, #0f4a2f); color: #fff;
  padding: 10px 14px; font: 600 13.5px "Archivo", "IBM Plex Sans", sans-serif;
}
#rnp-ia-panel .ia-acts { display: inline-flex; align-items: center; }
#rnp-ia-panel .ia-hbtn {
  background: rgba(255, 255, 255, .15); border: none; color: #e8f5ef;
  cursor: pointer; width: 26px; height: 26px; border-radius: 7px;
  font-size: 13px; text-decoration: none;
  display: inline-grid; place-items: center; margin-left: 6px;
}
#rnp-ia-panel .ia-hbtn:hover { background: rgba(255, 255, 255, .3); color: #fff; }
#rnp-ia-frame { flex: 1; border: 0; width: 100%; }

/* /rrhh tenía su propia burbuja de chat (cc-chat-fab) — con el FAB global
   arrastrable quedaban DOS robots (reporte Julio): fuera el duplicado, el
   FAB global abre el MISMO chat en cualquier página */
#cc-chat-fab, #cc-chat-panel { display: none !important; }
/* mientras se arrastra: sin transiciones que "persigan" al mouse, sin
   pulso, sin expandir la etiqueta — feedback inmediato y quieto */
#rnp-ia-fab.arrastrando {
  cursor: grabbing;
  transition: none;
  transform: scale(1.06);
  box-shadow: 0 14px 34px rgba(11, 58, 37, .5);
}
#rnp-ia-fab.arrastrando::before { animation: none; }
#rnp-ia-fab.arrastrando .ia-lbl { max-width: 0 !important; margin-left: 0 !important; }

/* Corrimiento del contenido: la barra no tapa nada (altura VARIABLE:
   42px + sub-barra si está abierta — el JS publica --rnp-tb-alto) */
html.rnp-con-topbar body { padding-top: var(--rnp-tb-alto, 42px) !important; }
html.rnp-con-topbar .ga-sidebar,
html.rnp-con-topbar .md-topbar,
html.rnp-con-topbar .ch-topbar { top: var(--rnp-tb-alto, 42px); }
html.rnp-con-topbar .ga-sidebar { height: calc(100vh - var(--rnp-tb-alto, 42px)); }

@media (max-width: 760px) {
  #rnp-topbar .rnp-tb-user { display: none; }
  #rnp-topbar .rnp-tb-brand .nom { display: none; }
  #rnp-topbar .rnp-tb-grupo > button { padding: 0 8px; }
}
@media (max-width: 640px) {
  #rnp-tb-sub { display: none !important; }   /* móvil: la topbar compacta manda */
  #rnp-topbar #rnp-tb-sub-toggle { display: none; }
}

/* /rrhh bajo la barra global: su header scrollea normal */
html.rnp-con-topbar .cc-topbar {
  position: static !important; top: auto !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
html.rnp-con-topbar .cc-salir { display: none !important; }
