/* Barra superior canónica de BÜRO-TEC: componente compartido y aislado. */
.legacy-topbar[data-app-topbar] {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 0 22px;
  color: #fff;
  background: linear-gradient(125deg, #168cf5 0%, #4036df 56%, #7438df 100%);
  border-bottom: 4px solid #26c8f5;
  box-shadow: 0 4px 15px rgba(51, 49, 196, .16);
  box-sizing: border-box;
  font-family: 'Burotec Sans', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.legacy-topbar[data-app-topbar] .legacy-brand {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.legacy-topbar[data-app-topbar] .legacy-brand > .burotec-monogram,
.legacy-topbar[data-app-topbar] .legacy-brand > strong {
  font-family: 'Burotec Inter', Inter, ui-sans-serif, sans-serif;
  font-weight: 700;
}

.legacy-topbar[data-app-topbar] .burotec-monogram {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8e9ff;
  border-radius: 10px;
  color: #1687f2;
  background: #fff;
  box-shadow: 0 5px 12px rgba(22, 135, 242, .2);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1;
  white-space: nowrap;
}

.legacy-topbar[data-app-topbar] .legacy-brand > strong {
  font-size: 20px;
  letter-spacing: .02em;
}

.legacy-topbar[data-app-topbar] .legacy-brand > small {
  color: rgba(255, 255, 255, .82);
  font-size: 12px;
}

.legacy-topbar[data-app-topbar] .legacy-nav {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.legacy-topbar[data-app-topbar] .legacy-nav > button:not([data-app-topbar-close]),
.legacy-topbar[data-app-topbar] .legacy-nav > a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border: 0;
  border-radius: 7px;
  color: rgba(255, 255, 255, .94);
  background: transparent;
  font: 650 15px/1.2 'Burotec Sans', ui-sans-serif, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
}

.legacy-topbar[data-app-topbar] .legacy-nav > button:not([data-app-topbar-close]):hover,
.legacy-topbar[data-app-topbar] .legacy-nav > a:hover,
.legacy-topbar[data-app-topbar] .legacy-nav > .is-active {
  background: rgba(255, 255, 255, .13);
}

.legacy-topbar[data-app-topbar] .legacy-nav .app-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-mobile-controls,
.legacy-topbar[data-app-topbar] .legacy-mobile-menu-toggle,
.legacy-topbar[data-app-topbar] .legacy-mobile-menu-backdrop,
.legacy-topbar[data-app-topbar] .legacy-mobile-nav-header {
  display: none;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-professional-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-professional-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 3px 10px 3px 5px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 12px;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  cursor: pointer;
  font: inherit;
  transition: all .15s ease;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-professional-btn:hover,
.legacy-topbar[data-app-topbar] .legacy-topbar-professional-btn.is-active {
  border-color: rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .24);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}

.legacy-topbar[data-app-topbar] .legacy-topbar-avatar-squircle {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  flex-shrink: 0;
  border-radius: 10px;
  color: #4338ca;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-name {
  max-width: 150px;
  overflow: hidden;
  color: #fff;
  font-size: 13.5px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-role {
  color: rgba(255, 255, 255, .82);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.legacy-topbar[data-app-topbar] .smart-select,
.legacy-topbar[data-app-topbar] select.sr-only {
  display: none !important;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-chevron {
  width: 14px;
  height: 14px;
  color: #fff;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  opacity: .95;
  transition: transform .2s ease;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-professional-btn.is-active .legacy-topbar-prof-chevron {
  transform: rotate(180deg);
}

.legacy-topbar[data-app-topbar] .legacy-brand {
  display: flex;
  min-width: max-content;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.legacy-topbar[data-app-topbar] .legacy-nav {
  display: flex;
  min-width: 0;
  flex: 0 1 auto;
  margin-left: auto;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-professional-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 90px;
  z-index: 95;
  display: flex;
  width: 280px;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  color: #1e293b;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .16);
  box-sizing: border-box;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-header {
  margin-bottom: 4px;
  padding: 8px 10px 6px;
  border-bottom: 1px solid #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  color: #1e293b;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
  text-decoration: none;
  transition: all .15s ease;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-item:hover {
  background: #f8fafc;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-item.is-selected {
  color: #4338ca;
  background: #eef2ff;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-squircle {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  flex-shrink: 0;
  border-radius: 9px;
  color: #475569;
  background: #e2e8f0;
  font-size: 12px;
  font-weight: 800;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-item.is-selected .legacy-topbar-prof-squircle {
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-meta strong {
  display: block;
  font-size: 13.5px;
  font-weight: 750;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-meta span {
  color: #64748b;
  font-size: 11.5px;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-check {
  width: 16px;
  height: 16px;
  color: #4f46e5;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-footer {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #4f46e5;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s ease;
}

.legacy-topbar[data-app-topbar] .legacy-topbar-prof-footer a:hover {
  background: #eef2ff;
}

@media (max-width: 1440px) and (min-width: 1301px) {
  .legacy-topbar[data-app-topbar] { gap: 10px; padding-inline: 14px; }
  .legacy-topbar[data-app-topbar] .legacy-brand > small,
  .legacy-topbar[data-app-topbar] .plan-preview-control { display: none; }
  .legacy-topbar[data-app-topbar] .legacy-nav > button:not([data-app-topbar-close]),
  .legacy-topbar[data-app-topbar] .legacy-nav > a { padding-inline: 6px; font-size: 13px; gap: 4px; }
  .legacy-topbar[data-app-topbar] .legacy-topbar-prof-name { max-width: 100px; }
}

@media (max-width: 1300px) {
  body.legacy-mobile-menu-open { overflow: hidden; }

  body .legacy-topbar[data-app-topbar] {
    min-height: 68px;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    overflow: visible;
  }

  .legacy-topbar[data-app-topbar] .legacy-brand > small,
  .legacy-topbar[data-app-topbar] .plan-preview-control { display: none; }

  .legacy-topbar[data-app-topbar] .legacy-brand > strong { font-size: 18px; }

  .legacy-topbar[data-app-topbar] .legacy-topbar-mobile-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .legacy-topbar[data-app-topbar] .legacy-topbar-professional-mobile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .legacy-topbar[data-app-topbar] .legacy-topbar-professional-mobile-btn .legacy-topbar-avatar-squircle {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .legacy-topbar[data-app-topbar] .legacy-topbar-professional-wrapper {
    display: none;
  }

  .legacy-topbar[data-app-topbar] .legacy-topbar-professional-dropdown {
    position: fixed;
    top: 74px;
    right: 12px;
    width: min(92vw, 300px);
  }

  .legacy-topbar[data-app-topbar] .legacy-mobile-menu-toggle {
    display: inline-flex;
    min-width: 92px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 14px;
    color: #fff;
    background: rgba(255, 255, 255, .13);
    box-shadow: inset 0 1px rgba(255, 255, 255, .18);
    font: 750 14px/1 'Burotec Sans', ui-sans-serif, sans-serif;
    cursor: pointer;
  }

  .legacy-topbar[data-app-topbar] .legacy-mobile-menu-toggle .app-icon {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
  }

  body .legacy-topbar[data-app-topbar] .legacy-nav {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 83;
    display: flex;
    width: min(88vw, 380px);
    min-width: 0;
    max-height: 100dvh;
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    gap: 7px;
    overflow-y: auto;
    padding: max(18px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
    border-radius: 28px 0 0 28px;
    color: #273b56;
    background: linear-gradient(180deg, #fff 0%, #f4f8ff 100%);
    box-shadow: -24px 0 70px rgba(15, 30, 76, .24);
    transform: translateX(108%);
    visibility: hidden;
    transition: transform .28s cubic-bezier(.22, 1, .36, 1), visibility .28s;
    overscroll-behavior: contain;
    box-sizing: border-box;
  }

  body .legacy-topbar[data-app-topbar] .legacy-nav.is-mobile-open {
    transform: translateX(0);
    visibility: visible;
  }

  .legacy-topbar[data-app-topbar] .legacy-mobile-nav-header {
    display: flex;
    min-height: 70px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
    padding: 7px 4px 14px 10px;
    border-bottom: 1px solid #dce6f5;
  }

  .legacy-topbar[data-app-topbar] .legacy-mobile-nav-header > div {
    display: grid;
    gap: 4px;
  }

  .legacy-topbar[data-app-topbar] .legacy-mobile-nav-header small {
    color: #5574a0;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .12em;
  }

  .legacy-topbar[data-app-topbar] .legacy-mobile-nav-header strong {
    color: #253a58;
    font-size: 21px;
  }

  .legacy-topbar[data-app-topbar] .legacy-mobile-nav-header > button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    padding: 0;
    border: 1px solid #d8e3f2;
    border-radius: 14px;
    color: #526b8c;
    background: #f7faff;
    cursor: pointer;
  }

  .legacy-topbar[data-app-topbar] .legacy-mobile-nav-header > button .app-icon {
    width: 20px;
    height: 20px;
  }

  body .legacy-topbar[data-app-topbar] .legacy-nav > button:not([data-app-topbar-close]),
  body .legacy-topbar[data-app-topbar] .legacy-nav > a {
    display: flex;
    width: 100%;
    min-height: 54px;
    flex: 0 0 auto;
    justify-content: flex-start;
    gap: 13px;
    padding: 9px 13px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: #3d5473;
    background: transparent;
    font-size: 15px;
    text-align: left;
  }

  body .legacy-topbar[data-app-topbar] .legacy-nav > button:not([data-app-topbar-close]) .app-icon,
  body .legacy-topbar[data-app-topbar] .legacy-nav > a .app-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    padding: 9px;
    border-radius: 12px;
    color: #3e6ecf;
    background: #eaf1ff;
    box-sizing: border-box;
  }

  body .legacy-topbar[data-app-topbar] .legacy-nav > button:not([data-app-topbar-close]):hover,
  body .legacy-topbar[data-app-topbar] .legacy-nav > a:hover {
    border-color: #dbe6f7;
    background: #f4f8ff;
  }

  body .legacy-topbar[data-app-topbar] .legacy-nav > .is-active {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(115deg, #2388ef 0%, #5144df 72%, #7145db 100%);
    box-shadow: 0 10px 22px rgba(65, 76, 208, .24);
  }

  body .legacy-topbar[data-app-topbar] .legacy-nav > .is-active .app-icon {
    color: #fff;
    background: rgba(255, 255, 255, .16);
  }

  .legacy-topbar[data-app-topbar] .legacy-mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 82;
    display: block;
    padding: 0;
    border: 0;
    background: rgba(16, 25, 63, .5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    backdrop-filter: blur(5px);
    transition: opacity .22s ease, visibility .22s;
  }

  .legacy-topbar[data-app-topbar] .legacy-mobile-menu-backdrop.is-mobile-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  body .legacy-topbar[data-app-topbar] .legacy-nav,
  .legacy-topbar[data-app-topbar] .legacy-mobile-menu-backdrop { transition: none; }
}
