/* Organization-first shell: contextual navigation and executive header. */

.company-context-hidden,
.context-group-hidden {
  display: none !important;
}

#organizationContextBar {
  display: none !important;
}

.premium-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 86px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(17, 24, 39, .08);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 26px rgba(15, 23, 42, .07);
  backdrop-filter: blur(18px);
}

.premium-header-entity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.premium-header-logo {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  flex: 0 0 48px;
}

.premium-header-logo .logo-circle.md {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(17, 24, 39, .09);
  background: #fff;
  box-shadow: 0 8px 22px rgba(17, 24, 39, .11);
}

.header-logo-fallback {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-secondary, #171717);
  color: var(--brand-primary, #f2d200);
  font-weight: 800;
  letter-spacing: .04em;
}

.premium-header-copy {
  min-width: 0;
}

.premium-header-copy > span {
  display: block;
  margin-bottom: 3px;
  color: #7a8494;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.premium-header-copy > strong {
  display: block;
  max-width: min(48vw, 680px);
  overflow: hidden;
  color: #171a21;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.premium-header-copy > small {
  display: block;
  max-width: min(48vw, 680px);
  margin-top: 4px;
  overflow: hidden;
  color: #687284;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.premium-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.premium-company-switch {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid color-mix(in srgb, var(--brand-primary, #f2d200) 48%, #d9dde4);
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand-primary, #f2d200) 11%, #fff);
  color: #1b1f27;
  font-size: 12px;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.premium-company-switch:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--brand-primary, #f2d200) 18%, #fff);
  box-shadow: 0 8px 20px rgba(17, 24, 39, .08);
}

.premium-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  padding: 8px 12px 8px 8px;
  border: 1px solid #e4e8ee;
  border-radius: 14px;
  background: #f8f9fb;
}

.premium-user-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  flex: 0 0 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--brand-secondary, #171717), #303744);
  color: var(--brand-primary, #f2d200);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(17, 24, 39, .18);
}

.premium-user-copy {
  min-width: 0;
}

.premium-user-copy strong,
.premium-user-copy small {
  display: block;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.premium-user-copy strong {
  color: #1c2028;
  font-size: 12px;
  font-weight: 800;
}

.premium-user-copy small {
  margin-top: 2px;
  color: #778192;
  font-size: 10px;
}

.legacy-context-controls {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.organization-only-context .sidebar .nav-menu::after {
  display: block;
  margin: 24px 18px 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
  color: rgba(255,255,255,.56);
  content: 'Selecciona una empresa para habilitar Dashboard, Operación, Reportes y Auditoría.';
  font-size: 11px;
  line-height: 1.6;
}

.has-company-context .sidebar .nav-menu::after {
  display: none;
}

.organization-quick-action[data-org-go-section="dashboard"] {
  display: none !important;
}

.organization-only-context #operationalChrome {
  display: none !important;
}

.organization-only-context .nav-item[data-section="organizacion"] {
  border-left-color: var(--brand-primary, #f2d200);
}

.organization-only-context .nav-item[data-section="organizacion"] .nav-icon {
  color: var(--brand-primary, #f2d200);
}

@media (max-width: 1180px) {
  .premium-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .premium-topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .premium-header-copy > strong,
  .premium-header-copy > small {
    max-width: 75vw;
  }
}

@media (max-width: 760px) {
  .premium-topbar {
    position: relative;
    min-height: auto;
    padding: 12px;
  }

  .premium-header-entity {
    width: 100%;
  }

  .premium-header-copy > strong,
  .premium-header-copy > small {
    max-width: calc(100vw - 108px);
  }

  .premium-topbar-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .premium-user-card {
    grid-column: 1 / -1;
    width: 100%;
  }

  .premium-company-switch {
    width: 100%;
  }

  .premium-topbar-actions #topLogoutBtn {
    min-height: 42px;
  }
}
