/* SesionaDesk · parche de barra superior
   Archivo independiente para evitar modificar styles.css.
*/
.topbar.topbar-enhanced {
  position: sticky;
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(260px, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 78px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid #dbe6ee;
  box-shadow: 0 1px 0 rgba(9, 60, 105, 0.03);
  z-index: 40;
}

.topbar-enhanced .menu-button {
  display: none;
}

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

.topbar-context-path {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6e8294;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-context-path span:last-child {
  color: #0d9f9c;
}

.topbar-context h1 {
  margin: 0;
  overflow: hidden;
  color: #073f78;
  font-family: inherit;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-search {
  position: relative;
  justify-self: center;
  width: min(100%, 560px);
}

.topbar-search-shell {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 44px;
  overflow: hidden;
  background: #f7fafc;
  border: 1px solid #d5e2eb;
  border-radius: 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.topbar-search-shell:focus-within {
  background: #fff;
  border-color: #18b8b3;
  box-shadow: 0 0 0 3px rgba(24, 184, 179, 0.12);
}

.topbar-search-shell #quick-search {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #174f7f;
}

.topbar-search-shell #quick-search:hover {
  background: rgba(13, 159, 156, 0.08);
}

.topbar-search-shell svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

#global-search {
  min-width: 0;
  height: 42px;
  padding: 0 8px 0 0;
  color: #123d64;
  font: inherit;
  font-size: 13px;
  border: 0;
  outline: 0;
  background: transparent;
}

#global-search::placeholder {
  color: #8799a8;
}

.topbar-search-shortcut {
  margin-right: 10px;
  padding: 3px 7px;
  color: #718697;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  background: #fff;
  border: 1px solid #dbe5ec;
  border-radius: 6px;
  box-shadow: 0 1px 1px rgba(7, 63, 120, 0.03);
}

.global-search-results {
  position: absolute;
  top: calc(100% + 9px);
  left: 0;
  right: 0;
  max-height: min(560px, calc(100vh - 120px));
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d5e2eb;
  border-radius: 15px;
  box-shadow: 0 20px 55px rgba(8, 48, 82, 0.2);
  z-index: 120;
}

.global-search-results[hidden] {
  display: none;
}

.global-search-result {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 13px;
  color: #153f63;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #edf2f5;
  background: #fff;
  cursor: pointer;
}

.global-search-result:hover,
.global-search-result.is-active {
  background: #edf9f8;
}

.global-search-result:focus-visible {
  position: relative;
  outline: 2px solid #18b8b3;
  outline-offset: -2px;
}

.global-search-result-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #087d7a;
  background: #e5f7f6;
  border-radius: 10px;
}

.global-search-result-icon svg {
  width: 18px;
  height: 18px;
}

.global-search-result > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.global-search-result small {
  color: #0c8e8a;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.global-search-result strong,
.global-search-result em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-result strong {
  font-size: 13px;
}

.global-search-result em {
  color: #718596;
  font-size: 11px;
  font-style: normal;
}

.global-search-result > b {
  color: #6e8798;
  font-size: 20px;
}

.global-search-empty {
  padding: 22px 18px;
  text-align: center;
}

.global-search-empty strong {
  display: block;
  margin-bottom: 4px;
  color: #123f67;
  font-size: 14px;
}

.global-search-empty p,
.global-search-results footer {
  margin: 0;
  color: #718596;
  font-size: 11px;
}

.global-search-results footer {
  padding: 9px 13px;
  background: #f8fafb;
  border-top: 1px solid #e7eef3;
}

.is-global-search-target {
  outline: 3px solid rgba(24, 184, 179, 0.3);
  outline-offset: 4px;
  border-radius: 12px;
  transition: outline-color 300ms ease;
}

.topbar-enhanced .topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-width: max-content;
}

.topbar-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 15px;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid #073f78;
  border-radius: 11px;
  background: #073f78;
  box-shadow: 0 5px 14px rgba(7, 63, 120, 0.14);
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.topbar-primary-action:hover {
  background: #0b4e91;
  box-shadow: 0 7px 18px rgba(7, 63, 120, 0.2);
  transform: translateY(-1px);
}

.topbar-primary-action:active {
  transform: translateY(0);
}

.topbar-primary-action svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}

.topbar-tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: #174f7f;
  border: 1px solid #d5e2eb;
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.topbar-tool:hover {
  color: #073f78;
  border-color: #afc7d8;
  background: #f5fafc;
}

.topbar-tool[aria-pressed="true"] {
  color: #006e6b;
  border-color: #65cbc7;
  background: #eaf9f8;
}

.topbar-tool svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
}

.topbar-notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  background: #d44747;
  border: 2px solid #fff;
  border-radius: 999px;
}

.topbar-notification-badge[hidden] {
  display: none;
}

.topbar-enhanced .connection-pill {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-popover {
  position: absolute;
  top: calc(100% + 13px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  overflow: hidden;
  background: #fff;
  border: 1px solid #d7e3eb;
  border-radius: 15px;
  box-shadow: 0 18px 50px rgba(10, 48, 82, 0.18);
  z-index: 80;
}

.topbar-popover[hidden] {
  display: none;
}

.topbar-popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 17px 13px;
  border-bottom: 1px solid #e7eef3;
}

.topbar-popover-header strong {
  display: block;
  color: #073f78;
  font-size: 14px;
}

.topbar-popover-header small {
  display: block;
  margin-top: 2px;
  color: #708494;
  font-size: 11px;
}

.topbar-popover-close {
  width: 29px;
  height: 29px;
  color: #567084;
  font-size: 20px;
  line-height: 1;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.topbar-popover-close:hover {
  background: #f0f5f8;
}

.topbar-notification-list {
  display: grid;
  max-height: 330px;
  overflow: auto;
  padding: 7px;
}

.topbar-notification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 10px;
  color: #163f61;
  text-align: left;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.topbar-notification-item:hover {
  background: #f2f8fa;
}

.topbar-notification-item span {
  min-width: 0;
}

.topbar-notification-item strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-notification-item small {
  display: block;
  margin-top: 2px;
  color: #738696;
  font-size: 10px;
}

.topbar-notification-item b {
  min-width: 25px;
  padding: 4px 7px;
  color: #fff;
  font-size: 10px;
  text-align: center;
  background: #086aa8;
  border-radius: 999px;
}

.topbar-notification-empty {
  padding: 28px 18px;
  color: #6f8393;
  font-size: 12px;
  text-align: center;
}

.topbar-popover-footer {
  padding: 9px;
  border-top: 1px solid #e7eef3;
}

.topbar-popover-footer button {
  width: 100%;
  padding: 9px 10px;
  color: #075d95;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  border: 0;
  border-radius: 9px;
  background: #eef7fa;
  cursor: pointer;
}

.topbar-popover-footer button:hover {
  background: #e4f2f6;
}

/* Modo privacidad: los nombres (data-privacy="identity") se difuminan
   visualmente con blur, sin cambiar ni reemplazar el texto real - nunca
   se muestra un nombre ficticio. El resto de las categorías se sustituye
   por un texto neutro fijo directamente en el DOM (ver
   topbar-enhancements.js). En ningún caso se aplica blur a tarjetas,
   filas ni secciones completas, ni se bloquea la pantalla: el resto de
   la interfaz permanece operable. */
body.privacy-mode [data-privacy]:not([data-privacy="identity"]) {
  font-style: italic;
}

body.privacy-mode .privacy-blur {
  filter: blur(5px);
  user-select: none;
}

body.privacy-mode::after {
  content: "Modo privacidad activo";
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 7px 11px;
  color: #005f5c;
  font-size: 11px;
  font-weight: 800;
  background: #e9faf8;
  border: 1px solid #77d4cf;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 92, 88, 0.12);
  z-index: 200;
  pointer-events: none;
}

@media (max-width: 1220px) {
  .topbar.topbar-enhanced {
    grid-template-columns: minmax(130px, 175px) minmax(220px, 1fr) auto;
    gap: 12px;
    padding-inline: 20px;
  }

  .topbar-enhanced .connection-pill {
    display: none;
  }

  .topbar-primary-action {
    padding-inline: 12px;
  }
}

@media (max-width: 900px) {
  .topbar.topbar-enhanced {
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .topbar-enhanced .menu-button {
    display: inline-flex;
    grid-column: 1;
    grid-row: 1;
  }

  .topbar-context {
    display: none;
  }

  .topbar-search {
    grid-column: 2;
  }

  .topbar-enhanced .topbar-actions {
    grid-column: 3;
  }

  .new-session-label {
    display: none;
  }

  .topbar-primary-action {
    width: 42px;
    padding: 0;
  }
}

/* Keep the menu trigger completely out of the desktop/tablet header while the
   persistent sidebar is still present. This also prevents its rounded border
   from peeking through at the sidebar edge. */
@media (min-width: 761px) and (max-width: 900px) {
  .topbar.topbar-enhanced {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .topbar-enhanced .menu-button {
    display: none;
  }

  .topbar-search {
    grid-column: 1;
  }

  .topbar-enhanced .topbar-actions {
    grid-column: 2;
  }
}

@media (max-width: 620px) {
  .topbar.topbar-enhanced {
    gap: 7px;
    min-height: 66px;
    padding: 9px 11px;
  }

  .topbar-search {
    width: 44px;
    justify-self: end;
  }

  .topbar-search-shell {
    display: block;
    width: 44px;
    min-height: 42px;
    border-radius: 11px;
  }

  #global-search,
  .topbar-search-shortcut {
    display: none;
  }

  .topbar-search.is-open {
    position: absolute;
    left: 62px;
    right: 10px;
    width: auto;
    z-index: 130;
  }

  .topbar-search.is-open .topbar-search-shell {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    width: 100%;
    background: #fff;
    box-shadow: 0 10px 28px rgba(8, 48, 82, 0.18);
  }

  .topbar-search.is-open #global-search {
    display: block;
    padding-right: 10px;
  }

  .topbar-search.is-open .global-search-results {
    position: fixed;
    top: 108px;
    left: 10px;
    right: 10px;
    max-height: calc(100vh - 128px);
  }

  .topbar-enhanced .topbar-actions {
    gap: 6px;
  }

  #privacy-toggle {
    display: none;
  }
}

/* FIX: eliminar banda vacía sobre el topbar */
.workspace {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.workspace > .topbar.topbar-enhanced {
  margin-top: 0 !important;
}

.topbar.topbar-enhanced {
  margin-top: 0 !important;
}

/* FIX EXTRA: si el espacio lo genera el contenedor superior */
.app-shell .workspace,
.workspace {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.app-shell .workspace > header.topbar.topbar-enhanced {
  margin-top: 0 !important;
}


/* SESIONADESK TOPBAR POSITION FIX START */
.topbar.topbar-enhanced {
  position: sticky !important;
}
/* SESIONADESK TOPBAR POSITION FIX END */

/* FIX: título completo del topbar en una sola línea */
@media (min-width: 901px) {
  .topbar.topbar-enhanced {
    grid-template-columns:
      max-content
      minmax(260px, 1fr)
      auto !important;
    column-gap: 24px !important;
  }

  .topbar-context {
    width: max-content !important;
    min-width: max-content !important;
    max-width: none !important;
  }

  .topbar-context h1 {
    display: block !important;
    width: max-content !important;
    min-width: max-content !important;
    max-width: none !important;

    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;

    font-size: 17px !important;
    line-height: 1.2 !important;

    -webkit-line-clamp: unset !important;
    -webkit-box-orient: initial !important;
  }

  .topbar-search {
    width: min(100%, 560px) !important;
    min-width: 220px;
  }
}

/* Ajuste para pantallas medianas */
@media (min-width: 901px) and (max-width: 1250px) {
  .topbar.topbar-enhanced {
    grid-template-columns:
      max-content
      minmax(200px, 1fr)
      auto !important;
    column-gap: 14px !important;
  }

  .topbar-context-path {
    display: none !important;
  }

  .topbar-context h1 {
    font-size: 15px !important;
  }

  .topbar-search {
    max-width: 400px !important;
  }
}
